//
// sub_C0021C from 0xc0021c to 0xc0042c (528 bytes)
//
// 1 xrefs:
// > jinit_c_master_control @ 0xc00980
//
// 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
//
_QWORD *__fastcall sub_C0021C(__int64 *a1)
{
_DWORD *v1; // x20
int v3; // w1
int v4; // w1
int v5; // w2
_QWORD *result; // x0
void (__fastcall *v7)(__int64 *); // x2
__int64 v8; // x1
int v9; // w0
v1 = (_DWORD *)a1[62];
v3 = v1[8];
if ( v3 == 1 )
{
sub_BFFD0C(a1);
sub_BFFF70(a1);
if ( *((_DWORD *)a1 + 115) || !*((_DWORD *)a1 + 117) )
{
(*(void (__fastcall **)(__int64 *, __int64))a1[70])(a1, 1);
(*(void (__fastcall **)(__int64 *, __int64))a1[65])(a1, 2);
v1[6] = 0;
goto LABEL_9;
}
v9 = v1[9];
v1[8] = 2;
v1[9] = v9 + 1;
goto LABEL_4;
}
if ( v3 )
{
if ( v3 != 2 )
{
v7 = *(void (__fastcall **)(__int64 *))*a1;
*(_DWORD *)(*a1 + 40) = 49;
v7(a1);
goto LABEL_9;
}
LABEL_4:
if ( !*((_DWORD *)a1 + 74) )
{
sub_BFFD0C(a1);
sub_BFFF70(a1);
}
(*(void (__fastcall **)(__int64 *, _QWORD))a1[70])(a1, 0);
(*(void (__fastcall **)(__int64 *, __int64))a1[65])(a1, 2);
if ( !v1[11] )
(*(void (__fastcall **)(__int64 *))(a1[66] + 8))(a1);
(*(void (__fastcall **)(__int64 *))(a1[66] + 16))(a1);
v1[6] = 0;
goto LABEL_9;
}
sub_BFFD0C(a1);
sub_BFFF70(a1);
if ( !*((_DWORD *)a1 + 72) )
{
(*(void (__fastcall **)(__int64 *))a1[67])(a1);
(*(void (__fastcall **)(__int64 *))a1[68])(a1);
(*(void (__fastcall **)(__int64 *, _QWORD))a1[64])(a1, 0);
}
(*(void (__fastcall **)(__int64 *))a1[69])(a1);
(*(void (__fastcall **)(__int64 *, _QWORD))a1[70])(a1, *((unsigned int *)a1 + 74));
if ( (int)v1[10] <= 1 )
v8 = 0;
else
v8 = 3;
(*(void (__fastcall **)(__int64 *, __int64))a1[65])(a1, v8);
(*(void (__fastcall **)(__int64 *, _QWORD))a1[63])(a1, 0);
if ( *((_DWORD *)a1 + 74) )
v1[6] = 0;
else
v1[6] = 1;
LABEL_9:
v4 = v1[10];
v5 = v1[9];
result = (_QWORD *)a1[2];
v1[7] = v5 == v4 - 1;
if ( result )
{
*((_DWORD *)result + 6) = v5;
*((_DWORD *)result + 7) = v4;
}
return result;
}