//
// sub_6F7F54 from 0x6f7f54 to 0x6f804a (246 bytes)
//
// 2 xrefs:
// > sub_6F85BC @ 0x6f8878
// > sub_6FC3A0 @ 0x6fc4de
//
// 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_6F7F54(_DWORD *a1, _DWORD *a2)
{
int *v4; // r8
int v5; // r3
_BOOL4 v6; // r5
int v7; // r0
int result; // r0
void *v9; // r0
int v10; // r3
int v11; // r1
int v12; // r2
int v13; // r3
int v14; // r0
int v15; // r2
int v16; // r3
int v17; // r3
int v18; // r3
v4 = a1 + 40;
if ( (int)a1[577] <= 0 || (v5 = a1[575], v5 < a1[75]) )
{
v6 = 0;
if ( a1[37] )
goto LABEL_4;
LABEL_13:
v17 = a1[575];
a1[42] = v6;
a1[41] = v17;
sub_6F7324(a1, a1 + 40);
return sub_6F77F8(a1, a2);
}
v6 = v5 <= a1[77];
if ( !a1[37] )
goto LABEL_13;
LABEL_4:
v7 = ((int (*)(void))WebPGetWorkerInterface)();
result = (*(int (__fastcall **)(_DWORD *))(v7 + 8))(a1 + 31) & 1;
if ( result )
{
v9 = memcpy(a1 + 45, a2, 0x6Cu);
v10 = a1[37];
v11 = a1[38];
v12 = a1[575];
a1[42] = v6;
a1[40] = v11;
a1[41] = v12;
if ( v10 == 2 )
{
v18 = a1[576];
a1[576] = a1[44];
a1[44] = v18;
}
else
{
v9 = sub_6F7324(a1, v4);
}
if ( v6 )
{
v13 = a1[565];
a1[565] = a1[43];
a1[43] = v13;
}
v14 = WebPGetWorkerInterface(v9);
(*(void (__fastcall **)(_DWORD *))(v14 + 12))(a1 + 31);
v15 = a1[39];
v16 = a1[38] + 1;
a1[38] = v16;
result = 1;
if ( v16 == v15 )
a1[38] = 0;
}
return result;
}