Function at 0x140167310
Capabilities:
Write file on windows

Disassembly:
push rbx
push rbp
push rsi
push rdi
push r12
push r14
sub rsp, 0x5f8
mov rax, qword [0x140210348]
xor rax, rsp
mov qword [rsp + 0x5e0], rax
xor edi, edi
test r8d, r8d
mov ebp, r8d
mov r12, rdx
movsxd rbx, ecx
mov r14d, edi
mov esi, edi
jne 0x14016734e
xor eax, eax
jmp 0x140167a68
test rdx, rdx
jne 0x140167381
call fcn.140160dc0
mov dword [rax], edi
call fcn.140160d90
xor r9d, r9d
xor r8d, r8d
xor edx, edx
xor ecx, ecx
mov dword [rax], 0x16
mov qword [rsp + 0x20], rdi
call fcn.14015fd60
or eax, 0xffffffff
jmp 0x140167a68
mov qword [rsp + 0x648], r13
mov rax, rbx
mov qword [rsp + 0x5f0], r15
and eax, 0x1f
mov r15, rbx
lea rcx, [0x140231200]
sar r15, 5
lea r13, [rax + rax*4]
mov rcx, qword [rcx + r15*8]
shl r13, 4
mov qword [rsp + 0x50], r15
movzx edi, byte [r13 + rcx + 0x38]
mov qword [rsp + 0x58], r13
add dil, dil
sar dil, 1
cmp dil, 2
je 0x1401673d3
cmp dil, 1
jne 0x140167408
mov eax, ebp
not eax
test al, 1
jne 0x140167408
call fcn.140160dc0
xor ebx, ebx
mov dword [rax], ebx
call fcn.140160d90
xor r9d, r9d
xor r8d, r8d
xor edx, edx
xor ecx, ecx
mov dword [rax], 0x16
mov qword [rsp + 0x20], rbx
call fcn.14015fd60
jmp 0x140167a55
test byte [r13 + rcx + 8], 0x20
je 0x14016741d
xor edx, edx
mov ecx, ebx
lea r8d, [rdx + 2]
call fcn.140175790
mov ecx, ebx
call fcn.140175710
test eax, eax
je 0x1401676d0
lea rdx, [0x140231200]
mov rax, qword [rdx + r15*8]
test byte [r13 + rax + 8], 0x80
je 0x1401676e9
call fcn.140165630
xor ebx, ebx
lea rdx, [rsp + 0x48]
mov rcx, qword [rax + 0xc0]
lea rax, [0x140231200]
cmp dword [rcx + 0x14], ebx
mov rcx, qword [rax + r15*8]
mov rcx, qword [r13 + rcx]
sete bl
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x1401676e2
test ebx, ebx
je 0x140167487
test dil, dil
je 0x1401676d9
call qword [sym.imp.KERNEL32.dll_GetConsoleCP]
test ebp, ebp
mov dword [rsp + 0x4c], esi
mov r13d, eax
mov dword [rsp + 0x48], eax
mov rbx, r12
je 0x1401676c6
mov r15d, dword [rsp + 0x48]
nop
nop
test dil, dil
jne 0x140167610
movsx ecx, byte [rbx]
xor r15d, r15d
cmp cl, 0xa
sete r15b
call fcn.14016bce0
test eax, eax
jne 0x1401674ef
lea r8d, [rax + 1]
lea rcx, [rsp + 0x40]
mov rdx, rbx
call fcn.140175c80
cmp eax, 0xffffffff
jne 0x14016751a
mov r15d, dword [rsp + 0x48]
jmp 0x1401679d7
mov rax, rbp
sub rax, rbx
add rax, r12
cmp rax, 1
jle 0x1401674e5
lea rcx, [rsp + 0x40]
mov r8d, 2
mov rdx, rbx
call fcn.140175c80
cmp eax, 0xffffffff
je 0x1401674e5
add rbx, 1
xor eax, eax
lea r8, [rsp + 0x40]
mov r9d, 1
mov qword [rsp + 0x38], rax
mov qword [rsp + 0x30], rax
lea rax, [rsp + 0x60]
xor edx, edx
mov ecx, r13d
mov dword [rsp + 0x28], 5
mov qword [rsp + 0x20], rax
add rbx, 1
call qword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
test eax, eax
mov r13d, eax
je 0x1401674e5
mov rax, qword [rsp + 0x50]
lea rcx, [0x140231200]
lea r9, [rsp + 0x4c]
mov rcx, qword [rcx + rax*8]
mov rax, qword [rsp + 0x58]
lea rdx, [rsp + 0x60]
mov rcx, qword [rax + rcx]
mov r8d, r13d
mov qword [rsp + 0x20], 0
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x14016769c
mov eax, dword [rsp + 0x4c]
add r14d, eax
cmp eax, r13d
jl 0x1401674e5
test r15d, r15d
je 0x140167609
mov rax, qword [rsp + 0x50]
mov byte [rsp + 0x60], SafeArrayDestroy
lea rcx, [0x140231200]
mov rcx, qword [rcx + rax*8]
mov rax, qword [rsp + 0x58]
lea r9, [rsp + 0x4c]
mov rcx, qword [rax + rcx]
lea rdx, [rsp + 0x60]
mov r8d, 1
mov qword [rsp + 0x20], 0
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x14016768e
cmp dword [rsp + 0x4c], 1
jl 0x1401674e5
mov r13d, dword [rsp + 0x48]
add esi, 1
add r14d, 1
jmp 0x140167677
mov r13d, dword [rsp + 0x48]
jmp 0x140167677
cmp dil, 1
je 0x14016761c
cmp dil, 2
jne 0x140167633
movzx eax, word [rbx]
xor r15d, r15d
cmp ax, 0xa
mov word [rsp + 0x40], ax
sete r15b
add rbx, 2
cmp dil, 1
je 0x14016763f
cmp dil, 2
jne 0x140167677
movzx ecx, word [rsp + 0x40]
call fcn.140176130
cmp ax, word [rsp + 0x40]
jne 0x1401676b8
add r14d, 1
test r15d, r15d
je 0x140167677
mov cx, SafeArrayDestroy
mov word [rsp + 0x40], SafeArrayDestroy
call fcn.140176130
cmp ax, word [rsp + 0x40]
jne 0x1401676aa
add r14d, 1
add esi, 1
mov eax, ebx
sub eax, r12d
cmp eax, ebp
jb 0x1401674b0
mov r15d, dword [rsp + 0x48]
jmp 0x1401679d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
jmp 0x1401679d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
jmp 0x1401679d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
jmp 0x1401679d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
jmp 0x1401679d7
mov r15d, dword [rsp + 0x48]
jmp 0x1401679ed
lea rdx, [0x140231200]
jmp 0x1401676e9
lea rdx, [0x140231200]
jmp 0x1401676e9
lea rdx, [0x140231200]
mov rcx, qword [rdx + r15*8]
test byte [r13 + rcx + 8], 0x80
je 0x1401679b0
xor r15d, r15d
test dil, dil
jne 0x1401677be
test ebp, ebp
mov rdi, r12
je 0x140167a23
lea rbx, [rsp + 0x70]
xor ecx, ecx
mov eax, edi
sub eax, r12d
cmp eax, ebp
jae 0x14016774c
movzx eax, byte [rdi]
add rdi, 1
cmp al, 0xa
jne 0x140167739
mov byte [rbx], SafeArrayDestroy
add rbx, 1
add esi, 1
add rcx, 1
add rcx, 1
mov byte [rbx], al
add rbx, 1
cmp rcx, 0x400
jb 0x140167717
lea rax, [rsp + 0x70]
mov r8d, ebx
lea r9, [rsp + 0x44]
sub r8d, eax
mov rax, qword [rsp + 0x50]
mov qword [rsp + 0x20], r15
mov rcx, qword [rdx + rax*8]
lea rdx, [rsp + 0x70]
mov rcx, qword [r13 + rcx]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1401677b0
movsxd rax, dword [rsp + 0x44]
lea rcx, [rsp + 0x70]
sub rbx, rcx
add r14d, eax
cmp rax, rbx
jl 0x1401679d7
mov eax, edi
lea rdx, [0x140231200]
sub eax, r12d
cmp eax, ebp
jb 0x140167710
jmp 0x1401679d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
jmp 0x1401679d7
cmp dil, 2
jne 0x140167893
test ebp, ebp
mov rdi, r12
je 0x140167a23
nop
nop
nop
nop
lea rbx, [rsp + 0x70]
xor ecx, ecx
mov eax, edi
sub eax, r12d
cmp eax, ebp
jae 0x140167821
movzx eax, word [rdi]
add rdi, 2
cmp ax, 0xa
jne 0x14016780d
mov word [rbx], SafeArrayDestroy
add rbx, 2
add esi, 2
add rcx, 2
add rcx, 2
mov word [rbx], ax
add rbx, 2
cmp rcx, 0x3ff
jb 0x1401677e7
lea rax, [rsp + 0x70]
mov r8d, ebx
lea r9, [rsp + 0x44]
sub r8d, eax
mov rax, qword [rsp + 0x50]
mov qword [rsp + 0x20], r15
mov rcx, qword [rdx + rax*8]
lea rdx, [rsp + 0x70]
mov rcx, qword [r13 + rcx]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x140167885
movsxd rax, dword [rsp + 0x44]
lea rcx, [rsp + 0x70]
sub rbx, rcx
add r14d, eax
cmp rax, rbx
jl 0x1401679d7
mov eax, edi
lea rdx, [0x140231200]
sub eax, r12d
cmp eax, ebp
jb 0x1401677e0
jmp 0x1401679d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
jmp 0x1401679d7
test ebp, ebp
mov rdi, r12
je 0x140167a23
nop
lea rcx, [rsp + 0x480]
xor edx, edx
nop
nop
mov eax, edi
sub eax, r12d
cmp eax, ebp
jae 0x1401678e7
movzx eax, word [rdi]
add rdi, 2
cmp ax, 0xa
jne 0x1401678d3
mov word [rcx], SafeArrayDestroy
add rcx, 2
add rdx, 2
add rdx, 2
mov word [rcx], ax
add rcx, 2
cmp rdx, 0x152
jb 0x1401678b0
lea rax, [rsp + 0x480]
mov qword [rsp + 0x38], rsi
mov qword [rsp + 0x30], rsi
sub ecx, eax
lea r8, [rsp + 0x480]
mov dword [rsp + 0x28], 0x2ab
mov eax, ecx
mov ecx, 0xfde9
cdq
sub eax, edx
xor edx, edx
sar eax, 1
mov r9d, eax
lea rax, [rsp + 0x70]
mov qword [rsp + 0x20], rax
call qword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
test eax, eax
mov r13d, eax
je 0x1401679a5
xor ebx, ebx
nop
nop
nop
mov rax, qword [rsp + 0x50]
movsxd rcx, ebx
mov r8d, r13d
lea rdx, [rsp + rcx + 0x70]
lea rcx, [0x140231200]
lea r9, [rsp + 0x44]
mov rcx, qword [rcx + rax*8]
mov rax, qword [rsp + 0x58]
sub r8d, ebx
mov rcx, qword [rax + rcx]
mov qword [rsp + 0x20], rsi
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x140167986
add ebx, dword [rsp + 0x44]
cmp r13d, ebx
jg 0x140167940
jmp 0x140167994
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp r13d, ebx
mov r15d, eax
jg 0x1401679d7
mov r14d, edi
sub r14d, r12d
cmp r14d, ebp
jb 0x1401678a0
jmp 0x1401679d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
jmp 0x1401679d7
mov rcx, qword [r13 + rcx]
lea r9, [rsp + 0x44]
mov r8d, ebp
mov rdx, r12
mov qword [rsp + 0x20], rsi
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1401679e4
mov r14d, dword [rsp + 0x44]
xor r15d, r15d
test r14d, r14d
je 0x1401679ed
sub r14d, esi
mov eax, r14d
jmp 0x140167a58
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r15d, eax
test r15d, r15d
je 0x140167a17
cmp r15d, 5
jne 0x140167a0d
call fcn.140160d90
mov dword [rax], 9
call fcn.140160dc0
mov dword [rax], r15d
jmp 0x140167a55
mov ecx, r15d
call fcn.140160df0
jmp 0x140167a55
mov r13, qword [rsp + 0x58]
lea rdx, [0x140231200]
mov rax, qword [rsp + 0x50]
mov rax, qword [rdx + rax*8]
test byte [r13 + rax + 8], 0x40
je 0x140167a3f
cmp byte [r12], 0x1a
jne 0x140167a3f
xor eax, eax
jmp 0x140167a58
call fcn.140160d90
mov dword [rax], 0x1c
call fcn.140160dc0
mov dword [rax], 0
or eax, 0xffffffff
mov r13, qword [rsp + 0x648]
mov r15, qword [rsp + 0x5f0]
mov rcx, qword [rsp + 0x5e0]
xor rcx, rsp
call fcn.14015d000
add rsp, 0x5f8
pop r14
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret