Function at 0x140003020
Capabilities:
Receive data
Receive data on socket
Send data
Send data on socket

Disassembly:
push rbx
sub rsp, 0x20
mov rbx, rcx
xor ecx, ecx
mov eax, dword [rbx + 0x20]
cmp eax, 0x10
jae 0x140002f05
movsxd rcx, dword [rbx]
mov r8d, reloc.WS2_32.dll_recv
mov edx, eax
sub r8d, eax
add rdx, qword [rbx + 0x18]
xor r9d, r9d
call qword [sym.imp.WS2_32.dll_recv]
mov ecx, eax
test eax, eax
jg 0x140002eef
test eax, eax
jns 0x140002ece
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov ecx, dword [rax]
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
mov r8d, dword [rbx]
lea rdx, str.Receive_from_client_fd__d_failed:__s
mov r9, rax
mov ecx, 1
call fcn.140005ad0
mov rcx, rbx
add rsp, 0x20
pop rbx
jmp fcn.1400013f0
mov r8d, dword [rbx]
lea rdx, str.Client__d_connection_closed
mov ecx, 4
call fcn.140005ad0
mov rcx, rbx
add rsp, 0x20
pop rbx
jmp fcn.1400013f0
mov eax, dword [rbx + 0x20]
add eax, ecx
mov dword [rbx + 0x20], eax
cmp eax, 0x10
jb 0x140003018
mov ecx, 1
mov qword [rsp + 0x30], rdi
mov rdi, qword [rbx + 0x18]
mov r8d, dword [rdi]
cmp r8d, dword [rbx + 0x24]
jbe 0x140002f40
mov r9d, r8d
lea rdx, str.Client__d_message_is_too_long___d_bytes_
mov r8d, dword [rbx]
mov ecx, 4
call fcn.140005ad0
mov rcx, rbx
mov rdi, qword [rsp + 0x30]
add rsp, 0x20
pop rbx
jmp fcn.1400013f0
cmp r8d, 0x10
jae 0x140002f6f
mov r9d, r8d
lea rdx, str.Client__d_message_is_too_short___d_bytes_
mov r8d, dword [rbx]
mov ecx, 1
call fcn.140005ad0
mov rcx, rbx
mov rdi, qword [rsp + 0x30]
add rsp, 0x20
pop rbx
jmp fcn.1400013f0
cmp eax, r8d
jae 0x140003001
test ecx, ecx
jne 0x140003013
movsxd rcx, dword [rbx]
sub r8d, eax
mov edx, eax
xor r9d, r9d
add rdx, rdi
call qword [sym.imp.WS2_32.dll_recv]
test eax, eax
jns 0x140002fcf
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov ecx, dword [rax]
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
mov r8d, dword [rbx]
lea rdx, str.Receive_from_client_fd__d_failed:__s
mov r9, rax
mov ecx, 1
call fcn.140005ad0
mov rcx, rbx
mov rdi, qword [rsp + 0x30]
add rsp, 0x20
pop rbx
jmp fcn.1400013f0
jne 0x140002ff7
mov r8d, dword [rbx]
lea rdx, str.Client__d_connection_closed
mov ecx, 4
call fcn.140005ad0
mov rcx, rbx
mov rdi, qword [rsp + 0x30]
add rsp, 0x20
pop rbx
jmp fcn.1400013f0
add dword [rbx + 0x20], eax
mov eax, dword [rbx + 0x20]
cmp eax, dword [rdi]
jb 0x140003013
mov rdx, rdi
mov rcx, rbx
call fcn.140001ef0
mov dword [rbx + 0x20], 0
mov rdi, qword [rsp + 0x30]
add rsp, 0x20
pop rbx
ret
mov qword [rsp + 8], rbx
mov qword [rsp + 0x10], rsi
push rdi
sub rsp, 0x30
mov edi, ecx
movzx esi, dx
lea rcx, [0x140012908]
call qword [sym.imp.pthreadVC3.dll_pthread_mutex_lock]
mov r9d, dword [0x140012838]
xor r8d, r8d
test r9d, r9d
jle 0x14000306f
mov rax, qword [0x140012830]
mov rbx, qword [rax]
test rbx, rbx
je 0x140003063
cmp dword [rbx], edi
je 0x1400030a0
inc r8d
add rax, 8
cmp r8d, r9d
jl 0x140003057
lea rcx, [0x140012908]
call qword [sym.imp.pthreadVC3.dll_pthread_mutex_unlock]
mov r8d, edi
lea rdx, str.client_process:_fd__d_not_found_in_client_list
mov ecx, 4
call fcn.140005ad0
mov rbx, qword [rsp + 0x40]
mov rsi, qword [rsp + 0x48]
add rsp, 0x30
pop rdi
ret
lea rcx, [0x140012908]
call qword [sym.imp.pthreadVC3.dll_pthread_mutex_unlock]
cmp dword [rbx + 0x34], 4
jne 0x1400030e2
lea rdx, str.client_process_in_CONNECTED_state
mov ecx, 6
call fcn.140005ad0
mov ecx, dword [rbx + 0x30]
movzx r8d, si
mov rdx, rbx
mov rbx, qword [rsp + 0x40]
mov rsi, qword [rsp + 0x48]
add rsp, 0x30
pop rdi
jmp 0x140004610
mov eax, 0x300
test ax, si
je 0x140003103
mov rcx, rbx
mov rbx, qword [rsp + 0x40]
mov rsi, qword [rsp + 0x48]
add rsp, 0x30
pop rdi
jmp 0x140002e60
test sil, 0x10
je 0x140003090
mov r8d, dword [rbx + 0x10]
movsxd rax, dword [rbx]
test r8d, r8d
jne 0x14000313e
mov r8d, eax
lea rdx, str.Client__d_OUT_process_but_nothing_to_send_
mov ecx, 2
call fcn.140005ad0
and word [rbx + 0x28], 0xffef
mov rbx, qword [rsp + 0x40]
mov rsi, qword [rsp + 0x48]
add rsp, 0x30
pop rdi
ret
mov rdx, qword [rbx + 8]
mov rcx, rax
xor r9d, r9d
call qword [sym.imp.WS2_32.dll_send]
movsxd rdi, eax
test eax, eax
jg 0x140003196
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov ecx, dword [rax]
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
mov r8d, dword [rbx]
lea rdx, str.Sending_to_client_fd__d_failed:__d__s
mov r9d, edi
mov qword [rsp + 0x20], rax
mov ecx, 1
call fcn.140005ad0
mov rcx, rbx
mov rbx, qword [rsp + 0x40]
mov rsi, qword [rsp + 0x48]
add rsp, 0x30
pop rdi
jmp fcn.1400013f0
mov eax, dword [rbx + 0x10]
cmp edi, eax
jne 0x1400031f8
and word [rbx + 0x28], 0xffef
cmp dword [rbx + 0x34], 3
mov dword [rbx + 0x10], 0
jne 0x140003090
mov r8d, dword [rbx]
lea rdx, str.Client__d_switching_to_CONNECTED_state
mov ecx, 5
call fcn.140005ad0
movzx eax, word [rbx + 0x2a]
mov rcx, qword [rbx + 8]
mov word [rbx + 0x28], ax
mov dword [rbx + 0x34], 4
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov qword [rbx + 8], 0
mov rbx, qword [rsp + 0x40]
mov rsi, qword [rsp + 0x48]
add rsp, 0x30
pop rdi
ret
mov rcx, qword [rbx + 8]
sub eax, edi
mov r8d, eax
mov dword [rbx + 0x10], r8d
lea rdx, [rcx + rdi]
mov rbx, qword [rsp + 0x40]
mov rsi, qword [rsp + 0x48]
add rsp, 0x30
pop rdi
jmp sub.VCRUNTIME140.dll_memmove
mov qword [rsp + 8], rbx
mov qword [rsp + 0x10], rbp
mov qword [rsp + 0x18], rsi
push rdi
sub rsp, 0x30
mov esi, ecx
movsx ebp, r8w
lea rcx, [0x1400128f0]
mov rbx, rdx
call qword [sym.imp.pthreadVC3.dll_pthread_mutex_lock]
mov r11d, dword [0x140012850]
xor r10d, r10d
xor edi, edi
test r11d, r11d
jle 0x1400046a7
mov r9, qword [0x140012848]
mov rax, qword [r9]
test rax, rax
je 0x14000465f
cmp dword [rax + 8], esi
je 0x14000467a
inc r10d
add r9, 8
cmp r10d, r11d
jl 0x140004652
lea rcx, [0x1400128f0]
call qword [sym.imp.pthreadVC3.dll_pthread_mutex_unlock]
jmp 0x1400046b9
movsxd rcx, dword [rax + 0x20]
test ecx, ecx
jle 0x1400046a7
mov r8, qword [rax + 0x18]
mov rdx, rcx
xor eax, eax
nop dword [rax + rax]
mov rcx, qword [r8 + rax*8]
test rcx, rcx
je 0x14000469f
cmp qword [rcx + 8], rbx
je 0x1400046d5
inc rax
cmp rax, rdx
jl 0x140004690
lea rcx, [0x1400128f0]
call qword [sym.imp.pthreadVC3.dll_pthread_mutex_unlock]
test rdi, rdi
jne 0x1400046da
mov r9, rbx
lea rdx, str.Could_not_find_connection_for_device__d_client__p
mov r8d, esi
mov ecx, 2
call fcn.140005ad0
jmp 0x14000481a
mov rdi, rcx
jmp 0x1400046a7
mov r8d, ebp
lea rdx, str.device_client_process___d_
mov ecx, 6
call fcn.140005ad0
test bpl, 0x10
je 0x14000475a
mov r8d, dword [rdi + 0x50]
test r8d, r8d
je 0x14000475a
mov rdx, qword [rdi + 0x48]
mov rcx, qword [rdi + 8]
call fcn.140001070
test eax, eax
jg 0x14000472f
mov r8d, eax
lea rdx, str.error_writing_to_client___d_
mov ecx, 5
call fcn.140005ad0
mov rcx, rdi
call fcn.140004040
jmp 0x14000481a
add dword [rdi + 0x1c], eax
mov ecx, dword [rdi + 0x50]
cmp eax, ecx
jne 0x140004742
mov dword [rdi + 0x50], 0
jmp 0x14000475a
sub ecx, eax
movsxd rdx, eax
mov r8d, ecx
mov rcx, qword [rdi + 0x48]
add rdx, rcx
mov dword [rdi + 0x50], r8d
call sub.VCRUNTIME140.dll_memmove
mov eax, 0x300
test ax, bp
je 0x140004812
mov esi, dword [rdi + 0x3c]
test esi, esi
je 0x140004812
mov rbx, qword [rdi + 8]
lea rdx, str.client_read_fd__d_buf__p_len__d
mov rbp, qword [rdi + 0x58]
mov ecx, 6
mov r9, rbp
mov dword [rsp + 0x20], esi
mov r8d, dword [rbx]
call fcn.140005ad0
cmp dword [rbx + 0x34], 4
movsxd rax, dword [rbx]
je 0x1400047c7
mov r8d, eax
lea rdx, str.Attempted_to_read_from_client__d_not_in_CONNECTED_state
mov ecx, 1
call fcn.140005ad0
mov ebx, 0xffffffff
lea rdx, str.error_reading_from_client___d_
mov r8d, ebx
jmp 0x140004718
mov rcx, rax
xor r9d, r9d
mov r8d, esi
mov rdx, rbp
call qword [sym.imp.WS2_32.dll_recv]
mov ebx, eax
test eax, eax
jg 0x1400047f6
test eax, eax
jns 0x140004722
mov r8d, eax
lea rdx, str.error_reading_from_client___d_
jmp 0x140004718
mov r8, qword [rdi + 0x58]
mov r9d, ebx
mov dl, reloc.WS2_32.dll_recv
mov rcx, rdi
call fcn.140003f00
test eax, eax
js 0x140004722
add dword [rdi + 0x18], ebx
mov rcx, rdi
call fcn.140004510
mov rbx, qword [rsp + 0x40]
mov rbp, qword [rsp + 0x48]
mov rsi, qword [rsp + 0x50]
add rsp, 0x30
pop rdi
ret