//
// WebPMemoryWrite from 0x9371dc to 0x93726c (144 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:04:58 +0000
//
void *__fastcall WebPMemoryWrite(void *a1, size_t a2, int a3)
{
int v3; // r6
unsigned int v4; // r2
unsigned __int64 v6; // r4
unsigned __int64 v8; // r2
void *result; // r0
void *v10; // r9
size_t v11; // r2
v3 = *(_DWORD *)(a3 + 76);
if ( !v3 )
return &dword_0 + 1;
v4 = *(_DWORD *)(v3 + 8);
v6 = *(unsigned int *)(v3 + 4) + (unsigned __int64)a2;
if ( v4 < v6 )
{
v8 = 2LL * v4;
if ( v6 < v8 )
v6 = v8;
if ( v6 < 0x2000 )
v6 = 0x2000;
result = (void *)WebPSafeMalloc(v6, HIDWORD(v6), 1);
v10 = result;
if ( !result )
return result;
v11 = *(_DWORD *)(v3 + 4);
if ( v11 )
memcpy(result, *(const void **)v3, v11);
WebPSafeFree(*(void **)v3);
*(_DWORD *)v3 = v10;
*(_DWORD *)(v3 + 8) = v6;
}
if ( !a2 )
return &dword_0 + 1;
memcpy((void *)(*(_DWORD *)v3 + *(_DWORD *)(v3 + 4)), a1, a2);
*(_DWORD *)(v3 + 4) += a2;
return &dword_0 + 1;
}