Function at 0x140021d04
Capabilities:
Read file on windows

Disassembly:
mov qword [rsp + 0x10], rdx
push rbx
push rbp
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x60
movsxd r12, ecx
mov r10, rdx
mov r13d, r8d
cmp r12d, 0xfffffffe
jne 0x140021d3f
call fcn.14001528c
and dword [rax], 0
call fcn.1400152ac
mov dword [rax], 9
jmp 0x14002213b
test ecx, ecx
js 0x140022123
cmp r12d, dword [0x1400874d0]
jae 0x140022123
mov rax, r12
lea rdi, [0x1400870d0]
and eax, 0x3f
mov r8d, 1
mov r9, r12
mov qword [rsp + 0x48], r8
shr r9, 6
mov qword [rsp + 0x40], r9
lea r14, [rax + rax*8]
mov rdx, qword [rdi + r9*8]
mov al, byte [rdx + r14*8 + 0x38]
test r8b, al
je 0x140022123
cmp r13d, 0x7fffffff
jbe 0x140021daf
call fcn.14001528c
and dword [rax], 0
call fcn.1400152ac
mov dword [rax], 0x16
jmp 0x140022136
test r13d, r13d
je 0x14002211f
test al, 2
jne 0x14002211f
test r10, r10
je 0x140021d97
movsx r11d, byte [rdx + r14*8 + 0x39]
xor ebx, ebx
mov rax, qword [rdx + r14*8 + 0x28]
mov ecx, r11d
mov qword [rsp + 0x38], rax
mov byte [rsp + 0xa0], r11b
lea r15d, [rbx + 4]
sub ecx, r8d
je 0x140021e1e
cmp ecx, r8d
jne 0x140021e16
mov eax, r13d
not eax
test r8b, al
jne 0x140021e16
call fcn.14001528c
and dword [rax], ebx
call fcn.1400152ac
mov dword [rax], 0x16
call fcn.14001044c
jmp 0x140021fad
mov ebp, r13d
mov r15, r10
jmp 0x140021e9d
mov eax, r13d
not eax
test r8b, al
je 0x140021dfa
mov ebp, r13d
shr ebp, 1
cmp ebp, r15d
cmovb ebp, r15d
mov ecx, ebp
call fcn.14001b480
xor ecx, ecx
mov rbx, rax
call fcn.14001b444
xor ecx, ecx
call fcn.14001b444
mov r15, rbx
test rbx, rbx
jne 0x140021e6f
call fcn.1400152ac
mov dword [rax], 0xc
call fcn.14001528c
mov dword [rax], 8
jmp 0x140021fad
xor edx, edx
mov ecx, r12d
lea r8d, [rdx + 1]
call fcn.1400223c8
mov r9, qword [rsp + 0x40]
mov r8d, 1
mov r11b, byte [rsp + 0xa0]
mov rcx, qword [rdi + r9*8]
mov qword [rcx + r14*8 + 0x30], rax
mov rdx, qword [rdi + r9*8]
xor edi, edi
mov qword [rsp + 0x50], r15
test byte [rdx + r14*8 + 0x38], 0x48
lea r10d, [rdi + 0xa]
je 0x140021f35
mov al, byte [rdx + r14*8 + 0x3a]
cmp al, r10b
je 0x140021f35
test ebp, ebp
je 0x140021f35
mov byte [r15], al
lea rdx, [0x1400870d0]
mov rax, qword [rdx + r9*8]
add r15, r8
dec ebp
mov edi, r8d
mov byte [rax + r14*8 + 0x3a], r10b
test r11b, r11b
je 0x140021f35
mov rax, qword [rdx + r9*8]
mov cl, byte [rax + r14*8 + 0x3b]
cmp cl, r10b
je 0x140021f35
test ebp, ebp
je 0x140021f35
mov byte [r15], cl
lea edi, [r10 - 8]
mov rax, qword [rdx + r9*8]
add r15, r8
dec ebp
mov byte [rax + r14*8 + 0x3b], r10b
cmp r11b, r8b
jne 0x140021f35
mov rax, qword [rdx + r9*8]
mov cl, byte [rax + r14*8 + 0x3c]
cmp cl, r10b
je 0x140021f35
test ebp, ebp
je 0x140021f35
mov byte [r15], cl
lea edi, [r10 - 7]
mov rax, qword [rdx + r9*8]
add r15, r8
dec ebp
mov byte [rax + r14*8 + 0x3c], r10b
mov ecx, r12d
call fcn.140029ab8
test eax, eax
je 0x140021fcb
mov rax, qword [rsp + 0x40]
lea rcx, [0x1400870d0]
mov rax, qword [rcx + rax*8]
cmp byte [rax + r14*8 + 0x38], 0
jge 0x140021fcb
mov rcx, qword [rsp + 0x38]
lea rdx, [rsp + 0x30]
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x140021fcb
cmp byte [rsp + 0xa0], 2
jne 0x140021fd0
mov rcx, qword [rsp + 0x38]
lea r9, [rsp + 0xb8]
and qword [rsp + 0x20], 0
mov rdx, r15
shr ebp, 1
mov r8d, ebp
call qword [sym.imp.KERNEL32.dll_ReadConsoleW]
test eax, eax
jne 0x140021fbf
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, eax
call fcn.140015220
or edi, 0xffffffff
mov rcx, rbx
call fcn.14001b444
mov eax, edi
jmp 0x14002213e
mov eax, dword [rsp + 0xb8]
lea edi, [rdi + rax*2]
jmp 0x14002200c
mov byte [rsp + 0x48], 0
mov rcx, qword [rsp + 0x38]
lea r9, [rsp + 0xb8]
and qword [rsp + 0x20], 0
mov r8d, ebp
mov rdx, r15
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x1400220e9
cmp dword [rsp + 0xb8], r13d
ja 0x1400220e9
add edi, dword [rsp + 0xb8]
mov rdx, qword [rsp + 0x40]
lea rbp, [0x1400870d0]
mov rax, qword [rbp + rdx*8]
cmp byte [rax + r14*8 + 0x38], 0
jge 0x140021fb0
cmp byte [rsp + 0xa0], 2
movsxd r8, edi
je 0x140022057
mov r9, qword [rsp + 0xa8]
mov rax, r13
shr rax, 1
mov rdx, r15
mov ecx, r12d
mov qword [rsp + 0x20], rax
call fcn.140021914
mov edi, eax
jmp 0x140021fb0
shr r8, 1
cmp byte [rsp + 0x48], 0
je 0x1400220d7
mov r10, qword [rsp + 0x50]
mov rax, r10
mov rdi, r10
lea r9, [r10 + r8*2]
cmp r10, r9
jae 0x1400220ca
mov r11d, 0xa
movzx ecx, word [rax]
cmp cx, 0x1a
je 0x1400220bf
cmp cx, 0xd
jne 0x1400220a5
lea r8, [rax + 2]
cmp r8, r9
jae 0x1400220a5
cmp word [r8], r11w
jne 0x1400220a5
movzx ecx, r11w
mov r8d, 4
jmp 0x1400220ab
mov r8d, 2
add rax, r8
mov word [rdi], cx
lea r8, [rdi + 2]
mov rdi, r8
cmp rax, r9
jb 0x14002207b
jmp 0x1400220ca
mov rax, qword [rbp + rdx*8]
or byte [rax + r14*8 + 0x38], 2
sub rdi, r10
sar rdi, 1
add edi, edi
jmp 0x140021fb0
mov rdx, qword [rsp + 0x50]
mov ecx, r12d
call fcn.14002173c
jmp 0x140022050
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 5
jne 0x14002210f
call fcn.1400152ac
mov dword [rax], 9
call fcn.14001528c
mov dword [rax], 5
jmp 0x140021fad
cmp eax, 0x6d
jne 0x140021fa6
xor edi, edi
jmp 0x140021fb0
xor eax, eax
jmp 0x14002213e
call fcn.14001528c
and dword [rax], 0
call fcn.1400152ac
mov dword [rax], 9
call fcn.14001044c
or eax, 0xffffffff
add rsp, 0x60
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rbp
pop rbx
ret