//
// sub_45316C from 0x45316c to 0x4532ca (350 bytes)
//
// 14 xrefs:
// > GameObject::addGlow @ 0x453334
// > GameObject::getColorFrame @ 0x45374e
// > GameObject::addColorSprite @ 0x45461e
// > GameObject::addColorSprite @ 0x45467c
// > GameObject::addColorSprite @ 0x4546e2
// > GameObject::addColorSprite @ 0x454742
// > GameObject::addColorSprite @ 0x4547a8
// > GameObject::addColorSprite @ 0x45480e
// > GameObject::getGlowFrame @ 0x454aa6
// > GameObject::playShineEffect @ 0x454d36
// > GameObject::playShineEffect @ 0x454d7e
// > GameObject::playShineEffect @ 0x4551be
// > GameObject::playShineEffect @ 0x45522c
// > GameObject::playShineEffect @ 0x45528e
//
// 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:48:38 +0000
//
int *__fastcall sub_45316C(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
size_t i; // r3
int v13; // r1
unsigned __int8 *v14; // r7
unsigned int v15; // r1
unsigned __int8 *v16; // r6
int v17; // r0
unsigned __int8 *v18; // lr
unsigned __int8 *v19; // r1
int v20; // r8
unsigned __int8 *v21; // r0
unsigned __int8 *v22; // r8
unsigned __int8 *v23; // r3
int v24; // r9
unsigned __int8 *v25; // r12
unsigned __int8 *v26; // r9
int v27; // t1
size_t v28; // r8
unsigned int v29; // r2
char *v30; // r3
size_t v31; // r1
int v32; // r3
int v34; // [sp+14h] [bp-20h] BYREF
unsigned int v35; // [sp+18h] [bp-1Ch]
unsigned __int8 *v36; // [sp+1Ch] [bp-18h]
int v37; // [sp+20h] [bp-14h] BYREF
size_t v38; // [sp+24h] [bp-10h]
char *v39; // [sp+28h] [bp-Ch]
int v40; // [sp+2Ch] [bp-8h]
a1[1] = 0;
a1[2] = 0;
v7 = _stack_chk_guard;
*a1 = 0;
v40 = v7;
v9 = strlen(a2);
std::string::__init(a1, a2, v9);
v34 = 0;
v35 = 0;
v36 = nullptr;
v10 = strlen(a3);
std::string::__init(&v34, a3, v10);
v37 = 0;
v38 = 0;
v39 = nullptr;
v11 = strlen(a4);
std::string::__init(&v37, a4, v11);
for ( i = 0; ; i = v32 + v28 )
{
v13 = *(unsigned __int8 *)a1;
if ( (v13 & 1) != 0 )
{
v14 = (unsigned __int8 *)a1[2];
v15 = a1[1];
}
else
{
v14 = (unsigned __int8 *)a1 + 1;
v15 = v13 >> 1;
}
if ( (v34 & 1) != 0 )
{
v16 = v36;
v17 = v35;
}
else
{
v17 = (int)(unsigned __int8)v34 >> 1;
v16 = (unsigned __int8 *)&v34 + 1;
}
if ( i > v15 || v15 - i < v17 )
break;
if ( v17 )
{
v18 = &v14[i];
v19 = &v14[v15];
if ( v19 - &v14[i] >= v17 )
{
v20 = 1 - v17;
v21 = &v16[v17];
v22 = &v19[v20];
LABEL_12:
while ( 1 )
{
v23 = v18;
if ( v18 == v22 )
break;
v24 = *v18++;
if ( v24 == *v16 )
{
v25 = v16;
v26 = v23;
while ( ++v25 != v21 )
{
v27 = *++v26;
if ( v27 != *v25 )
goto LABEL_12;
}
goto LABEL_19;
}
}
}
v23 = v19;
LABEL_19:
if ( v23 == v19 )
break;
v28 = v23 - v14;
}
else
{
v28 = i;
}
if ( v28 == -1 )
break;
if ( (v34 & 1) != 0 )
v29 = v35;
else
v29 = (int)(unsigned __int8)v34 >> 1;
if ( (v37 & 1) != 0 )
{
v30 = v39;
v31 = v38;
}
else
{
v31 = (int)(unsigned __int8)v37 >> 1;
v30 = (char *)&v37 + 1;
}
std::string::replace(a1, v28, v29, v30, v31);
if ( (v37 & 1) != 0 )
v32 = v38;
else
v32 = (int)(unsigned __int8)v37 >> 1;
}
std::string::~string((int)&v37);
std::string::~string((int)&v34);
return a1;
}