Function at 0x164f99c40
Capabilities:
Check if file exists
Delete file
Read file on windows
Write file on windows

Disassembly:
mov byte [rsp + 0x20], r9b
mov qword [rsp + 0x18], r8
mov qword [rsp + 0x10], rdx
mov qword [rsp + 8], rcx
push rbp
push rbx
push rsi
push rdi
push r12
push r14
push r15
lea rbp, [rsp - 0xb0]
sub rsp, 0x1b0
mov rax, qword [0x16514b200]
xor rax, rsp
mov qword [rbp + 0xa0], rax
mov r15, qword [rbp + 0xf0]
mov r14, qword [rbp + 0xf8]
mov qword [rbp - 0x20], r14
mov rdi, qword [rbp + 0x100]
mov qword [rbp + 8], rdi
xor r12d, r12d
mov dword [rsp + 0x40], r12d
xorps xmm0, xmm0
movups xmmword [r14], xmm0
mov qword [rsp + 0x30], r12
mov dword [rsp + 0x28], 0x80
mov dword [rsp + 0x20], 3
xor r9d, r9d
mov edx, 0x10005
lea r8d, [r12 + 7]
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rdx, rax
mov rcx, r14
call fcn.164f981a0
mov dword [rsp + 0x40], 1
mov rax, qword [r14]
test rax, rax
je 0x164f99cfa
cmp qword [rax], 0xffffffffffffffff
je 0x164f99cfa
mov cl, 1
jmp 0x164f99cfc
xor cl, cl
test cl, cl
jne 0x164f9a011
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov rsi, 0xffffffffffffffff
cmp eax, 2
je 0x164f99d69
cmp eax, 3
jne 0x164f9a15e
mov qword [rsp + 0x50], rdi
mov rax, rsi
nop word [rax + rax]
inc rax
cmp word [rdi + rax*2], 0
jne 0x164f99d30
mov qword [rsp + 0x58], rax
movaps xmm0, xmmword [rsp + 0x50]
movdqa xmmword [rbp - 0x50], xmm0
lea rdx, [rbp - 0x50]
lea rcx, [rbp + 0x68]
call fcn.164f9ef40
nop
mov rcx, rax
call fcn.164f9f0c0
nop
lea rcx, [rbp + 0x68]
call fcn.164e54bf0
xorps xmm0, xmm0
movups xmmword [rbp - 0x40], xmm0
mov qword [rbp - 0x30], r12
mov qword [rbp - 0x28], r12
mov r8, rsi
nop dword [rax + rax]
inc r8
cmp word [rdi + r8*2], 0
jne 0x164f99d80
mov rdx, rdi
lea rcx, [rbp - 0x40]
call fcn.164e485e0
nop
mov r8d, 5
lea rdx, str..tmp.
lea rcx, [rbp - 0x40]
call fcn.164e54db0
xorps xmm0, xmm0
movups xmmword [rbp + 0x28], xmm0
mov qword [rbp + 0x38], r12
mov qword [rbp + 0x40], r12
movups xmm0, xmmword [rax]
movups xmmword [rbp + 0x28], xmm0
movups xmm1, xmmword [rax + 0x10]
movups xmmword [rbp + 0x38], xmm1
mov qword [rax + 0x10], r12
mov qword [rax + 0x18], 7
mov word [rax], r12w
mov dword [rsp + 0x40], 5
lea rcx, [rbp - 0x40]
call fcn.164e54bf0
call fcn.164fa5a20
mov rbx, rax
mov qword [rsp + 0x60], rax
call fcn.164fa5a20
mov qword [rsp + 0x68], rax
shr rbx, 0x30
mov ecx, 0xfff
and bx, cx
mov ecx, 0x4000
or bx, cx
mov word [rsp + 0x66], bx
and al, 0x3f
or al, 0x80
mov byte [rsp + 0x68], al
movaps xmm0, xmmword [rsp + 0x60]
movdqa xmmword [rsp + 0x70], xmm0
lea rdx, [rsp + 0x70]
lea rcx, [rbp - 0x70]
call fcn.164ee7260
nop
mov r8, qword [rax + 0x10]
cmp qword [rax + 0x18], 7
jbe 0x164f99e4d
mov rax, qword [rax]
mov rdx, rax
lea rcx, [rbp + 0x28]
call fcn.164e54db0
nop
lea rcx, [rbp - 0x70]
call fcn.164e54bf0
lea rcx, [rbp + 0x28]
cmp qword [rbp + 0x40], 7
cmova rcx, qword [rbp + 0x28]
mov qword [rsp + 0x30], r12
mov dword [rsp + 0x28], 0x80
mov dword [rsp + 0x20], 1
xor r9d, r9d
mov edx, 0x10005
lea r8d, [r9 + 7]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rbx, rax
mov ecx, 0x18
call fcn.165001480
mov rcx, rax
mov qword [rbp - 0x80], rax
xorps xmm0, xmm0
movups xmmword [rax], xmm0
mov dword [rax + 8], 1
mov dword [rax + 0xc], 1
lea rax, vtable.std::_Ref_count_obj2_class_asw::wrappers::basic_handle_void____ptr64__struct_asw::wrappers::detail::traits_file_handle__.0
mov qword [rcx], rax
lea rax, [rcx + 0x10]
mov qword [rax], rbx
mov dword [rsp + 0x40], 7
mov qword [rbp - 0x80], rax
mov qword [rbp - 0x78], rcx
lea rdx, [rbp - 0x80]
mov rcx, r14
call fcn.164e52a80
mov rcx, qword [rbp - 0x78]
test rcx, rcx
je 0x164f99f36
mov eax, esi
lock xadd dword [rcx + 8], eax
cmp eax, 1
jne 0x164f99f32
mov rbx, qword [rbp - 0x78]
mov rax, qword [rbx]
mov rcx, rbx
mov rax, qword [rax]
call qword [case.0x164e9d7b8.0]
mov eax, esi
lock xadd dword [rbx + 0xc], eax
cmp eax, 1
jne 0x164f99f32
mov rcx, qword [rbp - 0x78]
mov rax, qword [rcx]
mov rax, qword [rax + 8]
call qword [case.0x164e9d7b8.0]
mov rdi, qword [rbp + 8]
mov rax, qword [r14]
test rax, rax
je 0x164f99f48
cmp qword [rax], 0xffffffffffffffff
je 0x164f99f48
mov cl, 1
jmp 0x164f99f4a
xor cl, cl
test cl, cl
je 0x164f9a1a9
mov word [rbp + 0x14], 0xbbef
mov byte [rbp + 0x16], 0xbf
mov dword [rbp + 0x1c], r12d
test rax, rax
je 0x164f99f6a
mov rcx, qword [rax]
jmp 0x164f99f6d
mov rcx, rsi
mov qword [rsp + 0x20], r12
lea r9, [rbp + 0x1c]
mov r8d, 3
lea rdx, [rbp + 0x14]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x164f9a1f4
mov qword [rsp + 0x50], rdi
mov rax, rsi
inc rax
cmp word [rdi + rax*2], 0
jne 0x164f99f96
mov qword [rsp + 0x58], rax
mov rcx, qword [r14]
test rcx, rcx
je 0x164f99fb2
mov rcx, qword [rcx]
jmp 0x164f99fb5
mov rcx, rsi
movaps xmm0, xmmword [rsp + 0x50]
movdqa xmmword [rsp + 0x70], xmm0
lea rdx, [rsp + 0x70]
call fcn.164f9f680
test al, al
jne 0x164f99fe3
lea rcx, [rbp + 0x28]
cmp qword [rbp + 0x40], 7
cmova rcx, qword [rbp + 0x28]
call qword [sym.imp.KERNEL32.dll_DeleteFileW]
nop
lea rcx, [rbp + 0x28]
call fcn.164e54bf0
xor eax, eax
mov word [rbp + 0x10], ax
mov byte [rbp + 0x12], al
mov dword [rbp + 0x20], r12d
xorps xmm0, xmm0
movups xmmword [rbp + 0x48], xmm0
movups xmmword [rbp + 0x58], xmm0
mov rcx, qword [r14]
test rcx, rcx
je 0x164f9a046
mov rcx, qword [rcx]
jmp 0x164f9a049
mov rsi, 0xffffffffffffffff
test rax, rax
je 0x164f9a022
mov rcx, qword [rax]
jmp 0x164f9a025
mov rcx, rsi
lea rdx, [rbp + 0x68]
call qword [sym.imp.KERNEL32.dll_GetFileInformationByHandle]
test eax, eax
je 0x164f9a216
cmp dword [rbp + 0x90], 1
jne 0x164f9a13f
jmp 0x164f99fec
mov rcx, rsi
lea rax, [rbp + 0x48]
mov qword [rsp + 0x20], rax
lea r9, [rbp + 0x20]
mov r8d, 3
lea rdx, [rbp + 0x10]
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x164f9a079
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x26
jne 0x164f9a238
mov word [rbp + 0x18], 0xbbef
movzx eax, word [rbp + 0x10]
cmp ax, word [rbp + 0x18]
jne 0x164f9a08f
cmp byte [rbp + 0x12], 0xbf
je 0x164f9a0d8
cmp byte [rbp + 0x108], 0
jne 0x164f9a0fc
mov rax, qword [r14]
test rax, rax
je 0x164f9a0a3
mov rsi, qword [rax]
lea rdx, [r15 + 0xb8]
mov rcx, rsi
call fcn.164f99390
mov r9b, 1
mov r8, rdi
lea rdx, [rbp - 0x50]
mov rcx, r15
call fcn.164f99c40
mov rdx, rax
mov rcx, r14
call fcn.164e52a80
lea rcx, [rbp - 0x50]
call fcn.164e51d90
mov rax, r14
mov rcx, qword [rbp + 0xa0]
xor rcx, rsp
call fcn.165001080
add rsp, 0x1b0
pop r15
pop r14
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret
lea rax, str.BOM_not_present_in_
mov qword [rsp + 0x50], rax
mov qword [rsp + 0x58], 0x17
movaps xmm0, xmmword [rsp + 0x50]
movdqa xmmword [rsp + 0x70], xmm0
lea r8, [rbp + 8]
lea rdx, [rsp + 0x70]
lea rcx, [rbp - 0x70]
call fcn.164f9c3e0
lea rdx, [0x165147178]
lea rcx, [rbp - 0x70]
call fcn.165003be0
int3
mov edx, 0x649
lea rcx, [rbp - 0x70]
call fcn.164ea52e0
lea rdx, [0x165147178]
lea rcx, [rbp - 0x70]
call fcn.165003be0
int3
lea rax, str.Failed_to_open_log_file_
mov qword [rsp + 0x60], rax
mov qword [rsp + 0x68], 0x1c
call qword [sym.imp.KERNEL32.dll_GetLastError]
movaps xmm0, xmmword [rsp + 0x60]
movdqa xmmword [rsp + 0x50], xmm0
lea r9, [rbp + 8]
lea r8, [rsp + 0x50]
mov edx, eax
lea rcx, [rbp - 0x18]
call fcn.164f9c310
lea rdx, [0x165147178]
lea rcx, [rbp - 0x18]
call fcn.165003be0
nop
lea rax, str.Failed_to_create_new_log_file_
mov qword [rsp + 0x50], rax
mov qword [rsp + 0x58], 0x22
call qword [sym.imp.KERNEL32.dll_GetLastError]
movaps xmm0, xmmword [rsp + 0x50]
movdqa xmmword [rsp + 0x70], xmm0
lea r9, [rbp + 0x28]
lea r8, [rsp + 0x70]
mov edx, eax
lea rcx, [rbp - 0x70]
call fcn.164ecb790
lea rdx, [0x165147178]
lea rcx, [rbp - 0x70]
call fcn.165003be0
int3
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, [rbp - 0x70]
call fcn.164ea52e0
lea rdx, [0x165147178]
lea rcx, [rbp - 0x70]
call fcn.165003be0
nop
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, [rbp - 0x70]
call fcn.164ea52e0
lea rdx, [0x165147178]
lea rcx, [rbp - 0x70]
call fcn.165003be0
int3
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, [rbp - 0x70]
call fcn.164ea52e0
lea rdx, [0x165147178]
lea rcx, [rbp - 0x70]
call fcn.165003be0
int3