//
// GJSmartTemplate::flipKey from 0x66ffce to 0x670134 (358 bytes)
//
// 4 xrefs:
// > GJSmartTemplate::scanForPrefab @ 0x671dfa
// > GJSmartTemplate::scanForPrefab @ 0x671e8a
// > GJSmartTemplate::scanForPrefab @ 0x671f22
// > GJSmartTemplate::scanForPrefab @ 0x671f2e
//
// 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::flipKey(int *a1, int a2, int a3, int a4)
{
int v7; // r0
int v8; // r1
int v9; // r2
int v10; // t0
int v11; // r10
int v12; // r11
int v13; // r8
int v14; // r9
int v15; // r7
unsigned __int8 *v16; // r0
int v17; // r3
int v18; // r12
int v19; // r4
int v20; // r1
int v21; // r1
int v22; // r1
char v23; // r11
char v24; // r10
char v25; // r9
char v26; // r8
char v27; // r4
char v28; // r0
int v31; // [sp+20h] [bp-14h]
char v32; // [sp+20h] [bp-14h]
int v33; // [sp+24h] [bp-10h]
int v34; // [sp+24h] [bp-10h]
int v35; // [sp+28h] [bp-Ch]
char v36; // [sp+28h] [bp-Ch]
int v37; // [sp+2Ch] [bp-8h]
if ( a3 || a4 )
{
v35 = *std::string::at((unsigned __int8 *)a2, 0);
v33 = *std::string::at((unsigned __int8 *)a2, 1u);
v31 = *std::string::at((unsigned __int8 *)a2, 2u);
v11 = *std::string::at((unsigned __int8 *)a2, 3u);
v12 = *std::string::at((unsigned __int8 *)a2, 4u);
v13 = *std::string::at((unsigned __int8 *)a2, 5u);
v14 = *std::string::at((unsigned __int8 *)a2, 6u);
v15 = *std::string::at((unsigned __int8 *)a2, 7u);
v16 = std::string::at((unsigned __int8 *)a2, 8u);
v17 = v31;
v18 = v33;
v19 = *v16;
if ( !a3 )
{
if ( a4 )
{
v20 = v13;
v13 = *v16;
v19 = v20;
v21 = v14;
v14 = v15;
v15 = v21;
v22 = v12;
v12 = v11;
v11 = v22;
v18 = v31;
v17 = v33;
}
else
{
v15 = 0;
v13 = 0;
v19 = 0;
v14 = 0;
v11 = 0;
v12 = 0;
v17 = 0;
v18 = 0;
}
}
v37 = v17;
v34 = v18;
v32 = GJSmartTemplate::flipBlockType(v35, a3, a4);
v36 = GJSmartTemplate::flipBlockType(v34, a3, a4);
LOBYTE(v34) = GJSmartTemplate::flipBlockType(v37, a3, a4);
v23 = GJSmartTemplate::flipBlockType(v12, a3, a4);
v24 = GJSmartTemplate::flipBlockType(v11, a3, a4);
v25 = GJSmartTemplate::flipBlockType(v14, a3, a4);
v26 = GJSmartTemplate::flipBlockType(v13, a3, a4);
v27 = GJSmartTemplate::flipBlockType(v19, a3, a4);
v28 = GJSmartTemplate::flipBlockType(v15, a3, a4);
GJSmartTemplate::keyFromNeighbors(a1, v32, v36, v34, v23, v24, v25, v26, v27, v28);
}
else
{
v7 = *(_DWORD *)a2;
v10 = a2 + 4;
v8 = *(_DWORD *)(a2 + 4);
v9 = *(_DWORD *)(v10 + 4);
*a1 = v7;
a1[1] = v8;
a1[2] = v9;
*(_DWORD *)a2 = a4;
*(_DWORD *)(a2 + 4) = a4;
*(_DWORD *)(a2 + 8) = a4;
}
return a1;
}