//
// sub_A61D3C from 0xa61d3c to 0xa62090 (852 bytes)
//
// 3 xrefs:
// > sub_A62BDC @ 0xa62db8
// > sub_A62BDC @ 0xa62de4
// > sub_A62BDC @ 0xa62e98
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:08:34 +0000
//
int __fastcall sub_A61D3C(int a1, int a2, int a3, int a4)
{
int v4; // r4
const char *v8; // r2
int v9; // r4
int v11; // r3
int v12; // r3
int v13; // r3
char v14; // r2
char v15; // r3
int v16; // r3
char v17; // r2
char v18; // r3
int v19; // r5
int i; // r4
bool v21; // zf
int v22; // r2
const char *v23; // r3
unsigned __int8 v24; // [sp+8h] [bp-10h] BYREF
unsigned __int8 v25; // [sp+9h] [bp-Fh]
unsigned __int8 v26; // [sp+Ah] [bp-Eh]
unsigned __int8 v27; // [sp+Bh] [bp-Dh]
char v28; // [sp+Ch] [bp-Ch]
char v29; // [sp+Dh] [bp-Bh]
char v30; // [sp+Eh] [bp-Ah]
char v31; // [sp+Fh] [bp-9h]
char v32; // [sp+10h] [bp-8h]
char v33; // [sp+11h] [bp-7h]
char v34; // [sp+12h] [bp-6h]
char v35; // [sp+13h] [bp-5h]
char v36; // [sp+14h] [bp-4h]
char v37; // [sp+15h] [bp-3h]
char v38; // [sp+16h] [bp-2h]
char v39; // [sp+17h] [bp-1h]
v4 = *(_DWORD *)a4;
if ( *(int *)a4 < 0 )
return 0;
if ( a2 != 1 )
{
if ( a2 != 2 )
{
if ( v4 )
{
v8 = &byte_BF4ECA;
v9 = 0;
while ( 1 )
{
BIO_printf(a1, "%s%02x", v8, *(unsigned __int8 *)(*(_DWORD *)(a4 + 8) + v9++));
if ( *(_DWORD *)a4 <= v9 )
break;
if ( v9 <= 0 )
v8 = &byte_BF4ECA;
else
v8 = ":";
}
}
BIO_printf(a1, "[%d]", *(_DWORD *)(a4 + 12) & 7);
return 1;
}
if ( v4 <= 16 )
{
if ( v4 )
{
memcpy(&v24, *(const void **)(a4 + 8), *(_DWORD *)a4);
v11 = *(_DWORD *)(a4 + 12) & 7;
if ( v11 )
{
v16 = 255 >> (8 - v11);
v17 = *(&v24 + v4 - 1);
if ( a3 )
v18 = v16 | v17;
else
v18 = v17 & ~(_BYTE)v16;
*(&v24 + v4 - 1) = v18;
}
}
memset(&v24 + v4, a3, 16 - v4);
if ( v39 || v38 )
{
v19 = 16;
}
else if ( v37 || v36 )
{
v19 = 14;
}
else if ( v35 || v34 )
{
v19 = 12;
}
else if ( v33 || v32 )
{
v19 = 10;
}
else if ( v31 || v30 )
{
v19 = 8;
}
else if ( v29 || v28 )
{
v19 = 6;
}
else if ( v27 || v26 )
{
v19 = 4;
}
else
{
if ( !v25 && !v24 )
{
BIO_puts(a1, (int)":");
BIO_puts(a1, (int)":");
return 1;
}
v19 = 2;
}
for ( i = 0; i < v19; i += 2 )
{
v21 = i == 14;
v22 = *(&v24 + i + 1) | (*(&v24 + i) << 8);
if ( v21 )
v23 = &byte_BF4ECA;
else
v23 = ":";
BIO_printf(a1, "%x%s", v22, v23);
}
if ( v19 != 16 )
BIO_puts(a1, (int)":");
return 1;
}
return 0;
}
if ( v4 > 4 )
return 0;
if ( v4 )
{
memcpy(&v24, *(const void **)(a4 + 8), *(_DWORD *)a4);
v12 = *(_DWORD *)(a4 + 12) & 7;
if ( v12 )
{
v13 = 255 >> (8 - v12);
v14 = *(&v24 + v4 - 1);
if ( a3 )
v15 = v13 | v14;
else
v15 = v14 & ~(_BYTE)v13;
*(&v24 + v4 - 1) = v15;
}
}
memset(&v24 + v4, a3, 4 - v4);
BIO_printf(a1, "%d.%d.%d.%d", v24, v25, v26, v27);
return 1;
}