//
// sub_6B444 from 0x6b444 to 0x6b610 (460 bytes)
//
// 1 xrefs:
// > sub_6B1AE @ 0x6b1b4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall sub_6B444(int a1)
{
int v1; // r10
int v2; // r5
int v3; // r0
bool v4; // cc
int v5; // r0
_DWORD *v6; // r10
int v7; // r0
int v8; // r5
bool v9; // zf
int v10; // r8
int v11; // r2
int v12; // r3
int v13; // r9
int v14; // r0
int *v16; // [sp+0h] [bp-50h]
int v17; // [sp+4h] [bp-4Ch]
int v19; // [sp+Ch] [bp-44h] BYREF
int v20[5]; // [sp+10h] [bp-40h] BYREF
int v21; // [sp+24h] [bp-2Ch] BYREF
_DWORD buf[3]; // [sp+28h] [bp-28h] BYREF
v2 = a1;
v16 = (int *)(a1 + 1188);
while ( 1 )
{
memset(buf, 0, sizeof(buf));
v3 = sub_50D52(*(_DWORD *)(v2 + 16), (char *)buf, 0xCu, &v21);
if ( v3 )
return v3;
if ( v21 != 12 )
return 28;
v3 = 28;
v4 = (unsigned int)(buf[0] - 12) > 0x63FFFF4;
if ( (unsigned int)(buf[0] - 12) <= 0x63FFFF4 )
v4 = LOBYTE(buf[2]) > 0xAu;
if ( v4 || HIBYTE(buf[2]) )
return v3;
v5 = *(_DWORD *)(v2 + 12);
v17 = v1;
if ( v5 )
v6 = sub_526A6(v5, (int)buf);
else
v6 = nullptr;
memset(v20, 0, sizeof(v20));
v19 = 0;
if ( !v6 )
{
v8 = 1;
v7 = sub_6AC9C(v16, (buf[0] + 3) & 0xFFFFFFFC, 1, v20);
if ( v7 )
goto LABEL_15;
v2 = a1;
if ( *(_BYTE *)(a1 + 624) )
{
v1 = 0;
v8 = 1;
goto LABEL_16;
}
v10 = v20[1];
v19 = v20[1];
if ( v20[2] )
{
memset((void *)v20[1], 255, v20[3]);
v10 = v20[2];
v19 = v20[2];
}
LABEL_19:
qmemcpy((void *)v10, buf, 0xCu);
v13 = buf[0] - 12;
if ( buf[0] != 12 )
{
v14 = sub_50D52(*(_DWORD *)(v2 + 16), (char *)(v10 + 12), buf[0] - 12, &v21);
if ( v14 )
{
v8 = 1;
v1 = v14;
goto LABEL_16;
}
if ( v21 != v13 )
{
v1 = 28;
v8 = 1;
goto LABEL_16;
}
v10 = v19;
}
if ( *(_BYTE *)(v10 + 8) )
{
if ( v6 )
{
v7 = (*(int (__fastcall **)(_DWORD *, int, int))(*v6 + 28))(v6, v10, v2);
goto LABEL_33;
}
}
else if ( !*(_BYTE *)(v10 + 9) )
{
v7 = sub_6B114(v2, *(unsigned __int8 *)(v10 + 12), *(unsigned __int8 *)(v10 + 13), *(_DWORD *)(v10 + 14));
if ( !v7 )
{
LABEL_34:
v8 = 0;
v1 = v17;
*(_DWORD *)(a1 + 1240) += buf[0];
goto LABEL_16;
}
v8 = 1;
goto LABEL_15;
}
v7 = sub_6AD9E(v16, v20[4] + v20[3], v11, v12);
LABEL_33:
if ( !v7 )
goto LABEL_34;
goto LABEL_13;
}
v7 = (*(int (__fastcall **)(_DWORD *, _DWORD *, int *))(*v6 + 24))(v6, buf, &v19);
if ( !v7 )
{
v10 = v19;
goto LABEL_19;
}
LABEL_13:
v8 = 1;
LABEL_15:
v1 = v7;
LABEL_16:
sub_5284E(v20);
v9 = v8 == 0;
v2 = a1;
if ( !v9 )
return v1;
}
}