Function at 0x140023145
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 rdx, rdx
mov rbx, rdx
mov rdi, rcx
lea rax, str.w__ccsUTF_8
mov dword [rsp + 0x8c8], r9d
mov r15, r8
mov qword [rsp + 0x50], rax
lea rax, str.w__ccsUTF_16LE
mov qword [rsp + 0x58], rax
sete al
test r8, r8
sete dl
xor esi, esi
mov word [rsp + 0x44], 0
or al, dl
jne 0x1400234f5
test rcx, rcx
je 0x1400234f5
cmp byte [rcx], 0
je 0x1400234f5
cmp byte [rbx], 0
je 0x1400234f5
cmp byte [r8], 0
je 0x1400234f5
call fcn.140021d92
mov rdx, rdi
mov qword [rsp + 0x20], rax
test rax, rax
je 0x1400231f4
mov rcx, rbx
call fcn.140021d92
mov r13, rax
test rax, rax
jne 0x14002320b
mov rdx, rbx
lea rcx, str.Could_not_convert__s_to_UTF_16
xor r14d, r14d
xor r13d, r13d
call fcn.140036717
jmp 0x1400234e9
mov rcx, r15
call fcn.140021d92
mov rdx, r15
lea rcx, str.Could_not_convert__s_to_UTF_16
mov r14, rax
test rax, rax
je 0x14002324e
mov rcx, qword [rsp + 0x20]
mov rsi, qword [sym.imp.msvcrt.dll__wfopen]
lea rdx, str.r__ccsUNICODE
call rsi
mov qword [rsp + 0x28], rax
test rax, rax
jne 0x140023258
mov rdx, rdi
lea rcx, str.Could_not_open_file__s_n
call fcn.140036717
jmp 0x1400234e9
mov r9, qword [rsp + 0x28]
lea rcx, [rsp + 0x44]
mov r8d, 1
mov edx, 2
call sub.msvcrt.dll_fread
dec rax
je 0x140023290
mov rdx, rdi
lea rcx, str.Could_not_read_file__s_n
xor r12d, r12d
xor ebx, ebx
call fcn.140036717
jmp 0x1400233bf
mov eax, dword [rsp + 0x44]
mov r12d, 1
cmp ax, 0xbbef
je 0x1400232ae
xor r12d, r12d
cmp ax, 0xfeff
sete r12b
add r12d, r12d
mov rcx, qword [rsp + 0x28]
xor r8d, r8d
xor edx, edx
call sub.msvcrt.dll_fseek
mov rcx, qword [rsp + 0x20]
call sub.msvcrt.dll_wcslen
mov edx, 2
lea rcx, [rax + 2]
call sub.msvcrt.dll_calloc
mov rbx, rax
test rax, rax
jne 0x1400232ee
lea rcx, str.Could_not_allocate_space_for_temporary_output_name_n
call fcn.140036717
jmp 0x1400233bf
mov rdx, qword [rsp + 0x20]
mov rcx, rax
call sub.msvcrt.dll_wcscpy
mov rcx, rbx
call sub.msvcrt.dll_wcslen
mov rcx, rbx
mov word [rbx + rax*2], 0x7e
movsxd rax, r12d
mov rdx, qword [rsp + rax*8 + 0x48]
call rsi
xor esi, esi
mov rbp, rax
test rax, rax
jne 0x140023380
mov rdx, rdi
lea rcx, str.Could_not_open_temporary_output_file__s_n
call fcn.140036717
jmp 0x1400233bf
mov rcx, qword [rsp + 0x30]
lea rdx, [0x14008f7c8]
call sub.msvcrt.dll_wcsspn
mov rcx, r13
mov qword [rsp + 0x38], rax
call sub.msvcrt.dll_wcslen
mov rdx, qword [rsp + 0x38]
mov r8, rax
mov rax, qword [rsp + 0x30]
add rdx, rdx
lea rcx, [rax + rdx]
mov rdx, r13
call qword [sym.imp.msvcrt.dll__wcsnicmp]
mov rcx, qword [rsp + 0x30]
mov rdx, rbp
test eax, eax
je 0x1400233a3
call sub.msvcrt.dll_fputws
lea rax, [rsp + 0x60]
mov r8, qword [rsp + 0x28]
mov edx, 0x400
mov rcx, rax
mov qword [rsp + 0x30], rax
call sub.msvcrt.dll_fgetws
test rax, rax
jne 0x140023334
jmp 0x1400233c3
call sub.msvcrt.dll_fputws
mov r8, r14
mov rcx, rbp
mov rsi, r15
lea rdx, [0x14008f30e]
call sub.msvcrt.dll_fwprintf_s
jmp 0x140023380
xor esi, esi
xor ebp, ebp
mov rcx, qword [rsp + 0x28]
call sub.msvcrt.dll_fclose
test rbp, rbp
je 0x1400233da
mov rcx, rbp
call sub.msvcrt.dll_fclose
test rsi, rsi
je 0x1400234b7
test rbx, rbx
je 0x1400234c5
cmp qword [rsp + 0x20], 0
je 0x1400234bc
mov rbp, qword [sym.imp.msvcrt.dll__wfopen]
lea rdx, [0x14008ed6e]
mov rcx, rbx
call rbp
mov rcx, qword [rsp + 0x20]
lea rdx, [0x14008f328]
mov r15, rax
call rbp
mov rbp, rax
test r15, r15
je 0x14002348d
test rax, rax
je 0x14002348d
xor edi, edi
cmp r12d, 2
lea r12, [rsp + 0x46]
sete dil
inc rdi
mov r9, r15
mov r8d, 1
mov rdx, rdi
mov rcx, r12
call sub.msvcrt.dll_fread
dec rax
jne 0x14002347b
cmp dword [rsp + 0x8c8], 0
je 0x140023465
cmp byte [rsp + 0x46], 0xd
je 0x14002343b
mov r9, rbp
mov r8d, 1
mov rdx, rdi
mov rcx, r12
call sub.msvcrt.dll_fwrite
jmp 0x14002343b
mov rcx, r15
call sub.msvcrt.dll_fclose
mov rcx, rbp
call sub.msvcrt.dll_fclose
jmp 0x1400234bc
lea rcx, str.Could_not_write__s___original_file_has_been_left_unmodified_n
mov rdx, rdi
call fcn.140036717
mov rcx, r15
test r15, r15
jne 0x1400234b0
mov rcx, rbp
test rbp, rbp
jne 0x1400234b0
xor esi, esi
jmp 0x1400234bc
call sub.msvcrt.dll_fclose
jmp 0x1400234ac
test rbx, rbx
je 0x1400234c5
mov rcx, rbx
call qword [sym.imp.msvcrt.dll__wunlink]
mov rcx, qword [rsp + 0x20]
call sub.msvcrt.dll_free
mov rcx, rbx
call sub.msvcrt.dll_free
mov rcx, r13
call sub.msvcrt.dll_free
mov rcx, r14
call sub.msvcrt.dll_free
jmp 0x1400234f5
xor esi, esi
xor r12d, r12d
xor ebx, ebx
jmp 0x1400233da
mov rax, rsi
add rsp, 0x868
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret