Function at 0x140040848
Capabilities:
Write file on windows

Disassembly:
push rbp
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
mov rbp, rsp
sub rsp, 0x78
xor edi, edi
mov r14d, r8d
movsxd r15, ecx
mov rbx, r9
mov rsi, rdx
test r8d, r8d
je 0x140040b3b
test rdx, rdx
jne 0x1400408af
mov byte [r9 + 0x38], 1
xor r8d, r8d
mov dword [r9 + 0x34], edi
xor edx, edx
mov byte [r9 + 0x30], 1
xor ecx, ecx
mov dword [r9 + 0x2c], 0x16
xor r9d, r9d
mov qword [rsp + 0x28], rbx
mov qword [rsp + 0x20], rdi
call fcn.140033754
or eax, 0xffffffff
jmp 0x140040b3d
mov rax, r15
lea rcx, [0x14006f330]
and eax, 0x3f
mov r12, r15
sar r12, 6
mov qword [rbp - 0x18], r12
lea r13, [rax + rax*8]
mov rcx, qword [rcx + r12*8]
mov al, byte [rcx + r13*8 + 0x39]
mov byte [rbp - 0x48], al
dec al
cmp al, 1
ja 0x1400408e6
mov eax, r14d
not eax
test al, 1
je 0x140040878
test byte [rcx + r13*8 + 0x38], 0x20
je 0x1400408fc
xor edx, edx
mov ecx, r15d
lea r8d, [rdx + 2]
call fcn.140043110
mov ecx, r15d
mov qword [rbp - 0x30], rdi
call fcn.14004c8b8
lea rdx, [0x14006f330]
test eax, eax
je 0x140040a2b
mov rax, qword [rdx + r12*8]
cmp byte [rax + r13*8 + 0x38], dil
jge 0x140040a2b
cmp byte [rbx + 0x28], dil
jne 0x14004093b
mov rcx, rbx
call fcn.140038c70
lea rdx, [0x14006f330]
mov rax, qword [rbx + 0x18]
cmp qword [rax + 0x138], rdi
jne 0x140040957
mov rax, qword [rdx + r12*8]
cmp byte [rax + r13*8 + 0x39], dil
je 0x140040a2b
mov rcx, qword [rdx + r12*8]
lea rdx, [rbp - 0x20]
mov rcx, qword [rcx + r13*8 + 0x28]
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x140040a24
movsx ecx, byte [rbp - 0x48]
test ecx, ecx
je 0x140040a01
sub ecx, 1
je 0x14004098c
cmp ecx, 1
jne 0x140040ac5
lea r12, [rsi + r14]
mov qword [rbp - 0x40], rdi
mov r15, rsi
cmp rsi, r12
jae 0x1400409f8
mov r14d, dword [rbp - 0x3c]
movzx eax, word [r15]
movzx ecx, ax
mov word [rbp - 0x48], ax
call fcn.14004cb00
movzx ecx, word [rbp - 0x48]
cmp ax, cx
jne 0x1400409ef
add r14d, 2
mov dword [rbp - 0x3c], r14d
cmp cx, 0xa
jne 0x1400409e4
mov ecx, 0xd
call fcn.14004cb00
mov ecx, 0xd
cmp ax, cx
jne 0x1400409ef
inc r14d
mov dword [rbp - 0x3c], r14d
inc edi
add r15, 2
cmp r15, r12
jae 0x1400409f8
jmp 0x1400409a0
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [rbp - 0x40], eax
mov r12, qword [rbp - 0x18]
jmp 0x140040abb
mov r9d, r14d
mov qword [rsp + 0x20], rbx
mov r8, rsi
lea rcx, [rbp - 0x40]
mov edx, r15d
call fcn.14003fe88
movsd xmm0, qword [rax]
mov edi, dword [rax + 8]
jmp 0x140040ac0
lea rdx, [0x14006f330]
mov rcx, qword [rdx + r12*8]
cmp byte [rcx + r13*8 + 0x38], dil
jge 0x140040a88
movsx ecx, byte [rbp - 0x48]
test ecx, ecx
je 0x140040a74
sub ecx, 1
je 0x140040a60
cmp ecx, 1
jne 0x140040acc
mov r9d, r14d
lea rcx, [rbp - 0x40]
mov r8, rsi
mov edx, r15d
call fcn.140040404
jmp 0x140040a18
mov r9d, r14d
lea rcx, [rbp - 0x40]
mov r8, rsi
mov edx, r15d
call fcn.140040520
jmp 0x140040a18
mov r9d, r14d
lea rcx, [rbp - 0x40]
mov r8, rsi
mov edx, r15d
call fcn.140040300
jmp 0x140040a18
mov rcx, qword [rcx + r13*8 + 0x28]
lea r9, [rbp - 0x3c]
xor eax, eax
mov r8d, r14d
and qword [rsp + 0x20], rax
mov rdx, rsi
mov qword [rbp - 0x40], rax
mov dword [rbp - 0x38], eax
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x140040ab8
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [rbp - 0x40], eax
mov edi, dword [rbp - 0x38]
movsd xmm0, qword [rbp - 0x40]
movsd qword [rbp - 0x30], xmm0
lea rdx, [0x14006f330]
mov rax, qword [rbp - 0x30]
shr rax, 0x20
test eax, eax
jne 0x140040b34
mov eax, dword [rbp - 0x30]
test eax, eax
je 0x140040b0b
cmp eax, 5
jne 0x140040afb
mov byte [rbx + 0x30], 1
mov dword [rbx + 0x2c], 9
mov byte [rbx + 0x38], 1
mov dword [rbx + 0x34], eax
jmp 0x1400408a7
mov ecx, dword [rbp - 0x30]
mov rdx, rbx
call fcn.1400342c0
jmp 0x1400408a7
mov rax, qword [rdx + r12*8]
test byte [rax + r13*8 + 0x38], 0x40
je 0x140040b1c
cmp byte [rsi], 0x1a
je 0x140040b3b
and dword [rbx + 0x34], 0
mov byte [rbx + 0x30], 1
mov dword [rbx + 0x2c], 0x1c
mov byte [rbx + 0x38], 1
jmp 0x1400408a7
mov eax, dword [rbp - 0x2c]
sub eax, edi
jmp 0x140040b3d
xor eax, eax
add rsp, 0x78
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret