//
// sub_1004B4214 from 0x1004b4214 to 0x1004b42a8 (148 bytes)
//
// 5 xrefs:
// > sub_1004AB2B8 @ 0x1004ab524
// > sub_1004AB2B8 @ 0x1004ab5c4
// > sub_1004AB2B8 @ 0x1004ab844
// > sub_1004AC1C0 @ 0x1004ac250
// > sub_1004AC1C0 @ 0x1004ac2ac
//
// 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_1004B4214(int a1, _BYTE *a2, int a3)
{
__int64 result; // x0
unsigned int v6; // w21
unsigned int v7; // w22
char v8; // [xsp+Fh] [xbp-21h] BYREF
result = 31;
if ( a2 && a3 )
{
*a2 = 0;
v6 = 0;
v7 = a3 - 1;
if ( a3 == 1 )
{
LABEL_4:
result = 0;
a2[v6] = 0;
}
else
{
while ( 1 )
{
v8 = 0;
result = sub_1004B414C(a1, &v8, 1);
if ( (_DWORD)result )
break;
if ( v8 != 13 )
{
if ( v8 == 10 )
goto LABEL_4;
a2[v6++] = v8;
}
if ( v6 >= v7 )
goto LABEL_4;
}
}
}
return result;
}