//
// sub_1006F158C from 0x1006f158c to 0x1006f1964 (984 bytes)
//
// 2 xrefs:
// > sub_1006F0648 @ 0x1006f0650
// > sub_1006F07A0 @ 0x1006f07a8
//
// 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_1006F158C(__int64 a1, _QWORD *a2, __int64 a3, int a4)
{
__int64 v8; // x0
int v9; // w0
int v10; // w8
unsigned __int64 v11; // x23
__int64 v12; // x0
int v13; // w0
int v14; // w8
unsigned __int64 v15; // x8
__int64 v16; // x0
int v17; // w0
int v18; // w8
unsigned __int64 v19; // x8
__int64 v20; // x0
int v21; // w0
int v22; // w8
unsigned __int64 v23; // x8
__int64 v24; // x0
int v25; // w0
int v26; // w8
unsigned __int64 v27; // x8
__int64 v28; // x0
int v29; // w0
int v30; // w8
unsigned __int64 v31; // x8
__int64 v32; // x0
int v33; // w0
int v34; // w8
unsigned __int64 v35; // x8
__int64 v36; // x0
int v37; // w0
int v38; // w8
unsigned __int64 v39; // x8
_BYTE *v40; // x23
__int64 v41; // x0
int v42; // w24
__int64 v43; // x19
const char *v44; // x24
const char *v45; // x1
v8 = a2[4];
if ( v8 )
{
v9 = sub_1006D0D88(v8);
v10 = v9 + 7;
if ( v9 + 7 < 0 )
v10 = v9 + 14;
v11 = v10 >> 3;
}
else
{
v11 = 0;
}
v12 = a2[5];
if ( v12 )
{
v13 = sub_1006D0D88(v12);
v14 = v13 + 7;
if ( v13 + 7 < 0 )
v14 = v13 + 14;
v15 = v14 >> 3;
if ( v11 < v15 )
v11 = v15;
}
if ( a4 )
{
v16 = a2[6];
if ( v16 )
{
v17 = sub_1006D0D88(v16);
v18 = v17 + 7;
if ( v17 + 7 < 0 )
v18 = v17 + 14;
v19 = v18 >> 3;
if ( v11 < v19 )
v11 = v19;
}
v20 = a2[7];
if ( v20 )
{
v21 = sub_1006D0D88(v20);
v22 = v21 + 7;
if ( v21 + 7 < 0 )
v22 = v21 + 14;
v23 = v22 >> 3;
if ( v11 < v23 )
v11 = v23;
}
v24 = a2[8];
if ( v24 )
{
v25 = sub_1006D0D88(v24);
v26 = v25 + 7;
if ( v25 + 7 < 0 )
v26 = v25 + 14;
v27 = v26 >> 3;
if ( v11 < v27 )
v11 = v27;
}
v28 = a2[9];
if ( v28 )
{
v29 = sub_1006D0D88(v28);
v30 = v29 + 7;
if ( v29 + 7 < 0 )
v30 = v29 + 14;
v31 = v30 >> 3;
if ( v11 < v31 )
v11 = v31;
}
v32 = a2[10];
if ( v32 )
{
v33 = sub_1006D0D88(v32);
v34 = v33 + 7;
if ( v33 + 7 < 0 )
v34 = v33 + 14;
v35 = v34 >> 3;
if ( v11 < v35 )
v11 = v35;
}
v36 = a2[11];
if ( v36 )
{
v37 = sub_1006D0D88(v36);
v38 = v37 + 7;
if ( v37 + 7 < 0 )
v38 = v37 + 14;
v39 = v38 >> 3;
if ( v11 < v39 )
LODWORD(v11) = v39;
}
}
v40 = sub_1006AE878((unsigned int)(v11 + 10), (__int64)"rsa_ameth.c", 204);
if ( v40 )
{
v41 = a2[4];
if ( v41 )
v42 = sub_1006D0D88(v41);
else
v42 = 0;
if ( (unsigned int)sub_100700B80(a1, a3, 128) )
{
if ( a4 && a2[6] )
{
if ( (int)sub_100702BA8(a1, "Private-Key: (%d bit)\n", v42) < 1 )
{
v43 = 0;
goto LABEL_75;
}
v44 = "publicExponent:";
v45 = "modulus:";
}
else
{
if ( (int)sub_100702BA8(a1, "Public-Key: (%d bit)\n", v42) < 1 )
{
v43 = 0;
goto LABEL_75;
}
v44 = "Exponent:";
v45 = "Modulus:";
}
if ( (unsigned int)sub_10071B4F0(a1, v45, a2[4], v40, a3) )
{
if ( (unsigned int)sub_10071B4F0(a1, v44, a2[5], v40, a3) )
{
if ( a4 )
{
if ( !(unsigned int)sub_10071B4F0(a1, "privateExponent:", a2[6], v40, a3) )
{
v43 = 0;
goto LABEL_75;
}
if ( !(unsigned int)sub_10071B4F0(a1, "prime1:", a2[7], v40, a3) )
{
v43 = 0;
goto LABEL_75;
}
if ( !(unsigned int)sub_10071B4F0(a1, "prime2:", a2[8], v40, a3) )
{
v43 = 0;
goto LABEL_75;
}
if ( !(unsigned int)sub_10071B4F0(a1, "exponent1:", a2[9], v40, a3) )
{
v43 = 0;
goto LABEL_75;
}
if ( !(unsigned int)sub_10071B4F0(a1, "exponent2:", a2[10], v40, a3) )
{
v43 = 0;
goto LABEL_75;
}
if ( !(unsigned int)sub_10071B4F0(a1, "coefficient:", a2[11], v40, a3) )
{
v43 = 0;
goto LABEL_75;
}
}
v43 = 1;
}
else
{
v43 = 0;
}
}
else
{
v43 = 0;
}
}
else
{
v43 = 0;
}
LABEL_75:
sub_1006AEDAC(v40);
return v43;
}
sub_100706FB0(4, 146, 65, "rsa_ameth.c", 206);
return 0;
}