//
// sub_E061F8 from 0xe061f8 to 0xe06638 (1088 bytes)
//
// 4 xrefs:
// > sub_E06638 @ 0xe067e8
// > sub_E06638 @ 0xe06804
// > sub_E06638 @ 0xe06940
// > sub_E0699C @ 0xe06c40
//
// 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:09:34 +0000
//
__int64 __fastcall sub_E061F8(__int64 a1, int a2, const char *a3, unsigned __int64 a4)
{
__int64 v8; // x22
const char *v9; // x2
__int64 result; // x0
unsigned int v11; // w22
unsigned __int8 *v12; // x0
int v13; // w24
unsigned int v14; // w22
__int64 v15; // x2
v8 = 0;
if ( !a2 )
goto LABEL_6;
if ( a2 == 60 )
v9 = "RCVD";
else
v9 = "SENT";
sub_DF16E0(a1, "%s IAC SB ", v9);
if ( a4 <= 2 )
{
a4 -= 2LL;
v8 = 0;
goto LABEL_6;
}
v12 = (unsigned __int8 *)&a3[a4];
a4 -= 2LL;
v13 = *(v12 - 1);
v8 = (unsigned __int8)a3[a4];
if ( v13 != 240 || (_DWORD)v8 != 255 )
{
sub_DF16E0(a1, "(terminated by ");
if ( (unsigned int)v8 <= 0x27 )
{
sub_DF16E0(a1, "%s ", off_13FBF70[(unsigned int)v8]);
}
else if ( (unsigned int)(v8 - 236) > 0x13 )
{
sub_DF16E0(a1, "%u ", v8);
}
else
{
sub_DF16E0(a1, "%s ", off_13FC0B0[(unsigned int)(v8 - 236)]);
}
if ( v13 <= 39 )
{
sub_DF16E0(a1, "%s", off_13FBF70[v13]);
}
else if ( (unsigned int)(v13 - 236) > 0x13 )
{
sub_DF16E0(a1, "%d", v13);
}
else
{
sub_DF16E0(a1, "%s", off_13FC0B0[v13 - 236]);
}
sub_DF16E0(a1, ", not IAC SE!) ");
LABEL_6:
if ( a4 )
goto LABEL_7;
return sub_DF16E0(a1, "(Empty suboption?)");
}
v8 = 255;
if ( !a4 )
return sub_DF16E0(a1, "(Empty suboption?)");
LABEL_7:
if ( *(unsigned __int8 *)a3 <= 0x27u )
{
switch ( *a3 )
{
case 0x18:
case 0x1F:
case 0x23:
case 0x27:
sub_DF16E0(a1, "%s", off_13FBF70[*(unsigned __int8 *)a3]);
result = *(unsigned __int8 *)a3;
if ( (_DWORD)result != 31 )
goto LABEL_31;
goto LABEL_11;
default:
sub_DF16E0(a1, "%s (unsupported)", off_13FBF70[*(unsigned __int8 *)a3]);
goto LABEL_10;
}
}
sub_DF16E0(a1, "%d (unknown)", (unsigned __int8)a3[v8]);
LABEL_10:
result = *(unsigned __int8 *)a3;
if ( (_DWORD)result == 31 )
{
LABEL_11:
if ( a4 > 4 )
result = sub_DF16E0(
a1,
"Width: %hu ; Height: %hu",
*((unsigned __int8 *)a3 + 2) | (*((unsigned __int8 *)a3 + 1) << 8),
*((unsigned __int8 *)a3 + 4) | (*((unsigned __int8 *)a3 + 3) << 8));
LABEL_13:
if ( !a2 )
return result;
return sub_DF16E0(a1, &byte_11AAA48);
}
LABEL_31:
switch ( a3[1] )
{
case 0:
sub_DF16E0(a1, " IS");
result = *(unsigned __int8 *)a3;
break;
case 1:
sub_DF16E0(a1, " SEND");
result = *(unsigned __int8 *)a3;
break;
case 2:
sub_DF16E0(a1, " INFO/REPLY");
result = *(unsigned __int8 *)a3;
break;
case 3:
sub_DF16E0(a1, " NAME");
result = *(unsigned __int8 *)a3;
break;
default:
break;
}
switch ( (_DWORD)result )
{
case 0x23:
goto LABEL_52;
case 0x27:
result = *((unsigned __int8 *)a3 + 1);
if ( !a3[1] )
{
result = sub_DF16E0(a1, &byte_11E1A70);
if ( a4 > 3 )
{
v14 = 3;
result = 3;
do
{
v15 = (unsigned __int8)a3[result];
if ( a3[result] )
{
if ( (_DWORD)v15 == 1 )
sub_DF16E0(a1, " = ");
else
sub_DF16E0(a1, "%c", v15);
}
else
{
sub_DF16E0(a1, ", ");
}
result = ++v14;
}
while ( a4 > v14 );
}
}
goto LABEL_13;
case 0x18:
LABEL_52:
a3[a4] = 0;
result = sub_DF16E0(a1, " \"%s\"", a3 + 2);
goto LABEL_13;
}
if ( a4 <= 2 )
goto LABEL_13;
v11 = 2;
result = 2;
do
{
++v11;
sub_DF16E0(a1, " %.2x", (unsigned __int8)a3[result]);
result = v11;
}
while ( a4 > v11 );
if ( a2 )
return sub_DF16E0(a1, &byte_11AAA48);
return result;
}