//
// sub_180044980 from 0x180044980 to 0x180044b88 (520 bytes)
//
// 5 xrefs:
// > sub_1800445F0 @ 0x180044635
// > sub_1800446F0 @ 0x180044737
// > sub_1800447A0 @ 0x180044875
// > sub_180047910 @ 0x180047c16
// > ??> @ 0x1801f81b4
//
// 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_180044980(__int64 a1, __int64 a2)
{
int v3; // r14d
unsigned int v4; // ebp
int v6; // r12d
__int64 v7; // rdx
unsigned int v9; // ebx
unsigned int v10; // edi
__int64 v11; // rax
unsigned int v12; // [rsp+70h] [rbp+18h] BYREF
unsigned int v13; // [rsp+78h] [rbp+20h] BYREF
v3 = 0;
v4 = 0;
v6 = 1;
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
LABEL_2:
v7 = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(v7 + 3976) )
{
v12 = *(unsigned __int8 *)(v7 + 4038);
*(_DWORD *)(v7 + 3976) = 0;
}
else if ( !(unsigned int)sub_180041D20(a1, *(_QWORD *)(v7 + 120), &v12, 8u) )
{
return 0;
}
if ( v12 != (unsigned __int8)byte_180165720[v4 + 256] )
break;
++v4;
v6 = 1;
v3 = 0;
if ( v4 >= 4 )
{
**(_DWORD **)a2 = 1;
return 1;
}
}
if ( v12 != byte_1801AC0F0[v3] )
break;
++v3;
v4 = 0;
if ( v3 == 3 )
{
if ( (unsigned int)sub_180041D20(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL), &v13, 0x18u) )
{
v9 = 0;
v10 = 0;
while ( (unsigned int)sub_180041D20(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL), &v13, 8u) )
{
++v10;
v9 = (v9 << 7) | v13 & 0x7F;
if ( v10 >= 4 )
{
if ( (unsigned int)sub_180042920(a1, *(_DWORD **)(*(_QWORD *)(a2 + 8) + 120LL), v9) )
goto LABEL_2;
return 0;
}
}
}
return 0;
}
}
v3 = 0;
if ( v12 == 255 )
break;
LABEL_21:
v4 = 0;
if ( v6 )
{
v11 = *(_QWORD *)(a2 + 8);
if ( !*(_DWORD *)(v11 + 4112) )
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))(v11 + 56))(a2, 0, *(_QWORD *)(v11 + 104));
v6 = 0;
}
}
*(_BYTE *)(*(_QWORD *)(a2 + 8) + 4036LL) = -1;
if ( !(unsigned int)sub_180041D20(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL), &v12, 8u) )
return 0;
if ( v12 == 255 )
{
*(_BYTE *)(*(_QWORD *)(a2 + 8) + 4038LL) = -1;
*(_DWORD *)(*(_QWORD *)(a2 + 8) + 3976LL) = 1;
goto LABEL_21;
}
if ( (v12 & 0xFFFFFFFC) != 0xF8 )
goto LABEL_21;
*(_BYTE *)(*(_QWORD *)(a2 + 8) + 4037LL) = v12;
**(_DWORD **)a2 = 3;
return 1;
}