//
// sub_1005DB370 from 0x1005db370 to 0x1005db408 (152 bytes)
//
// 1 xrefs:
// > ??> @ 0x100860ff8
//
// 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_1005DB370(__int64 a1, _BYTE *a2, int a3)
{
__int64 v6; // x22
int v7; // w9
__int64 v8; // x2
int v9; // w10
__int64 result; // x0
v6 = *(_QWORD *)(a1 + 48);
sub_1005DA600(a1, 15);
v7 = a3 - 1;
if ( *(_DWORD *)v6 < a3 )
v7 = *(_DWORD *)v6;
if ( v7 <= 0 )
{
*a2 = 0;
return 0;
}
else
{
v8 = 0;
do
{
if ( v8 >= v7 )
break;
v9 = *(unsigned __int8 *)(*(_QWORD *)(v6 + 8) + v8++);
}
while ( v9 != 10 );
result = sub_1005DB278(a1, a2, v8);
if ( (int)result >= 1 )
a2[(int)result] = 0;
}
return result;
}