//
// sub_1005309E0 from 0x1005309e0 to 0x100530bcc (492 bytes)
//
// 5 xrefs:
// > sub_100530880 @ 0x100530908
// > sub_100530880 @ 0x100530958
// > sub_100530F70 @ 0x10053101c
// > sub_100534FD8 @ 0x1005353f8
// > sub_100534FD8 @ 0x100535538
//
// 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
//
bool __fastcall sub_1005309E0(__int64 a1, unsigned __int8 *a2, unsigned __int8 *a3)
{
__int64 v3; // x8
__int64 v4; // x9
unsigned __int64 v5; // x8
unsigned __int64 i; // x10
__int64 v8; // x10
int v9; // w11
unsigned __int8 *v10; // x8
unsigned __int64 v11; // x9
unsigned __int64 j; // x10
unsigned __int64 v13; // x9
__int64 v14; // x10
unsigned __int64 v15; // x8
unsigned __int64 v16; // x8
unsigned __int64 v17; // x9
unsigned __int8 *v18; // x10
int v19; // w8
bool v20; // zf
if ( a3 )
{
v3 = *(_QWORD *)(a1 + 304);
v4 = *(_QWORD *)(v3 + 296);
if ( v4 )
{
v5 = *(_QWORD *)(v3 + 288);
if ( v5 )
{
for ( i = 0; i < v5; ++i )
{
if ( *a3 == *(unsigned __int8 *)(v4 + i) )
break;
}
}
else
{
i = 0;
}
if ( i == v5 )
return 0;
}
}
if ( !a2 )
return 1;
v8 = *(_QWORD *)(a1 + 256);
v9 = *(_DWORD *)(v8 + 108) & 0x30000;
v10 = (unsigned __int8 *)&unk_100669968;
v11 = 2;
switch ( v9 )
{
case 196608:
goto LABEL_18;
case 131072:
v10 = (unsigned __int8 *)&unk_10066996A;
LABEL_17:
v11 = 1;
goto LABEL_18;
case 65536:
v10 = (unsigned __int8 *)&unk_100669968;
goto LABEL_17;
}
v10 = *(unsigned __int8 **)(a1 + 560);
if ( v10 )
{
v13 = *(_QWORD *)(a1 + 552);
if ( (v13 & 1) != 0 )
goto LABEL_38;
v11 = v13 >> 1;
if ( !v11 )
{
v11 = 0;
j = 0;
goto LABEL_27;
}
}
else
{
v11 = 13;
if ( *(_DWORD *)(a1 + 56) )
{
v19 = *(_DWORD *)(v8 + 104);
v20 = v19 == 0;
if ( v19 )
v10 = (unsigned __int8 *)&unk_10066996C;
else
v10 = (unsigned __int8 *)&unk_10066990C;
if ( v20 )
v11 = 28;
else
v11 = 13;
}
else
{
v10 = (unsigned __int8 *)&unk_10066996C;
}
}
LABEL_18:
for ( j = 0; j < v11; ++j )
{
if ( *v10 == *a2 && v10[1] == a2[1] )
break;
v10 += 2;
}
LABEL_27:
if ( j == v11 )
return 0;
if ( !*(_DWORD *)(a1 + 56) )
return 1;
v14 = *(_QWORD *)(a1 + 304);
v15 = *(_QWORD *)(v14 + 304);
if ( (v15 & 1) != 0 )
{
LABEL_38:
sub_1005E0E48(20, 338, 68, "t1_lib.c", 512);
return 0;
}
v16 = v15 >> 1;
if ( !v16 )
return 1;
v17 = 0;
v18 = *(unsigned __int8 **)(v14 + 312);
do
{
if ( *v18 == *a2 && v18[1] == a2[1] )
break;
++v17;
v18 += 2;
}
while ( v17 < v16 );
return v17 != v16;
}