//
// sub_100624258 from 0x100624258 to 0x1006244f8 (672 bytes)
//
// 2 xrefs:
// > sub_100622FA8 @ 0x1006230b4
// > ??> @ 0x100869250
//
// 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_100624258(__int64 *a1)
{
_BYTE *v2; // x20
int v3; // w24
_BYTE *v4; // x21
int v5; // w1
__int64 v6; // x23
__int64 v7; // x22
__int64 v8; // x25
__int64 *v9; // x0
__int64 v10; // x26
__int64 v11; // x27
__int64 *v12; // x0
__int64 v13; // x28
int v14; // w0
int v15; // w0
char **v16; // x0
int v18; // w1
int v19; // w0
char **v20; // x0
int v21; // w8
int v22; // w8
__int64 v23; // [xsp+10h] [xbp-70h]
unsigned int (__fastcall *v24)(__int64, __int64, int *, __int64, int *, __int64, __int64, __int64, int, _QWORD, __int64); // [xsp+20h] [xbp-60h]
int v25; // [xsp+28h] [xbp-58h] BYREF
int v26; // [xsp+2Ch] [xbp-54h] BYREF
v25 = 0;
v26 = 0;
v2 = (_BYTE *)a1[5];
if ( v2 )
{
v3 = 0;
LABEL_3:
v4 = (_BYTE *)a1[4];
if ( v4 )
goto LABEL_7;
v4 = sub_1005AAD34();
if ( !v4 )
return 0;
v26 = sub_1005AAC20(a1[1]);
v5 = *(_DWORD *)(a1[1] + 8);
if ( v5 <= *((_DWORD *)v4 + 3) || sub_1005AAF94((__int64)v4, v5) )
{
LABEL_7:
v6 = xmmword_100885BD8("/dev/ubskey");
if ( (int)v6 <= 0 )
{
v19 = dword_100885BD4;
if ( !dword_100885BD4 )
{
v19 = sub_1005E197C();
dword_100885BD4 = v19;
}
sub_1005E0E48(v19, 111, 108, (__int64)"e_ubsec.c", 981);
v20 = sub_1005D270C();
return ((__int64 (__fastcall *)(__int64 *))v20[1])(a1);
}
else
{
v24 = (unsigned int (__fastcall *)(__int64, __int64, int *, __int64, int *, __int64, __int64, __int64, int, _QWORD, __int64))off_100885C18;
v7 = *(_QWORD *)v2;
v8 = *(_QWORD *)v4;
v9 = (__int64 *)a1[2];
v10 = *v9;
v11 = sub_1005AAC20((__int64)v9);
v12 = (__int64 *)a1[1];
v13 = *v12;
v14 = sub_1005AAC20((__int64)v12);
LODWORD(v23) = 0;
HIDWORD(v23) = v3;
if ( v24(v6, v7, &v25, v8, &v26, v10, v11, v13, v14, 0, v23) )
{
v15 = dword_100885BD4;
if ( !dword_100885BD4 )
{
v15 = sub_1005E197C();
dword_100885BD4 = v15;
}
sub_1005E0E48(v15, 111, 106, (__int64)"e_ubsec.c", 1000);
off_100885BE8(v6);
v16 = sub_1005D270C();
return ((__int64 (__fastcall *)(__int64 *))v16[1])(a1);
}
else
{
off_100885BE8(v6);
a1[4] = (__int64)v4;
v21 = v26 + 126;
if ( v26 + 63 >= 0 )
v21 = v26 + 63;
*((_DWORD *)v4 + 2) = v21 >> 6;
a1[5] = (__int64)v2;
v22 = v25 + 126;
if ( v25 + 63 >= 0 )
v22 = v25 + 63;
*((_DWORD *)v2 + 2) = v22 >> 6;
return 1;
}
}
}
else
{
return 0;
}
}
else
{
v2 = sub_1005AAD34();
if ( v2 )
{
v25 = sub_1005AAC20(a1[1]);
v18 = *(_DWORD *)(a1[1] + 8);
if ( v18 <= *((_DWORD *)v2 + 3) || sub_1005AAF94((__int64)v2, v18) )
{
while ( (unsigned int)sub_1005ADFD8((__int64)v2, a1[1]) )
{
if ( *((_DWORD *)v2 + 2) )
{
v3 = sub_1005AAC20((__int64)v2);
goto LABEL_3;
}
}
return 0;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
}