//
// sub_1007024F4 from 0x1007024f4 to 0x10070263c (328 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009e9258
//
// 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:49 +0000
//
__int64 __fastcall sub_1007024F4(__int64 a1, _BYTE *a2, int a3)
{
unsigned int *v5; // x23
int v6; // w24
__int64 v7; // x19
int v8; // w22
signed int v9; // w10
char v10; // w9
__int64 v11; // x8
__int64 v12; // x10
__int64 v13; // x11
unsigned int v14; // w8
v5 = *(unsigned int **)(a1 + 48);
v6 = a3 - 1;
sub_100700768(a1, 15);
LODWORD(v7) = 0;
v8 = v5[4];
while ( v8 >= 1 )
{
v9 = v5[5];
LABEL_6:
v10 = 0;
LODWORD(v11) = 0;
if ( v6 >= 1 )
{
v11 = 0;
v12 = *((_QWORD *)v5 + 1) + v9;
while ( 1 )
{
a2[v11] = *(_BYTE *)(v12 + v11);
v13 = (__int64)&a2[v11 + 1];
if ( *(_BYTE *)(v12 + v11) == 10 )
break;
++v11;
v8 = v5[4];
if ( v11 >= v6 || v11 >= v8 )
{
v10 = 0;
a2 += v11;
goto LABEL_13;
}
}
LODWORD(v11) = v11 + 1;
v8 = v5[4];
v10 = 1;
a2 = (_BYTE *)v13;
}
LABEL_13:
v7 = (unsigned int)(v11 + v7);
v8 -= v11;
v5[4] = v8;
v5[5] += v11;
if ( (v10 & 1) == 0 )
{
v6 -= v11;
if ( v6 )
continue;
}
*a2 = 0;
return v7;
}
v8 = sub_100700794(*(_QWORD *)(a1 + 56), *((_QWORD *)v5 + 1), *v5);
if ( v8 > 0 )
{
v9 = 0;
*((_QWORD *)v5 + 2) = (unsigned int)v8;
goto LABEL_6;
}
sub_100701210(a1);
*a2 = 0;
if ( (int)v7 <= 0 )
v14 = v8;
else
v14 = v7;
if ( v8 < 0 )
return v14;
else
return (unsigned int)v7;
}