//
// sub_721EF0 from 0x721ef0 to 0x722174 (644 bytes)
//
// 3 xrefs:
// > sub_722188 @ 0x7227a4
// > sub_722188 @ 0x7227f2
// > sub_722188 @ 0x722896
//
// 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_721EF0(int a1, int a2, int *a3)
{
int v3; // r7
unsigned __int8 *v6; // r4
int result; // r0
int v8; // r6
int v9; // r7
char *v10; // r9
int v11; // t1
int v12; // r3
unsigned int v13; // r5
int v14; // r8
int v15; // r4
int v16; // r4
int v17; // r4
unsigned __int8 *v18; // r5
int v19; // r8
int v20; // t1
unsigned int v21; // [sp+0h] [bp-1Ch]
v3 = *a3;
v6 = (unsigned __int8 *)(a3[4] + 33 * *a3 + 11 * a2);
result = sub_733B14(a1, a3[1] >= 0, *v6);
if ( result )
{
if ( v3 <= 15 )
{
v8 = v3 + 1;
v9 = 2 * v3;
v10 = &byte_A01EA0[v8];
while ( 1 )
{
v12 = *(__int16 *)(a3[2] + v9);
v13 = (unsigned int)v12 >> 31;
v14 = (v12 ^ (v12 >> 31)) + ((unsigned int)v12 >> 31);
if ( sub_733B14(a1, v14 != 0, v6[1]) )
{
if ( sub_733B14(a1, v14 > 1, v6[2]) )
{
if ( sub_733B14(a1, v14 > 4, v6[3]) )
{
if ( sub_733B14(a1, v14 > 10, v6[6]) )
{
if ( v14 <= 18 )
{
sub_733B14(a1, 0, v6[8]);
sub_733B14(a1, 0, v6[9]);
v21 = v13;
v17 = 4;
v18 = (unsigned __int8 *)&unk_A04778;
v19 = v14 - 11;
}
else if ( v14 <= 34 )
{
sub_733B14(a1, 0, v6[8]);
sub_733B14(a1, 1, v6[9]);
v21 = v13;
v17 = 8;
v18 = (unsigned __int8 *)&unk_A04768;
v19 = v14 - 19;
}
else
{
sub_733B14(a1, 1, v6[8]);
if ( v14 > 66 )
{
sub_733B14(a1, 1, v6[10]);
v21 = v13;
v17 = 1024;
v18 = (unsigned __int8 *)&unk_A04780;
v19 = v14 - 67;
}
else
{
sub_733B14(a1, 0, v6[10]);
v21 = v13;
v17 = 16;
v18 = (unsigned __int8 *)&unk_A04770;
v19 = v14 - 35;
}
}
do
{
v20 = *v18++;
sub_733B14(a1, (v17 & v19) != 0, v20);
v17 >>= 1;
}
while ( v17 );
v13 = v21;
}
else if ( sub_733B14(a1, v14 > 6, v6[7]) )
{
sub_733B14(a1, v14 > 8, 165);
sub_733B14(a1, !(v14 & 1), 145);
}
else
{
sub_733B14(a1, v14 == 6, 159);
}
}
else if ( sub_733B14(a1, v14 != 2, v6[4]) )
{
sub_733B14(a1, v14 == 4, v6[5]);
}
v16 = a3[4] + 33 * (unsigned __int8)*v10;
sub_733C40(a1, v13);
v6 = (unsigned __int8 *)(v16 + 22);
if ( v8 == 16 )
return 1;
}
else
{
v15 = a3[4] + 33 * (unsigned __int8)*v10;
sub_733C40(a1, v13);
v6 = (unsigned __int8 *)(v15 + 11);
if ( v8 == 16 )
return 1;
}
if ( !sub_733B14(a1, a3[1] >= v8, *v6) )
return 1;
v9 += 2;
++v10;
}
else
{
v11 = (unsigned __int8)*v10++;
v9 += 2;
v6 = (unsigned __int8 *)(a3[4] + 33 * v11);
if ( v8 == 16 )
return 1;
}
++v8;
}
}
return 1;
}
return result;
}