//
// GameLevelManager::applyDeathBlob from 0x4d948c to 0x4d992e (1186 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetDeathDataCompleted @ 0x4d99e8
// > GameLevelManager::processOnDownloadLevelCompleted @ 0x4d9de6
//
// 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:50:55 +0000
//
int __fastcall GameLevelManager::applyDeathBlob(int a1, unsigned int a2, unsigned __int8 *a3)
{
int v3; // r8
int v6; // r11
unsigned __int8 *v7; // r7
int v8; // r3
unsigned __int8 *v9; // r9
size_t v10; // r7
char *v11; // r0
int v12; // r9
int v13; // r6
int v14; // r6
unsigned int v15; // r12
unsigned int v16; // r6
unsigned __int8 *v17; // r11
unsigned __int8 *v18; // r6
unsigned __int8 *v19; // r10
int *v20; // r7
_BYTE *v21; // r2
int v22; // r3
int v23; // r0
int v24; // r1
_BYTE *v25; // r2
const char *v26; // r0
_BYTE *v27; // r2
int v28; // r3
int v29; // r0
int v30; // r1
_BYTE *v31; // r2
int v32; // r2
int *v33; // r0
int v34; // r3
unsigned __int8 *v35; // r0
unsigned int v36; // r5
unsigned int v37; // r7
unsigned int v38; // r6
_DWORD *v39; // r2
_DWORD *i; // r11
unsigned int v41; // r0
int v42; // r1
_DWORD *v43; // r0
unsigned int v44; // r3
_DWORD *v45; // r6
float v46; // s13
float v47; // s15
bool v48; // r11
unsigned int prime; // r5
unsigned int v50; // r0
unsigned int v51; // r8
int v52; // r0
unsigned int v53; // r1
unsigned int v54; // s15
float v55; // s14
unsigned int v56; // r0
_DWORD *v57; // r3
int v58; // r3
unsigned int v59; // r0
int v60; // r1
float v62; // r0
unsigned int v63; // [sp+1Ch] [bp-50h] BYREF
unsigned __int8 *v64[2]; // [sp+20h] [bp-4Ch] BYREF
int v65; // [sp+28h] [bp-44h] BYREF
int v66; // [sp+2Ch] [bp-40h]
_BYTE *v67; // [sp+30h] [bp-3Ch]
int v68; // [sp+34h] [bp-38h] BYREF
int v69; // [sp+38h] [bp-34h]
_BYTE *v70; // [sp+3Ch] [bp-30h]
int v71[3]; // [sp+40h] [bp-2Ch] BYREF
int v72; // [sp+4Ch] [bp-20h] BYREF
int v73; // [sp+50h] [bp-1Ch]
_BYTE *v74; // [sp+54h] [bp-18h]
int v75; // [sp+58h] [bp-14h] BYREF
int v76; // [sp+5Ch] [bp-10h]
char *v77; // [sp+60h] [bp-Ch]
v6 = *a3;
v63 = a2;
if ( (v6 & 1) != 0 )
v7 = *((unsigned __int8 **)a3 + 2);
else
v7 = a3 + 1;
if ( (v6 & 1) != 0 )
v8 = *((_DWORD *)a3 + 1);
else
v8 = v6 >> 1;
if ( !v8
|| (v9 = &v7[v8],
std::__search(
v64,
v7,
&v7[v8],
";",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v64[0] == v9)
|| (v10 = v64[0] - v7, v10 == -1) )
{
std::string::basic_string(&v75, (int)a3);
v10 = -1;
}
else
{
std::string::basic_string(&v75, a3, 0, v10);
}
if ( (v75 & 1) != 0 )
v11 = v77;
else
v11 = (char *)&v75 + 1;
v12 = atoi(v11);
std::string::~string((int)&v75);
v13 = 0;
v65 = 0;
v66 = 0;
v67 = nullptr;
if ( v10 != -1 )
{
v14 = *a3;
v15 = v10 + 1;
if ( (v14 & 1) != 0 )
{
v16 = *((_DWORD *)a3 + 1);
v17 = *((unsigned __int8 **)a3 + 2);
}
else
{
v16 = v14 >> 1;
v17 = a3 + 1;
}
if ( v16 <= v15
|| (v18 = &v17[v16],
std::__search(
v64,
&v17[v15],
v18,
";",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq),
v15 = v10 + 1,
v64[0] == v18)
|| (v19 = (unsigned __int8 *)(v64[0] - v17), v64[0] - v17 == -1) )
{
v20 = &v68;
std::string::basic_string(&v68, a3, v15, 0xFFFFFFFF);
v13 = 0;
v22 = v65 & 1;
if ( (v65 & 1) != 0 )
{
v21 = v67;
v22 = 0;
}
else
{
BYTE1(v65) = v65 & 1;
}
if ( (v65 & 1) != 0 )
{
*v21 = v22;
v66 = v22;
}
else
{
LOBYTE(v65) = v22;
}
std::string::reserve(&v65, 0);
v23 = v68;
v24 = v69;
v25 = v70;
v68 = 0;
v69 = 0;
v70 = nullptr;
v65 = v23;
v66 = v24;
v67 = v25;
}
else
{
std::string::basic_string(v71, a3, v10 + 1, (size_t)&v19[~v10]);
v20 = &v72;
if ( (v71[0] & 1) != 0 )
v26 = (const char *)v71[2];
else
v26 = (char *)v71 + 1;
v13 = atoi(v26);
std::string::~string((int)v71);
std::string::basic_string(&v72, a3, (unsigned int)(v19 + 1), 0xFFFFFFFF);
v28 = v65 & 1;
if ( (v65 & 1) != 0 )
{
v27 = v67;
v28 = 0;
}
else
{
BYTE1(v65) = v65 & 1;
}
if ( (v65 & 1) != 0 )
{
*v27 = v28;
v66 = v28;
}
else
{
LOBYTE(v65) = v28;
}
std::string::reserve(&v65, 0);
v29 = v72;
v30 = v73;
v31 = v74;
v72 = 0;
v73 = 0;
v74 = nullptr;
v65 = v29;
v66 = v30;
v67 = v31;
}
std::string::~string((int)v20);
}
if ( (v65 & 1) != 0 )
v32 = v66;
else
v32 = (int)(unsigned __int8)v65 >> 1;
if ( v32 )
{
cocos2d::ZipUtils::decompressString(&v75, &v65, 0, 0);
}
else
{
v75 = 0;
v76 = 0;
v77 = nullptr;
std::string::__init(&v75, &unk_B6B226, 0);
}
if ( std::string::find((unsigned __int8 *)&v75, 124, 0) == -1 )
{
if ( (v75 & 1) != 0 )
{
*v77 = 0;
v76 = 0;
}
else
{
LOWORD(v75) = 0;
}
}
v33 = (int *)(a1 + 264);
if ( (v75 & 1) != 0 )
v34 = v76;
else
v34 = (int)(unsigned __int8)v75 >> 1;
if ( v34 )
{
v35 = (unsigned __int8 *)std::unordered_map::operator[]((int)v33, &v63);
std::string::operator=(v35, (unsigned __int8 *)&v75);
*std::unordered_map::operator[](a1 + 284, &v63) = v13;
}
else
{
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
v33,
&v63);
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
(int *)(a1 + 284),
&v63);
}
v36 = *(_DWORD *)(a1 + 308);
v37 = v63;
if ( v36 )
{
v38 = v36 - 1;
v3 = ((v36 - 1) & v36) != 0 ? v63 % v36 : v38 & v63;
v39 = *(_DWORD **)(*(_DWORD *)(a1 + 304) + 4 * v3);
if ( v39 )
{
for ( i = (_DWORD *)*v39; i; i = (_DWORD *)*i )
{
v41 = i[1];
v42 = ((v36 - 1) & v36) != 0 ? v41 % v36 : v38 & v41;
if ( v42 != v3 )
break;
if ( i[2] == v63 )
goto LABEL_98;
}
}
}
v43 = (_DWORD *)operator new(0xCu);
v44 = v63;
v43[1] = v37;
v45 = v43;
v43[2] = v44;
*v43 = 0;
v46 = *(float *)(a1 + 320);
v47 = (float)(unsigned int)(*(_DWORD *)(a1 + 316) + 1);
if ( v47 > (float)((float)v36 * v46) )
{
v48 = v36 > 2 && ((v36 - 1) & v36) == 0;
LABEL_70:
prime = 2 * v36 + !v48;
v50 = (unsigned int)ceilf(v47 / v46);
if ( prime < v50 )
prime = v50;
if ( prime == 1 )
{
prime = 2;
}
else if ( ((prime - 1) & prime) != 0 )
{
prime = std::__next_prime(prime);
}
v51 = *(_DWORD *)(a1 + 308);
if ( prime <= v51 )
{
if ( prime >= v51 )
goto LABEL_79;
v54 = *(_DWORD *)(a1 + 316);
v55 = *(float *)(a1 + 320);
if ( v51 <= 2 || ((v51 - 1) & v51) != 0 )
{
v62 = ceilf((float)v54 / v55);
v56 = std::__next_prime((unsigned int)v62);
}
else
{
v56 = 1 << (32 - __clz((unsigned int)ceilf((float)v54 / v55) - 1));
}
v53 = v56;
if ( v56 < prime )
v53 = prime;
if ( v53 >= v51 )
goto LABEL_79;
v52 = a1 + 304;
}
else
{
v52 = a1 + 304;
v53 = prime;
}
std::__hash_table,std::equal_to,std::allocator>::__rehash(v52, v53);
LABEL_79:
v36 = *(_DWORD *)(a1 + 308);
if ( ((v36 - 1) & v36) != 0 )
v3 = v37 % v36;
else
v3 = (v36 - 1) & v37;
goto LABEL_90;
}
if ( !v36 )
{
v48 = 0;
goto LABEL_70;
}
LABEL_90:
v57 = *(_DWORD **)(*(_DWORD *)(a1 + 304) + 4 * v3);
if ( v57 )
{
*v45 = *v57;
*v57 = v45;
}
else
{
*v45 = *(_DWORD *)(a1 + 312);
v58 = *(_DWORD *)(a1 + 304);
*(_DWORD *)(a1 + 312) = v45;
*(_DWORD *)(v58 + 4 * v3) = a1 + 312;
if ( *v45 )
{
v59 = *(_DWORD *)(*v45 + 4);
if ( ((v36 - 1) & v36) != 0 )
v60 = v59 % v36;
else
v60 = (v36 - 1) & v59;
*(_DWORD *)(*(_DWORD *)(a1 + 304) + 4 * v60) = v45;
}
}
++*(_DWORD *)(a1 + 316);
LABEL_98:
std::string::~string((int)&v75);
std::string::~string((int)&v65);
return v12;
}