//
// sub_6671F8 from 0x6671f8 to 0x667360 (360 bytes)
//
// 0 xrefs:
//
// 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_6671F8(int a1, int a2)
{
_DWORD *v3; // r5
int v5; // r2
int v6; // r6
int v7; // r8
_DWORD *v8; // r7
int v9; // r10
int v10; // t1
unsigned int v11; // r11
_DWORD *v12; // r11
void *v13; // r0
unsigned int v14; // r10
_DWORD *v15; // r10
void *v16; // r0
v3 = *(_DWORD **)(a1 + 424);
if ( a2 )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 49;
(**(void (__fastcall ***)(int))a1)(a1);
}
if ( !*(_DWORD *)(a1 + 268) )
{
v3[1] = sub_668188;
goto LABEL_9;
}
if ( *(_DWORD *)(a1 + 372) )
{
if ( *(_DWORD *)(a1 + 364) )
v3[1] = sub_668498;
else
v3[1] = sub_66861C;
LABEL_9:
if ( *(int *)(a1 + 292) <= 0 )
goto LABEL_7;
goto LABEL_10;
}
if ( *(_DWORD *)(a1 + 364) )
{
v3[1] = sub_668688;
goto LABEL_9;
}
v3[1] = sub_66885C;
if ( *(int *)(a1 + 292) > 0 )
{
LABEL_10:
v6 = 0;
v7 = a1 + 292;
v8 = v3 + 9;
do
{
v10 = *(_DWORD *)(v7 + 4);
v7 += 4;
v9 = v10;
if ( !*(_DWORD *)(a1 + 364) && !*(_DWORD *)(a1 + 372) )
{
v11 = *(_DWORD *)(v9 + 20);
if ( v11 > 0xF )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 50;
*(_DWORD *)(*(_DWORD *)a1 + 24) = v11;
(**(void (__fastcall ***)(int))a1)(a1);
}
v12 = &v3[v11];
v13 = (void *)v12[19];
if ( !v13 )
{
v13 = (void *)(**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 64);
v12[19] = v13;
}
memset(v13, 0, 0x40u);
*v8 = 0;
v8[4] = 0;
}
if ( !*(_DWORD *)(a1 + 368) )
goto LABEL_22;
v14 = *(_DWORD *)(v9 + 24);
if ( v14 > 0xF )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 50;
*(_DWORD *)(*(_DWORD *)a1 + 24) = v14;
v15 = &v3[v14];
(**(void (__fastcall ***)(int))a1)(a1);
v16 = (void *)v15[35];
if ( !v16 )
{
LABEL_25:
v16 = (void *)(**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 256);
v15[35] = v16;
}
}
else
{
v15 = &v3[v14];
v16 = (void *)v15[35];
if ( !v16 )
goto LABEL_25;
}
memset(v16, 0, 0x100u);
LABEL_22:
++v6;
++v8;
}
while ( *(_DWORD *)(a1 + 292) > v6 );
}
LABEL_7:
v3[3] = 0;
v3[5] = 0;
v3[6] = 0;
v3[4] = 0x10000;
v3[7] = 11;
v3[8] = -1;
v5 = *(_DWORD *)(a1 + 236);
v3[18] = 0;
v3[17] = v5;
return 0x10000;
}