//
// sub_1007044B8 from 0x1007044b8 to 0x10070460c (340 bytes)
//
// 1 xrefs:
// > sub_10072BAC0 @ 0x10072bc34
//
// 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:12:50 +0000
//
int *__fastcall sub_1007044B8(__int64 a1, __int64 (*a2)(void), void (*a3)(void))
{
int *v6; // x0
int *v7; // x19
int v8; // w8
_BYTE *v9; // x0
__int64 v10; // x8
__int64 v11; // x9
int v12; // w8
__int64 i; // x23
__int64 v14; // x0
__int64 v15; // x21
__int64 v16; // x8
void *v17; // x0
v6 = (int *)sub_1006AE878(32, (__int64)"stack.c", 124);
v7 = v6;
if ( v6 )
{
*((_QWORD *)v6 + 3) = *(_QWORD *)(a1 + 24);
v6[4] = *(_DWORD *)(a1 + 16);
*v6 = *(_DWORD *)a1;
v8 = *(_DWORD *)a1;
if ( *(int *)a1 <= 4 )
v8 = 4;
v6[5] = v8;
v9 = sub_1006AE878((unsigned int)(8 * v8), (__int64)"stack.c", 130);
*((_QWORD *)v7 + 1) = v9;
if ( v9 )
{
v10 = v7[5];
if ( (int)v10 >= 1 )
{
*(_QWORD *)v9 = 0;
v11 = 1;
if ( (int)v10 > 1 )
{
do
*(_QWORD *)(*((_QWORD *)v7 + 1) + 8 * v11++) = 0;
while ( v11 < v10 );
}
}
v12 = *v7;
if ( *v7 >= 1 )
{
for ( i = 0; i < v12; ++i )
{
if ( *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * i) )
{
v14 = a2();
*(_QWORD *)(*((_QWORD *)v7 + 1) + 8 * i) = v14;
if ( !v14 )
{
if ( (int)i >= 1 )
{
v15 = (int)i - 1LL;
do
{
if ( *(_QWORD *)(*((_QWORD *)v7 + 1) + 8 * v15) )
a3();
v16 = v15-- + 1;
}
while ( v16 > 1 );
}
v17 = *((void **)v7 + 1);
if ( v17 )
sub_1006AEDAC(v17);
goto LABEL_22;
}
v12 = *v7;
}
}
}
}
else
{
LABEL_22:
sub_1006AEDAC(v7);
return nullptr;
}
}
return v7;
}