//
// PlatformToolbox::spriteFromSavedFile from 0x641c24 to 0x641fcc (936 bytes)
//
// 1 xrefs:
// > ??> @ 0x7e010
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:50:18 +0000
//
__int64 __fastcall PlatformToolbox::spriteFromSavedFile(unsigned __int8 *a1)
{
const char *v2; // x1
size_t v3; // x0
unsigned __int8 v4; // w0
size_t v5; // x1
unsigned __int8 v6; // w4
unsigned __int8 v7; // w2
char *v8; // x7
size_t v9; // x0
int v10; // w5
unsigned __int8 *v11; // x8
signed __int64 v12; // x3
size_t v13; // x25
size_t v14; // x2
char *v15; // x3
size_t v16; // x4
size_t v17; // x2
size_t v18; // x1
cocos2d::CCSprite *v19; // x0
const char *v20; // x1
__int64 v21; // x19
char *v23; // x1
char *v24; // x0
char *v25; // x12
char *v26; // x1
unsigned __int8 *v27; // x3
char *v28; // x25
char *v29; // x13
unsigned __int8 *v30; // x6
char *v31; // x9
int v32; // t1
void *v33; // x1
size_t v34; // x2
cocos2d::CCSprite *v35; // x0
char *v36; // [xsp+58h] [xbp+58h]
__int64 v37; // [xsp+60h] [xbp+60h] BYREF
size_t v38; // [xsp+68h] [xbp+68h]
void *v39; // [xsp+70h] [xbp+70h]
__int64 v40; // [xsp+78h] [xbp+78h] BYREF
size_t v41; // [xsp+80h] [xbp+80h]
void *v42; // [xsp+88h] [xbp+88h]
char *v43; // [xsp+90h] [xbp+90h] BYREF
size_t v44; // [xsp+98h] [xbp+98h]
cocos2d::CCSprite *v45; // [xsp+A0h] [xbp+A0h]
if ( (unsigned __int8)PlatformToolbox::isHD(_stack_chk_guard) )
{
v2 = (const char *)(a1 + 1);
if ( (*a1 & 1) != 0 )
v2 = *((const char **)a1 + 2);
v36 = (char *)v2;
v37 = 0;
v38 = 0;
v39 = nullptr;
v3 = strlen(v2);
std::string::__init(&v37, v36, v3);
v40 = 0;
v41 = 0;
v42 = nullptr;
std::string::__init(&v40, ".png", 4u);
v43 = nullptr;
v44 = 0;
v45 = nullptr;
std::string::__init((__int64 *)&v43, "-hd.png", 7u);
v4 = v37;
v5 = 0;
v6 = (unsigned __int8)v43;
if ( (v37 & 1) == 0 )
goto LABEL_17;
LABEL_5:
v7 = v40;
v8 = (char *)v39;
v9 = v38;
v10 = v40 & 1;
if ( (v40 & 1) != 0 )
{
LABEL_6:
v11 = (unsigned __int8 *)v42;
v12 = v41;
if ( v5 <= v9 )
goto LABEL_7;
}
else
{
while ( 1 )
{
v12 = v7 >> 1;
v11 = (unsigned __int8 *)&v40 + 1;
if ( v5 > v9 )
break;
LABEL_7:
if ( v9 - v5 < v12 )
break;
v13 = v5;
if ( v12 )
{
v23 = &v8[v5];
v24 = &v8[v9];
if ( v12 > v24 - v23 )
break;
v25 = &v24[1 - v12];
if ( v23 == v25 )
break;
v26 = v23 + 1;
v27 = &v11[v12];
do
{
v28 = v26 - 1;
v29 = v26;
if ( (unsigned __int8)*(v26 - 1) == *v11 )
{
v30 = v11;
v31 = v26 - 1;
while ( ++v30 != v27 )
{
v32 = (unsigned __int8)*++v31;
if ( v32 != *v30 )
goto LABEL_42;
}
if ( v28 != v24 )
{
v13 = v28 - v8;
goto LABEL_9;
}
goto LABEL_19;
}
LABEL_42:
++v26;
}
while ( v25 != v29 );
if ( (v6 & 1) == 0 )
goto LABEL_20;
goto LABEL_39;
}
LABEL_9:
if ( v13 == -1 )
break;
v14 = v7 >> 1;
if ( v10 )
v14 = v41;
if ( (v6 & 1) != 0 )
{
v15 = (char *)v45;
v16 = v44;
}
else
{
v16 = v6 >> 1;
v15 = (char *)&v43 + 1;
}
std::string::replace(&v37, v13, v14, v15, v16);
v6 = (unsigned __int8)v43;
v17 = (unsigned __int8)v43 >> 1;
if ( ((unsigned __int8)v43 & 1) != 0 )
v17 = v44;
v4 = v37;
v5 = v17 + v13;
if ( (v37 & 1) != 0 )
goto LABEL_5;
LABEL_17:
v7 = v40;
v9 = v4 >> 1;
v8 = (char *)&v37 + 1;
v10 = v40 & 1;
if ( (v40 & 1) != 0 )
goto LABEL_6;
}
}
LABEL_19:
if ( (v6 & 1) != 0 )
{
LABEL_39:
operator delete(v45);
if ( (v40 & 1) == 0 )
{
LABEL_21:
if ( (*a1 & 1) == 0 )
{
LABEL_22:
a1[1] = 0;
*a1 = 0;
LABEL_23:
std::string::reserve((__int64 *)a1, 0);
*((_QWORD *)a1 + 2) = v39;
v18 = v38;
*(_QWORD *)a1 = v37;
*((_QWORD *)a1 + 1) = v18;
goto LABEL_24;
}
LABEL_29:
**((_BYTE **)a1 + 2) = 0;
*((_QWORD *)a1 + 1) = 0;
goto LABEL_23;
}
}
else
{
LABEL_20:
if ( !v10 )
goto LABEL_21;
}
operator delete(v42);
if ( (*a1 & 1) == 0 )
goto LABEL_22;
goto LABEL_29;
}
LABEL_24:
v19 = (cocos2d::CCSprite *)(a1 + 1);
v20 = (const char *)*a1;
if ( ((unsigned __int8)v20 & 1) != 0 )
v19 = *((cocos2d::CCSprite **)a1 + 2);
v21 = cocos2d::CCSprite::create(v19, v20);
if ( !v21 )
{
v43 = nullptr;
v44 = 0;
v45 = nullptr;
std::string::__init((__int64 *)&v43, "/data/data/com.robtopx.geometryjump/", 0x24u);
if ( (*a1 & 1) != 0 )
{
v33 = *((void **)a1 + 2);
v34 = *((_QWORD *)a1 + 1);
}
else
{
v33 = a1 + 1;
v34 = *a1 >> 1;
}
std::string::append((__int64)&v43, v33, v34);
v35 = (cocos2d::CCSprite *)((char *)&v43 + 1);
if ( ((unsigned __int8)v43 & 1) != 0 )
v35 = v45;
v21 = cocos2d::CCSprite::create(v35, (const char *)(unsigned __int8)v43);
if ( ((unsigned __int8)v43 & 1) != 0 )
operator delete(v45);
}
return v21;
}