//
// sub_100441820 from 0x100441820 to 0x100441a88 (616 bytes)
//
// 5 xrefs:
// > sub_10043CAFC @ 0x10043cb50
// > sub_1004BDD4C @ 0x1004bdd88
// > sub_1004C1DB8 @ 0x1004c1dd8
// > sub_1004C3A60 @ 0x1004c3aa0
// > sub_1004C47E4 @ 0x1004c48b0
//
// 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_100441820(__int64 a1, __int64 a2)
{
int v4; // w8
__int64 v5; // x21
__int64 v6; // x22
__int64 v7; // x9
__int64 result; // x0
_QWORD *v9; // x21
_QWORD *v10; // x22
char v11; // w23
__int64 v12; // x23
__int64 v13; // x9
_QWORD *v14; // x8
__int64 v15; // x9
unsigned int *v16; // x22
char v17; // w8
__int64 v18; // x23
__int64 v19; // x8
__int64 v20; // x21
unsigned int v21; // w8
__int64 v22; // x8
__int64 v23; // x24
int v24; // [xsp+4h] [xbp-3Ch] BYREF
__int64 v25; // [xsp+8h] [xbp-38h] BYREF
v4 = *(_DWORD *)(a1 + 1684);
if ( v4 >= 1 )
{
v5 = 0;
v6 = 48;
do
{
v7 = *(_QWORD *)(*(_QWORD *)(a1 + 1696) + v6);
if ( v7 && *(_QWORD *)(v7 + 64) == a2 )
{
result = sub_1004CF54C(a1, v5);
if ( (_DWORD)result )
return result;
v4 = *(_DWORD *)(a1 + 1684);
}
++v5;
v6 += 56;
}
while ( v5 < v4 );
}
if ( !(**(unsigned int (__fastcall ***)(__int64))a2)(a2) )
{
v11 = 0;
goto LABEL_23;
}
sub_100442B5C(a1, 10);
v9 = (_QWORD *)(a1 + 72672);
v10 = *(_QWORD **)(a1 + 72672);
if ( v10 != (_QWORD *)(a1 + 72672) )
{
while ( 1 )
{
v12 = v10[2];
v13 = *(_QWORD *)(v12 + 40);
v10 = (_QWORD *)*v10;
if ( !v13 )
goto LABEL_12;
if ( v13 == a2 )
goto LABEL_20;
v14 = *(_QWORD **)(v13 + 160);
if ( v14 )
{
v15 = *(unsigned int *)(v13 + 176);
if ( (int)v15 >= 1 )
{
while ( *v14 != a2 )
{
++v14;
if ( !--v15 )
goto LABEL_12;
}
goto LABEL_20;
}
LABEL_12:
v11 = 0;
if ( v10 == v9 )
goto LABEL_21;
}
else
{
if ( *(_QWORD *)(v13 + 384) != *(_QWORD *)(a2 + 384) )
goto LABEL_12;
LABEL_20:
sub_100442B7C(a1, 10);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(v12 + 24) + 8LL))(*(_QWORD *)(v12 + 24));
sub_100442B5C(a1, 10);
v11 = 1;
if ( v10 == v9 )
goto LABEL_21;
}
}
}
v11 = 0;
LABEL_21:
sub_100442B7C(a1, 10);
LABEL_23:
v16 = (unsigned int *)(a2 + 88);
v17 = atomic_load((unsigned int *)(a2 + 88));
if ( (v17 & 4) == 0 )
return 0;
if ( !(v11 & 1 | (*(_DWORD *)(a2 + 312) == 0)) )
{
v18 = a1 + 496;
v19 = *(_QWORD *)(a1 + 872);
v20 = v19 ? v19 - 376 : 0LL;
if ( v20 != v18 )
{
do
{
v22 = *(_QWORD *)(v20 + 376);
if ( v22 )
v23 = v22 - 376;
else
v23 = 0;
if ( *(_QWORD *)(v20 + 472) )
{
v25 = 0;
sub_10045F038(v20, &v25);
if ( v25 == a2 )
sub_10045C264(v20, 83);
}
v20 = v23;
}
while ( v23 != v18 );
}
}
(*(void (__fastcall **)(__int64, int *, _QWORD, _QWORD, _QWORD))(*(_QWORD *)a2 + 192LL))(a2, &v24, 0, 0, 0);
if ( v24 != 6 || (result = sub_10043E2C8(a1, 1), !(_DWORD)result) )
{
if ( ((**(__int64 (__fastcall ***)(__int64))a2)(a2) & 1) == 0 )
{
do
v21 = __ldaxr(v16);
while ( __stlxr(v21 & 0xFFFFFFFB, v16) );
}
return 0;
}
return result;
}