//
// sub_944180 from 0x944180 to 0x944246 (198 bytes)
//
// 2 xrefs:
// > sub_92C7D0 @ 0x92c8a0
// > sub_942344 @ 0x942472
//
// 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:09 +0000
//
char *__fastcall sub_944180(unsigned int *a1)
{
int v2; // lr
char *result; // r0
char *v4; // r2
size_t v5; // r5
unsigned __int64 v6; // r6
bool v7; // zf
unsigned int v8; // r1
_BOOL4 v9; // r3
int v10; // r6
char *v11; // r0
char *v12; // r7
unsigned int v13; // r3
unsigned int v14; // r3
int v15; // r2
v2 = a1[1];
result = (char *)a1[2];
v4 = (char *)a1[3];
v5 = v4 - result;
v6 = (unsigned int)(v4 - result) + (unsigned __int64)(unsigned int)((v2 + 7) >> 3);
v7 = HIDWORD(v6) == 0;
if ( !HIDWORD(v6) )
v7 = 1;
if ( !v7 )
{
a1[5] = 1;
return result;
}
v8 = a1[4] - (_DWORD)result;
v9 = v8 >= (unsigned int)v6;
if ( !v8 )
v9 = 0;
if ( !v9 )
{
if ( (unsigned int)v6 < (3 * v8) >> 1 )
LODWORD(v6) = (3 * v8) >> 1;
v10 = (v6 & 0xFFFFFC00) + 1024;
v11 = (char *)WebPSafeMalloc(1, 0, v10);
v12 = v11;
if ( !v11 )
{
result = (char *)a1[2];
a1[5] = 1;
return result;
}
if ( v5 )
memcpy(v11, (const void *)a1[2], v5);
WebPSafeFree((void *)a1[2]);
v2 = a1[1];
result = v12;
v4 = &v12[v5];
a1[4] = (unsigned int)&v12[v10];
a1[3] = (unsigned int)&v12[v5];
a1[2] = (unsigned int)v12;
}
if ( v2 > 0 )
{
v13 = *a1;
while ( 1 )
{
a1[3] = (unsigned int)(v4 + 1);
*v4 = v13;
v14 = *a1;
v15 = a1[1] - 8;
a1[1] = v15;
v13 = v14 >> 8;
*a1 = v13;
if ( v15 <= 0 )
break;
v4 = (char *)a1[3];
}
result = (char *)a1[2];
}
a1[1] = 0;
return result;
}