//
// GJSmartTemplate::flipKey from 0xb0e880 to 0xb0eb50 (720 bytes)
//
// 5 xrefs:
// > GJSmartTemplate::scanForPrefab @ 0xb12d04
// > GJSmartTemplate::scanForPrefab @ 0xb12dd4
// > GJSmartTemplate::scanForPrefab @ 0xb12eb8
// > GJSmartTemplate::scanForPrefab @ 0xb12ed0
// > ??> @ 0xb4c10
//
// 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::flipKey@(
unsigned __int8 *a1@,
unsigned __int8 a2@,
unsigned __int8 a3@,
__int64 *a4@)
{
int v4; // w20
int v5; // w19
__int64 v7; // x3
int v9; // w1
int v10; // w1
int v11; // w2
int v12; // w3
int v13; // w28
int v14; // w26
int v15; // w27
int v16; // w24
int v17; // w25
int v18; // w23
unsigned __int8 *v19; // x0
int v20; // w22
int v21; // w5
int v22; // w4
int v23; // w1
int v24; // w0
char v25; // w28
char v26; // w0
unsigned __int64 v27; // x1
char v28; // [xsp+78h] [xbp+68h]
char v29; // [xsp+80h] [xbp+70h]
char v30; // [xsp+88h] [xbp+78h]
char v31; // [xsp+90h] [xbp+80h]
char v32; // [xsp+98h] [xbp+88h]
char v33; // [xsp+A0h] [xbp+90h]
int v34; // [xsp+A8h] [xbp+98h]
v4 = a3;
v5 = a2;
if ( a2 < (a3 ^ 1u) )
{
v7 = *((_QWORD *)a1 + 1);
*a4 = *(_QWORD *)a1;
a4[1] = v7;
a4[2] = *((_QWORD *)a1 + 2);
*(_QWORD *)a1 = 0;
*((_QWORD *)a1 + 1) = 0;
*((_QWORD *)a1 + 2) = 0;
return a4;
}
v9 = *a1;
if ( (v9 & 1) != 0 )
{
v27 = *((_QWORD *)a1 + 1);
if ( v27 )
{
v19 = *((unsigned __int8 **)a1 + 2);
v11 = *v19;
if ( v27 > 1 )
{
v12 = v19[1];
if ( v27 != 2 )
{
v13 = v19[2];
if ( v27 != 3 )
{
v14 = v19[3];
if ( v27 != 4 )
{
v15 = v19[4];
if ( v27 != 5 )
{
v16 = v19[5];
if ( v27 != 6 )
{
v17 = v19[6];
if ( v27 != 7 )
{
v18 = v19[7];
if ( v27 != 8 )
goto LABEL_15;
}
}
}
}
}
}
}
}
LABEL_28:
sub_B0BD50();
}
v10 = v9 >> 1;
if ( !v10 )
goto LABEL_28;
v11 = a1[1];
if ( v10 == 1 )
goto LABEL_28;
v12 = a1[2];
if ( v10 == 2 )
goto LABEL_28;
v13 = a1[3];
if ( v10 == 3 )
goto LABEL_28;
v14 = a1[4];
if ( v10 == 4 )
goto LABEL_28;
v15 = a1[5];
if ( v10 == 5 )
goto LABEL_28;
v16 = a1[6];
if ( v10 == 6 )
goto LABEL_28;
v17 = a1[7];
if ( v10 == 7 )
goto LABEL_28;
v18 = a1[8];
if ( v10 == 8 )
goto LABEL_28;
v19 = a1 + 1;
LABEL_15:
v20 = v19[8];
if ( !v5 )
{
if ( v4 )
{
v21 = v16;
v22 = v17;
v23 = v15;
v24 = v12;
v16 = v20;
v17 = v18;
v15 = v14;
v12 = v13;
v20 = v21;
v18 = v22;
v14 = v23;
v13 = v24;
}
else
{
v18 = 0;
v20 = 0;
v16 = 0;
v17 = 0;
v14 = 0;
v15 = 0;
v13 = 0;
v12 = 0;
}
}
v34 = v12;
v28 = GJSmartTemplate::flipBlockType(v11, v5, v4);
v29 = GJSmartTemplate::flipBlockType(v34, v5, v4);
v25 = GJSmartTemplate::flipBlockType(v13, v5, v4);
v30 = GJSmartTemplate::flipBlockType(v15, v5, v4);
v31 = GJSmartTemplate::flipBlockType(v14, v5, v4);
v32 = GJSmartTemplate::flipBlockType(v17, v5, v4);
v33 = GJSmartTemplate::flipBlockType(v16, v5, v4);
LOBYTE(v34) = GJSmartTemplate::flipBlockType(v20, v5, v4);
v26 = GJSmartTemplate::flipBlockType(v18, v5, v4);
GJSmartTemplate::keyFromNeighbors(v28, v29, v25, v30, v31, v32, v33, v34, a4, v26);
return a4;
}