Function at 0x1400160d0
Capabilities:
Get socket status
Receive data
Receive data on socket
Send data
Send data on socket

Disassembly:
push rdi
sub rsp, 0x490
mov rax, qword [0x1400a8040]
xor rax, rsp
mov qword [rsp + 0x460], rax
cmp dword [rcx + 0x58], 1
mov r8d, edx
mov rdi, rcx
jne 0x140016141
test edx, edx
jle 0x1400164ea
mov eax, 0x10624dd3
xor r9d, r9d
mul r8d
xor ecx, ecx
shr edx, 6
imul eax, edx, 0x3e8
mov dword [rsp + 0x30], edx
xor edx, edx
sub r8d, eax
imul eax, r8d, 0x3e8
xor r8d, r8d
mov dword [rsp + 0x34], eax
lea rax, [rsp + 0x30]
mov qword [rsp + 0x20], rax
call qword [sym.imp.WS2_32.dll_select]
jmp 0x1400164ea
mov qword [rsp + 0x4b0], rbx
mov qword [rsp + 0x4b8], rbp
mov qword [rsp + 0x488], rsi
mov qword [rsp + 0x480], r12
mov qword [rsp + 0x478], r14
mov qword [rsp + 0x470], r15
test r8d, r8d
je 0x140016201
mov ecx, r8d
mov dword [rsp + 0x250], 1
xor r9d, r9d
mov eax, 0x10624dd3
imul r8d
mov dword [rsp + 0x40], r9d
sar edx, 6
mov eax, edx
shr eax, 0x1f
add edx, eax
imul eax, edx, 0x3e8
mov dword [rsp + 0x30], edx
mov rdx, qword [rdi + 0x28]
sub ecx, eax
imul eax, ecx, 0x3e8
mov rcx, qword [rdi + 0x50]
mov qword [rsp + 0x258], rcx
mov dword [rsp + 0x34], eax
sub rdx, qword [rdi + 0x20]
je 0x1400161db
mov qword [rsp + 0x48], rcx
mov dword [rsp + 0x40], 1
test r8d, r8d
lea rax, [rsp + 0x30]
lea r8, [rsp + 0x40]
cmovle rax, r9
lea rdx, [rsp + 0x250]
inc ecx
mov qword [rsp + 0x20], rax
call qword [sym.imp.WS2_32.dll_select]
mov ebp, dword [rdi + 0x10]
sub ebp, dword [rdi + 8]
mov rsi, qword [rdi + 0x10]
mov rdx, qword [rdi + 8]
mov rcx, rsi
sub rcx, rdx
lea eax, [rbp + 0x5dc]
movsxd rbx, eax
cmp rbx, rcx
jae 0x140016229
lea rax, [rdx + rbx]
jmp 0x140016259
jbe 0x14001625d
mov rax, qword [rdi + 0x18]
sub rax, rdx
cmp rbx, rax
jbe 0x140016245
mov rdx, rbx
lea rcx, [rdi + 8]
call fcn.1400180b0
jmp 0x14001625d
sub rbx, rcx
xor edx, edx
mov r8, rbx
mov rcx, rsi
call fcn.140053c50
lea rax, [rsi + rbx]
mov qword [rdi + 0x10], rax
mov rcx, qword [rdi + 0x50]
xor r9d, r9d
movsxd rdx, ebp
mov r8d, 0x5dc
add rdx, qword [rdi + 8]
call qword [sym.imp.WS2_32.dll_recv]
lea r12, str.Connection_error__n
mov ebx, eax
lea r15, str.Connection_closed__n
test eax, eax
jns 0x1400162a5
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
je 0x140016313
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2734
je 0x140016313
mov rdx, qword [rdi + 8]
test ebx, ebx
jle 0x140016376
mov r15, qword [rdi + 0x10]
lea eax, [rbx + rbp]
mov rcx, r15
movsxd rbx, eax
sub rcx, rdx
cmp rbx, rcx
jae 0x1400162d3
lea rax, [rdx + rbx]
mov qword [rdi + 0x10], rax
jmp 0x140016201
jbe 0x140016201
mov rax, qword [rdi + 0x18]
sub rax, rdx
cmp rbx, rax
jbe 0x1400162f6
mov rdx, rbx
lea rcx, [rdi + 8]
call fcn.1400180b0
jmp 0x140016201
sub rbx, rcx
xor edx, edx
mov r8, rbx
mov rcx, r15
call fcn.140053c50
lea rax, [r15 + rbx]
mov qword [rdi + 0x10], rax
jmp 0x140016201
mov rsi, qword [rdi + 0x10]
mov rdx, qword [rdi + 8]
mov rcx, rsi
sub rcx, rdx
movsxd rbx, ebp
cmp rbx, rcx
jae 0x140016336
lea rax, [rdx + rbx]
mov qword [rdi + 0x10], rax
jmp 0x1400163ee
jbe 0x1400163ee
mov rax, qword [rdi + 0x18]
sub rax, rdx
cmp rbx, rax
jbe 0x140016359
mov rdx, rbx
lea rcx, [rdi + 8]
call fcn.1400180b0
jmp 0x1400163ee
sub rbx, rcx
xor edx, edx
mov r8, rbx
mov rcx, rsi
call fcn.140053c50
lea rax, [rsi + rbx]
mov qword [rdi + 0x10], rax
jmp 0x1400163ee
mov r14, qword [rdi + 0x10]
mov rcx, r14
movsxd rbp, ebp
sub rcx, rdx
cmp rbp, rcx
jae 0x14001638e
lea rax, [rdx + rbp]
jmp 0x1400163be
jbe 0x1400163c2
mov rax, qword [rdi + 0x18]
sub rax, rdx
cmp rbp, rax
jbe 0x1400163aa
mov rdx, rbp
lea rcx, [rdi + 8]
call fcn.1400180b0
jmp 0x1400163c2
sub rbp, rcx
xor edx, edx
mov r8, rbp
mov rcx, r14
call fcn.140053c50
lea rax, [r14 + rbp]
mov qword [rdi + 0x10], rax
mov rcx, qword [rdi + 0x50]
call qword [sym.imp.WS2_32.dll_closesocket]
mov ecx, 2
mov dword [rdi + 0x58], 1
call fcn.140057d9c
test ebx, ebx
mov rcx, r15
mov rdx, rax
cmovs rcx, r12
call fcn.14005cea8
mov rcx, qword [rdi + 0x28]
mov rdx, qword [rdi + 0x20]
mov r14, qword [rsp + 0x478]
mov rbp, qword [rsp + 0x4b8]
cmp rcx, rdx
je 0x1400164a9
nop
sub ecx, edx
xor r9d, r9d
mov r8d, ecx
mov rcx, qword [rdi + 0x50]
call qword [sym.imp.WS2_32.dll_send]
movsxd rbx, eax
test eax, eax
jns 0x140016443
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
je 0x1400164a9
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2734
je 0x1400164a9
test ebx, ebx
jle 0x14001647d
mov rsi, qword [rdi + 0x20]
lea rdx, [rsi + rbx]
cmp rsi, rdx
je 0x14001646e
mov rbx, qword [rdi + 0x28]
mov rcx, rsi
sub rbx, rdx
mov r8, rbx
call fcn.1400535a0
lea rax, [rbx + rsi]
mov qword [rdi + 0x28], rax
mov rcx, qword [rdi + 0x28]
mov rdx, qword [rdi + 0x20]
cmp rcx, rdx
jne 0x140016410
jmp 0x1400164a9
mov rcx, qword [rdi + 0x50]
call qword [sym.imp.WS2_32.dll_closesocket]
mov ecx, 2
mov dword [rdi + 0x58], 1
call fcn.140057d9c
test ebx, ebx
mov rdx, rax
cmovs r15, r12
mov rcx, r15
call fcn.14005cea8
mov rax, qword [rdi + 0x28]
mov r15, qword [rsp + 0x470]
mov r12, qword [rsp + 0x480]
mov rsi, qword [rsp + 0x488]
mov rbx, qword [rsp + 0x4b0]
cmp rax, qword [rdi + 0x20]
jne 0x1400164ea
cmp dword [rdi + 0x58], 0
jne 0x1400164ea
mov rcx, qword [rdi + 0x50]
call qword [sym.imp.WS2_32.dll_closesocket]
mov dword [rdi + 0x58], 1
mov rcx, qword [rsp + 0x460]
xor rcx, rsp
call fcn.140051200
add rsp, 0x490
pop rdi
ret