//
// sub_D10C2 from 0xd10c2 to 0xd1264 (418 bytes)
//
// 2 xrefs:
// > sub_725B8 @ 0x7260e
// > sub_72710 @ 0x72800
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:41:59 +0000
//
int __fastcall sub_D10C2(int *a1, _DWORD *a2, int a3)
{
int v3; // r5
int v7; // r6
unsigned int v9; // r0
int v10; // r1
int v11; // r9
int v12; // r0
int v13; // r10
int v14; // r8
size_t v15; // r6
int v16; // r1
int v17; // r0
__int64 v18; // kr00_8
__int64 v19; // kr20_8
__int64 v20; // kr28_8
__int64 v21; // kr30_8
__int64 v22; // r0
int v23; // [sp+4h] [bp-24h]
int v24; // [sp+8h] [bp-20h]
v3 = *a1;
v7 = *(_DWORD *)(*a1 + 28);
if ( sub_CFB1E(a2, 1) )
return -135;
v9 = *(_DWORD *)(v7 + 8);
v10 = 0;
if ( v9 )
--v9;
while ( v9 )
{
v9 >>= 1;
++v10;
}
v11 = sub_CFB1E(a2, v10);
if ( v11 == -1 )
return -136;
if ( v11 >= *(_DWORD *)(v7 + 8) )
return -136;
v12 = a1[7];
v13 = 0;
a1[6] = v12;
v24 = v7;
v23 = a3;
v14 = 0;
a1[7] = *(unsigned __int8 *)(*(_DWORD *)(v7 + 28) + 2 * v11);
v15 = *(_DWORD *)(v7 + 4 * v12) & 0xFFFFFFFC;
while ( v13 < *(_DWORD *)(v3 + 4) )
{
qmemcpy((void *)(a1[2] + v14), (const void *)(a1[1] + v15 + 2 * v14), v15);
v14 += 2048;
++v13;
}
if ( a1[7] )
{
sub_CFB1E(a2, 1);
if ( sub_CFB1E(a2, 1) == -1 )
return -136;
}
if ( v23 )
sub_D2114(a1, a2, *(_DWORD *)(v24 + 32) + 20 * *(unsigned __int8 *)(*(_DWORD *)(v24 + 28) + 2 * v11 + 1));
v16 = a1[3];
v17 = 0;
a1[3] = 0;
if ( v16 != -1 )
v17 = *(_DWORD *)(v24 + 4 * a1[7]) / 4 + *(_DWORD *)(v24 + 4 * a1[6]) / 4;
a1[4] = v17;
v18 = *((_QWORD *)a1 + 5);
if ( ((unsigned int)v18 & HIDWORD(v18)) == 0xFFFFFFFF )
{
a1[8] = -1;
a1[9] = -1;
*((_QWORD *)a1 + 5) = v18 + 1;
a1[12] = -1;
a1[13] = -1;
goto LABEL_23;
}
*((_QWORD *)a1 + 5) = v18 + 1;
v19 = *((_QWORD *)a1 + 6);
if ( v19 == -1 )
{
LABEL_23:
v20 = 0;
goto LABEL_24;
}
v20 = v19 + *(_DWORD *)(v24 + 4 * a1[7]) / 4 + *(_DWORD *)(v24 + 4 * a1[6]) / 4;
LABEL_24:
*((_QWORD *)a1 + 6) = v20;
v21 = *((_QWORD *)a1 + 4);
if ( v21 == -1 )
v22 = 0;
else
v22 = v21 + *(_DWORD *)(v24 + 4 * a1[7]) / 4 + *(_DWORD *)(v24 + 4 * a1[6]) / 4;
*((_QWORD *)a1 + 4) = v22;
return 0;
}