Function at 0x415590
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x58
mov rsi, rcx
mov rcx, qword [rcx + 0xa0]
mov rdi, r8
mov r14d, r9d
mov rax, rcx
mov ebp, r14d
sub rax, rdx
cmp rbp, rax
jle 0x41541a
test rax, rax
jle 0x415430
sub r14d, eax
add rdi, rax
mov rdx, rcx
mov rax, rcx
mov ebp, r14d
sub rax, rdx
cmp rbp, rax
jg 0x4153fe
add rsp, 0x58
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov r13, qword [rsi + 0xa8]
mov r12, r13
sub r12, rdx
cmp rbp, r12
jle 0x415470
mov r8, rdi
mov rcx, rsi
mov r9d, r12d
call fcn.004153d0
sub r14d, r12d
add rdi, r12
mov rdx, r13
mov rcx, qword [rsi + 0xa0]
jmp 0x4153f0
lea rax, [rsi + 0x50]
test r14d, r14d
mov qword [rsp + 0x30], rax
je 0x415530
lea rax, [rsp + 0x4c]
mov qword [rsp + 0x38], rax
jmp 0x415499
test r14d, r14d
je 0x415530
mov r11, qword [rsi + 0x70]
mov rdx, rdi
mov r15d, dword [rsi + 0x7c]
mov ebx, dword [rsi + 0x78]
and r15d, r11d
sub ebx, r15d
mov ecx, r15d
cmp ebx, r14d
cmovg ebx, r14d
add rcx, qword [rsi + 0x68]
mov r13d, ebx
sub r14d, ebx
add ebx, r15d
mov r8, r13
add rdi, r13
call sub.msvcrt.dll_memcpy
mov rdx, qword [rsi + 0x70]
add rdx, r13
cmp ebx, dword [rsi + 0x78]
mov qword [rsi + 0x70], rdx
jne 0x415490
mov r13, qword [rsi + 0x68]
mov rcx, qword [rsp + 0x30]
call fcn.00415370
mov rcx, qword [rsi + 0x58]
mov r8d, ebx
mov rdx, r13
mov qword [rsp + 0x20], 0
mov r9, qword [rsp + 0x38]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x41556c
cmp ebx, dword [rsp + 0x4c]
jne 0x41556c
add qword [rsi + 0x60], rbx
test r14d, r14d
jne 0x415499
nop dword [rax]
nop word cs:[rax + rax]
add qword [rsi + 0xb0], rbp
cmp rbp, r12
jne 0x41541a
mov rax, qword [rsi + 0x98]
mov rdx, qword [rax]
add rax, 0x18
mov qword [rsi + 0xa0], rdx
mov rdx, qword [rax - 0x10]
mov qword [rsi + 0x98], rax
mov qword [rsi + 0xa8], rdx
jmp 0x41541a
lea rcx, [0x0042b297]
call sub.msvcrt.dll_puts
mov ecx, 1
call sub.msvcrt.dll_exit
nop
nop
nop
nop word cs:[rax + rax]
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x58
test r8d, r8d
mov rbx, rcx
mov rdi, rdx
mov dword [rsp + 0xb0], r8d
je 0x415759
mov rax, qword [sym.imp.KERNEL32.dll_SetFilePointer]
mov rdx, qword [rcx + 0xc0]
mov qword [rsp + 0x38], rax
mov r10, qword [rbx + 0xd0]
mov ebp, dword [rsp + 0xb0]
cmp r10, rdx
jbe 0x415850
sub r10, rdx
cmp r10, rbp
cmovg r10, rbp
test r10d, r10d
mov r12d, r10d
je 0x415700
mov edx, dword [rbx + 0x10218]
lea rbp, [rbx + 0x210]
mov rsi, rdi
mov r13d, r10d
jmp 0x41564c
mov r14d, 0x10000
sub r14d, edx
add rdx, rbp
cmp r13d, r14d
mov rcx, rsi
cmovle r14d, r13d
mov r15d, r14d
mov r8, r15
add rsi, r15
call sub.msvcrt.dll_memcpy
mov edx, r14d
add edx, dword [rbx + 0x10218]
sub r13d, r14d
mov dword [rbx + 0x10218], edx
je 0x415843
cmp edx, 0x10000
jne 0x415610
mov rcx, qword [rbx + 0xe8]
mov r14d, 0x10000
mov rdx, rbp
cmp qword [rbx + 0x10210], 0x10000
cmovle r14, qword [rbx + 0x10210]
mov rax, qword [rcx]
mov r8d, r14d
mov r14d, r14d
call qword [rax + 0x10]
mov rdx, rbp
mov dword [rbx + 0x10218], 0
sub qword [rbx + 0x10210], r14
mov r14d, 0x10000
jmp 0x41561c
mov rax, qword [rbx + 0x90]
mov rdx, qword [rax]
add rax, 0x1c
mov qword [rbx + 0xd0], rdx
mov rdx, qword [rax - 0x14]
mov qword [rbx + 0xd8], rdx
mov rdx, qword [rax - 0xc]
mov qword [rbx + 0xc8], rdx
mov edx, dword [rax - 4]
mov qword [rbx + 0x90], rax
mov dword [rbx + 0xe0], edx
mov rdx, qword [rbx + 0xc0]
nop dword [rax]
nop word cs:[rax + rax]
mov rcx, qword [rbx + 0xa0]
mov r13d, r12d
mov rbp, rdi
mov rax, rcx
mov r15d, r13d
sub rax, rdx
cmp rax, r15
jge 0x415737
test rax, rax
jle 0x415770
sub r13d, eax
add rbp, rax
mov rdx, rcx
mov rax, rcx
mov r15d, r13d
sub rax, rdx
cmp rax, r15
jl 0x41571b
mov edx, r12d
add rdi, rdx
add rdx, qword [rbx + 0xc0]
sub dword [rsp + 0xb0], r12d
mov qword [rbx + 0xc0], rdx
jne 0x4155ca
add rsp, 0x58
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov rsi, qword [rbx + 0xa8]
mov r14, rsi
sub r14, rdx
cmp r15, r14
jle 0x415950
mov r8, rbp
mov rcx, rbx
mov r9d, r14d
call fcn.004153d0
sub r13d, r14d
add rbp, r14
mov rdx, rsi
mov rcx, qword [rbx + 0xa0]
jmp 0x41570d
mov r15d, dword [rsp + 0x30]
mov r11, rdi
test r15d, r15d
je 0x4157f2
nop dword [rax]
mov edx, r13d
mov esi, dword [rbx + 0x78]
mov rcx, r11
and edx, dword [rbx + 0x7c]
sub esi, edx
cmp esi, r15d
cmovg esi, r15d
add rdx, qword [rbx + 0x68]
mov r12d, esi
mov r8, r12
add r13, r12
call sub.msvcrt.dll_memcpy
mov r11, rax
add r11, r12
sub r15d, esi
jne 0x4157c0
cmp ebp, dword [rsp + 0x30]
mov r12d, ebp
jbe 0x415822
mov rcx, qword [rsp + 0x30]
sub ebp, 1
xor eax, eax
sub ebp, ecx
mov ecx, ecx
lea rdx, [rbp + 1]
add rcx, rdi
movzx r8d, byte [rdi + rax]
mov byte [rcx + rax], r8b
add rax, 1
cmp rax, rdx
jne 0x415810
mov rax, qword [rbx + 0xc8]
cmp r14, rax
je 0x4156b0
add qword [rbx + 0xd8], r14
sub rax, r14
mov qword [rbx + 0xc8], rax
mov rdx, qword [rbx + 0xc0]
jmp 0x415700
mov esi, dword [rbx + 0xe0]
mov eax, dword [rbx + 0x88]
cmp qword [rbx + 0xc8], rbp
cmovle rbp, qword [rbx + 0xc8]
cmp esi, eax
jb 0x41588c
lea edx, [rsi + 1]
add eax, eax
lea rcx, [rbx + 0x80]
cmp eax, edx
cmovge edx, eax
call fcn.0041ed30
mov rdx, qword [rbx + 0xc0]
mov r12, qword [rbx + 0xd8]
lea rcx, [rsi + rsi*2]
mov r14d, ebp
mov rax, qword [rbx + 0x80]
mov r15, qword [rbx + 0x70]
sub rdx, r12
cmp rdx, r14
mov rsi, rdx
cmovg rsi, r14
add r12, qword [rax + rcx*8 + 0x10]
sub r12, qword [rax + rcx*8]
mov qword [rsp + 0x30], rsi
cmp r12, r15
mov r13, r12
jge 0x4157b0
mov ecx, esi
sub r15, r12
cmp rcx, r15
cmovle r15, rcx
cmp r12, qword [rbx + 0x60]
mov rcx, qword [rbx + 0x58]
je 0x415903
mov qword [rbx + 0x60], r12
lea r8, [rbx + 0x64]
xor r9d, r9d
mov edx, r12d
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x415a8e
mov rcx, qword [rbx + 0x58]
mov qword [rsp + 0x20], 0
lea r9, [rsp + 0x4c]
mov r8d, r15d
mov rdx, rdi
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x41592c
cmp r15d, dword [rsp + 0x4c]
je 0x415a70
lea rcx, [0x0042b2af]
call sub.msvcrt.dll_puts
mov ecx, 1
call sub.msvcrt.dll_exit
nop dword [rax]
nop word cs:[rax + rax]
test r13d, r13d
je 0x415a2c
mov qword [rsp + 0xa8], rdi
mov edi, r13d
mov r13, rbp
mov dword [rsp + 0x30], r12d
jmp 0x415978
test edi, edi
je 0x415a1f
mov r9, qword [rbx + 0x70]
mov rdx, r13
mov r12d, dword [rbx + 0x7c]
mov esi, dword [rbx + 0x78]
and r12d, r9d
sub esi, r12d
mov ecx, r12d
cmp esi, edi
cmovg esi, edi
add rcx, qword [rbx + 0x68]
mov ebp, esi
sub edi, esi
add esi, r12d
mov r8, rbp
add r13, rbp
call sub.msvcrt.dll_memcpy
mov rdx, qword [rbx + 0x70]
add rdx, rbp
cmp esi, dword [rbx + 0x78]
mov qword [rbx + 0x70], rdx
jne 0x415970
cmp rdx, qword [rbx + 0x60]
mov rbp, qword [rbx + 0x68]
mov rcx, qword [rbx + 0x58]
je 0x4159e7
mov qword [rbx + 0x60], rdx
lea r8, [rbx + 0x64]
xor r9d, r9d
mov rax, qword [rsp + 0x38]
call rax
cmp eax, 0xffffffff
je 0x415ac0
mov rcx, qword [rbx + 0x58]
mov qword [rsp + 0x20], 0
lea r9, [rsp + 0x4c]
mov r8d, esi
mov rdx, rbp
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x415ad0
cmp esi, dword [rsp + 0x4c]
jne 0x415ad0
add qword [rbx + 0x60], rsi
test edi, edi
jne 0x415978
mov r12d, dword [rsp + 0x30]
mov rdi, qword [rsp + 0xa8]
add qword [rbx + 0xb0], r15
cmp r15, r14
jne 0x415737
mov rax, qword [rbx + 0x98]
mov rdx, qword [rax]
add rax, 0x18
mov qword [rbx + 0xa0], rdx
mov rdx, qword [rax - 0x10]
mov qword [rbx + 0x98], rax
mov qword [rbx + 0xa8], rdx
jmp 0x415737
lea r13, [r12 + r15]
mov eax, r15d
add qword [rbx + 0x60], rax
lea r11, [rdi + r15]
mov eax, dword [rsp + 0x30]
sub eax, r15d
mov r15d, eax
jmp 0x4157b8
call qword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x4158ff
lea rcx, str._n__ERROR__Seek_failed_
call sub.msvcrt.dll_puts
mov ecx, 1
call sub.msvcrt.dll_exit
nop dword [rax]
nop word cs:[rax + rax]
call qword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x4159e3
jmp 0x415a9c
lea rcx, [0x0042b297]
call sub.msvcrt.dll_puts
mov ecx, 1
call sub.msvcrt.dll_exit
nop
nop
nop dword [rax + rax]