//
// sub_1006AE0E4 from 0x1006ae0e4 to 0x1006ae2f8 (532 bytes)
//
// 1 xrefs:
// > sub_100746958 @ 0x100746968
//
// 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:11:48 +0000
//
__int64 __fastcall sub_1006AE0E4(__int64 a1)
{
_DWORD *v1; // x0
_QWORD *v2; // x19
__int64 v3; // x0
__int64 v4; // x20
__int64 v5; // x2
__int64 v6; // x4
int v8; // w8
if ( !off_100A0C728 )
{
v5 = 100;
v6 = 248;
LABEL_20:
sub_100706FB0(15, 103, v5, "cryptlib.c", v6);
return 0;
}
if ( off_100A0C748 )
a1 = ((__int64 (__fastcall *)(__int64, __int64, const char *, __int64))off_100A0C748)(9, 29, "cryptlib.c", 251);
if ( !qword_100A0C730 )
{
qword_100A0C730 = sub_10070460C(a1);
if ( !qword_100A0C730 )
{
if ( off_100A0C748 )
((void (__fastcall *)(__int64, __int64, const char *, __int64))off_100A0C748)(10, 29, "cryptlib.c", 254);
v5 = 65;
v6 = 255;
goto LABEL_20;
}
}
if ( off_100A0C748 )
((void (__fastcall *)(__int64, __int64, const char *, __int64))off_100A0C748)(10, 29, "cryptlib.c", 258);
v1 = (_DWORD *)sub_1006AE878(16, "cryptlib.c", 260);
v2 = v1;
if ( !v1 )
{
v5 = 65;
v6 = 262;
goto LABEL_20;
}
*v1 = 1;
v3 = off_100A0C728("cryptlib.c", 266);
v2[1] = v3;
if ( !v3 )
{
sub_1006AEDAC(v2);
v5 = 65;
v6 = 269;
goto LABEL_20;
}
if ( off_100A0C748 )
((void (__fastcall *)(__int64, __int64, const char *, __int64))off_100A0C748)(9, 29, "cryptlib.c", 273);
v4 = sub_100704898(qword_100A0C730, 0);
if ( (_DWORD)v4 == -1 )
LODWORD(v4) = sub_100704974(qword_100A0C730, v2) - 1;
else
sub_100704BF8(qword_100A0C730, v4, v2);
if ( off_100A0C748 )
((void (__fastcall *)(__int64, __int64, const char *, __int64))off_100A0C748)(10, 29, "cryptlib.c", 289);
if ( (_DWORD)v4 == -1 )
{
off_100A0C738(v2[1], "cryptlib.c", 292);
sub_1006AEDAC(v2);
v8 = -1;
}
else
{
v8 = v4 + 1;
}
return (unsigned int)-v8;
}