//
// sub_5A0304 from 0x5a0304 to 0x5a044c (328 bytes)
//
// 5 xrefs:
// > GJBaseGameLayer::addGuideArt @ 0x5a053c
// > GJBaseGameLayer::addGuideArt @ 0x5a05f8
// > GJBaseGameLayer::addGuideArt @ 0x5a06ea
// > GJBaseGameLayer::addGuideArt @ 0x5a07a6
// > GJBaseGameLayer::addGuideArt @ 0x5a08d0
//
// 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 11:53:16 +0000
//
int *__fastcall sub_5A0304(int *a1, char *a2, const char *a3, const char *a4)
{
int v7; // r3
size_t v9; // r0
size_t v10; // r0
size_t v11; // r0
unsigned __int8 *i; // r1
int v13; // r2
int v14; // r10
unsigned int v15; // r2
unsigned __int8 *v16; // r3
unsigned int v17; // r0
unsigned __int8 *v18; // r5
unsigned __int8 *v19; // r10
unsigned int v20; // r2
char *v21; // r3
size_t v22; // r1
int v23; // r1
unsigned __int8 *v25; // [sp+14h] [bp-24h] BYREF
int v26; // [sp+1Ch] [bp-1Ch] BYREF
unsigned int v27; // [sp+20h] [bp-18h]
unsigned __int8 *v28; // [sp+24h] [bp-14h]
int v29; // [sp+28h] [bp-10h] BYREF
size_t v30; // [sp+2Ch] [bp-Ch]
char *v31; // [sp+30h] [bp-8h]
int v32; // [sp+34h] [bp-4h]
a1[1] = 0;
a1[2] = 0;
v7 = _stack_chk_guard;
*a1 = 0;
v32 = v7;
v9 = strlen(a2);
std::string::__init(a1, a2, v9);
v26 = 0;
v27 = 0;
v28 = nullptr;
v10 = strlen(a3);
std::string::__init(&v26, a3, v10);
v29 = 0;
v30 = 0;
v31 = nullptr;
v11 = strlen(a4);
std::string::__init(&v29, a4, v11);
for ( i = nullptr; ; i = &v19[v23] )
{
v13 = *(unsigned __int8 *)a1;
if ( (v13 & 1) != 0 )
{
v14 = a1[2];
v15 = a1[1];
}
else
{
v14 = (int)a1 + 1;
v15 = v13 >> 1;
}
if ( (v26 & 1) != 0 )
{
v16 = v28;
v17 = v27;
}
else
{
v17 = (int)(unsigned __int8)v26 >> 1;
v16 = (unsigned __int8 *)&v26 + 1;
}
if ( (unsigned int)i > v15 || v15 - (unsigned int)i < v17 )
break;
if ( v17 )
{
v18 = (unsigned __int8 *)(v14 + v15);
std::__search(
&v25,
&i[v14],
(unsigned __int8 *)(v14 + v15),
v16,
&v16[v17],
(int (__fastcall *)(int, _DWORD))std::char_traits::eq);
if ( v25 == v18 )
break;
v19 = &v25[-v14];
}
else
{
v19 = i;
}
if ( v19 == (unsigned __int8 *)-1 )
break;
if ( (v26 & 1) != 0 )
v20 = v27;
else
v20 = (int)(unsigned __int8)v26 >> 1;
if ( (v29 & 1) != 0 )
{
v21 = v31;
v22 = v30;
}
else
{
v22 = (int)(unsigned __int8)v29 >> 1;
v21 = (char *)&v29 + 1;
}
std::string::replace(a1, (size_t)v19, v20, v21, v22);
if ( (v29 & 1) != 0 )
v23 = v30;
else
v23 = (int)(unsigned __int8)v29 >> 1;
}
std::string::~string((int)&v29);
std::string::~string((int)&v26);
return a1;
}