//
// GJSmartTemplate::rotateKey from 0x53af58 to 0x53b0c0 (360 bytes)
//
// 1 xrefs:
// > GJSmartTemplate::scanForPrefab @ 0x53c4da
//
// 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::rotateKey(_DWORD *a1, _DWORD *a2, int a3)
{
SmartBlockType v6; // r9
SmartBlockType v7; // r10
SmartBlockType v8; // r7
SmartBlockType v9; // r6
SmartBlockType v10; // r8
unsigned __int8 *v11; // r0
SmartBlockType v12; // r3
SmartBlockType v13; // r2
SmartBlockType v14; // r5
SmartBlockType v15; // r1
SmartBlockType v16; // r1
SmartBlockType v17; // r1
SmartBlockType v18; // r1
unsigned __int8 v19; // r10
unsigned __int8 v20; // r9
unsigned __int8 v21; // r8
unsigned __int8 v22; // r7
unsigned __int8 v23; // r5
unsigned __int8 v24; // r0
SmartBlockType v26; // [sp+18h] [bp-14h]
SmartBlockType v27; // [sp+18h] [bp-14h]
SmartBlockType v28; // [sp+1Ch] [bp-10h]
unsigned __int8 v29; // [sp+1Ch] [bp-10h]
SmartBlockType v30; // [sp+20h] [bp-Ch]
unsigned __int8 v31; // [sp+20h] [bp-Ch]
SmartBlockType v32; // [sp+24h] [bp-8h]
if ( a3 )
{
v30 = *(unsigned __int8 *)sub_7757BC(a2, 0);
v6 = *(unsigned __int8 *)sub_7757BC(a2, 1);
v7 = *(unsigned __int8 *)sub_7757BC(a2, 2);
v28 = *(unsigned __int8 *)sub_7757BC(a2, 3);
v26 = *(unsigned __int8 *)sub_7757BC(a2, 4);
v8 = *(unsigned __int8 *)sub_7757BC(a2, 5);
v9 = *(unsigned __int8 *)sub_7757BC(a2, 6);
v10 = *(unsigned __int8 *)sub_7757BC(a2, 7);
v11 = (unsigned __int8 *)sub_7757BC(a2, 8);
v12 = v26;
v13 = v28;
v14 = *v11;
if ( a3 != 90 )
{
if ( a3 == 180 )
{
v18 = v10;
v10 = *v11;
v14 = v9;
v9 = v8;
v8 = v18;
v13 = v7;
v7 = v26;
v12 = v6;
v6 = v28;
}
else if ( a3 == 270 )
{
v15 = v8;
v8 = *v11;
v14 = v15;
v16 = v10;
v10 = v9;
v9 = v16;
v17 = v7;
v7 = v6;
v6 = v17;
v13 = v26;
v12 = v28;
}
else
{
v9 = 0;
v10 = 0;
v14 = 0;
v8 = 0;
v6 = 0;
v7 = 0;
v12 = 0;
v13 = 0;
}
}
v32 = v12;
v27 = v13;
v31 = GJSmartTemplate::rotateBlockType(v30, a3);
v29 = GJSmartTemplate::rotateBlockType(v27, a3);
LOBYTE(v27) = GJSmartTemplate::rotateBlockType(v32, a3);
v19 = GJSmartTemplate::rotateBlockType(v7, a3);
v20 = GJSmartTemplate::rotateBlockType(v6, a3);
v21 = GJSmartTemplate::rotateBlockType(v10, a3);
v22 = GJSmartTemplate::rotateBlockType(v8, a3);
v23 = GJSmartTemplate::rotateBlockType(v14, a3);
v24 = GJSmartTemplate::rotateBlockType(v9, a3);
GJSmartTemplate::keyFromNeighbors((int)a1, v31, v29, v27, v19, v20, v21, v22, v23, v24);
}
else
{
*a1 = *a2;
*a2 = &unk_ACDDA8;
}
return a1;
}