//
// sub_100666510 from 0x100666510 to 0x100666600 (240 bytes)
//
// 4 xrefs:
// > sub_1006430D0 @ 0x100643c44
// > sub_100647C48 @ 0x100648598
// > sub_10065DE8C @ 0x10065e9c0
// > sub_10065EBB0 @ 0x10065f4d4
//
// 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:01 +0000
//
__int64 __fastcall sub_100666510(__int64 result, int a2)
{
__int64 v3; // x20
int v4; // w22
__int64 v5; // x20
unsigned __int8 *v6; // x8
time_t v7; // x1
v3 = result;
if ( !*(_DWORD *)(*(_QWORD *)(result + 304) + 68LL) )
return result;
result = *(_QWORD *)(result + 624);
v4 = *(_DWORD *)(result + 64);
if ( (v4 & a2) != 0 && !*(_DWORD *)(v3 + 168) )
{
if ( (v4 & 0x200) != 0 )
{
LABEL_7:
if ( *(_QWORD *)(result + 80) )
{
sub_1006AE670(*(_QWORD *)(v3 + 304) + 192LL, 1, 14, "ssl_lib.c", 2633);
result = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)(v3 + 624) + 80LL))(v3, *(_QWORD *)(v3 + 304));
if ( !(_DWORD)result )
result = sub_100668448(*(_QWORD *)(v3 + 304));
}
goto LABEL_10;
}
result = sub_100668E08();
if ( (_DWORD)result )
{
result = *(_QWORD *)(v3 + 624);
goto LABEL_7;
}
}
LABEL_10:
if ( (v4 & 0x80) == 0 && (v4 & a2) == a2 )
{
v5 = *(_QWORD *)(v3 + 624);
v6 = (unsigned __int8 *)(v5 + 112);
if ( (a2 & 1) == 0 )
v6 = (unsigned __int8 *)(v5 + 124);
if ( *v6 == 255 )
{
v7 = time(nullptr);
return sub_100669274(v5, v7);
}
}
return result;
}