//
// sub_991A74 from 0x991a74 to 0x991c54 (480 bytes)
//
// 2 xrefs:
// > sub_988BAC @ 0x988c4e
// > sub_988BAC @ 0x988db6
//
// 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:06:36 +0000
//
_DWORD *__fastcall sub_991A74(unsigned int *a1, _DWORD *a2)
{
unsigned int v4; // r0
int v5; // r4
int v6; // r8
const void *v7; // r0
void *v9; // r10
unsigned __int8 *v10; // r6
const void *v11; // r0
const void *v12; // r0
const void *v13; // r0
unsigned __int8 *v14; // r5
int v15; // r0
int v16; // r1
int v17; // t1
unsigned __int8 *v18; // r0
int v19; // t1
unsigned int v20; // r4
_BYTE *v21; // r9
const char *v22; // r1
_BYTE *v23; // r0
_BYTE *v24; // r0
char v25; // t1
v4 = *(unsigned __int8 *)a2;
v5 = a2[1];
v6 = v4 & 1;
if ( (v4 & 1) == 0 )
v5 = v4 >> 1;
if ( v5 <= 11 )
{
if ( !v5 )
return sub_9827AC(a1, a2);
if ( v5 == 11 )
{
v7 = (const void *)a2[2];
if ( !v6 )
v7 = (char *)a2 + 1;
if ( !memcmp(v7, "std::string", 0xBu) )
{
sub_98987A(a2, "std::basic_string, std::allocator >", 0x46u);
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
return (_DWORD *)sub_9827DA(a1, "basic_string", 0xCu);
}
}
goto LABEL_23;
}
if ( v5 == 12 )
{
v12 = (const void *)a2[2];
if ( !v6 )
v12 = (char *)a2 + 1;
if ( !memcmp(v12, "std::istream", 0xCu) )
{
sub_98987A(a2, "std::basic_istream >", 0x31u);
v22 = "basic_istream";
}
else
{
v13 = (const void *)a2[2];
if ( !v6 )
v13 = (char *)a2 + 1;
if ( memcmp(v13, "std::ostream", 0xCu) )
goto LABEL_23;
sub_98987A(a2, "std::basic_ostream >", 0x31u);
v22 = "basic_ostream";
}
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
return (_DWORD *)sub_9827DA(a1, v22, 0xDu);
}
if ( v5 == 13 )
{
v9 = (void *)a2[2];
v10 = (unsigned __int8 *)a2 + 1;
v11 = v9;
if ( !v6 )
v11 = (char *)a2 + 1;
if ( !memcmp(v11, "std::iostream", 0xDu) )
{
sub_98987A(a2, "std::basic_iostream >", 0x32u);
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
return (_DWORD *)sub_9827DA(a1, "basic_iostream", 0xEu);
}
goto LABEL_24;
}
LABEL_23:
v9 = (void *)a2[2];
v10 = (unsigned __int8 *)a2 + 1;
LABEL_24:
if ( v6 )
v10 = (unsigned __int8 *)v9;
v14 = &v10[v5];
if ( v10[v5 - 1] != 62 )
goto LABEL_36;
v15 = 1;
while ( 2 )
{
--v14;
do
{
if ( v10 == v14 )
goto LABEL_37;
v17 = *--v14;
v16 = v17;
if ( v17 == 62 )
{
++v15;
goto LABEL_28;
}
}
while ( v16 != 60 );
if ( --v15 )
{
LABEL_28:
++v14;
continue;
}
break;
}
LABEL_36:
if ( v14 - v10 >= 2 )
{
v18 = v14 - 1;
while ( v10 != v18 )
{
v19 = *v18--;
if ( v19 == 58 )
{
v10 = v18 + 2;
break;
}
}
v20 = v14 - v10;
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
if ( (unsigned int)(v14 - v10) > 0xA )
{
v23 = malloc((v20 + 16) & 0xFFFFFFF0);
*a1 = (v20 + 16) & 0xFFFFFFF0 | 1;
a1[1] = v20;
a1[2] = (unsigned int)v23;
v21 = v23;
}
else
{
*(_BYTE *)a1 = 2 * v20;
v21 = (char *)a1 + 1;
}
if ( v10 != v14 )
{
v24 = v21;
do
{
v25 = *v10++;
*v24++ = v25;
}
while ( v14 != v10 );
v21 += v20;
}
*v21 = 0;
return nullptr;
}
else
{
LABEL_37:
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
return nullptr;
}
}