//
// sub_971DA8 from 0x971da8 to 0x971e7a (210 bytes)
//
// 2 xrefs:
// > std::__ndk1::__codecvt_utf16::do_in @ 0x971d7a
// > std::__ndk1::__codecvt_utf16::do_in @ 0x972632
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:05:53 +0000
//
int __fastcall sub_971DA8(
unsigned __int8 *a1,
unsigned int a2,
unsigned __int8 **a3,
unsigned int *a4,
unsigned int a5,
unsigned int **a6,
unsigned int a7,
char a8)
{
unsigned __int8 *v8; // r3
unsigned int *v9; // r7
int v10; // r6
int v11; // r4
int v12; // r5
unsigned int v13; // r6
unsigned __int8 *v14; // r3
int v15; // r5
unsigned int v16; // r4
*a3 = a1;
*a6 = a4;
v8 = *a3;
if ( (a8 & 4) != 0 && (int)(a2 - (_DWORD)v8) >= 2 && *v8 == 254 && v8[1] == 255 )
{
v8 += 2;
*a3 = v8;
}
if ( (unsigned int)v8 < a2 - 1 )
{
v9 = *a6;
while ( (unsigned int)v9 < a5 )
{
v10 = *v8;
v11 = v8[1];
v12 = (v10 << 8) & 0xFC00;
v13 = v11 | (v10 << 8);
if ( v12 == 55296 )
{
if ( (int)(a2 - (_DWORD)v8) < 4 )
return 1;
v15 = v8[2];
if ( ((v15 << 8) & 0xFC00) != 0xDC00 )
return 2;
v16 = ((_WORD)v15 << 8) & 0x300
| (unsigned __int16)((_WORD)v11 << 10)
| (((v13 << 10) & 0xF0000) + 0x10000)
| v8[3];
if ( v16 > a7 )
return 2;
v14 = v8 + 4;
*v9 = v16;
}
else
{
if ( v12 == 56320 || v13 > a7 )
return 2;
*v9 = v13;
v14 = v8 + 2;
}
*a3 = v14;
v9 = *a6 + 1;
*a6 = v9;
v8 = *a3;
if ( (unsigned int)*a3 >= a2 - 1 )
return (unsigned int)v8 < a2;
}
}
return (unsigned int)v8 < a2;
}