//
// sub_5DDC0 from 0x5ddc0 to 0x5de7e (190 bytes)
//
// 1 xrefs:
// > ??> @ 0x5ddbe
//
// 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
//
int __fastcall sub_5DDC0(int a1, int a2, __int16 *a3)
{
int v3; // r6
int v4; // r4
int v6; // r8
int v7; // r5
unsigned int v8; // r0
unsigned int v10; // [sp+4h] [bp-1Ch] BYREF
if ( a2 )
return 31;
v4 = *(_DWORD *)(a1 + 4);
v6 = *((_DWORD *)off_E8000 + *(_DWORD *)(a1 + 28) + 75);
sub_6502C(v6);
v7 = (*(int (__fastcall **)(int))(*(_DWORD *)v4 + 12))(v4);
sub_5E2E8(v4);
if ( v7 )
v7 = v4;
if ( a3 )
{
v3 = 0;
sub_57A48(v6, &v10, nullptr);
v8 = ((v10 - ((v10 >> 1) & 0x55555555)) & 0x33333333) + (((v10 - ((v10 >> 1) & 0x55555555)) >> 2) & 0x33333333);
if ( (16843009 * ((v8 + (v8 >> 4)) & 0xF0F0F0F)) >> 24 == 1 )
v3 = sub_5DFE4(v4, a3 + 1, 2, *a3);
}
else
{
v3 = 0;
}
if ( v7 )
(*(void (__fastcall **)(int))(*(_DWORD *)v7 + 16))(v7);
sub_65044(v6);
return v3;
}