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

Disassembly:
mov qword [rsp + 8], rcx
push rbp
push rbx
push rsi
push rdi
push r12
push r14
push r15
mov rbp, rsp
sub rsp, 0x80
mov qword [rbp - 0x38], 0xfffffffffffffffe
mov rbx, rdx
lea rcx, [0x1400403c0]
call sub.msvcrt.dll_wprintf
xor edi, edi
test rbx, rbx
je 0x140021adb
mov qword [rsp + 0x30], rdi
mov dword [rsp + 0x28], edi
mov dword [rsp + 0x20], 3
xor r9d, r9d
mov edx, 0x80000000
lea r8d, [r9 + 1]
mov rcx, qword [rbx + 0x10]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rsi, rax
lea rax, [0x14003f0a8]
mov qword [rbp - 0x20], rax
mov qword [rbp - 0x18], rsi
cmp rsi, 0xffffffffffffffff
jne 0x14002191e
call qword [sym.imp.KERNEL32.dll_GetLastError]
movzx ecx, ax
or ecx, 0x80070000
test eax, eax
cmovle ecx, eax
lea rdx, str.CreateFile_error_restoring_partial_file
call fcn.14001aa8c
mov qword [rbp - 0x30], rdi
and qword [rbp - 0x28], 0
mov rdx, qword [rbx + 0x28]
lea rcx, [rbp - 0x30]
call fcn.140028b28
mov r14d, edi
mov r12, rdi
mov r15, qword [rbp - 0x30]
cmp dword [rbp - 0x28], edi
jle 0x140021a9c
mov rax, r15
mov qword [rbp - 0x40], rax
test r12, r12
js 0x140021aed
cmp r14d, dword [rbp - 0x28]
jge 0x140021aed
movups xmm0, xmmword [rax]
movups xmmword [rbp - 0x10], xmm0
xor r9d, r9d
xor r8d, r8d
movd edx, xmm0
mov rcx, qword [rbx + 0x20]
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x1400219a1
call qword [sym.imp.KERNEL32.dll_GetLastError]
movzx ecx, ax
or ecx, 0x80070000
test eax, eax
cmovle ecx, eax
lea rdx, str.SetFilePointer_error_restoring_partial_file
call fcn.14001aa8c
mov edi, dword [rbp - 8]
test edi, edi
je 0x140021a7b
mov r15, qword [rbp + 0x40]
mov ecx, 0x100000
mov eax, ecx
cmp edi, ecx
cmovb eax, edi
mov dword [rbp + 0x58], eax
and dword [rbp + 0x48], 0
and dword [rbp + 0x50], 0
and qword [rsp + 0x20], 0
lea r9, [rbp + 0x48]
mov r8d, eax
mov rdx, qword [r15 + 0x90]
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x140021a08
call qword [sym.imp.KERNEL32.dll_GetLastError]
movzx ecx, ax
or ecx, 0x80070000
test eax, eax
cmovle ecx, eax
lea rdx, str.ReadFile_error_restoring_partial_file
call fcn.14001aa8c
mov r8d, dword [rbp + 0x48]
cmp dword [rbp + 0x58], r8d
cmovne edi, r8d
and qword [rsp + 0x20], 0
lea r9, [rbp + 0x50]
mov rdx, qword [r15 + 0x90]
mov rcx, qword [rbx + 0x20]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x140021a53
call qword [sym.imp.KERNEL32.dll_GetLastError]
movzx ecx, ax
or ecx, 0x80070000
test eax, eax
cmovle ecx, eax
lea rdx, str.WriteFile_error_restoring_partial_file
call fcn.14001aa8c
mov eax, dword [rbp + 0x48]
cmp eax, dword [rbp + 0x50]
je 0x140021a6f
lea rdx, str.couldnt_finish_writing_to_destination_file_of_partial_file_backup
mov ecx, 0x8000ffff
call fcn.14001aa8c
mov eax, dword [rbp + 0x48]
sub edi, eax
jne 0x1400219b0
mov r15, qword [rbp - 0x30]
inc r14d
inc r12
mov rax, qword [rbp - 0x40]
add rax, 0x10
mov qword [rbp - 0x40], rax
cmp r14d, dword [rbp - 0x28]
mov edi, 0
jl 0x14002194e
mov rbx, qword [rbx + 8]
test r15, r15
je 0x140021ab2
mov rcx, r15
call qword [sym.imp.msvcrt.dll_free]
mov qword [rbp - 0x30], rdi
and qword [rbp - 0x28], 0
cmp rsi, 0xffffffffffffffff
je 0x140021ac6
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
or qword [rbp - 0x18], 0xffffffffffffffff
lea rax, [0x14003efd0]
mov qword [rbp - 0x20], rax
jmp 0x1400218b6
add rsp, 0x80
pop r15
pop r14
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret
mov edx, 1
mov ecx, 0xc000008c
call fcn.140028b14
int3
push rbx
sub rsp, 0x20
mov rdx, qword [rcx + 0x60]
mov rbx, rcx
call fcn.140021634
mov rdx, qword [rbx + 0x68]
mov rcx, rbx
add rsp, 0x20
pop rbx
jmp 0x140021884