//
// sub_1800D0B80 from 0x1800d0b80 to 0x1800d0cb9 (313 bytes)
//
// 5 xrefs:
// > sub_180021100 @ 0x180021773
// > sub_1800BB630 @ 0x1800bb650
// > ??> @ 0x18018bbd8
// > ??> @ 0x18018bbf4
// > ??> @ 0x1801feaa8
//
// 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_1800D0B80(__int64 a1, __int64 a2, __int64 a3, char a4)
{
int v8; // edi
__int64 v9; // rsi
_DWORD *v10; // rbx
int v11; // eax
__int64 v12; // rdx
char v13; // [rsp+48h] [rbp+10h] BYREF
if ( !a2 )
return 31;
if ( (_DWORD)a3 != -1 )
{
if ( (int)a3 >= 0 && (int)a3 < *(_DWORD *)a1 )
{
v12 = 8LL * (int)a3;
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + v12) + 60LL) |= 0x10u;
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + v12) + 60LL) |= 0x100u;
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + v12) + 60LL) &= ~0x80u;
*(_QWORD *)a2 = *(_QWORD *)(v12 + *(_QWORD *)(a1 + 24));
return 0;
}
goto LABEL_12;
}
v8 = 0;
if ( *(int *)a1 <= 0 )
{
LABEL_12:
if ( *(_QWORD *)a2 )
{
*(_DWORD *)(*(_QWORD *)a2 + 60LL) &= ~0x10u;
*(_DWORD *)(*(_QWORD *)a2 + 60LL) &= ~0x100u;
*(_DWORD *)(*(_QWORD *)a2 + 60LL) |= 0x80u;
}
return 2;
}
v9 = 0;
while ( 1 )
{
v10 = *(_DWORD **)(v9 + *(_QWORD *)(a1 + 24));
v11 = v10[15];
if ( (v11 & 0x8110) == 0 && ((v11 & 0x1000) == 0 || a4) )
{
LOBYTE(a3) = 1;
if ( !(*(unsigned int (__fastcall **)(_QWORD, char *, __int64))(*(_QWORD *)v10 + 176LL))(
*(_QWORD *)(v9 + *(_QWORD *)(a1 + 24)),
&v13,
a3)
&& !v13 )
{
break;
}
}
++v8;
v9 += 8;
if ( v8 >= *(_DWORD *)a1 )
goto LABEL_12;
}
v10[15] = v10[15] & 0xFFFFEE6F | 0x110;
*(_QWORD *)a2 = v10;
return 0;
}