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

Disassembly:
push rbp
lea rbp, [rsp - 0x57]
sub rsp, 0xf0
mov rax, qword [0x140018cb8]
xor rax, rsp
mov qword [rbp + 0x2f], rax
cmp ecx, 4
je 0x1400010a6
mov r8, qword [rdx]
lea rdx, str.usage:__s_oldfile_newfile_patchfile_n
mov ecx, 1
call fcn.140001000
int3
mov rax, qword [rdx + 0x10]
mov qword [rsp + 0x100], rbx
mov rbx, qword [rdx + 0x18]
mov qword [rsp + 0x118], rdi
mov qword [rsp + 0xd8], r14
mov r14, qword [rdx + 8]
lea rdx, [0x1400143c4]
mov rcx, rbx
mov qword [rbp - 0x51], rax
mov qword [rbp - 0x19], r14
call fcn.14000657c
mov rdi, rax
test rax, rax
jne 0x1400010fc
lea rdx, str.fopen__s__n
lea ecx, [rax + 2]
mov r8, rbx
call fcn.140001000
int3
mov edx, 1
lea rcx, [rbp + 0xf]
mov r9, rax
lea r8d, [rdx + 0x1f]
call fcn.140006484
mov rcx, rdi
cmp rax, 0x20
jae 0x140001145
call fcn.140006154
mov ecx, 3
test eax, eax
je 0x140001135
lea rdx, str.Corrupt_patch_n
call fcn.140001000
int3
lea rdx, str.fread__s__n
mov r8, rbx
call fcn.140001000
int3
call fcn.1400060ec
mov r11, qword [rbp + 0xf]
cmp r11, qword [str.BSDIFF40]
je 0x140001169
lea rdx, str.Corrupt_patch_n
mov ecx, 4
call fcn.140001000
int3
mov qword [rsp + 0x110], rsi
lea rcx, [rbp + 0x17]
mov qword [rsp + 0xe8], r12
mov qword [rsp + 0xd0], r15
call fcn.140001030
lea rcx, [rbp + 0x1f]
mov esi, eax
call fcn.140001030
lea rcx, [rbp + 0x27]
mov r12d, eax
call fcn.140001030
mov r15d, eax
test esi, esi
js 0x14000178b
test r12d, r12d
js 0x14000178b
test eax, eax
js 0x14000178b
lea rdx, [0x1400143c4]
mov rcx, rbx
call fcn.14000657c
mov rdi, rax
mov qword [rbp - 0x11], rax
test rax, rax
jne 0x1400011eb
lea rdx, str.fopen__s__n
lea ecx, [rax + 2]
mov r8, rbx
call fcn.140001000
int3
xor r8d, r8d
mov rcx, rax
lea edx, [r8 + 0x20]
call fcn.140005ff4
test eax, eax
je 0x140001218
mov r9d, 0x20
lea rdx, str.fseeko__s___lld__n
mov r8, rbx
lea ecx, [r9 - 0x1d]
call fcn.140001000
int3
xor eax, eax
lea rcx, [rbp - 0x61]
xor r9d, r9d
mov dword [rsp + 0x28], eax
xor r8d, r8d
mov rdx, rdi
mov qword [rsp + 0x20], rax
mov qword [rsp + 0xe0], r13
call fcn.1400026d0
mov r13, rax
mov qword [rbp - 0x49], rax
test rax, rax
jne 0x14000125d
mov r8d, dword [rbp - 0x61]
lea rdx, str.BZ2_bzReadOpen__bz2err___d_n
lea ecx, [rax + 7]
call fcn.140001000
int3
lea rdx, [0x1400143c4]
mov rcx, rbx
call fcn.14000657c
mov qword [rbp - 0x41], rax
test rax, rax
jne 0x140001288
lea rdx, str.fopen__s__n
lea ecx, [rax + 2]
mov r8, rbx
call fcn.140001000
int3
lea edi, [rsi + 0x20]
xor r8d, r8d
mov rcx, rax
mov edx, edi
call fcn.140005ff4
test eax, eax
je 0x1400012b4
lea rdx, str.fseeko__s___lld__n
movsxd r9, edi
mov r8, rbx
mov ecx, 6
call fcn.140001000
int3
mov rdx, qword [rbp - 0x41]
xor eax, eax
lea rcx, [rbp - 0x65]
mov dword [rsp + 0x28], eax
xor r9d, r9d
xor r8d, r8d
mov qword [rsp + 0x20], rax
call fcn.1400026d0
mov qword [rbp - 0x29], rax
test rax, rax
jne 0x1400012ef
mov r8d, dword [rbp - 0x65]
lea rdx, str.BZ2_bzReadOpen__bz2err___d_n
lea ecx, [rax + 7]
call fcn.140001000
int3
lea rdx, [0x1400143c4]
mov rcx, rbx
call fcn.14000657c
mov qword [rbp - 0x39], rax
test rax, rax
jne 0x14000131a
lea rdx, str.fopen__s__n
lea ecx, [rax + 2]
mov r8, rbx
call fcn.140001000
int3
lea edi, [r12 + rsi + 0x20]
xor r8d, r8d
mov rcx, rax
mov edx, edi
call fcn.140005ff4
test eax, eax
je 0x140001348
lea rdx, str.fseeko__s___lld__n
movsxd r9, edi
mov r8, rbx
mov ecx, 6
call fcn.140001000
int3
mov rdx, qword [rbp - 0x39]
xor eax, eax
lea rcx, [rbp - 0x69]
mov dword [rsp + 0x28], eax
xor r9d, r9d
xor r8d, r8d
mov qword [rsp + 0x20], rax
call fcn.1400026d0
mov qword [rbp - 0x21], rax
test rax, rax
jne 0x140001383
mov r8d, dword [rbp - 0x69]
lea rdx, str.BZ2_bzReadOpen__bz2err___d_n
lea ecx, [rax + 7]
call fcn.140001000
int3
lea rdx, [0x1400143c4]
mov rcx, r14
call fcn.14000657c
mov r12, rax
mov qword [rbp - 0x59], rax
test rax, rax
jne 0x1400013b1
lea rdx, str.Open_failed_:_s_n
lea ecx, [rax + 9]
mov r8, r14
call fcn.140001000
int3
xor edx, edx
mov rcx, rax
lea r8d, [rdx + 2]
call fcn.140005ff4
test eax, eax
je 0x1400013d8
lea rdx, str.Seek_failed_:_s_n
mov r8, r14
mov ecx, 0xa
call fcn.140001000
int3
mov rcx, r12
call fcn.140005ee8
mov rdi, qword [rbp - 0x51]
lea rdx, [0x14001431c]
mov rcx, rdi
mov dword [rbp - 0x5d], eax
call fcn.14000657c
mov rbx, rax
mov qword [rbp - 0x31], rax
test rax, rax
jne 0x140001415
lea rdx, str.Create_failed_:_s_n
lea ecx, [rax + 0xc]
mov r8, rdi
call fcn.140001000
int3
xor r14d, r14d
xor esi, esi
test r15d, r15d
jle 0x14000161b
nop word [rax + rax]
xor ebx, ebx
lea r8, [rbp + 7]
lea rcx, [rbp - 0x61]
mov r9d, 8
mov rdx, r13
call fcn.140002ae0
cmp eax, 8
jl 0x140001779
mov eax, dword [rbp - 0x61]
test eax, eax
je 0x140001461
cmp eax, 4
jne 0x140001779
movzx eax, byte [rbp + 9]
movzx ecx, byte [rbp + 0xa]
shl ecx, 8
add ecx, eax
movzx eax, byte [rbp + 8]
shl ecx, 8
add ecx, eax
movzx eax, byte [rbp + 7]
shl ecx, 8
add ecx, eax
test byte [rbp + 0xe], 0x80
je 0x140001488
neg ecx
mov dword [rbp + rbx*4 - 9], ecx
inc rbx
cmp rbx, 2
jle 0x140001432
movsxd rdi, dword [rbp - 9]
lea r13d, [rdi + rsi]
cmp r13d, r15d
jg 0x140001767
lea eax, [rdi + 1]
movsxd rbx, eax
mov rcx, rbx
call fcn.140005c78
mov rsi, rax
test rax, rax
je 0x140001751
mov rdx, qword [rbp - 0x29]
lea rcx, [rbp - 0x65]
mov r9d, edi
mov r8, rax
call fcn.140002ae0
cmp eax, edi
jl 0x14000173f
mov edx, dword [rbp - 0x65]
test edx, edx
je 0x1400014eb
cmp edx, 4
jne 0x14000173f
xor r8d, r8d
mov edx, r14d
mov rcx, r12
call fcn.140005ff4
mov rcx, rbx
call fcn.140005c78
mov rbx, rax
test rax, rax
je 0x140001729
mov r9, qword [rbp - 0x59]
mov r8, rdi
mov edx, 1
mov rcx, rax
mov r12, rdi
call fcn.140006484
cmp rax, 0xffffffffffffffff
je 0x140001713
test edi, edi
jle 0x140001562
mov r12d, dword [rbp - 0x5d]
mov r10, rbx
mov rdx, rsi
mov ecx, r14d
mov r9d, edi
sub r10, rsi
test ecx, ecx
js 0x140001555
cmp ecx, r12d
jge 0x140001555
movzx eax, byte [r10 + rdx]
add byte [rdx], al
inc ecx
inc rdx
dec r9
jne 0x140001545
mov r12, rdi
mov rcx, rbx
call fcn.140005c38
mov r9, qword [rbp - 0x31]
mov r8, r12
mov edx, 1
mov rcx, rsi
call fcn.140005ba8
cmp rax, 0xffffffffffffffff
je 0x1400016fd
mov rcx, rsi
call fcn.140005c38
movsxd rbx, dword [rbp - 5]
add r14d, edi
lea esi, [rbx + r13]
cmp esi, r15d
jg 0x1400016eb
lea eax, [rbx + 1]
movsxd rcx, eax
call fcn.140005c78
mov rdx, qword [rbp - 0x21]
lea rcx, [rbp - 0x69]
mov r8, rax
mov r9d, ebx
mov rdi, rax
call fcn.140002ae0
cmp eax, ebx
jl 0x1400016d9
mov ecx, dword [rbp - 0x69]
test ecx, ecx
je 0x1400015dd
cmp ecx, 4
jne 0x1400016d9
mov r8, rbx
mov rbx, qword [rbp - 0x31]
mov edx, 1
mov r9, rbx
mov rcx, rdi
call fcn.140005ba8
cmp rax, 0xffffffffffffffff
je 0x1400016c3
mov rcx, rdi
call fcn.140005c38
add r14d, dword [rbp - 1]
mov r13, qword [rbp - 0x49]
mov r12, qword [rbp - 0x59]
cmp esi, r15d
jl 0x140001430
lea rcx, [rbp - 0x61]
mov rdx, r13
call fcn.140002860
mov rdx, qword [rbp - 0x29]
lea rcx, [rbp - 0x65]
call fcn.140002860
mov rdx, qword [rbp - 0x21]
lea rcx, [rbp - 0x69]
call fcn.140002860
mov rcx, qword [rbp - 0x11]
call fcn.1400060ec
test eax, eax
jne 0x140001664
mov rcx, qword [rbp - 0x41]
call fcn.1400060ec
test eax, eax
jne 0x140001664
mov rcx, qword [rbp - 0x39]
call fcn.1400060ec
mov rcx, r12
call fcn.1400060ec
mov rcx, rbx
call fcn.1400060ec
mov r13, qword [rsp + 0xe0]
mov rsi, qword [rsp + 0x110]
mov r12, qword [rsp + 0xe8]
mov r15, qword [rsp + 0xd0]
mov rdi, qword [rsp + 0x118]
mov rbx, qword [rsp + 0x100]
mov r14, qword [rsp + 0xd8]
xor eax, eax
mov rcx, qword [rbp + 0x2f]
xor rcx, rsp
call fcn.1400065a0
add rsp, 0xf0
pop rbp
ret
mov r8, qword [rbp - 0x51]
lea rdx, str.Write_failed_:_s_n
mov ecx, 0xd
call fcn.140001000
int3
lea rdx, str.Corrupt_patch_n
mov ecx, 8
call fcn.140001000
int3
lea rdx, str.Corrupt_patch_n
mov ecx, 5
call fcn.140001000
int3
mov r8, qword [rbp - 0x51]
lea rdx, str.Write_failed_:_s_n
mov ecx, 0xd
call fcn.140001000
int3
mov r8, qword [rbp - 0x19]
lea rdx, str.Read_failed_:_s_n
mov ecx, 0xb
call fcn.140001000
int3
lea r8d, [rdi + 1]
lea rdx, str.Malloc_failed_:_ld_n
mov ecx, 0xe
call fcn.140001000
int3
lea rdx, str.Corrupt_patch_n
mov ecx, 8
call fcn.140001000
int3
lea r8d, [rdi + 1]
lea rdx, str.Malloc_failed_:_ld_n
mov ecx, 0xe
call fcn.140001000
int3
lea rdx, str.Corrupt_patch_n
mov ecx, 5
call fcn.140001000
int3
lea rdx, str.Corrupt_patch_n
mov ecx, 8
call fcn.140001000
int3
lea rdx, str.Corrupt_patch_n
mov ecx, 5
call fcn.140001000
int3