Function at 0x516e90
Capabilities:
Write 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 r13, rdx
mov r15, r8
movsxd rbx, r9d
je 0x5171b2
mov eax, dword [0x008de1c0]
test eax, eax
je 0x517125
test byte [rsi + 0x30], 4
jne 0x516f78
xor r9d, r9d
mov qword [rbp - 0x30], r13
mov rcx, qword [rsi + 8]
mov rdx, r13
lea r8, [rbp - 0x30]
call qword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x516f48
shl rbx, 4
lea rdi, [r15 + rbx]
cmp r15, rdi
jae 0x51716c
lea r13, [rbp - 0x34]
xor ebx, ebx
mov r12, qword [sym.imp.KERNEL32.dll_WriteFile]
jmp 0x516f23
add r15, 0x10
add ebx, dword [rbp - 0x34]
cmp rdi, r15
jbe 0x5170fa
mov rcx, qword [rsi + 8]
mov dword [rbp - 0x34], 0
mov r9, r13
mov qword [rsp + 0x20], 0
mov r8d, dword [r15 + 8]
mov rdx, qword [r15]
call r12
test eax, eax
jne 0x516f13
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, ebx
mov rcx, r15
call fcn.005405f0
mov r14d, dword [0x008de1c0]
mov edi, eax
lea eax, [rax + r14 - 1]
cdq
idiv r14d
lea r8d, [rax + 1]
mov dword [rbp - 0x44], eax
movsxd r8, r8d
shl r8, 3
lea rax, [r8 + 0x1e]
and rax, 0xfffffffffffffff0
call fcn.0067cdd0
xor edx, edx
sub rsp, rax
shl rbx, 4
lea r12, [rsp + 0x30]
mov rcx, r12
call sub.msvcrt.dll_memset
lea r11, [r15 + rbx]
mov rcx, r12
cmp r15, r11
jae 0x516fff
movsxd r10, r14d
mov rax, qword [r15 + 8]
test eax, eax
mov r8d, eax
jle 0x516ff6
mov rdx, qword [r15]
xor eax, eax
add eax, r14d
mov qword [rcx], rdx
add rcx, 8
add rdx, r10
cmp eax, r8d
jl 0x516fe4
add r15, 0x10
cmp r11, r15
ja 0x516fd4
mov rax, r13
mov qword [rcx], 0
xor r9d, r9d
xor r8d, r8d
sar rax, 0x20
xor ecx, ecx
mov dword [rbp - 0x20], r13d
mov edx, 1
mov qword [rbp - 0x30], 0
lea r15, [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 0x516f48
mov r8d, dword [0x008de1c0]
mov ebx, edi
lea eax, [r8 - 1]
test eax, edi
je 0x517101
movsxd rax, edi
mov rcx, qword [rsi + 8]
xor r9d, r9d
mov qword [rsp + 0x20], r15
imul r8d, dword [rbp - 0x44]
add r13, rax
mov rdx, r12
call qword [sym.imp.KERNEL32.dll_WriteFileGather]
test eax, eax
jne 0x5170dc
mov rbx, qword [sym.imp.KERNEL32.dll_GetLastError]
call rbx
cmp eax, 0x3e5
mov r12d, eax
jne 0x517146
mov edx, 0xffffffff
mov rcx, qword [rbp - 0x18]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0xffffffff
je 0x517173
mov rcx, qword [rsi + 8]
lea r8, [rbp - 0x34]
xor r9d, r9d
mov rdx, r15
call qword [sym.imp.KERNEL32.dll_GetOverlappedResult]
test eax, eax
je 0x517193
mov ebx, dword [rbp - 0x34]
cmp edi, ebx
cmovbe ebx, edi
mov rcx, qword [rbp - 0x18]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
test r13, r13
jle 0x5170fa
mov r8, qword [rbp + 0x60]
mov rdx, r13
mov rcx, rsi
call fcn.00516b80
mov eax, ebx
jmp 0x516f67
mov rcx, qword [rsi + 8]
xor r9d, r9d
mov qword [rsp + 0x20], r15
mov r8d, edi
mov rdx, r12
call qword [sym.imp.KERNEL32.dll_WriteFileGather]
test eax, eax
jne 0x517135
xor r13d, r13d
jmp 0x517089
call fcn.005f3c10
mov dword [0x008de1c0], eax
jmp 0x516ecd
mov rcx, qword [rbp - 0x18]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, ebx
jmp 0x516f67
call fcn.004d6fb0
mov rdi, qword [rbp + 0x60]
mov rcx, qword [rbp - 0x18]
mov dword [rdi], r12d
mov qword [rdi + 8], rax
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rax, 0xffffffffffffffff
jmp 0x516f67
xor eax, eax
jmp 0x516f67
call fcn.004d6fb0
mov rsi, rax
call rbx
mov rdi, qword [rbp + 0x60]
mov rcx, qword [rbp - 0x18]
mov dword [rdi], eax
mov qword [rdi + 8], rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x517160
call rbx
mov ebx, eax
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 0x517160
call fcn.004d6fb0
mov rdi, qword [rbp + 0x60]
mov qword [rdi + 8], rax
mov rax, 0xffffffffffffffff
mov dword [rdi], 6
jmp 0x516f67