//
// sub_100611758 from 0x100611758 to 0x1006119a0 (584 bytes)
//
// 2 xrefs:
// > sub_10060F234 @ 0x10060f8cc
// > sub_10060F234 @ 0x10060fc60
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:10:10 +0000
//
__int64 __fastcall sub_100611758(
__int64 a1,
__int64 a2,
unsigned int a3,
unsigned int a4,
_QWORD *a5,
__int64 a6,
int a7)
{
__int64 v13; // x8
unsigned int v14; // w9
unsigned int v15; // w12
unsigned int *v16; // x27
unsigned int *v17; // x28
unsigned int v18; // w21
__int64 result; // x0
int v20; // w8
unsigned int v21; // w1
unsigned int v22; // w26
unsigned int v23; // w25
unsigned int v24; // w28
unsigned int v25; // w21
bool v26; // zf
int v27; // w8
__int64 v28; // x27
bool v29; // zf
unsigned int v30; // w8
unsigned int v31; // w27
int v32; // [xsp+10h] [xbp-60h]
unsigned int v33; // [xsp+14h] [xbp-5Ch]
int v34; // [xsp+18h] [xbp-58h] BYREF
unsigned int v35; // [xsp+1Ch] [xbp-54h] BYREF
v13 = *(_QWORD *)(a2 + 8);
v14 = *(_DWORD *)(v13 + 1368);
if ( a4 )
v15 = v14 >> a4;
else
v15 = v14 - a3;
if ( a7 )
v16 = (unsigned int *)&unk_100774600;
else
v16 = (unsigned int *)&unk_1007745FC;
if ( a7 )
v17 = (unsigned int *)&unk_10077460C;
else
v17 = (unsigned int *)&unk_100774608;
if ( a4 )
{
v18 = v15;
if ( v15 < a3 )
{
LABEL_12:
if ( !*(_DWORD *)(v13 + 4112) )
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))(v13 + 56))(a2, 0, *(_QWORD *)(v13 + 104));
result = 1;
v20 = 2;
goto LABEL_43;
}
}
else
{
v18 = v15;
if ( v14 < a3 )
goto LABEL_12;
}
if ( a4 <= 6 )
v21 = 6;
else
v21 = a4;
result = sub_1005FF1B0((__int64)a5, v21);
if ( !(_DWORD)result )
{
v20 = 8;
LABEL_43:
**(_DWORD **)a2 = v20;
return result;
}
v32 = a3;
v22 = 0;
v23 = 0;
v33 = *v17;
v24 = v18;
v25 = *v16;
while ( 1 )
{
result = sub_100550E58(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL), &v35, v25);
if ( !(_DWORD)result )
return result;
*(_DWORD *)(*a5 + 4LL * v22) = v35;
if ( v35 >= v33 )
{
result = sub_100550E58(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL), &v35, 5u);
if ( !(_DWORD)result )
return result;
if ( v22 )
v29 = 1;
else
v29 = a4 == 0;
*(_DWORD *)(a5[1] + 4LL * v22) = v35;
v30 = v32;
if ( v29 )
v30 = 0;
if ( v30 < v24 )
{
v31 = v24 - v30;
do
{
result = sub_1005510F0(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL), &v34, v35);
if ( !(_DWORD)result )
return result;
*(_DWORD *)(a6 + 4LL * v23++) = v34;
}
while ( --v31 );
}
}
else
{
if ( v22 )
v26 = 1;
else
v26 = a4 == 0;
*(_DWORD *)(a5[1] + 4LL * v22) = 0;
v27 = v32;
if ( v26 )
v27 = 0;
v28 = v24 - v27;
result = (*(__int64 (__fastcall **)(__int64, _QWORD, __int64, __int64, _QWORD))(*(_QWORD *)(a2 + 8) + 96LL))(
a1,
*(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL),
a6 + 4LL * v23,
v28,
v35);
if ( !(_DWORD)result )
return result;
v23 += v28;
}
if ( ++v22 >> a4 )
return 1;
}
}