//
// sub_1800B7820 from 0x1800b7820 to 0x1800b7957 (311 bytes)
//
// 9 xrefs:
// > sub_1800B4490 @ 0x1800b44fe
// > sub_1800B4490 @ 0x1800b4567
// > sub_1800B4680 @ 0x1800b48fc
// > sub_1800B4680 @ 0x1800b4990
// > sub_1800B4680 @ 0x1800b4e10
// > ??> @ 0x1801898d8
// > ??> @ 0x1801898f4
// > ??> @ 0x180189904
// > ??> @ 0x1801fd188
//
// This function is hookable on this platform (idp: pc, 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 10:53:59 +0000
//
__int64 __fastcall sub_1800B7820(SOCKET s, _BYTE *a2, int a3)
{
unsigned int v5; // esi
unsigned int v6; // r15d
int v7; // edi
char *p_buf; // rbx
__int64 result; // rax
__int64 v10; // rdx
__int64 v11; // r8
__int64 v12; // r9
__int64 v13; // rax
int v14; // [rsp+20h] [rbp-38h] BYREF
_DWORD v15[3]; // [rsp+24h] [rbp-34h] BYREF
char buf; // [rsp+68h] [rbp+10h] BYREF
unsigned int v17; // [rsp+78h] [rbp+20h]
v5 = 0;
if ( !a2 || !a3 )
return 31;
v6 = a3 - 1;
*a2 = 0;
if ( a3 == 1 )
{
LABEL_12:
a2[v5] = 0;
return 0;
}
else
{
while ( 1 )
{
buf = 0;
v7 = 1;
v14 = 0;
p_buf = &buf;
sub_1800C1770(&v14);
v17 = 0;
result = sub_18010A250(s, &buf, 1);
if ( (_DWORD)result == 45 )
break;
LABEL_7:
if ( (_DWORD)result )
return result;
if ( buf != 10 )
{
if ( buf != 13 )
{
v13 = v5++;
a2[v13] = buf;
}
if ( v5 < v6 )
continue;
}
goto LABEL_12;
}
while ( 1 )
{
p_buf += v17;
v7 -= v17;
FMOD_OS_Time_Sleep(1, v10, v11, v12);
sub_1800C1770(v15);
if ( v15[0] - v14 >= dword_1801AEA78 )
return 43;
v17 = 0;
result = sub_18010A250(s, p_buf, v7);
if ( (_DWORD)result != 45 )
goto LABEL_7;
}
}
}