//
// GJSmartTemplate::getSimplifiedKey from 0x1403b7540 to 0x1403b7cd3 (1939 bytes)
//
// 6 xrefs:
// > GJSmartTemplate::saveRemap @ 0x1403b6fb4
// > GJSmartTemplate::getPrefab @ 0x1403b917a
// > GJSmartTemplate::getPrefab @ 0x1403b92bc
// > GJSmartTemplate::getPrefab @ 0x1403b9369
// > GJSmartTemplate::getPrefab @ 0x1403b9481
// > ??> @ 0x140923d08
//
// This function is hookable on this platform (idp: pc, 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 11:31:25 +0000
//
// Hidden C++ exception states: #wind=2
void **__fastcall GJSmartTemplate::getSimplifiedKey(void **Src, unsigned __int64 *a2, __int64 a3, __int64 a4)
{
unsigned __int64 *v4; // rbx
unsigned __int64 v6; // rcx
unsigned __int64 v7; // rax
int v8; // r10d
int v9; // r14d
int v10; // ebp
unsigned __int64 v11; // rax
int v12; // esi
int v13; // edi
unsigned __int64 *v14; // rax
unsigned __int64 v15; // rax
int v16; // r13d
unsigned __int64 *v17; // rax
int v18; // r15d
char v19; // dl
char v21; // [rsp+20h] [rbp-68h]
char v22; // [rsp+24h] [rbp-64h]
v4 = a2;
v6 = a2[2];
if ( !v6 )
goto LABEL_111;
v7 = a2[3];
if ( v7 > 0xF )
a2 = (unsigned __int64 *)*a2;
v8 = *(char *)a2;
if ( v6 <= 1 )
goto LABEL_111;
a2 = v4;
if ( v7 > 0xF )
a2 = (unsigned __int64 *)*v4;
v9 = *((char *)a2 + 1);
if ( v6 <= 2 )
goto LABEL_111;
v6 = (unsigned __int64)v4;
if ( v7 > 0xF )
v6 = *v4;
v10 = *(char *)(v6 + 2);
v11 = v4[2];
if ( v11 <= 3 )
goto LABEL_111;
a2 = v4;
v6 = v4[3];
if ( v6 > 0xF )
a2 = (unsigned __int64 *)*v4;
v12 = *((char *)a2 + 3);
if ( v11 <= 4 )
goto LABEL_111;
a2 = v4;
if ( v6 > 0xF )
a2 = (unsigned __int64 *)*v4;
v13 = *((char *)a2 + 4);
if ( v11 <= 5 )
goto LABEL_111;
v14 = v4;
if ( v6 > 0xF )
v14 = (unsigned __int64 *)*v4;
a4 = (unsigned int)*((char *)v14 + 5);
v21 = *((_BYTE *)v14 + 5);
v15 = v4[2];
if ( v15 <= 6 )
goto LABEL_111;
a2 = v4;
if ( v6 > 0xF )
a2 = (unsigned __int64 *)*v4;
a3 = (unsigned int)*((char *)a2 + 6);
v22 = *((_BYTE *)a2 + 6);
if ( v15 <= 7 )
goto LABEL_111;
a2 = v4;
if ( v6 > 0xF )
a2 = (unsigned __int64 *)*v4;
v16 = *((char *)a2 + 7);
if ( v15 <= 8 )
LABEL_111:
sub_14003F4D0(v6, a2, a3, a4);
v17 = v4;
if ( v6 > 0xF )
v17 = (unsigned __int64 *)*v4;
v18 = *((char *)v17 + 8);
v19 = 0;
switch ( v9 )
{
case '4':
case '5':
case 'A':
case 'B':
case 'C':
case 'D':
case 'I':
case 'J':
case 'K':
case 'L':
v9 = 48;
v19 = 1;
break;
default:
break;
}
switch ( (int)a4 )
{
case '4':
case '5':
case 'A':
case 'B':
case 'C':
case 'D':
goto LABEL_32;
case 'I':
case 'J':
case 'K':
case 'L':
if ( (_DWORD)a4 != v12 )
{
LABEL_32:
LODWORD(a4) = 48;
v19 = 1;
v21 = 48;
}
break;
default:
break;
}
switch ( (int)a3 )
{
case '4':
case '5':
case 'A':
case 'B':
case 'C':
case 'D':
goto LABEL_35;
case 'I':
case 'J':
case 'K':
case 'L':
if ( (_DWORD)a3 != v13 )
{
LABEL_35:
LODWORD(a3) = 48;
v19 = 1;
v22 = 48;
}
break;
default:
break;
}
switch ( v10 )
{
case '2':
case '3':
case '6':
case '7':
case '8':
case '9':
case 'E':
case 'F':
case 'G':
case 'H':
v10 = 48;
v19 = 1;
break;
default:
break;
}
switch ( v16 )
{
case '2':
case '3':
case '6':
case '7':
case '8':
case '9':
goto LABEL_40;
case 'E':
case 'F':
case 'G':
case 'H':
if ( v16 != v12 )
{
LABEL_40:
v19 = 1;
v16 = 48;
}
break;
default:
break;
}
switch ( *((_BYTE *)v17 + 8) )
{
case '2':
case '3':
case '6':
case '7':
case '8':
case '9':
goto LABEL_43;
case 'E':
case 'F':
case 'G':
case 'H':
if ( v18 != v13 )
{
LABEL_43:
v19 = 1;
v18 = 48;
}
break;
default:
break;
}
switch ( v12 )
{
case '3':
case '5':
case '8':
case 'C':
case 'G':
case 'K':
v12 = 48;
v19 = 1;
break;
default:
break;
}
switch ( v13 )
{
case '2':
case '4':
case '6':
case 'A':
case 'E':
case 'I':
v13 = 48;
v19 = 1;
break;
default:
break;
}
switch ( v8 )
{
case '2':
case '6':
case 'E':
v12 = 48;
LODWORD(a4) = 48;
v21 = 48;
v9 = 48;
LABEL_56:
v19 = 1;
goto LABEL_57;
case '3':
case '8':
case 'G':
v13 = 48;
LODWORD(a3) = 48;
v22 = 48;
v9 = 48;
goto LABEL_53;
case '4':
case 'A':
case 'I':
v12 = 48;
v10 = 48;
v16 = 48;
goto LABEL_53;
case '5':
case 'C':
case 'K':
v13 = 48;
v10 = 48;
v18 = 48;
LABEL_53:
v19 = 1;
break;
default:
break;
}
switch ( (int)a4 )
{
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
LODWORD(a4) = 49;
v21 = 49;
goto LABEL_56;
default:
break;
}
LABEL_57:
switch ( (int)a3 )
{
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
v19 = 1;
LODWORD(a3) = 49;
v22 = 49;
break;
default:
break;
}
switch ( v16 )
{
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
v19 = 1;
v16 = 49;
break;
default:
break;
}
switch ( v18 )
{
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
v19 = 1;
v18 = 49;
break;
default:
break;
}
if ( (_DWORD)a4 != 48 && (v9 == 48 || v12 == 48 || v9 == 50 || v12 == 50) )
{
LODWORD(a4) = 48;
v21 = 48;
v19 = 1;
}
if ( (_DWORD)a3 != 48 && (v9 == 48 || v13 == 48 || v9 == 51 || v13 == 51) )
{
LODWORD(a3) = 48;
v22 = 48;
v19 = 1;
}
if ( v16 != 48 && (v10 == 48 || v12 == 48 || v10 == 52 || v12 == 52) )
{
v16 = 48;
v19 = 1;
}
if ( v18 != 48 && (v10 == 48 || v13 == 48 || v10 == 53 || v13 == 53) )
{
v18 = 48;
v19 = 1;
}
if ( (_DWORD)a4 != 48 || (_DWORD)a3 != 48 || v16 != 48 || v18 != 48 )
goto LABEL_107;
if ( v9 != 48 && v12 == 48 && v13 == 48 )
{
v9 = 49;
v19 = 1;
}
if ( v10 == 48 )
{
if ( v12 == 48 )
goto LABEL_103;
}
else if ( v12 == 48 )
{
if ( v13 == 48 )
{
LOBYTE(v10) = 49;
goto LABEL_108;
}
goto LABEL_104;
}
if ( v9 == 48 && v10 == 48 )
{
LOBYTE(v12) = 49;
v19 = 1;
}
LABEL_103:
if ( v13 != 48 )
{
LABEL_104:
if ( v9 == 48 && v10 == 48 )
{
LOBYTE(v13) = 49;
goto LABEL_108;
}
}
LABEL_107:
if ( !v19 )
{
*(_OWORD *)Src = 0;
Src[2] = nullptr;
Src[3] = (void *)15;
*(_BYTE *)Src = 0;
goto LABEL_109;
}
LABEL_108:
*(_OWORD *)Src = 0;
Src[2] = nullptr;
Src[3] = (void *)15;
*(_BYTE *)Src = 0;
sub_14003DBD0(Src, v8);
sub_14003DBD0(Src, v9);
sub_14003DBD0(Src, v10);
sub_14003DBD0(Src, v12);
sub_14003DBD0(Src, v13);
sub_14003DBD0(Src, v21);
sub_14003DBD0(Src, v22);
sub_14003DBD0(Src, v16);
sub_14003DBD0(Src, v18);
LABEL_109:
sub_14003D310((__int64)v4);
return Src;
}