//
// GJSmartTemplate::flipKey from 0x53b0c4 to 0x53b22a (358 bytes)
//
// 4 xrefs:
// > GJSmartTemplate::scanForPrefab @ 0x53c536
// > GJSmartTemplate::scanForPrefab @ 0x53c596
// > GJSmartTemplate::scanForPrefab @ 0x53c5fc
// > GJSmartTemplate::scanForPrefab @ 0x53c60c
//
// 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
//
_DWORD *__fastcall GJSmartTemplate::flipKey(_DWORD *a1, _DWORD *a2, _BOOL4 a3, _BOOL4 a4)
{
SmartBlockType v7; // r10
SmartBlockType v8; // r11
SmartBlockType v9; // r8
SmartBlockType v10; // r9
SmartBlockType v11; // r7
unsigned __int8 *v12; // r0
SmartBlockType v13; // r3
SmartBlockType v14; // r12
SmartBlockType v15; // r6
SmartBlockType v16; // r1
SmartBlockType v17; // r1
SmartBlockType v18; // r1
unsigned __int8 v19; // r11
unsigned __int8 v20; // r10
unsigned __int8 v21; // r9
unsigned __int8 v22; // r8
unsigned __int8 v23; // r6
unsigned __int8 v24; // r0
SmartBlockType v27; // [sp+20h] [bp-14h]
unsigned __int8 v28; // [sp+20h] [bp-14h]
SmartBlockType v29; // [sp+24h] [bp-10h]
SmartBlockType v30; // [sp+24h] [bp-10h]
SmartBlockType v31; // [sp+28h] [bp-Ch]
unsigned __int8 v32; // [sp+28h] [bp-Ch]
SmartBlockType v33; // [sp+2Ch] [bp-8h]
if ( a3 || a4 )
{
v31 = *(unsigned __int8 *)sub_7757BC(a2, 0);
v29 = *(unsigned __int8 *)sub_7757BC(a2, 1);
v27 = *(unsigned __int8 *)sub_7757BC(a2, 2);
v7 = *(unsigned __int8 *)sub_7757BC(a2, 3);
v8 = *(unsigned __int8 *)sub_7757BC(a2, 4);
v9 = *(unsigned __int8 *)sub_7757BC(a2, 5);
v10 = *(unsigned __int8 *)sub_7757BC(a2, 6);
v11 = *(unsigned __int8 *)sub_7757BC(a2, 7);
v12 = (unsigned __int8 *)sub_7757BC(a2, 8);
v13 = v27;
v14 = v29;
v15 = *v12;
if ( !a3 )
{
if ( a4 )
{
v16 = v9;
v9 = *v12;
v15 = v16;
v17 = v10;
v10 = v11;
v11 = v17;
v18 = v8;
v8 = v7;
v7 = v18;
v14 = v27;
v13 = v29;
}
else
{
v11 = 0;
v9 = 0;
v15 = 0;
v10 = 0;
v7 = 0;
v8 = 0;
v13 = 0;
v14 = 0;
}
}
v33 = v13;
v30 = v14;
v28 = GJSmartTemplate::flipBlockType(v31, a3, a4);
v32 = GJSmartTemplate::flipBlockType(v30, a3, a4);
LOBYTE(v30) = GJSmartTemplate::flipBlockType(v33, a3, a4);
v19 = GJSmartTemplate::flipBlockType(v8, a3, a4);
v20 = GJSmartTemplate::flipBlockType(v7, a3, a4);
v21 = GJSmartTemplate::flipBlockType(v10, a3, a4);
v22 = GJSmartTemplate::flipBlockType(v9, a3, a4);
v23 = GJSmartTemplate::flipBlockType(v15, a3, a4);
v24 = GJSmartTemplate::flipBlockType(v11, a3, a4);
GJSmartTemplate::keyFromNeighbors((int)a1, v28, v32, v30, v19, v20, v21, v22, v23, v24);
}
else
{
*a1 = *a2;
*a2 = &unk_ACDDA8;
}
return a1;
}