Function at 0x140002cb0
Capabilities:
Clear file content
Read file on windows
Write file on windows

Disassembly:
push rbp
push rbx
push rsi
push rdi
push r13
push r15
lea rbp, [rsp - 0x2f]
sub rsp, 0xd8
mov rax, qword [0x140046020]
xor rax, rsp
mov qword [rbp + 0x17], rax
mov rsi, r8
mov qword [rbp - 0x61], r8
mov r15, rdx
mov rdi, rcx
call fcn.140003080
mov rdx, qword [rdi + 0x38]
mov r9d, 4
mov r8d, 0x3000
xor ecx, ecx
mov rbx, rax
call qword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov qword [rbp + 0xf], rax
mov r13, rax
test rax, rax
je 0x14000303a
cmp qword [r15 + 0x18], 8
mov rcx, r15
mov qword [rsp + 0x128], r12
mov qword [rsp + 0xd0], r14
jb 0x140002d2d
mov rcx, qword [r15]
mov qword [rsp + 0x30], 0
xor r9d, r9d
mov dword [rsp + 0x28], 0x50000080
xor r8d, r8d
mov edx, 0x40000000
mov dword [rsp + 0x20], 2
call qword [sym.imp.KERNEL32.dll_CreateFileW]
shl rbx, 0xb
xor r9d, r9d
mov rdx, rbx
mov rcx, rax
xor r8d, r8d
mov r12, rax
call qword [sym.imp.KERNEL32.dll_SetFilePointerEx]
mov rcx, r12
call qword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov rax, qword [rdi + 0x20]
xor r14d, r14d
sub rax, qword [rdi + 0x18]
sar rax, 5
mov qword [rbp - 0x69], rax
test rax, rax
je 0x140002f1a
xor esi, esi
xor ebx, ebx
nop dword [rax]
mov rcx, qword [rdi]
add rcx, rsi
cmp qword [rcx + 0x18], 8
jb 0x140002db0
mov rcx, qword [rcx]
xor r9d, r9d
mov qword [rsp + 0x30], 0
mov dword [rsp + 0x28], 0x48000080
mov edx, 0x80000000
mov dword [rsp + 0x20], 3
lea r8d, [r9 + 1]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rcx, qword [rdi]
xorps xmm0, xmm0
mov rdx, qword [rbp + 0xf]
mov r13, rax
movups xmmword [rbp - 0x11], xmm0
lea rax, [rbp - 0x11]
xor r9d, r9d
movups xmmword [rbp - 1], xmm0
mov r8d, dword [rsi + rcx + 0x40]
mov rcx, r13
mov qword [rsp + 0x20], rax
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x140002e60
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
jne 0x14000305b
cmp byte [0x140048db8], 0
je 0x140002e40
mov rdx, qword [rdi + 0x18]
add rdx, 8
add rdx, rbx
call fcn.140007900
mov rcx, rax
call fcn.1400075b0
mov r9d, 1
mov dword [rbp - 0x3d], 0
lea r8, [rbp - 0x3d]
mov rcx, r12
lea rdx, [rbp - 0x11]
call qword [sym.imp.KERNEL32.dll_GetOverlappedResult]
jmp 0x140002e81
cmp byte [0x140048db8], 0
je 0x140002e81
mov rdx, qword [rdi + 0x18]
add rdx, 8
add rdx, rbx
call fcn.140007900
mov rcx, rax
call fcn.1400075b0
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rax, qword [rdi + 0x18]
lea rcx, [rbp - 0x31]
mov r13, qword [rbp + 0xf]
xorps xmm0, xmm0
movups xmmword [rbp - 0x21], xmm0
mov qword [rsp + 0x20], rcx
xor r9d, r9d
movups xmmword [rbp - 0x31], xmm0
mov eax, dword [rbx + rax]
mov rdx, r13
shl rax, 0xb
mov rcx, r12
mov dword [rbp - 0x21], eax
shr rax, 0x20
mov dword [rbp - 0x1d], eax
mov rax, qword [rdi]
mov r8d, dword [rsi + rax + 0x40]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x140002f01
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
jne 0x140003019
mov r9d, 1
mov dword [rbp - 0x39], 0
lea r8, [rbp - 0x39]
mov rcx, r12
lea rdx, [rbp - 0x31]
call qword [sym.imp.KERNEL32.dll_GetOverlappedResult]
inc r14
add rbx, 0x20
add rsi, 0x48
cmp r14, qword [rbp - 0x69]
jb 0x140002da0
mov rsi, qword [rbp - 0x61]
mov rcx, r12
call qword [sym.imp.KERNEL32.dll_CloseHandle]
xor edx, edx
mov r8d, 0x8000
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_VirtualFree]
mov ecx, dword [rdi + 0x30]
cmp ecx, 1
jne 0x140002f48
cmp qword [r15 + 0x18], 8
jb 0x140002f55
mov r15, qword [r15]
jmp 0x140002f55
cmp qword [rsi + 0x18], 8
jb 0x140002f52
mov rsi, qword [rsi]
mov r15, rsi
xor esi, esi
mov edx, 0x40000000
cmp ecx, 1
mov qword [rsp + 0x30], rsi
mov eax, esi
mov dword [rsp + 0x28], 0x8000080
sete al
mov rcx, r15
add eax, 2
xor r9d, r9d
xor r8d, r8d
mov dword [rsp + 0x20], eax
call qword [sym.imp.KERNEL32.dll_CreateFileW]
cmp dword [rdi + 0x30], 1
mov rbx, rax
mov dword [rbp - 0x41], esi
jne 0x140002fc3
mov rcx, qword [rdi + 0x20]
lea r9, [rbp - 0x41]
sub rcx, qword [rdi + 0x18]
lea r8d, [rsi + 8]
sar rcx, 5
lea rdx, [rbp + 0xf]
mov dword [rbp + 0x13], ecx
mov rcx, rax
mov dword [rbp + 0xf], 0x32524556
mov qword [rsp + 0x20], rsi
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rdx, qword [rdi + 0x18]
lea r9, [rbp - 0x41]
mov r8, qword [rdi + 0x20]
mov rcx, rbx
sub r8, rdx
mov qword [rsp + 0x20], rsi
and r8d, 0xffffffe0
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov r12, qword [rsp + 0x128]
mov r14, qword [rsp + 0xd0]
mov rcx, qword [rbp + 0x17]
xor rcx, rsp
call fcn.14000e520
add rsp, 0xd8
pop r15
pop r13
pop rdi
pop rsi
pop rbx
pop rbp
ret
lea rdx, str.Failed_to_write_to_IMG
lea rcx, [rbp - 0x59]
call fcn.1400014b0
lea rdx, [0x1400447b0]
lea rcx, [rbp - 0x59]
call fcn.1400102d4
int3
lea rdx, str.Failed_to_allocate_memory
lea rcx, [rbp - 0x59]
call fcn.1400014b0
lea rdx, [0x1400447b0]
lea rcx, [rbp - 0x59]
call fcn.1400102d4
int3
lea rdx, str.Failed_to_read_the_file
lea rcx, [rbp - 0x59]
call fcn.1400014b0
lea rdx, [0x1400447b0]
lea rcx, [rbp - 0x59]
call fcn.1400102d4
int3