//
// GJSmartTemplate::rotateKey from 0xb0e5cc to 0xb0e880 (692 bytes)
//
// 2 xrefs:
// > GJSmartTemplate::scanForPrefab @ 0xb12c54
// > ??> @ 0xee9d8
//
// This function is hookable on this platform (idp: arm, 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 13:01:27 +0000
//
__int64 *__usercall GJSmartTemplate::rotateKey@(unsigned __int8 *a1@, int a2@, __int64 *a3@)
{
unsigned int v3; // w21
unsigned int v4; // w22
unsigned int v5; // w23
unsigned int v6; // w24
unsigned int v7; // w25
unsigned int v8; // w26
unsigned int v9; // w27
__int64 v12; // x3
int v14; // w1
int v15; // w1
unsigned int v16; // w2
unsigned int v17; // w4
unsigned int v18; // w3
unsigned int v19; // w6
unsigned int v20; // w5
unsigned int v21; // w8
unsigned int v22; // w7
bool v23; // zf
unsigned int v24; // w1
unsigned __int8 *v25; // x0
unsigned int v26; // w0
char v27; // w20
char v28; // w27
char v29; // w0
unsigned __int64 v30; // x1
unsigned int v31; // [xsp+7Ch] [xbp+6Ch]
char v32; // [xsp+80h] [xbp+70h]
char v33; // [xsp+88h] [xbp+78h]
char v34; // [xsp+90h] [xbp+80h]
char v35; // [xsp+98h] [xbp+88h]
char v36; // [xsp+A0h] [xbp+90h]
char v37; // [xsp+A8h] [xbp+98h]
if ( !a2 )
{
v12 = *((_QWORD *)a1 + 1);
*a3 = *(_QWORD *)a1;
a3[1] = v12;
a3[2] = *((_QWORD *)a1 + 2);
*(_QWORD *)a1 = 0;
*((_QWORD *)a1 + 1) = 0;
*((_QWORD *)a1 + 2) = 0;
return a3;
}
v14 = *a1;
if ( (v14 & 1) != 0 )
{
v30 = *((_QWORD *)a1 + 1);
if ( v30 )
{
v25 = *((unsigned __int8 **)a1 + 2);
v16 = *v25;
if ( v30 > 1 )
{
v17 = v25[1];
if ( v30 != 2 )
{
v18 = v25[2];
if ( v30 != 3 )
{
v19 = v25[3];
if ( v30 != 4 )
{
v20 = v25[4];
if ( v30 != 5 )
{
v21 = v25[5];
if ( v30 != 6 )
{
v22 = v25[6];
if ( v30 != 7 )
{
v23 = v30 == 8;
v24 = v25[7];
if ( !v23 )
goto LABEL_15;
}
}
}
}
}
}
}
}
LABEL_30:
sub_B0BD50();
}
v15 = v14 >> 1;
if ( !v15 )
goto LABEL_30;
v16 = a1[1];
if ( v15 == 1 )
goto LABEL_30;
v17 = a1[2];
if ( v15 == 2 )
goto LABEL_30;
v18 = a1[3];
if ( v15 == 3 )
goto LABEL_30;
v19 = a1[4];
if ( v15 == 4 )
goto LABEL_30;
v20 = a1[5];
if ( v15 == 5 )
goto LABEL_30;
v21 = a1[6];
if ( v15 == 6 )
goto LABEL_30;
v22 = a1[7];
if ( v15 == 7 )
goto LABEL_30;
v23 = v15 == 8;
v24 = a1[8];
if ( v23 )
goto LABEL_30;
v25 = a1 + 1;
LABEL_15:
v26 = v25[8];
switch ( a2 )
{
case 90:
v31 = v22;
v3 = v26;
v4 = v21;
v5 = v24;
v6 = v17;
v7 = v18;
v8 = v20;
v9 = v19;
break;
case 180:
v31 = v21;
v3 = v22;
v4 = v24;
v5 = v26;
v6 = v19;
v7 = v20;
v8 = v17;
v9 = v18;
break;
case 270:
v31 = v24;
v3 = v21;
v4 = v26;
v5 = v22;
v6 = v18;
v7 = v17;
v8 = v19;
v9 = v20;
break;
}
v27 = GJSmartTemplate::rotateBlockType(v16, a2);
v28 = GJSmartTemplate::rotateBlockType(v9, a2);
v32 = GJSmartTemplate::rotateBlockType(v8, a2);
v33 = GJSmartTemplate::rotateBlockType(v7, a2);
v34 = GJSmartTemplate::rotateBlockType(v6, a2);
v35 = GJSmartTemplate::rotateBlockType(v5, a2);
v36 = GJSmartTemplate::rotateBlockType(v4, a2);
v37 = GJSmartTemplate::rotateBlockType(v3, a2);
v29 = GJSmartTemplate::rotateBlockType(v31, a2);
GJSmartTemplate::keyFromNeighbors(v27, v28, v32, v33, v34, v35, v36, v37, a3, v29);
return a3;
}