//
// a2i_ipadd from 0x1082acc to 0x1082c8c (448 bytes)
//
// 8 xrefs:
// > X509_VERIFY_PARAM_set1_ip_asc @ 0x106d1b4
// > sub_107521C @ 0x10753fc
// > sub_107521C @ 0x107555c
// > X509_check_ip_asc @ 0x1082cb0
// > a2i_IPADDRESS @ 0x1082d14
// > a2i_IPADDRESS_NC @ 0x1082dd4
// > a2i_IPADDRESS_NC @ 0x1082de8
// > ??> @ 0x7efd0
//
// 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:17:11 +0000
//
__int64 __fastcall a2i_ipadd(char *a1, char *a2)
{
int v4; // w19
int v5; // w22
__int64 result; // x0
__int64 v7; // x1
char v8; // w2
char v9; // w3
char v10; // w4
unsigned int v11; // [xsp+44h] [xbp+44h] BYREF
unsigned int v12; // [xsp+48h] [xbp+48h] BYREF
unsigned int v13; // [xsp+4Ch] [xbp+4Ch] BYREF
_QWORD v14[2]; // [xsp+50h] [xbp+50h] BYREF
int v15; // [xsp+60h] [xbp+60h]
int v16; // [xsp+64h] [xbp+64h]
int v17; // [xsp+68h] [xbp+68h]
if ( !strchr(a2, 58) )
{
result = sscanf(a2, "%d.%d.%d.%d", &v11, &v12, &v13, v14);
if ( (_DWORD)result == 4 && v11 <= 0xFF )
{
v8 = v12;
if ( v12 <= 0xFF )
{
v9 = v13;
if ( v13 <= 0xFF )
{
v10 = v14[0];
if ( LODWORD(v14[0]) <= 0xFF )
{
*a1 = v11;
a1[1] = v8;
a1[2] = v9;
a1[3] = v10;
return result;
}
}
}
}
return 0;
}
v15 = 0;
v16 = -1;
v17 = 0;
if ( !(unsigned int)CONF_parse_list(
a2,
58,
0,
(__int64 (__fastcall *)(const char *, _QWORD, __int64))sub_1080DA4,
(__int64)v14) )
return 0;
v4 = v16;
if ( v16 == -1 )
{
if ( v15 == 16 )
goto LABEL_20;
return 0;
}
v5 = v15;
if ( v15 == 16 || v17 > 3 )
return 0;
if ( v17 == 3 )
{
if ( v15 <= 0 )
goto LABEL_10;
return 0;
}
if ( v17 != 2 )
{
if ( v16 && v16 != v15 )
goto LABEL_10;
return 0;
}
if ( v16 && v16 != v15 )
return 0;
LABEL_10:
if ( v16 < 0 )
{
LABEL_20:
v7 = v14[1];
*(_QWORD *)a1 = v14[0];
*((_QWORD *)a1 + 1) = v7;
return 16;
}
memcpy(a1, v14, v16);
memset(&a1[v4], 0, 16 - v5);
if ( v4 != v5 )
memcpy(&a1[v4 + 16LL - v5], (char *)v14 + v4, v5 - v4);
return 16;
}