//
// sub_1006F2AD0 from 0x1006f2ad0 to 0x1006f2e68 (920 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009bdd00
//
// 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 11:12:41 +0000
//
__int64 __fastcall sub_1006F2AD0(__int64 a1, int a2, int a3, _DWORD *a4)
{
__int64 v6; // x21
__int64 result; // x0
int v8; // w8
int v9; // w0
int v10; // w8
__int64 v11; // x8
__int64 v12; // x2
__int64 v13; // x4
__int64 v14; // x8
int v15; // w0
__int64 v16; // x2
__int64 v17; // x4
void *v18; // x0
v6 = *(_QWORD *)(a1 + 40);
if ( a2 <= 4096 )
{
result = 1;
switch ( a2 )
{
case 1:
if ( !a4 )
goto LABEL_51;
v8 = *(_DWORD *)(v6 + 24);
if ( v8 == 5 )
{
v9 = sub_100711408(a4);
if ( (unsigned int)sub_1006F03A0(v9) != -1 )
goto LABEL_51;
goto LABEL_24;
}
if ( v8 != 3 )
goto LABEL_51;
break;
case 2:
v12 = 148;
v13 = 629;
goto LABEL_63;
case 3:
case 4:
case 5:
case 7:
case 9:
case 10:
case 11:
return result;
case 13:
goto LABEL_17;
default:
return 4294967294LL;
}
LABEL_49:
v16 = 141;
v17 = 476;
LABEL_50:
sub_100706FB0(4, 140, v16, "rsa_pmeth.c", v17);
return 0;
}
switch ( a2 )
{
case 4097:
if ( (unsigned int)(a3 - 1) > 5 )
goto LABEL_62;
v14 = *(_QWORD *)(v6 + 32);
if ( v14 )
{
switch ( a3 )
{
case 3:
goto LABEL_49;
case 4:
goto LABEL_54;
case 5:
v15 = sub_100711408(*(_QWORD *)(v6 + 32));
if ( (unsigned int)sub_1006F03A0(v15) != -1 )
goto LABEL_61;
LABEL_24:
v16 = 142;
v17 = 482;
break;
case 6:
goto LABEL_58;
default:
goto LABEL_61;
}
goto LABEL_50;
}
if ( a3 == 4 )
{
LABEL_54:
if ( (*(_BYTE *)(a1 + 33) & 3) != 0 )
{
if ( !v14 )
goto LABEL_60;
goto LABEL_61;
}
LABEL_62:
v12 = 144;
v13 = 517;
goto LABEL_63;
}
if ( a3 != 6 )
goto LABEL_61;
LABEL_58:
if ( (*(_BYTE *)(a1 + 32) & 0x18) == 0 )
goto LABEL_62;
if ( !v14 )
LABEL_60:
*(_QWORD *)(v6 + 32) = sub_10070F06C(a1);
LABEL_61:
*(_DWORD *)(v6 + 24) = a3;
return 1;
case 4098:
case 4103:
if ( *(_DWORD *)(v6 + 24) != 6 )
{
v12 = 146;
v13 = 527;
goto LABEL_63;
}
if ( a2 == 4103 )
{
v10 = *(_DWORD *)(v6 + 48);
LABEL_30:
*a4 = v10;
return 1;
}
else
{
if ( a3 < -2 )
return 4294967294LL;
*(_DWORD *)(v6 + 48) = a3;
return 1;
}
case 4099:
if ( a3 <= 255 )
{
v12 = 145;
v13 = 541;
goto LABEL_63;
}
*(_DWORD *)v6 = a3;
return 1;
case 4100:
if ( !a4 )
return 4294967294LL;
sub_1006D0E38(*(_BYTE **)(v6 + 8));
*(_QWORD *)(v6 + 8) = a4;
return 1;
case 4101:
case 4104:
if ( (*(_DWORD *)(v6 + 24) | 2) != 6 )
{
v12 = 156;
v13 = 580;
goto LABEL_63;
}
if ( a2 != 4104 )
{
*(_QWORD *)(v6 + 40) = a4;
return 1;
}
v11 = *(_QWORD *)(v6 + 40);
if ( v11 )
goto LABEL_18;
goto LABEL_17;
case 4102:
v10 = *(_DWORD *)(v6 + 24);
goto LABEL_30;
case 4105:
case 4107:
if ( *(_DWORD *)(v6 + 24) != 4 )
{
v12 = 141;
v13 = 557;
goto LABEL_63;
}
if ( a2 == 4107 )
{
LABEL_17:
v11 = *(_QWORD *)(v6 + 32);
LABEL_18:
*(_QWORD *)a4 = v11;
return 1;
}
else
{
LABEL_51:
*(_QWORD *)(v6 + 32) = a4;
return 1;
}
case 4106:
if ( *(_DWORD *)(v6 + 24) != 4 )
{
v12 = 141;
v13 = 594;
goto LABEL_63;
}
v18 = *(void **)(v6 + 64);
if ( v18 )
sub_1006AEDAC(v18);
if ( a3 >= 1 && a4 )
{
*(_QWORD *)(v6 + 64) = a4;
*(_QWORD *)(v6 + 72) = a3;
return 1;
}
else
{
*(_QWORD *)(v6 + 64) = 0;
*(_QWORD *)(v6 + 72) = 0;
return 1;
}
case 4108:
if ( *(_DWORD *)(v6 + 24) == 4 )
{
*(_QWORD *)a4 = *(_QWORD *)(v6 + 64);
return *(unsigned int *)(v6 + 72);
}
else
{
v12 = 141;
v13 = 610;
LABEL_63:
sub_100706FB0(4, 143, v12, "rsa_pmeth.c", v13);
return 4294967294LL;
}
default:
return 4294967294LL;
}
}