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

Disassembly:
mov r11, rsp
sub rsp, 0xd8
mov rax, qword [0x005ca070]
mov qword [rsp + 0xc0], rax
mov qword [r11 + 0x10], rbx
mov rbx, qword [rcx + 0x3d0]
mov dword [rsp + 0x30], 0x80
mov r8d, dword [rbx + 0x15c]
mov rdx, qword [rbx + 0x168]
mov qword [r11 + 0x18], rbp
lea rax, [rsp + 0x30]
mov qword [r11 - 8], rdi
mov rdi, qword [rcx]
mov qword [rsp + 0x28], rax
mov rbp, rcx
mov rcx, qword [rbx + 0x18]
lea rax, [rsp + 0x40]
add r8d, 4
xor r9d, r9d
mov qword [rsp + 0x20], rax
call qword [sym.imp.WS2_32.dll_recvfrom]
cmp dword [rbx + 0x150], 0
mov dword [rbx + 0x154], eax
jne 0x540abe
movsxd r8, dword [rsp + 0x30]
lea rcx, [rbx + 0xd0]
lea rdx, [rsp + 0x40]
call fcn.004435a0
mov r11d, dword [rsp + 0x30]
mov dword [rbx + 0x150], r11d
mov r8d, dword [rbx + 0x154]
mov qword [rsp + 0xf8], rsi
cmp r8d, 4
jge 0x540b20
lea rdx, str.Received_too_short_packet
mov rcx, rdi
call fcn.005374d0
mov dword [rbx + 0xc], 7
xor eax, eax
mov rdi, qword [rsp + 0xd0]
mov rsi, qword [rsp + 0xf8]
mov rbp, qword [rsp + 0xf0]
mov rbx, qword [rsp + 0xe8]
mov rcx, qword [rsp + 0xc0]
call fcn.0055e990
add rsp, 0xd8
ret
mov rcx, qword [rbx + 0x168]
movzx eax, byte [rcx]
shl ax, 8
movzx edx, ax
movzx eax, byte [rcx + 1]
or edx, eax
mov dword [rbx + 0xc], edx
sub edx, 3
je 0x540bc9
dec edx
je 0x540c3e
dec edx
je 0x540b92
dec edx
je 0x540b6e
lea r8, str.Internal_error:_Unexpected_packet
lea rdx, [0x005626ec]
mov rcx, rdi
call fcn.005374d0
jmp 0x540c3e
mov rdx, qword [rbx + 0x168]
add r8d, 0xfffffffe
mov rcx, rbx
add rdx, 2
call fcn.0053f530
test eax, eax
je 0x540c3e
jmp 0x540aeb
mov rdx, qword [rbx + 0x168]
mov r8, qword [rbx + 0x168]
movzx eax, byte [rdx + 2]
add r8, 4
shl ax, 8
movzx ecx, ax
movzx eax, byte [rdx + 3]
lea rdx, [0x00567710]
or ecx, eax
mov dword [rbx + 8], ecx
mov rcx, rdi
call fcn.005373d0
jmp 0x540c3e
cmp r8d, 4
jle 0x540c3e
mov rcx, qword [rbx + 0x168]
movzx eax, byte [rcx + 2]
shl ax, 8
movzx edx, ax
movzx eax, byte [rcx + 3]
or edx, eax
movzx eax, word [rbx + 0x48]
inc eax
cmp eax, edx
jne 0x540c3e
lea eax, [r8 - 4]
lea r8, [rcx + 4]
mov edx, 1
movsxd r9, eax
mov rcx, rbp
call fcn.005377c0
test eax, eax
mov esi, eax
je 0x540c23
mov edx, 5
mov rcx, rbx
call fcn.005409a0
mov eax, esi
jmp 0x540aeb
mov eax, dword [rbx + 0x154]
mov rcx, rdi
sub eax, 4
cdqe
add qword [rdi + 0x48], rax
mov rdx, qword [rdi + 0x48]
call fcn.005531c0
mov rcx, rbp
call fcn.00553220
test eax, eax
je 0x540ae9
mov rax, qword [rbx + 0x10]
mov r8d, dword [rbx]
test r8d, r8d
mov rcx, qword [rax]
je 0x540d98
dec r8d
je 0x540d26
dec r8d
je 0x540cae
dec r8d
je 0x540c91
lea r8, str.Internal_state_machine_error
lea rdx, [0x005626ec]
call fcn.005374d0
mov eax, 0x2a
jmp 0x540aeb
lea r8, str.TFTP_finished
lea rdx, [0x00567710]
call fcn.005373d0
mov eax, 0x2a
jmp 0x540aeb
mov dword [rbx], 3
mov rax, qword [rbx + 0x170]
xor r9d, r9d
mov byte [rax], 0
mov rax, qword [rbx + 0x170]
lea r8d, [r9 + 4]
mov byte [rax + 1], 5
movzx edx, word [rbx + 0x48]
mov rax, qword [rbx + 0x170]
movzx ecx, dx
shr cx, 8
mov byte [rax + 2], cl
mov rax, qword [rbx + 0x170]
lea rcx, [rbx + 0xd0]
mov byte [rax + 3], dl
mov eax, dword [rbx + 0x150]
mov rdx, qword [rbx + 0x170]
mov dword [rsp + 0x28], eax
mov qword [rsp + 0x20], rcx
mov rcx, qword [rbx + 0x18]
call qword [sym.imp.WS2_32.dll_sendto]
mov dword [rbx], 3
mov eax, 0x2a
jmp 0x540aeb
mov rax, qword [rbx + 0x170]
xor r9d, r9d
mov byte [rax], 0
mov rax, qword [rbx + 0x170]
lea r8d, [r9 + 4]
mov byte [rax + 1], 5
movzx edx, word [rbx + 0x48]
mov rax, qword [rbx + 0x170]
movzx ecx, dx
shr cx, 8
mov byte [rax + 2], cl
mov rax, qword [rbx + 0x170]
lea rcx, [rbx + 0xd0]
mov byte [rax + 3], dl
mov eax, dword [rbx + 0x150]
mov rdx, qword [rbx + 0x170]
mov dword [rsp + 0x28], eax
mov qword [rsp + 0x20], rcx
mov rcx, qword [rbx + 0x18]
call qword [sym.imp.WS2_32.dll_sendto]
mov dword [rbx], 3
mov eax, 0x2a
jmp 0x540aeb
mov dword [rbx], 3
mov eax, 0x2a
jmp 0x540aeb