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

Disassembly:
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
push rbp
sub rsp, 0xc8
xor r14d, r14d
movzx eax, byte [rcx + 0x51]
xor edi, edi
mov qword [rsp + 0xa0], r8
xor r12d, r12d
mov qword [rsp + 0xb0], rcx
mov r15, r9
mov dword [rsp + 0xa8], eax
mov rsi, rdx
mov qword [rsp + 0x98], rdi
lea ebp, [rax + 1]
xor r13d, r13d
xor bl, bl
call qword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [rsp + 0xb8], r14d
mov rdx, rdi
xor al, al
shl rdx, 4
sub rdx, rdi
shl rdx, 4
lea r14, [rsi + rdx + 0x40]
cmp dword [r14], 0
je 0x140016340
inc al
add r14, 0x30
cmp al, 2
jb 0x140015fdf
mov dword [rsp + 0x88], r13d
mov dword [rsp + 0x90], r12d
mov qword [rsp + 0x70], rdi
mov qword [rsp + 0x78], r15
mov r12, qword [rsp + 0x98]
mov r13, qword [rsp + 0xb0]
mov r14, qword [rsp + 0xa0]
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov ecx, ebp
mov rdx, r14
xor r8d, r8d
mov r9d, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForMultipleObjects]
mov r15d, eax
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov rdi, r15
shl rdi, 4
sub rdi, r15
shl rdi, 4
cmp dword [rdi + rsi + 0x20], 0
jne 0x14001608d
mov r11d, dword [rdi + rsi + 0x24]
xor r10b, r10b
xor r9d, r9d
lea r8, [rsi + rdi + 0x40]
lea rax, [r8 + r9]
cmp dword [rax], 1
je 0x140016307
inc r10b
add r9, 0x30
cmp r10b, 2
jl 0x140016073
cmp r15d, r12d
jne 0x1400160d5
mov r8d, dword [rsp + 0x88]
mov eax, dword [rsp + 0x90]
mov r10, r12
xor r11b, r11b
shl r10, 4
xor r9d, r9d
sub r10, r12
shl r10, 4
add r10, rsi
cmp dword [r9 + r10 + 0x40], 2
je 0x140016104
inc r11b
add r9, 0x30
cmp r11b, 2
jb 0x1400160b8
mov dword [rsp + 0x88], r8d
test bl, bl
jne 0x140016025
mov qword [rsp + 0x98], r12
mov r13d, dword [rsp + 0x88]
mov rdi, qword [rsp + 0x70]
mov r12d, dword [rsp + 0x90]
mov r15, qword [rsp + 0x78]
jmp 0x140015fca
cmp r8d, dword [r9 + r10 + 0x44]
jne 0x1400160c0
mov r11, r12
shl r11, 4
sub r11, r12
shl r11, 4
mov dword [r9 + r10 + 0x40], 0
mov r15d, dword [r9 + r10 + 0x4c]
mov edx, dword [r9 + r10 + 0x48]
mov rcx, qword [r11 + rsi + 0x10]
test r15, r15
je 0x1400162d2
mov qword [rsp + 0x68], rsi
mov byte [rsp + 0x40], bl
mov rbx, rcx
mov qword [rsp + 0x48], rdi
mov qword [rsp + 0x98], r12
mov dword [rsp + 0x88], r8d
mov dword [rsp + 0x60], ebp
mov rbp, rdx
mov rsi, qword [rsp + 0x78]
mov rdi, rbp
mov r12, rbp
shr rdi, 0x18
and r12, 0xffffff
mov eax, dword [rbx + 0xc20]
mov r9, qword [rbx + rdi*8 + 0x4b0]
mov rdi, r12
neg rdi
add r12, r9
add rdi, 0x1000000
cmp rdi, r15
cmovae rdi, r15
add rbp, rdi
sub r15, rdi
mov r8, rbp
sub r8, rax
mov eax, dword [rsi + 0x28c]
cmovns rbp, r8
cmp eax, 1
jne 0x1400161e5
mov rax, rsp
mov rdx, r12
mov rcx, qword [rsi + 0x298]
mov r8d, edi
lea r9, [rsp + 0x54]
mov qword [rax + 0x20], 0
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov r14d, dword [rsp + 0x54]
jmp 0x140016282
cmp eax, 2
je 0x140016215
mov r14d, 0xffffffff
mov rcx, qword [rsp + 0xb0]
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, r14d
add rsp, 0xc8
pop rbp
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
ret
mov r13, rdi
test rdi, rdi
je 0x14001627f
mov qword [rsp + 0x58], rbx
mov rax, qword [rsi + 0x48]
cmp rax, r13
mov rdx, r12
cmovae rax, r13
mov ebx, eax
mov r8, rbx
mov rcx, qword [rsi + 0x40]
mov r14, qword [rsi + 0x28]
call fcn.14003f570
mov dword [r14], 2
mov dword [r14 + 4], ebx
mov rcx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, qword [rsi + 8]
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov r14d, dword [r14 + 8]
test r14d, r14d
jl 0x1400162fd
add r12, rbx
sub r13, rbx
jne 0x140016222
mov rbx, qword [rsp + 0x58]
mov r14d, edi
test r14d, r14d
jl 0x1400161f0
test r15, r15
jne 0x140016167
mov qword [rsp + 0x78], rsi
mov bl, byte [rsp + 0x40]
mov rdi, qword [rsp + 0x48]
mov r12, qword [rsp + 0x98]
mov r8d, dword [rsp + 0x88]
mov eax, dword [rsp + 0x90]
mov ebp, dword [rsp + 0x60]
mov r13, qword [rsp + 0xb0]
mov rsi, qword [rsp + 0x68]
mov r14, qword [rsp + 0xa0]
xor r9d, r9d
inc r8d
inc r12d
cmp r12d, ebp
cmovae r12, r9
test bl, bl
je 0x1400160a1
cmp r8d, eax
jne 0x1400160a1
mov r14d, dword [rdi + rsi + 0x28]
jmp 0x1400161f0
mov rbx, qword [rsp + 0x58]
jmp 0x140016282
cmp r11d, dword [rax + 4]
jne 0x140016080
mov r8d, dword [rsp + 0xa8]
mov rcx, qword [rdi + rsi + 0x30]
mov dword [rdi + rsi + 0x20], 1
mov qword [rdi + rsi + 0x18], rax
lea r9d, [r11 + r8 + 1]
mov dword [rdi + rsi + 0x24], r9d
call qword [sym.imp.KERNEL32.dll_SetEvent]
jmp 0x14001608d
mov eax, dword [r15 + 0x28c]
cmp eax, 1
jne 0x140016392
mov rax, rsp
lea rdx, [rsp + 0x84]
mov rcx, qword [r15 + 0x290]
mov r8d, 4
lea r9, [rsp + 0x80]
mov qword [rax + 0x20], 0
call qword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [rsp + 0x80]
mov r8d, dword [rsp + 0x84]
test eax, eax
jl 0x14001639c
jmp 0x140016458
cmp eax, 2
je 0x1400163a4
mov eax, 0xffffffff
mov r14d, eax
jmp 0x1400161f0
lea rcx, [rsp + 0x84]
cmp rcx, qword [r15 + 0x30]
je 0x14001666b
mov eax, 4
mov qword [rsp + 0x70], rdi
mov rdi, rax
mov dword [rsp + 0x90], r12d
mov dword [rsp + 0x60], ebp
mov qword [rsp + 0x68], rsi
mov rsi, rcx
mov rdx, qword [r15 + 0x38]
cmp rdx, rdi
cmovae rdx, rdi
mov ebp, edx
test rbp, rbp
je 0x140016432
mov r12, qword [r15 + 0x28]
mov dword [r12], 1
mov dword [r12 + 4], ebp
mov rcx, qword [r15]
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, qword [r15 + 8]
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [r12 + 8]
test eax, eax
jg 0x140016423
jl 0x1400165e8
jmp 0x140016432
mov rcx, rsi
mov r8, rbp
mov rdx, qword [r15 + 0x30]
call fcn.14003f570
add rsi, rbp
sub rdi, rbp
jne 0x1400163d7
mov rdi, qword [rsp + 0x70]
mov r12d, dword [rsp + 0x90]
mov ebp, dword [rsp + 0x60]
mov rsi, qword [rsp + 0x68]
mov r8d, dword [rsp + 0x84]
test r8d, r8d
jne 0x14001646d
cmp r13d, r12d
je 0x140016603
mov bl, 1
jmp 0x140015ff3
mov r9d, dword [r15 + 0x28c]
mov rdx, qword [r14 + 0x18]
mov eax, r8d
cmp r9d, 1
jne 0x1400164a8
mov rax, rsp
lea r9, [rsp + 0x50]
mov rcx, qword [r15 + 0x290]
mov qword [rax + 0x20], 0
call qword [sym.imp.KERNEL32.dll_ReadFile]
mov r8d, dword [rsp + 0x50]
jmp 0x140016579
cmp r9d, 2
je 0x1400164bc
mov r8d, 0xffffffff
mov r14d, r8d
jmp 0x1400161f0
cmp rdx, qword [r15 + 0x30]
je 0x140016633
test rax, rax
je 0x140016579
mov dword [rsp + 0x88], r13d
mov qword [rsp + 0x70], rdi
mov edi, r8d
mov dword [rsp + 0x90], r12d
mov r12, rax
mov dword [rsp + 0x60], ebp
mov qword [rsp + 0x68], rsi
mov rsi, rdx
mov rbp, qword [r15 + 0x38]
cmp rbp, r12
cmovae rbp, r12
mov ebp, ebp
test rbp, rbp
je 0x140016550
mov r13, qword [r15 + 0x28]
mov dword [r13], 1
mov dword [r13 + 4], ebp
mov rcx, qword [r15]
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, qword [r15 + 8]
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov r8d, dword [r13 + 8]
test r8d, r8d
jg 0x140016541
jl 0x140016610
jmp 0x140016550
mov rcx, rsi
mov r8, rbp
mov rdx, qword [r15 + 0x30]
call fcn.14003f570
add rsi, rbp
sub r12, rbp
jne 0x1400164f6
mov r13d, dword [rsp + 0x88]
mov r8d, edi
mov rdi, qword [rsp + 0x70]
mov r12d, dword [rsp + 0x90]
mov ebp, dword [rsp + 0x60]
mov rsi, qword [rsp + 0x68]
test r8d, r8d
jl 0x1400164b4
mov r8, rdi
shl r8, 4
sub r8, rdi
shl r8, 4
mov dword [r14], 1
mov dword [r14 + 4], r12d
cmp dword [r8 + rsi + 0x20], 0
jne 0x1400165d6
mov eax, dword [r8 + rsi + 0x24]
cmp r12d, eax
jne 0x1400165d6
mov edx, dword [rsp + 0xa8]
mov rcx, qword [r8 + rsi + 0x30]
mov dword [r8 + rsi + 0x20], 1
mov qword [r8 + rsi + 0x18], r14
lea eax, [rax + rdx + 1]
mov dword [r8 + rsi + 0x24], eax
call qword [sym.imp.KERNEL32.dll_SetEvent]
xor eax, eax
inc r12d
inc edi
cmp edi, ebp
cmovae rdi, rax
jmp 0x140015fca
mov rdi, qword [rsp + 0x70]
mov r12d, dword [rsp + 0x90]
mov ebp, dword [rsp + 0x60]
mov rsi, qword [rsp + 0x68]
jmp 0x140016381
mov r14d, dword [rsp + 0xb8]
jmp 0x1400161f0
mov r13d, dword [rsp + 0x88]
mov rdi, qword [rsp + 0x70]
mov r12d, dword [rsp + 0x90]
mov ebp, dword [rsp + 0x60]
mov rsi, qword [rsp + 0x68]
jmp 0x140016579
mov rdx, qword [r15 + 0x28]
mov qword [rsp + 0x30], rdx
mov dword [rdx], 1
mov dword [rdx + 4], eax
mov rcx, qword [r15]
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, qword [r15 + 8]
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov rax, qword [rsp + 0x30]
mov r8d, dword [rax + 8]
jmp 0x140016579
mov rax, qword [r15 + 0x28]
mov qword [rsp + 0x38], rax
mov dword [rax], 1
mov dword [rax + 4], 4
mov rcx, qword [r15]
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, qword [r15 + 8]
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov rax, qword [rsp + 0x38]
mov eax, dword [rax + 8]
jmp 0x140016381