//
// lws_parse_uri from 0x857030 to 0x85711a (234 bytes)
//
// 1 xrefs:
// > sub_859ADC @ 0x859be4
//
// 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:02:37 +0000
//
int __fastcall lws_parse_uri(const char *a1, const char **a2, const char **a3, int *a4, _DWORD *a5)
{
const char *v5; // r6
int v7; // r4
const char *v8; // r5
const char *v9; // r4
int v10; // r2
bool v11; // zf
int v12; // t1
bool v13; // zf
int v14; // r3
int v16; // r3
bool v17; // zf
int v18; // r3
int v19; // t1
bool v20; // zf
v5 = a1;
*a2 = a1;
v7 = *(unsigned __int8 *)a1;
v8 = a1;
if ( *a1 )
{
do
{
if ( v7 == 58 )
{
v7 = *((unsigned __int8 *)v8 + 1);
if ( v7 != 47 )
goto LABEL_4;
if ( v8[2] == 47 )
{
*v8 = 0;
v5 = v8 + 3;
goto LABEL_10;
}
++v8;
}
v7 = *((unsigned __int8 *)v8 + 1);
LABEL_4:
++v8;
}
while ( v7 );
}
*a2 = v8;
LABEL_10:
*a3 = v5;
v9 = *a2;
if ( !strcmp(*a2, "http") || !strcmp(v9, "ws") )
{
*a4 = 80;
}
else if ( !strcmp(v9, "https") || !strcmp(v9, "wss") )
{
*a4 = 443;
}
v10 = *(unsigned __int8 *)v5;
v11 = v10 == 58;
if ( v10 != 58 )
v11 = v10 == 0;
if ( v11 )
{
LABEL_26:
if ( v10 == 58 )
{
*v5 = 0;
*a4 = atoi(v5 + 1);
v16 = *(unsigned __int8 *)++v5;
v17 = v16 == 47;
if ( v16 != 47 )
v17 = v16 == 0;
if ( !v17 )
{
do
{
v19 = *(unsigned __int8 *)++v5;
v18 = v19;
v20 = v19 == 47;
if ( v19 != 47 )
v20 = v18 == 0;
}
while ( !v20 );
}
}
}
else
{
while ( v10 != 47 )
{
v12 = *(unsigned __int8 *)++v5;
v10 = v12;
v13 = v12 == 58;
if ( v12 != 58 )
v13 = v10 == 0;
if ( v13 )
goto LABEL_26;
}
}
*a5 = &word_BF54E4;
if ( *v5 )
{
v14 = *((unsigned __int8 *)v5 + 1);
*v5 = 0;
if ( v14 )
*a5 = v5 + 1;
}
return 0;
}