Function at 0x140018654
Capabilities:
Get file size
Read file on windows

Disassembly:
mov rax, rsp
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x50
mov qword [rax - 0x38], 0xfffffffffffffffe
mov qword [rax + 8], rbp
mov qword [rax + 0x18], rsi
mov r14d, r9d
mov r12, r8
xor r13d, r13d
mov qword [rax + 0x10], r13
or rdi, 0xffffffffffffffff
test rdx, rdx
jne 0x14001868f
mov eax, r13d
jmp 0x14001869c
mov rax, rdi
inc rax
cmp word [rdx + rax*2], r13w
jne 0x140018692
mov r8d, eax
lea rcx, [rsp + 0x88]
call fcn.14000a054
lea rdx, [0x14003f0d0]
mov rax, rdi
inc rax
cmp word [rdx + rax*2], r13w
jne 0x1400186b6
mov r8d, eax
lea rcx, [rsp + 0x88]
call fcn.14000a054
test r12, r12
jne 0x1400186da
mov eax, r13d
jmp 0x1400186e7
mov rax, rdi
inc rax
cmp word [r12 + rax*2], r13w
jne 0x1400186dd
mov r8d, eax
mov rdx, r12
lea rcx, [rsp + 0x88]
call fcn.14000a054
mov qword [rsp + 0x30], r13
mov dword [rsp + 0x28], r13d
mov dword [rsp + 0x20], 3
xor r9d, r9d
mov edx, 0xc0000000
lea r8d, [r9 + 1]
mov rcx, qword [rsp + 0x88]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rsi, rax
mov r15d, 0x8000ffff
cmp rax, rdi
jne 0x140018759
call qword [sym.imp.KERNEL32.dll_GetLastError]
add eax, 0xfffffffe
cmp eax, 1
ja 0x140018759
mov r8, qword [rsp + 0x88]
lea rdx, str._s_was_not_restored._n
mov ecx, r15d
call fcn.14001aa8c
xor edx, edx
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebp, eax
cmp eax, 0xffffffff
jne 0x140018799
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
movzx ecx, di
or ecx, 0x80070000
test edi, edi
cmovle ecx, edi
mov r8d, edi
lea rdx, str.GetFileSize_failed_due_to_error__d._n
call fcn.14001aa8c
cmp ebp, r14d
je 0x1400187be
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov r8, qword [rsp + 0x88]
lea rdx, str.Failed_to_restore_file__s_correctly._n
mov ecx, r15d
call fcn.14001aa8c
mov r15, r14
lea rdx, [0x14003ef00]
mov rcx, r14
call fcn.14002c89c
mov rbp, rax
test rax, rax
jne 0x1400187f2
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
lea rdx, str.Out_of_memory._n
mov ecx, 0x8007000e
call fcn.14001aa8c
mov qword [rsp + 0x20], r13
lea r9, [rsp + 0x98]
mov r8d, r14d
mov rdx, rbp
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x140018848
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov rcx, rbp
call fcn.14002bfcc
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
movzx ecx, di
or ecx, 0x80070000
test edi, edi
cmovle ecx, edi
mov r8d, edi
lea rdx, str.Write_file_failed_due_to_error__d._n
call fcn.14001aa8c
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
movzx edi, word [r12]
add edi, r14d
test r14d, r14d
je 0x140018892
mov rsi, rbp
cmp byte [rsi], dil
je 0x140018887
mov rcx, rbp
call fcn.14002bfcc
mov r8, qword [rsp + 0x88]
lea rdx, str.Failed_to_restore_file__s_correctly._n
mov ecx, 0x8000ffff
call fcn.14001aa8c
inc rsi
inc edi
sub r15, 1
jne 0x140018861
mov rcx, rbp
call fcn.14002bfcc
nop
mov rcx, qword [rsp + 0x88]
call qword [sym.imp.OLEAUT32.dll_SysStringLen]
lea r11, [rsp + 0x50]
mov rbp, qword [r11 + 0x30]
mov rsi, qword [r11 + 0x40]
mov rsp, r11
pop r15
pop r14
pop r13
pop r12
pop rdi
ret