//
// sub_815E6C from 0x815e6c to 0x816020 (436 bytes)
//
// 22 xrefs:
// > sub_8179AC @ 0x817b22
// > sub_8179AC @ 0x817b2c
// > sub_8179AC @ 0x817bc0
// > sub_8179AC @ 0x817c2a
// > sub_8179AC @ 0x817d2a
// > sub_8179AC @ 0x817d34
// > sub_8179AC @ 0x817dc2
// > sub_8179AC @ 0x817e32
// > sub_818068 @ 0x8181de
// > sub_818068 @ 0x818230
// > sub_818068 @ 0x818282
// > sub_8183A0 @ 0x8184f4
// > sub_8183A0 @ 0x818820
// > sub_8183A0 @ 0x8189c8
// > sub_818C60 @ 0x818cfe
// > sub_818C60 @ 0x818d22
// > sub_818C60 @ 0x818da0
// > sub_818C60 @ 0x818e00
// > sub_818E48 @ 0x818ee6
// > sub_818E48 @ 0x818f0a
// > sub_818E48 @ 0x818f88
// > sub_818E48 @ 0x818fe8
//
// 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:01:42 +0000
//
int __fastcall sub_815E6C(int a1, pugi::xpath_node *this, int a3)
{
int v5; // r1
int v6; // r2
void *v7; // r0
int v8; // r1
const char *v9; // r7
int v10; // r8
int v11; // r1
const char *v12; // r10
int v13; // r1
void (*v14)(); // r0
int v15; // r1
int v16; // r1
size_t v17; // r9
size_t v18; // r0
int *v19; // r1
int *v20; // r0
int *v21; // r11
const char *v22; // r1
size_t v24; // [sp+0h] [bp-24h]
size_t v25; // [sp+4h] [bp-20h]
void (*child)(); // [sp+10h] [bp-14h] BYREF
void (*v28)(); // [sp+14h] [bp-10h] BYREF
void (*sibling)(); // [sp+18h] [bp-Ch] BYREF
sibling = (void (*)())pugi::xpath_node::attribute(this);
if ( !pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&sibling) )
{
v28 = pugi::xpath_node::node((void (**)())this, v5, v6);
switch ( (unsigned int)pugi::xml_node::type((pugi::xml_node *)&v28) )
{
case 1u:
case 2u:
v9 = (const char *)&unk_B6B226;
v10 = 0;
child = (void (*)())pugi::xml_node::first_child((pugi::xml_node *)&v28, v8);
break;
case 3u:
case 4u:
case 5u:
case 6u:
v7 = pugi::xml_node::value((pugi::xml_node *)&v28);
goto LABEL_5;
default:
*(_DWORD *)a1 = &unk_B6B226;
goto LABEL_11;
}
while ( 1 )
{
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&child) || !pugi::xml_node::operator!=(&child, &v28) )
{
*(_DWORD *)a1 = v9;
*(_BYTE *)(a1 + 4) = v10;
return a1;
}
if ( pugi::xml_node::type((pugi::xml_node *)&child) == (int *)((char *)&dword_0 + 3)
|| pugi::xml_node::type((pugi::xml_node *)&child) == &byte_4 )
{
v12 = (const char *)pugi::xml_node::value((pugi::xml_node *)&child);
if ( *v12 )
{
if ( *v9 || v10 )
{
v17 = strlen(v9);
v18 = strlen(v12);
if ( v10 )
v19 = (int *)v9;
else
v19 = nullptr;
v24 = v18;
v25 = v18 + v17;
v20 = sub_8110F0(a3, v19, v17 + 1, v18 + v17 + 1);
v21 = v20;
if ( !v10 )
memcpy(v20, v9, v17);
v22 = v12;
v12 = (const char *)v21;
memcpy((char *)v21 + v17, v22, v24);
v10 = 1;
*((_BYTE *)v21 + v25) = 0;
}
}
else
{
v12 = v9;
}
v9 = v12;
}
sibling = (void (*)())pugi::xml_node::first_child((pugi::xml_node *)&child, v11);
if ( pugi::xml_node::operator void (*)(pugi::xml_node***)(&sibling) )
break;
sibling = (void (*)())pugi::xml_node::next_sibling((pugi::xml_node *)&child, v13);
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&sibling) )
{
while ( 1 )
{
sibling = (void (*)())pugi::xml_node::next_sibling((pugi::xml_node *)&child, v15);
if ( !pugi::xml_node::operator!(&sibling) || !pugi::xml_node::operator!=(&child, &v28) )
break;
child = (void (*)())pugi::xml_node::parent((pugi::xml_node *)&child, v16);
}
if ( !pugi::xml_node::operator!=(&child, &v28) )
continue;
}
v14 = (void (*)())pugi::xml_node::next_sibling((pugi::xml_node *)&child, v15);
LABEL_22:
child = v14;
}
v14 = (void (*)())pugi::xml_node::first_child((pugi::xml_node *)&child, v13);
goto LABEL_22;
}
sibling = (void (*)())pugi::xpath_node::attribute(this);
v7 = pugi::xml_attribute::value((pugi::xml_attribute *)&sibling);
LABEL_5:
*(_DWORD *)a1 = v7;
LABEL_11:
*(_BYTE *)(a1 + 4) = 0;
return a1;
}