//
// GJSmartTemplate::getSimplifiedKey from 0x66fa48 to 0x66fe66 (1054 bytes)
//
// 5 xrefs:
// > GJSmartTemplate::saveRemap @ 0x670228
// > GJSmartTemplate::getPrefab @ 0x670f1e
// > GJSmartTemplate::getPrefab @ 0x671084
// > GJSmartTemplate::getPrefab @ 0x6710e6
// > GJSmartTemplate::getPrefab @ 0x6711ae
//
// 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:55:50 +0000
//
int *__fastcall GJSmartTemplate::getSimplifiedKey(int *a1, unsigned __int8 *a2)
{
int v4; // r5
int v5; // r6
int v6; // r7
int v7; // r4
int v8; // r11
unsigned __int8 *v9; // r0
int v10; // r3
int v11; // r8
unsigned int v12; // r0
int v13; // r10
unsigned int v14; // r1
unsigned int v15; // r1
unsigned int v16; // r1
unsigned int v17; // r2
int v18; // r2
unsigned int v19; // r2
int v20; // r2
unsigned int v21; // r1
unsigned int v22; // r1
int v23; // r11
int v24; // r0
int v25; // r12
int v26; // r3
bool v27; // zf
size_t v28; // r2
int v30; // [sp+18h] [bp-34h]
int v31; // [sp+18h] [bp-34h]
int v32; // [sp+1Ch] [bp-30h]
int SimplifiedType; // [sp+1Ch] [bp-30h]
int v34; // [sp+20h] [bp-2Ch]
int v35; // [sp+20h] [bp-2Ch]
int v36; // [sp+24h] [bp-28h]
int v37; // [sp+28h] [bp-24h]
int v38; // [sp+2Ch] [bp-20h]
int v39; // [sp+30h] [bp-1Ch]
unsigned __int8 v40; // [sp+43h] [bp-9h] BYREF
v38 = *std::string::at(a2, 0);
v4 = *std::string::at(a2, 1u);
v39 = *std::string::at(a2, 2u);
v5 = v39;
v32 = *std::string::at(a2, 3u);
v6 = v32;
v34 = *std::string::at(a2, 4u);
v7 = v34;
v30 = *std::string::at(a2, 5u);
v36 = *std::string::at(a2, 6u);
v37 = *std::string::at(a2, 7u);
v8 = v37;
v9 = std::string::at(a2, 8u);
v10 = v36;
v11 = *v9;
v40 = 0;
v12 = (unsigned __int8)(v4 - 52);
v13 = v11;
if ( v12 <= 0x18 && ((1 << v12) & 0x1E1E003) != 0 )
{
v4 = 48;
v40 = 1;
}
v14 = (unsigned __int8)(v30 - 52);
if ( v14 <= 0x18 && (((1 << v14) & 0x1E003) != 0 || ((1 << v14) & 0x1E00000) != 0 && v30 != v32) )
{
v40 = 1;
v30 = 48;
}
v15 = (unsigned __int8)(v36 - 52);
if ( v15 <= 0x18 && (((1 << v15) & 0x1E003) != 0 || ((1 << v15) & 0x1E00000) != 0 && v36 != v34) )
{
v10 = 48;
v40 = 1;
}
v16 = (unsigned __int8)(v39 - 50);
if ( v16 <= 0x16 && ((1 << v16) & 0x7800F3) != 0 )
{
v5 = 48;
v40 = 1;
}
v17 = (unsigned __int8)(v37 - 50);
if ( v17 <= 0x16 )
{
v18 = 1 << v17;
if ( (v18 & 0xF3) != 0 || (v18 & 0x780000) != 0 && v37 != v32 )
{
v8 = 48;
v40 = 1;
}
}
v19 = (unsigned __int8)(v11 - 50);
if ( v19 <= 0x16 )
{
v20 = 1 << v19;
if ( (v20 & 0xF3) != 0 || (v20 & 0x780000) != 0 && v11 != v34 )
{
v13 = 48;
v40 = 1;
}
}
v21 = (unsigned __int8)(v32 - 51);
if ( v21 <= 0x18 && ((1 << v21) & 0x1110025) != 0 )
{
v6 = 48;
v40 = 1;
}
v22 = (unsigned __int8)(v34 - 50);
if ( v22 <= 0x17 && ((1 << v22) & 0x888015) != 0 )
{
v7 = 48;
v40 = 1;
}
switch ( v38 )
{
case '2':
case '6':
case 'E':
v40 = 1;
v30 = 48;
v6 = 48;
v4 = 48;
break;
case '3':
case '8':
case 'G':
v40 = 1;
v10 = 48;
v7 = 48;
v4 = 48;
break;
case '4':
case 'A':
case 'I':
v8 = 48;
v6 = 48;
v40 = 1;
v5 = 48;
break;
case '5':
case 'C':
case 'K':
v13 = 48;
v7 = 48;
v5 = 48;
v40 = 1;
break;
default:
break;
}
v35 = v10;
SimplifiedType = GJSmartTemplate::getSimplifiedType(v30, &v40);
v31 = GJSmartTemplate::getSimplifiedType(v35, &v40);
v23 = GJSmartTemplate::getSimplifiedType(v8, &v40);
v24 = GJSmartTemplate::getSimplifiedType(v13, &v40);
v25 = SimplifiedType;
v26 = v31;
if ( SimplifiedType != 48 )
{
if ( (v4 & 0xFFFFFFFD) != 0x30 && (v6 & 0xFFFFFFFD) != 0x30 )
{
if ( v31 == 48 )
goto LABEL_52;
goto LABEL_45;
}
v40 = 1;
}
if ( v31 == 48 )
{
v25 = 48;
goto LABEL_52;
}
if ( v4 == 48 )
{
v25 = 48;
LABEL_50:
v40 = 1;
v26 = 48;
goto LABEL_52;
}
v25 = 48;
LABEL_45:
if ( v7 == 48 || v4 == 51 || v7 == 51 )
goto LABEL_50;
LABEL_52:
if ( v23 != 48 )
{
if ( (v5 & 0xFFFFFFFB) != 0x30 && (v6 & 0xFFFFFFFB) != 0x30 )
{
if ( v24 == 48 )
goto LABEL_67;
goto LABEL_59;
}
v40 = 1;
}
if ( v24 == 48 )
{
v23 = 48;
goto LABEL_67;
}
if ( v5 == 48 )
{
v23 = 48;
LABEL_64:
v40 = 1;
if ( v25 != 48 )
{
LOBYTE(v24) = 48;
goto LABEL_80;
}
if ( v26 != 48 )
{
LOBYTE(v24) = 48;
goto LABEL_80;
}
v27 = v23 == 48;
LOBYTE(v24) = 48;
LABEL_72:
if ( !v27 )
goto LABEL_79;
if ( v4 == 48 )
{
if ( v5 == 48 )
{
if ( v6 != 48 )
{
v40 = 1;
if ( v7 == 48 )
{
LOBYTE(v24) = 48;
LOBYTE(v23) = 48;
LOBYTE(v6) = 49;
LOBYTE(v5) = 48;
LOBYTE(v4) = 48;
goto LABEL_79;
}
LOBYTE(v6) = 49;
goto LABEL_102;
}
LABEL_107:
if ( v7 == 48 )
goto LABEL_108;
goto LABEL_99;
}
if ( v6 != 48 )
goto LABEL_107;
if ( v7 != 48 )
goto LABEL_96;
goto LABEL_94;
}
if ( v6 != 48 )
{
LABEL_97:
if ( v7 == 48 )
{
LABEL_108:
LOBYTE(v24) = v7;
LOBYTE(v23) = v7;
goto LABEL_79;
}
if ( v4 != 48 )
{
LOBYTE(v24) = 48;
LOBYTE(v23) = 48;
goto LABEL_79;
}
LABEL_99:
if ( v5 != 48 )
{
LOBYTE(v24) = 48;
LOBYTE(v23) = 48;
goto LABEL_105;
}
LABEL_102:
LOBYTE(v24) = 48;
LOBYTE(v23) = 48;
v40 = 1;
LOBYTE(v7) = 49;
LOBYTE(v5) = 48;
LABEL_105:
LOBYTE(v4) = 48;
goto LABEL_79;
}
if ( v7 == 48 )
{
v4 = 49;
v40 = 1;
if ( v5 != 48 )
{
LABEL_94:
v5 = 49;
v40 = 1;
LABEL_96:
LOBYTE(v6) = 48;
goto LABEL_97;
}
}
else if ( v5 != 48 )
{
goto LABEL_96;
}
v5 = 48;
goto LABEL_97;
}
v23 = 48;
LABEL_59:
if ( v7 == 48 || v5 == 53 || v7 == 53 )
goto LABEL_64;
LABEL_67:
if ( v25 == 48 && v26 == 48 && v23 == 48 )
{
v27 = v24 == 48;
goto LABEL_72;
}
LABEL_79:
v28 = v40;
if ( !v40 )
{
*a1 = 0;
a1[1] = v28;
a1[2] = v28;
std::string::__init(a1, &unk_B6B226, v28);
return a1;
}
LABEL_80:
GJSmartTemplate::keyFromNeighbors(a1, v38, v4, v5, v6, v7, v25, v26, v23, v24);
return a1;
}