Function at 0x140012090
Capabilities:
Write file on windows

Disassembly:
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x440
mov ebx, ecx
mov qword [rsp + 0x488], rdx
mov rsi, r8
cmp ebx, dword [0x1400243b0]
jae 0x140012326
mov eax, ebx
and eax, 0x1f
mov eax, eax
mov rdi, rax
shl rdi, 4
mov eax, ebx
shr eax, 5
mov eax, eax
mov qword [rsp + 0x30], rax
lea rdx, [0x1400241b0]
mov rax, qword [rdx + rax*8]
test byte [rdi + rax + 8], 1
je 0x140012326
movabs rax, 0xffffffff00000000
test rsi, rax
jne 0x140012336
test rsi, rsi
je 0x140012322
mov rax, qword [rsp + 0x30]
lea rdx, [0x1400241b0]
mov rax, qword [rdx + rax*8]
test byte [rdi + rax + 8], 0x20
je 0x14001212d
mov r8d, 2
xor edx, edx
mov ecx, ebx
call fcn.140012e40
mov rax, qword [rsp + 0x30]
lea rdx, [0x1400241b0]
mov rax, qword [rdx + rax*8]
test byte [rdi + rax + 8], 0x80
je 0x140012281
mov rax, qword [rsp + 0x488]
mov r12, rax
xor r13, r13
xor r14, r14
jmp 0x140012253
lea rax, [rsp + 0x3b]
jmp 0x140012185
cmp byte [r12], 0xa
jne 0x140012177
add r13, 1
mov byte [rax], 0xd
add rax, 1
mov dl, byte [r12]
mov byte [rax], dl
add r12, 1
add rax, 1
mov r15, rax
lea rdx, [rsp + 0x3b]
neg rdx
add rdx, r15
cmp rdx, 0x400
jge 0x1400121a9
mov rdx, r12
sub rdx, qword [rsp + 0x28]
cmp rsi, rdx
ja 0x140012165
mov rax, qword [rsp + 0x30]
lea rdx, [0x1400241b0]
mov rax, qword [rdx + rax*8]
test byte [rdi + rax + 8], 0x40
je 0x1400121ff
mov ecx, ebx
call fcn.140013140
mov rcx, rax
lea rdx, [rsp + 0x43c]
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x1400121ff
call qword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
mov ecx, eax
lea rax, [rsp + 0x3b]
mov r9, r15
sub r9, rax
lea r8, [rsp + 0x3b]
mov edx, dword [0x14001c0b8]
call fcn.140013270
mov ecx, ebx
call fcn.140013140
mov rcx, rax
xor eax, eax
mov qword [rsp + 0x20], rax
lea rax, [rsp + 0x3b]
neg rax
add rax, r15
mov r8d, eax
lea r9, [rsp + 0x43c]
lea rdx, [rsp + 0x3b]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x140012276
mov eax, dword [rsp + 0x43c]
add r14, rax
lea rax, [rsp + 0x3b]
sub r15, rax
mov eax, r15d
cmp dword [rsp + 0x43c], eax
jb 0x140012271
mov rax, qword [rsp + 0x488]
mov qword [rsp + 0x28], rax
mov rax, r12
sub rax, qword [rsp + 0x28]
cmp rsi, rax
ja 0x14001215e
xor r12d, r12d
jmp 0x1400122d0
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r12d, eax
jmp 0x1400122d0
mov ecx, ebx
call fcn.140013140
mov rcx, rax
xor eax, eax
mov qword [rsp + 0x20], rax
mov r8d, esi
lea r9, [rsp + 0x43c]
mov rdx, qword [rsp + 0x488]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1400122c1
mov eax, dword [rsp + 0x43c]
mov r14d, eax
xor r13, r13
xor r12d, r12d
jmp 0x1400122d0
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r12d, eax
xor r13, r13
xor r14, r14
test r14, r14
jne 0x140012356
test r12d, r12d
je 0x1400122fe
cmp r12d, 5
jne 0x1400122f0
mov dword [0x14001b090], 9
jmp 0x1400122f8
mov ecx, r12d
call fcn.140013380
or rax, 0xffffffffffffffff
jmp 0x14001235c
mov rax, qword [rsp + 0x30]
lea rdx, [0x1400241b0]
mov rax, qword [rdx + rax*8]
test byte [rdi + rax + 8], 0x40
je 0x140012346
mov rax, qword [rsp + 0x488]
cmp byte [rax], 0x1a
jne 0x140012346
xor eax, eax
jmp 0x14001235c
mov dword [0x14001b090], 9
or rax, 0xffffffffffffffff
jmp 0x14001235c
mov dword [0x14001b090], 0x22
or rax, 0xffffffffffffffff
jmp 0x14001235c
mov dword [0x14001b090], 0x1c
or rax, 0xffffffffffffffff
jmp 0x14001235c
mov rax, r14
sub rax, r13
add rsp, 0x440
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
ret