//
// sub_820040 from 0x820040 to 0x820072 (50 bytes)
//
// 6 xrefs:
// > sub_828FD8 @ 0x829384
// > sub_82A4FC @ 0x82a7e8
// > sub_83CCC8 @ 0x83d338
// > sub_83DA38 @ 0x83dcce
// > sub_845000 @ 0x8450ec
// > sub_84542C @ 0x845734
//
// 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:01:50 +0000
//
const char *__fastcall sub_820040(int a1, char *buf, socklen_t len)
{
int v4; // r4
int v5; // r5
char *v6; // r2
int v7; // r0
const void *v8; // r1
int v9; // r5
v4 = *(_DWORD *)(a1 + 4);
if ( v4 == 2 )
{
v9 = *(_DWORD *)(a1 + 24);
v6 = buf;
v7 = 2;
v8 = (const void *)(v9 + 4);
return j_inet_ntop(v7, v8, v6, len);
}
if ( v4 == 10 )
{
v5 = *(_DWORD *)(a1 + 24);
v6 = buf;
v7 = 10;
v8 = (const void *)(v5 + 8);
return j_inet_ntop(v7, v8, v6, len);
}
return nullptr;
}