Function at 0x140040a70
Capabilities:
Connect socket
Set socket configuration

Disassembly:
push rdi
sub rsp, 0x50
mov rax, qword [0x14006a110]
xor rax, rsp
mov qword [rsp + 0x48], rax
mov r9d, dword [rcx + 0x30]
mov rdi, rcx
cmp r9d, 4
je 0x140040e09
cmp r9d, 3
je 0x140040e09
mov qword [rsp + 0x68], rbx
mov qword [rsp + 0x70], rsi
cmp r9d, 2
jne 0x140040af3
mov rax, qword [rcx + 0x28]
mov rcx, qword [rcx + 0x10]
xor r9d, r9d
lea r8d, [r9 + 4]
lea rdx, [rsp + 0x34]
mov qword [rsp + 0x20], rax
call fcn.14002d360
test eax, eax
je 0x140040c50
js 0x140040c5e
mov r8, qword [rdi + 0x10]
lea rdx, str._3d:_ERROR:_read_data_from_a_completed_request
xor ecx, ecx
call fcn.140025be0
jmp 0x140040b9f
cmp r9d, 1
je 0x140040b10
mov r8, qword [rcx + 0x10]
lea rdx, str._3d:_ERROR:_read_msg_called_with_invalid_transfer_state___d_
xor ecx, ecx
call fcn.140025be0
jmp 0x140040b9f
mov eax, dword [rcx + 0x34]
cmp eax, 0x1c
jae 0x140040c18
lea rdx, [rax + rcx + 0x38]
mov r8d, 0x1c
xor r9d, r9d
sub r8d, eax
mov rax, qword [rcx + 0x28]
mov rcx, qword [rcx + 0x10]
mov qword [rsp + 0x20], rax
call fcn.14002d360
test eax, eax
je 0x140040c50
js 0x140040c5e
add dword [rdi + 0x34], eax
mov eax, dword [rdi + 0x34]
cmp eax, 0x1c
jbe 0x140040b6c
mov r8, qword [rdi + 0x10]
lea rdx, str._3d:_ERROR:_read_msg___read_too_many_header_bytes
xor ecx, ecx
call fcn.140025be0
jmp 0x140040b9f
jne 0x140040c18
lea rcx, [rdi + 0x38]
call fcn.14000a050
mov r9d, dword [rdi + 0x38]
cmp r9d, 1
je 0x140040bc3
mov r8, qword [rdi + 0x10]
mov dword [rsp + 0x20], 1
lea rdx, str._3d:_ERROR:_client_version_0x_08X_daemon_version_0x_08X
xor ecx, ecx
call fcn.140025be0
mov dword [rdi + 0x30], 3
mov rbx, qword [rsp + 0x68]
mov rsi, qword [rsp + 0x70]
mov rcx, qword [rsp + 0x48]
xor rcx, rsp
call fcn.1400437e0
add rsp, 0x50
pop rdi
ret
mov ebx, dword [rdi + 0x3c]
cmp ebx, 0x11170
jbe 0x140040be2
mov r8, qword [rdi + 0x10]
mov dword [rsp + 0x20], ebx
mov r9d, ebx
lea rdx, str._3d:_ERROR:_read_msg:_hdr.datalen__u__0x_X____70000
jmp 0x140040b98
lea esi, [rbx + 5]
mov ecx, esi
call fcn.140044568
mov rcx, rax
mov qword [rdi + 0x58], rax
test rax, rax
jne 0x140040c06
lea rcx, str.ERROR:_malloc
call fcn.14003ab10
jmp 0x140040b9f
mov qword [rdi + 0x60], rax
add rax, rbx
mov edx, esi
mov qword [rdi + 0x68], rax
call fcn.140025ce0
cmp dword [rdi + 0x34], 0x1c
jne 0x140040ba6
mov eax, dword [rdi + 0x54]
mov r8d, dword [rdi + 0x3c]
cmp eax, r8d
jae 0x140040cd0
mov rcx, qword [rdi + 0x10]
mov edx, eax
sub r8d, eax
mov rax, qword [rdi + 0x28]
add rdx, qword [rdi + 0x58]
xor r9d, r9d
mov qword [rsp + 0x20], rax
call fcn.14002d360
test eax, eax
jne 0x140040c5c
mov dword [rdi + 0x30], 4
jmp 0x140040ba6
jns 0x140040cae
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
je 0x140040ba6
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2714
je 0x140040ba6
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov ecx, eax
call fcn.140009dd0
mov rbx, rax
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov r8, qword [rdi + 0x10]
mov qword [rsp + 0x20], rbx
lea rdx, str._3d:_ERROR:_read_msg_errno__d___s_
mov r9d, eax
jmp 0x140040b98
add dword [rdi + 0x54], eax
mov eax, dword [rdi + 0x54]
cmp eax, dword [rdi + 0x3c]
jbe 0x140040cd0
mov r8, qword [rdi + 0x10]
lea rdx, str._3d:_ERROR:_read_msg___read_too_many_data_bytes
xor ecx, ecx
call fcn.140025be0
jmp 0x140040b9f
cmp dword [rdi + 0x34], 0x1c
jne 0x140040ba6
mov eax, dword [rdi + 0x3c]
cmp dword [rdi + 0x54], eax
jne 0x140040ba6
cmp qword [rdi + 0x88], 0
mov ebx, 2
je 0x140040e01
cmp dword [rdi + 0x44], 0x3f
je 0x140040e01
mov rcx, qword [rdi + 0x60]
mov dword [rsp + 0x34], 1
movzx eax, byte [rcx]
mov byte [rsp + 0x30], al
movzx eax, byte [rcx + 1]
mov word [rsp + 0x38], bx
mov byte [rsp + 0x31], al
lea rax, [rcx + 2]
lea rcx, str.127.0.0.1
mov qword [rdi + 0x60], rax
movzx eax, word [rsp + 0x30]
mov word [rsp + 0x3a], ax
call qword [sym.imp.WS2_32.dll_inet_addr]
lea edx, [rbx - 1]
xor r8d, r8d
mov ecx, ebx
mov dword [rsp + 0x3c], eax
call qword [sym.imp.WS2_32.dll_socket]
mov qword [rdi + 0x18], rax
cmp rax, 0xffffffffffffffff
jne 0x140040d6f
lea rcx, str.ERROR:_socket
call fcn.14003ab10
jmp 0x140040b9f
lea rdx, [rsp + 0x38]
mov r8d, reloc.WS2_32.dll_recv
mov rcx, rax
call qword [sym.imp.WS2_32.dll_connect]
test eax, eax
js 0x140040b9f
cmp dword [0x14006badc], 0
je 0x140040dbb
mov eax, dword [rdi + 0x48]
mov r9, qword [rdi + 0x18]
mov r8, qword [rdi + 0x10]
mov dword [rsp + 0x28], eax
mov eax, dword [rdi + 0x4c]
lea rdx, str._3d:_Error_socket__d_created__08X__08X
mov ecx, 1
mov dword [rsp + 0x20], eax
call fcn.140025be0
mov rcx, qword [rdi + 0x18]
lea r8, [rsp + 0x34]
mov edx, 0x8004667e
call qword [sym.imp.WS2_32.dll_ioctlsocket]
test eax, eax
je 0x140040e01
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov ecx, eax
call fcn.140009dd0
mov rbx, rax
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov r8, qword [rdi + 0x10]
mov qword [rsp + 0x20], rbx
lea rdx, str._3d:_ERROR:_could_not_set_control_socket_to_non_blocking_mode_errno__d___s_
mov r9d, eax
jmp 0x140040b98
mov dword [rdi + 0x30], ebx
jmp 0x140040ba6
mov r8, qword [rcx + 0x10]
lea rdx, str._3d:_ERROR:_read_msg_called_with_transfer_state_terminated_or_error
xor ecx, ecx
call fcn.140025be0
mov dword [rdi + 0x30], 3
mov rcx, qword [rsp + 0x48]
xor rcx, rsp
call fcn.1400437e0
add rsp, 0x50
pop rdi
ret