Function at 0x516430
Capabilities:
Read file on windows

Disassembly:
push rbp
push r15
push r14
push r13
push r12
push rdi
push rsi
push rbx
sub rsp, 0x78
lea rbp, [rsp + 0x80]
cmp qword [rcx + 8], 0xffffffffffffffff
mov rsi, rcx
mov r12, rdx
mov rbx, r8
movsxd r15, r9d
je 0x5166f4
mov eax, dword [0x008de1c0]
test eax, eax
je 0x516688
test byte [rsi + 0x30], 4
jne 0x516518
xor r9d, r9d
mov qword [rbp - 0x30], r12
mov rcx, qword [rsi + 8]
mov rdx, r12
lea r8, [rbp - 0x30]
call qword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x5164e8
shl r15, 4
lea r13, [rbx + r15]
cmp rbx, r13
jae 0x5166ed
lea r15, [rbp - 0x34]
xor edi, edi
mov r14, qword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x5164c3
add rbx, 0x10
add edi, dword [rbp - 0x34]
cmp r13, rbx
jbe 0x5166c0
mov rcx, qword [rsi + 8]
mov dword [rbp - 0x34], 0
mov r9, r15
mov qword [rsp + 0x20], 0
mov r8d, dword [rbx + 8]
mov rdx, qword [rbx]
call r14
test eax, eax
jne 0x5164b3
call fcn.004d6fb0
mov rbx, rax
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov rdi, qword [rbp + 0x60]
mov dword [rdi], eax
mov rax, 0xffffffffffffffff
mov qword [rdi + 8], rbx
lea rsp, [rbp - 8]
pop rbx
pop rsi
pop rdi
pop r12
pop r13
pop r14
pop r15
pop rbp
ret
mov edx, r15d
mov rcx, rbx
call fcn.005405f0
mov r9d, dword [0x008de1c0]
mov r14d, eax
lea eax, [rax + r9 - 1]
mov dword [rbp - 0x44], r9d
cdq
idiv r9d
lea r8d, [rax + 1]
mov edi, eax
movsxd r8, r8d
shl r8, 3
lea rax, [r8 + 0x1e]
and rax, 0xfffffffffffffff0
call fcn.0067cdd0
xor edx, edx
sub rsp, rax
shl r15, 4
lea r13, [rsp + 0x30]
add r15, rbx
mov rcx, r13
call sub.msvcrt.dll_memset
cmp rbx, r15
mov rcx, r13
jae 0x5165ab
movsxd r11, dword [rbp - 0x44]
mov r9, r11
nop dword [rax]
mov rax, qword [rbx + 8]
test eax, eax
mov r8d, eax
jle 0x5165a2
mov rax, qword [rbx]
xor edx, edx
add edx, r9d
mov qword [rcx], rax
add rcx, 8
add rax, r11
cmp edx, r8d
jl 0x516590
add rbx, 0x10
cmp r15, rbx
ja 0x516580
mov rax, r12
mov qword [rcx], 0
xor r9d, r9d
xor r8d, r8d
sar rax, 0x20
xor ecx, ecx
mov dword [rbp - 0x20], r12d
mov edx, 1
mov qword [rbp - 0x30], 0
lea rbx, [rbp - 0x30]
mov qword [rbp - 0x28], 0
mov qword [rbp - 0x18], 0
mov dword [rbp - 0x1c], eax
call qword [sym.imp.KERNEL32.dll_CreateEventW]
test rax, rax
mov qword [rbp - 0x18], rax
je 0x5164e8
mov rcx, qword [rsi + 8]
xor r9d, r9d
mov qword [rsp + 0x20], rbx
mov rdx, r13
imul edi, dword [0x008de1c0]
mov r15d, r14d
mov r8d, edi
call qword [sym.imp.KERNEL32.dll_ReadFileScatter]
test eax, eax
jne 0x516676
mov rdi, qword [sym.imp.KERNEL32.dll_GetLastError]
call rdi
cmp eax, 0x3e5
mov r13d, eax
jne 0x5166c7
mov edx, 0xffffffff
mov rcx, qword [rbp - 0x18]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0xffffffff
je 0x516713
mov rcx, qword [rsi + 8]
lea r8, [rbp - 0x34]
xor r9d, r9d
mov rdx, rbx
call qword [sym.imp.KERNEL32.dll_GetOverlappedResult]
test eax, eax
je 0x516698
mov eax, dword [rbp - 0x34]
cmp r14d, eax
cmovbe eax, r14d
mov r15d, eax
mov rcx, qword [rbp - 0x18]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, r15d
jmp 0x516507
call fcn.005f3c10
mov dword [0x008de1c0], eax
jmp 0x51646d
call rdi
cmp eax, 0x26
mov ebx, eax
je 0x516669
call fcn.004d6fb0
mov rdi, qword [rbp + 0x60]
mov rcx, qword [rbp - 0x18]
mov dword [rdi], ebx
mov qword [rdi + 8], rax
call qword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x5166e1
mov eax, edi
jmp 0x516507
call fcn.004d6fb0
mov rsi, qword [rbp + 0x60]
mov rcx, qword [rbp - 0x18]
mov dword [rsi], r13d
mov qword [rsi + 8], rax
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rax, 0xffffffffffffffff
jmp 0x516507
xor eax, eax
jmp 0x516507
call fcn.004d6fb0
mov rsi, qword [rbp + 0x60]
mov qword [rsi + 8], rax
mov rax, 0xffffffffffffffff
mov dword [rsi], 6
jmp 0x516507
call fcn.004d6fb0
mov rbx, rax
call rdi
mov rsi, qword [rbp + 0x60]
mov rcx, qword [rbp - 0x18]
mov dword [rsi], eax
mov qword [rsi + 8], rbx
call qword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x5166e1