//
// sub_943800 from 0x943800 to 0x943920 (288 bytes)
//
// 14 xrefs:
// > sub_931AB0 @ 0x931b6e
// > sub_931AB0 @ 0x931bd2
// > sub_93F008 @ 0x93f052
// > sub_93F008 @ 0x93f05a
// > sub_93F008 @ 0x93f06a
// > sub_93F008 @ 0x93f088
// > sub_93F008 @ 0x93f0a4
// > sub_93F008 @ 0x93f11a
// > sub_93F008 @ 0x93f370
// > sub_93F008 @ 0x93f378
// > sub_93F008 @ 0x93f3a0
// > sub_93F008 @ 0x93f3be
// > sub_93F008 @ 0x93f5d2
// > sub_940484 @ 0x940548
//
// 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_943800(int a1, int a2)
{
int v4; // r3
int v5; // r1
int v6; // r1
int v7; // r2
int v8; // r0
unsigned int v9; // r7
unsigned int v10; // r6
unsigned __int64 v11; // r2
bool v12; // zf
unsigned int v14; // r1
unsigned int v15; // r8
_BYTE *v16; // r0
_BYTE *v17; // r9
size_t v18; // r2
_BYTE *v19; // r3
int v20; // r2
int v21; // r2
int v22; // r3
bool v23; // cc
v4 = *(int *)a1 >> 1;
if ( a2 )
{
v5 = v4 + 1;
v4 = ~v4 + *(_DWORD *)a1;
*(_DWORD *)(a1 + 4) += v5;
}
*(_DWORD *)a1 = v4;
if ( v4 > 126 )
return a2;
v6 = *(_DWORD *)(a1 + 12);
v7 = 2 * *(_DWORD *)(a1 + 4);
v8 = byte_C48E68[v4 + 128];
*(_DWORD *)(a1 + 12) = v6 + 1;
*(_DWORD *)a1 = v8;
*(_DWORD *)(a1 + 4) = v7;
if ( v6 + 1 <= 0 )
return a2;
v9 = v7 >> (v6 + 9);
*(_DWORD *)(a1 + 12) = v6 - 7;
*(_DWORD *)(a1 + 4) = v7 - (v9 << (v6 + 9));
if ( (unsigned __int8)v9 == 255 )
{
++*(_DWORD *)(a1 + 8);
return a2;
}
else
{
v10 = *(_DWORD *)(a1 + 20);
v11 = v10 + (unsigned __int64)(unsigned int)(*(_DWORD *)(a1 + 8) + 1);
v12 = HIDWORD(v11) == 0;
if ( !HIDWORD(v11) )
v12 = 1;
if ( !v12 )
goto LABEL_9;
v14 = *(_DWORD *)(a1 + 24);
if ( (unsigned int)v11 <= v14 )
{
v19 = *(_BYTE **)(a1 + 16);
}
else
{
v15 = 2 * v14;
if ( 2 * v14 < (unsigned int)v11 )
v15 = v10 + *(_DWORD *)(a1 + 8) + 1;
if ( v15 < 0x400 )
v15 = 1024;
v16 = (_BYTE *)WebPSafeMalloc(1, 0, v15);
v17 = v16;
if ( !v16 )
{
LABEL_9:
*(_DWORD *)(a1 + 28) = 1;
return a2;
}
v18 = *(_DWORD *)(a1 + 20);
if ( v18 )
memcpy(v16, *(const void **)(a1 + 16), v18);
WebPSafeFree(*(void **)(a1 + 16));
v19 = v17;
*(_DWORD *)(a1 + 16) = v17;
*(_DWORD *)(a1 + 24) = v15;
}
if ( v10 )
v20 = (v9 >> 8) & 1;
else
v20 = 0;
if ( v20 )
{
++v19[v10 - 1];
v19 = *(_BYTE **)(a1 + 16);
}
if ( *(int *)(a1 + 8) > 0 )
{
do
{
v19[v10] = -!(v9 & 0x100);
v21 = ++v10;
v22 = *(_DWORD *)(a1 + 8) - 1;
*(_DWORD *)(a1 + 8) = v22;
v23 = v22 <= 0;
v19 = *(_BYTE **)(a1 + 16);
}
while ( !v23 );
}
else
{
v21 = v10;
}
v19[v21] = v9;
*(_DWORD *)(a1 + 20) = v21 + 1;
return a2;
}
}