//
// sub_943E44 from 0x943e44 to 0x943ed6 (146 bytes)
//
// 2 xrefs:
// > sub_92C7D0 @ 0x92c824
// > sub_92C7D0 @ 0x92c830
//
// 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:05:08 +0000
//
int __fastcall sub_943E44(int a1, const void *a2, size_t a3)
{
unsigned int v4; // r3
unsigned __int64 v7; // r6
bool v9; // zf
unsigned int v10; // r2
unsigned int v11; // r2
void *v12; // r0
size_t v13; // r2
int v14; // r0
if ( *(_DWORD *)(a1 + 12) != -8 )
return 0;
v4 = *(_DWORD *)(a1 + 20);
v7 = v4 + (unsigned __int64)a3;
v9 = HIDWORD(v7) == 0;
if ( !HIDWORD(v7) )
v9 = 1;
if ( !v9 )
goto LABEL_6;
v10 = *(_DWORD *)(a1 + 24);
if ( (unsigned int)v7 <= v10 )
{
v14 = *(_DWORD *)(a1 + 16);
}
else
{
v11 = 2 * v10;
if ( (unsigned int)v7 < v11 )
LODWORD(v7) = v11;
if ( (unsigned int)v7 < 0x400 )
LODWORD(v7) = 1024;
v12 = (void *)WebPSafeMalloc(1, 0, v7);
HIDWORD(v7) = v12;
if ( !v12 )
{
LABEL_6:
*(_DWORD *)(a1 + 28) = 1;
return 0;
}
v13 = *(_DWORD *)(a1 + 20);
if ( v13 )
memcpy(v12, *(const void **)(a1 + 16), v13);
WebPSafeFree(*(void **)(a1 + 16));
v4 = *(_DWORD *)(a1 + 20);
v14 = HIDWORD(v7);
*(_DWORD *)(a1 + 16) = HIDWORD(v7);
*(_DWORD *)(a1 + 24) = v7;
}
memcpy((void *)(v14 + v4), a2, a3);
*(_DWORD *)(a1 + 20) += a3;
return 1;
}