//
// sub_1006136D0 from 0x1006136d0 to 0x1006137ec (284 bytes)
//
// 2 xrefs:
// > sub_10061395C @ 0x100613f14
// > sub_1006140EC @ 0x100614558
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_1006136D0(__int64 a1, int a2, int a3)
{
__int64 v3; // x20
int v6; // w0
__int64 v7; // x8
__int16 v8; // w2
int v9; // w4
LODWORD(v3) = a3;
v6 = sub_10058AE10(*(_QWORD *)(a1 + 24));
if ( a2 == 2 )
{
if ( v6 == 22 )
{
v7 = *(_QWORD *)(a1 + 32);
v3 = 1;
if ( v7 )
v3 = *(_QWORD *)(*(_QWORD *)(v7 + 40) + 32LL) == 0;
*(_DWORD *)(a1 + 20) = v3;
return v3;
}
v8 = 104;
v9 = 99;
goto LABEL_14;
}
if ( a2 != 1 )
{
v8 = 110;
v9 = 105;
LABEL_14:
sub_1005E0E48(33, 104, v8, (__int64)"pk7_lib.c", v9);
return 0;
}
if ( v6 != 22 )
{
v8 = 104;
v9 = 85;
goto LABEL_14;
}
*(_DWORD *)(a1 + 20) = v3;
if ( !(_DWORD)v3 )
return 0;
v3 = (int)v3;
if ( (unsigned int)sub_10058AE10(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 40LL) + 24LL)) == 21 )
{
sub_1005F8F20(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 40LL) + 32LL));
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 40LL) + 32LL) = 0;
}
return v3;
}