//
// sub_1005D4CEC from 0x1005d4cec to 0x1005d4e8c (416 bytes)
//
// 2 xrefs:
// > ??> @ 0x10083b528
// > ??> @ 0x10083b5f8
//
// 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_1005D4CEC(__int64 a1, int a2, int a3, _DWORD *a4)
{
__int64 result; // x0
__int64 v7; // x21
__int64 v8; // x8
void *v9; // x0
void *v10; // x0
if ( a2 > 4096 )
{
v7 = *(_QWORD *)(a1 + 40);
switch ( a2 )
{
case 4097:
if ( a3 < 256 )
return 4294967294LL;
*(_DWORD *)v7 = a3;
return 1;
case 4098:
if ( *(_DWORD *)(v7 + 8) )
return 4294967294LL;
*(_DWORD *)(v7 + 4) = a3;
return 1;
case 4099:
if ( (unsigned int)(a3 - 1) > 2 )
return 4294967294LL;
*(_DWORD *)(v7 + 24) = a3;
return 1;
case 4100:
if ( !*(_DWORD *)(v7 + 8) )
return 4294967294LL;
*(_DWORD *)(v7 + 12) = a3;
return 1;
case 4101:
if ( (unsigned int)a3 > 2 )
return 4294967294LL;
*(_DWORD *)(v7 + 8) = a3;
return 1;
case 4102:
if ( a3 == -2 )
return (unsigned int)*(char *)(v7 + 36);
if ( (unsigned int)(a3 - 1) > 1 )
return 4294967294LL;
*(_BYTE *)(v7 + 36) = a3;
result = 1;
break;
case 4103:
*(_QWORD *)(v7 + 48) = a4;
return 1;
case 4104:
v8 = *(_QWORD *)(v7 + 48);
goto LABEL_32;
case 4105:
if ( a3 < 1 )
return 4294967294LL;
*(_QWORD *)(v7 + 72) = a3;
return 1;
case 4106:
*a4 = *(_QWORD *)(v7 + 72);
return 1;
case 4107:
v9 = *(void **)(v7 + 56);
if ( v9 )
sub_100588C44(v9);
*(_QWORD *)(v7 + 56) = a4;
if ( a4 )
*(_QWORD *)(v7 + 64) = a3;
else
*(_QWORD *)(v7 + 64) = 0;
return 1;
case 4108:
*(_QWORD *)a4 = *(_QWORD *)(v7 + 56);
return *(unsigned int *)(v7 + 64);
case 4109:
v10 = *(void **)(v7 + 40);
if ( v10 )
sub_1005EE6D8(v10);
*(_QWORD *)(v7 + 40) = a4;
return 1;
case 4110:
v8 = *(_QWORD *)(v7 + 40);
LABEL_32:
*(_QWORD *)a4 = v8;
return 1;
default:
return 4294967294LL;
}
}
else if ( a2 == 2 )
{
return 1;
}
else
{
return 4294967294LL;
}
return result;
}