//
// EndLevelLayer::getCoinString from 0x140134960 to 0x140134ca0 (832 bytes)
//
// 3 xrefs:
// > EndLevelLayer::customSetup @ 0x140133a92
// > ??> @ 0x1406c9e94
// > ??> @ 0x1406c9ea0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=1
_QWORD *__fastcall EndLevelLayer::getCoinString(__int64 a1, _QWORD *a2)
{
int *v4; // rcx
int v5; // r12d
int v6; // r13d
int v7; // r14d
char v8; // bl
void **v9; // rdx
cocos2d::CCString *v10; // rax
const char *CString; // rax
size_t v12; // r8
void *v13; // rcx
void *Block[2]; // [rsp+30h] [rbp-30h] BYREF
__int64 v16; // [rsp+40h] [rbp-20h]
unsigned __int64 v17; // [rsp+48h] [rbp-18h]
if ( *(_QWORD *)(a1 + 608) )
{
*(_OWORD *)Block = 0;
Block[0] = sub_14003AA10(0x20u);
v16 = 17;
v17 = 31;
strcpy((char *)Block[0], "all coins");
v4 = *(int **)(*(_QWORD *)(a1 + 608) + 2168LL);
v5 = v4[241] - v4[242];
v6 = v4[244] - v4[245];
v7 = v4[247] - v4[248];
if ( v4[230] >= 2 && (v5 == 1 || v6 == 1 || v7 == 1) )
{
v16 = 5;
memmove(Block[0], "coin ", 5u);
*((_BYTE *)Block[0] + 5) = 0;
v8 = 1;
if ( v5 != 1 )
{
v8 = 0;
sub_140041270(Block, "1", 9u);
}
if ( v6 != 1 )
{
if ( !v8 )
sub_140041270(Block, ", ", 2u);
v8 = 0;
sub_140041270(Block, "2", 9u);
}
if ( v7 != 1 && *(int *)(*(_QWORD *)(*(_QWORD *)(a1 + 608) + 2168LL) + 920LL) >= 3 )
{
if ( !v8 )
sub_140041270(Block, ", ", 2u);
sub_140041270(Block, "3", 9u);
}
}
v9 = Block;
if ( v17 > 0xF )
v9 = (void **)Block[0];
v10 = cocos2d::CCString::createWithFormat("You need to collect %s to verify the level!", (const char *)v9);
CString = cocos2d::CCString::getCString(v10);
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 0;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003A930(a2, CString, v12);
if ( v17 > 0xF )
{
v13 = Block[0];
if ( v17 + 1 >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
}
else
{
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 15;
*(_BYTE *)a2 = 0;
}
return a2;
}