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

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x868
lea rax, [0x14008f256]
mov qword [rsp + 0x48], rax
test rcx, rcx
mov r14, rdx
mov rbx, rcx
lea rax, str.w__ccsUTF_8
mov word [rsp + 0x44], 0
mov r12, r8
mov qword [rsp + 0x50], rax
lea rax, str.w__ccsUTF_16LE
mov qword [rsp + 0x58], rax
sete al
test rdx, rdx
sete dl
xor ebp, ebp
or al, dl
jne 0x140022d4d
test r8, r8
je 0x140022d4d
cmp byte [r8], 0
je 0x140022d4d
cmp byte [rcx], 0
je 0x140022d4d
cmp byte [r14], 0
je 0x140022d4d
mov rcx, r8
call fcn.140021d92
mov rdx, r12
mov qword [rsp + 0x28], rax
test rax, rax
je 0x140022a08
mov rcx, rbx
call fcn.140021d92
mov qword [rsp + 0x20], rax
test rax, rax
jne 0x140022a25
mov rdx, rbx
lea rcx, str.Could_not_convert__s_to_UTF_16
call fcn.140036717
xor eax, eax
mov qword [rsp + 0x30], rax
mov qword [rsp + 0x20], rax
jmp 0x140022d49
mov rcx, r14
call fcn.140021d92
mov rdx, r14
lea rcx, str.Could_not_convert__s_to_UTF_16
mov qword [rsp + 0x30], rax
test rax, rax
je 0x140022a6a
mov rcx, qword [rsp + 0x28]
mov rbx, qword [sym.imp.msvcrt.dll__wfopen]
lea rdx, str.r__ccsUNICODE
call rbx
mov qword [rsp + 0x38], rax
test rax, rax
jne 0x140022a74
mov rdx, r12
lea rcx, str.Could_not_open_file__s_n
call fcn.140036717
jmp 0x140022d49
mov r9, qword [rsp + 0x38]
lea rcx, [rsp + 0x44]
mov edx, 2
xor r15d, r15d
mov r8d, 1
call sub.msvcrt.dll_fread
dec rax
jne 0x140022ac3
mov eax, dword [rsp + 0x44]
mov r15d, 1
cmp ax, 0xbbef
je 0x140022ab4
xor r15d, r15d
cmp ax, 0xfeff
sete r15b
add r15d, r15d
mov rcx, qword [rsp + 0x38]
xor r8d, r8d
xor edx, edx
call sub.msvcrt.dll_fseek
mov rcx, qword [rsp + 0x28]
call sub.msvcrt.dll_wcslen
mov edx, 2
lea rcx, [rax + 2]
call sub.msvcrt.dll_calloc
mov rsi, rax
test rax, rax
jne 0x140022af1
lea rcx, str.Could_not_allocate_space_for_temporary_output_name_n
call fcn.140036717
jmp 0x140022b32
mov rdx, qword [rsp + 0x28]
mov rcx, rax
xor ebp, ebp
call sub.msvcrt.dll_wcscpy
mov rcx, rsi
call sub.msvcrt.dll_wcslen
mov rcx, rsi
mov word [rsi + rax*2], 0x7e
movsxd rax, r15d
mov rdx, qword [rsp + rax*8 + 0x48]
call rbx
mov rdi, rax
test rax, rax
jne 0x140022b66
mov rdx, r12
lea rcx, str.Could_not_open_temporary_output_file__s_n
call fcn.140036717
xor ebp, ebp
xor edi, edi
jmp 0x140022c3d
lea rdx, [0x14008f7c8]
mov rcx, r13
call sub.msvcrt.dll_wcsspn
mov rbx, rax
mov ax, word [rsp + rax*2 + 0x60]
sub eax, 0x3b
test ax, 0xffdf
jne 0x140022b87
mov rdx, rdi
mov rcx, r13
call sub.msvcrt.dll_fputws
lea r13, [rsp + 0x60]
mov r8, qword [rsp + 0x38]
mov edx, 0x400
mov rcx, r13
call sub.msvcrt.dll_fgetws
test rax, rax
jne 0x140022b3b
jmp 0x140022c1c
mov rcx, qword [rsp + 0x20]
call sub.msvcrt.dll_wcslen
lea rcx, [rbx + rbx]
mov rdx, qword [rsp + 0x20]
add rcx, r13
mov r8, rax
call qword [sym.imp.msvcrt.dll__wcsnicmp]
test eax, eax
jne 0x140022b5b
mov rcx, qword [rsp + 0x20]
call sub.msvcrt.dll_wcslen
lea rdx, [0x14008f7c8]
add rbx, rax
lea rcx, [rbx + rbx]
add rcx, r13
call sub.msvcrt.dll_wcsspn
add rbx, rax
cmp word [rsp + rbx*2 + 0x60], 0x3d
jne 0x140022b5b
inc rbx
lea rdx, [0x14008f7c8]
mov rbp, r14
lea rcx, [rbx + rbx]
add rcx, r13
call sub.msvcrt.dll_wcsspn
mov rdx, rdi
mov rcx, r13
add rbx, rax
mov word [rsp + rbx*2 + 0x60], 0
call sub.msvcrt.dll_fputws
mov r8, qword [rsp + 0x30]
lea rdx, [0x14008f30e]
mov rcx, rdi
call sub.msvcrt.dll_fwprintf_s
jmp 0x140022b66
test rbp, rbp
jne 0x140022c3d
mov r9, qword [rsp + 0x30]
mov r8, qword [rsp + 0x20]
mov rcx, rdi
mov rbp, r14
lea rdx, str._s___s_n
call sub.msvcrt.dll_fwprintf_s
mov rcx, qword [rsp + 0x38]
call sub.msvcrt.dll_fclose
test rdi, rdi
je 0x140022c54
mov rcx, rdi
call sub.msvcrt.dll_fclose
test rbp, rbp
je 0x140022d05
xor ebx, ebx
test rsi, rsi
mov rdi, qword [sym.imp.msvcrt.dll__wfopen]
je 0x140022c7a
lea rdx, [0x14008ed6e]
mov rcx, rsi
call rdi
mov rbx, rax
mov rcx, qword [rsp + 0x28]
lea rdx, [0x14008f328]
call rdi
mov rdi, rax
test rbx, rbx
je 0x140022ce9
test rax, rax
je 0x140022ce9
xor r12d, r12d
cmp r15d, 2
lea r13, [rsp + 0x46]
sete r12b
inc r12
mov r9, rbx
mov r8d, 1
mov rdx, r12
mov rcx, r13
call sub.msvcrt.dll_fread
dec rax
jne 0x140022cd7
mov r9, rdi
mov r8d, 1
mov rdx, r12
mov rcx, r13
call sub.msvcrt.dll_fwrite
jmp 0x140022ca8
mov rcx, rbx
call sub.msvcrt.dll_fclose
mov rcx, rdi
call sub.msvcrt.dll_fclose
jmp 0x140022d13
mov rdx, r12
lea rcx, str.Could_not_write__s___original_file_has_been_left_unmodified_n
call fcn.140036717
test rbx, rbx
je 0x140022d09
mov rcx, rbx
call sub.msvcrt.dll_fclose
xor ebp, ebp
jmp 0x140022d13
mov rcx, rdi
test rdi, rdi
jne 0x140022d00
jmp 0x140022d05
test rsi, rsi
je 0x140022d21
mov rcx, rsi
call qword [sym.imp.msvcrt.dll__wunlink]
mov rcx, qword [rsp + 0x28]
call sub.msvcrt.dll_free
mov rcx, rsi
call sub.msvcrt.dll_free
mov rcx, qword [rsp + 0x20]
call sub.msvcrt.dll_free
mov rcx, qword [rsp + 0x30]
call sub.msvcrt.dll_free
jmp 0x140022d4d
xor esi, esi
jmp 0x140022d05
mov rax, rbp
add rsp, 0x868
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret