Function at 0x100401160
Capabilities:
Set current directory

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x98
xor esi, esi
mov qword [rsp + 0xe8], rdx
mov rbx, qword [rsp + 0xe8]
mov dword [rsp + 0xe0], ecx
mov dword [rsp + 0xf0], r8d
mov qword [rsp + 0xf8], r9
test ecx, ecx
jg 0x1004011bc
jmp 0x100401288
add esi, 1
add rbx, 8
cmp dword [rsp + 0xe0], esi
je 0x100401288
mov rcx, qword [rbx]
call qword [sym.imp.msys_ncursesw6.dll__nc_is_dir_path]
test al, al
je 0x1004011a8
mov rcx, qword [rbx]
call sub.msys_2.0.dll_opendir
mov r13, rax
test rax, rax
je 0x100401490
mov eax, dword [rsp + 0xf0]
test eax, eax
jne 0x100401440
xor r12d, r12d
mov rcx, r13
call sub.msys_2.0.dll_readdir
test rax, rax
je 0x100401255
lea r15, [rax + 0x18]
mov rcx, r15
call sub.msys_2.0.dll_strlen
lea rcx, [rax + 1]
mov rdi, rax
call sub.msys_2.0.dll_malloc
mov r14, rax
test rax, rax
je 0x10040179a
mov r8, rdi
mov rdx, r15
mov rcx, rax
call sub.msys_2.0.dll_memcpy
mov byte [r14 + rdi], 0
cmp byte [r14], 0x2e
jne 0x1004012b8
cmp byte [r14 + 1], 0
jne 0x1004012b8
mov rcx, r14
call sub.msys_2.0.dll_free
mov rcx, r13
call sub.msys_2.0.dll_readdir
test rax, rax
jne 0x1004011fc
mov rcx, r13
call sub.msys_2.0.dll_closedir
test r12, r12
je 0x1004011a8
mov rcx, r12
add esi, 1
add rbx, 8
call sub.msys_2.0.dll_free
cmp dword [rsp + 0xe0], esi
jne 0x1004011bc
nop word [rax + rax]
lea rax, [0x1004017c0]
cmp qword [rsp + 0xf8], rax
je 0x1004014dd
xor eax, eax
add rsp, 0x98
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
cmp byte [r14], 0x2e
jne 0x1004012d0
cmp byte [r14 + 1], 0x2e
jne 0x1004012d0
cmp byte [r14 + 2], 0
je 0x100401240
mov rcx, r15
call sub.msys_2.0.dll_strlen
mov rcx, qword [rbx]
mov rdi, rax
call sub.msys_2.0.dll_strlen
mov rcx, r12
lea rdx, [rdi + rax + 3]
call qword [sym.imp.msys_ncursesw6.dll__nc_doalloc]
mov r12, rax
test rax, rax
je 0x1004017a6
mov r8, qword [rbx]
mov r9, r14
lea rdx, str._s__s_
mov rcx, rax
call sub.msys_2.0.dll_sprintf
mov rcx, r14
call sub.msys_2.0.dll_free
mov rcx, r12
call sub.msys_2.0.dll_chdir
test eax, eax
jne 0x1004011ef
lea rcx, [0x100404076]
mov rdi, r12
call sub.msys_2.0.dll_opendir
mov r15, rax
test rax, rax
je 0x1004014d0
mov rcx, r15
call sub.msys_2.0.dll_readdir
test rax, rax
je 0x1004013bf
lea r12, [rax + 0x18]
mov rcx, r12
call sub.msys_2.0.dll_strlen
lea rcx, [rax + 1]
mov rbp, rax
call sub.msys_2.0.dll_malloc
mov r14, rax
test rax, rax
je 0x10040179a
mov r8, rbp
mov rdx, r12
mov rcx, rax
call sub.msys_2.0.dll_memcpy
mov byte [r14 + rbp], 0
cmp byte [r14], 0x2e
jne 0x100401396
cmp byte [r14 + 1], 0
je 0x1004013aa
cmp byte [r14], 0x2e
jne 0x1004013d0
cmp byte [r14 + 1], 0x2e
jne 0x1004013d0
cmp byte [r14 + 2], 0
jne 0x1004013d0
mov rcx, r14
call sub.msys_2.0.dll_free
mov rcx, r15
call sub.msys_2.0.dll_readdir
test rax, rax
jne 0x100401352
mov rcx, r15
mov r12, rdi
call sub.msys_2.0.dll_closedir
jmp 0x1004011ef
mov rcx, r14
call qword [sym.imp.msys_ncursesw6.dll__nc_is_file_path]
test al, al
je 0x1004013aa
lea r12, [rsp + 0x40]
mov rcx, r14
mov rdx, r12
call qword [sym.imp.msys_ncursesw6.dll__nc_read_file_entry]
test eax, eax
jle 0x100401458
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.msys_ncursesw6.dll__nc_first_name]
mov rdx, r14
mov rcx, rax
mov rbp, rax
call sub.msys_2.0.dll_strcmp
test eax, eax
jne 0x100401425
mov edx, dword [rsp + 0xe0]
mov r9, r12
mov r8, rbp
mov ecx, esi
call qword [rsp + 0xf8]
mov rcx, r12
call qword [sym.imp.msys_ncursesw6.dll__nc_free_termtype2]
mov rcx, r14
call sub.msys_2.0.dll_free
jmp 0x100401345
mov rdx, qword [rbx]
lea rcx, str._n_s:_n_n
call sub.msys_2.0.dll_printf
jmp 0x1004011ec
call sub.msys_2.0.dll___getreent
mov rcx, qword [rax + 0x10]
call sub.msys_2.0.dll_fflush
mov rbp, qword [section..bss]
call sub.msys_2.0.dll___getreent
mov r9, r14
lea rdx, str._s:_couldnt_open_terminfo_file__s._n
mov rcx, qword [rax + 0x18]
mov r8, rbp
call sub.msys_2.0.dll_fprintf
jmp 0x1004013aa
call sub.msys_2.0.dll___getreent
mov rcx, qword [rax + 0x10]
call sub.msys_2.0.dll_fflush
mov r12, qword [rbx]
mov rbp, qword [section..bss]
call sub.msys_2.0.dll___getreent
lea rdx, str._s:_cant_open_terminfo_directory__s_n
mov rcx, qword [rax + 0x18]
mov r9, r12
mov r8, rbp
call sub.msys_2.0.dll_fprintf
jmp 0x1004011a8
mov rcx, r12
call sub.msys_2.0.dll_perror
jmp 0x1004011ef
mov rdx, qword [0x100408010]
test rdx, rdx
je 0x1004016e8
cmp dword [rsp + 0xe0], 1
jle 0x10040176b
xor esi, esi
movsxd r12, dword [rsp + 0xe0]
mov r13, qword [rsp + 0xe8]
lea rdi, [0x10040409d]
lea rbp, [0x1004040a0]
nop dword [rax + rax]
xor ebx, ebx
nop word [rax + rax]
mov rcx, rdi
add ebx, 1
call sub.msys_2.0.dll_printf
cmp ebx, esi
jle 0x100401528
mov rcx, rbp
call sub.msys_2.0.dll_printf
mov rcx, qword [r13 + rsi*8]
add rsi, 1
call sub.msys_2.0.dll_puts
cmp r12, rsi
jne 0x100401520
mov rdx, qword [0x100408010]
cmp rdx, 1
ja 0x100401775
test rdx, rdx
je 0x1004016e8
xor edi, edi
lea r15, str.__10s_t_s_n
jmp 0x1004015b7
mov rbx, rdi
mov rbp, rdi
add rdi, 1
shl rbx, 5
movsxd rbp, ebp
mov rdx, qword [rax + rbx + 0x10]
mov rcx, r15
shl rbp, 5
mov r8, qword [rax + rbp + 0x18]
call sub.msys_2.0.dll_printf
mov rbx, qword [0x100408010]
cmp rbx, rdi
jbe 0x10040170f
mov rax, qword [0x100408018]
cmp dword [rsp + 0xe0], 1
mov r9, rax
jle 0x100401580
xor r14d, r14d
mov ebp, 0xffffffff
mov r12d, 0x2a
lea rsi, [0x10040409d]
mov rbx, rdi
shl rbx, 5
cmp dword [r9 + rbx], r14d
jle 0x100401609
nop dword [rax]
mov rcx, rsi
add r14d, 1
call sub.msys_2.0.dll_printf
mov rax, qword [0x100408018]
cmp r14d, dword [rax + rbx]
jl 0x1004015f0
movsx edx, r12b
lea rcx, [0x1004040a3]
call sub.msys_2.0.dll_printf
mov r9, qword [0x100408018]
lea rax, [r9 + rbx]
mov r11, qword [rax + 8]
cmp r12b, 0x2a
jne 0x100401633
test ebp, ebp
cmovs ebp, edi
add r14d, 1
lea r13, [rdi + 1]
cmp r13, qword [0x100408010]
mov qword [rsp + 0x28], r11
jae 0x100401697
lea r10, [r9 + rbx + 0x20]
mov rcx, qword [rax + 0x10]
mov qword [rsp + 0x38], r9
mov rdx, qword [r10 + 0x10]
mov qword [rsp + 0x30], r10
call sub.msys_2.0.dll_strcmp
mov r10, qword [rsp + 0x30]
mov r9, qword [rsp + 0x38]
test eax, eax
mov r11, qword [rsp + 0x28]
jne 0x100401697
mov r12d, 0x2a
test r11, r11
je 0x10040168f
cmp qword [r10 + 8], r11
sete r12b
add r12d, 0x2a
mov rdi, r13
jmp 0x1004015e0
lea rsi, [0x10040409d]
cmp dword [rsp + 0xe0], r14d
jle 0x1004016c6
nop dword [rax + rax]
mov rcx, rsi
add r14d, 1
call sub.msys_2.0.dll_printf
cmp dword [rsp + 0xe0], r14d
jne 0x1004016b0
lea rcx, [0x1004040a7]
call sub.msys_2.0.dll_printf
test ebp, ebp
jns 0x1004016d9
mov rbp, rdi
mov rax, qword [0x100408018]
mov rdi, r13
jmp 0x10040158e
mov r12, qword [0x100408018]
test r12, r12
jne 0x100401756
mov qword [0x100408010], 0
mov qword [0x100408008], 0
jmp 0x10040129d
mov r12, qword [0x100408018]
test r12, r12
je 0x1004016f4
test rbx, rbx
je 0x100401756
mov rsi, rbx
shl rsi, 5
add rsi, r12
nop word [rax + rax]
mov rcx, qword [rsi - 0x10]
sub rbx, 1
sub rsi, 0x20
mov qword [0x100408010], rbx
call sub.msys_2.0.dll_free
mov rcx, qword [rsi + 0x18]
call sub.msys_2.0.dll_free
test rbx, rbx
jne 0x100401730
mov rcx, r12
call sub.msys_2.0.dll_free
mov qword [0x100408018], 0
jmp 0x1004016f4
cmp rdx, 1
je 0x10040156c
mov rcx, qword [0x100408018]
lea r9, [0x1004010a0]
mov r8d, 0x20
call sub.msys_2.0.dll_qsort
mov rdx, qword [0x100408010]
jmp 0x100401563
lea rcx, str.copy_entryname
call fcn.100401080
lea rcx, str.realloc_cwd_buf
call fcn.100401080
nop
nop word cs:[rax + rax]
nop
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x20
mov edi, edx
mov rdx, qword [0x100408010]
mov ebp, ecx
mov r12, r8
mov rcx, qword [0x100408018]
mov rsi, r9
lea rax, [rdx + 1]
cmp rax, qword [0x100408008]
jae 0x100401970
shl rdx, 5
mov qword [0x100408010], rax
xor r10d, r10d
lea rbx, [rcx + rdx]
mov dword [rbx], ebp
cmp edi, 1
jg 0x100401870
mov qword [rbx + 8], r10
mov rcx, r12
call sub.msys_2.0.dll_strdup
test rax, rax
je 0x1004019b4
mov qword [rbx + 0x10], rax
mov rcx, qword [rsi]
lea r12, str._No_description_
test rcx, rcx
je 0x10040184d
mov edx, 0x7c
call sub.msys_2.0.dll_strrchr
test rax, rax
je 0x10040184d
cmp byte [rax + 1], 0
je 0x10040184d
lea r12, [rax + 1]
mov rcx, r12
call sub.msys_2.0.dll_strdup
test rax, rax
je 0x1004019b4
mov qword [rbx + 0x18], rax
add rsp, 0x20
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
ret
mov rdx, qword [rsi]
cmp rdx, 0xffffffffffffffff
je 0x1004019a8
test rdx, rdx
je 0x10040189e
movzx eax, byte [rdx]
test al, al
je 0x10040189e
nop dword [rax]
add rdx, 1
add r10, rax
movzx eax, byte [rdx]
test al, al
jne 0x100401890
movzx eax, word [rsi + 0x38]
test eax, eax
je 0x1004018d3
mov rdx, qword [rsi + 0x10]
lea ecx, [rax - 1]
lea rax, [rdx + 1]
add rcx, rax
jmp 0x1004018c4
add rax, 1
movsx rdx, byte [rdx]
add r10, rdx
mov rdx, rax
cmp rax, rcx
jne 0x1004018c0
movzx eax, word [rsi + 0x3a]
test eax, eax
je 0x100401902
mov rdx, qword [rsi + 0x18]
lea ecx, [rax - 1]
lea rax, [rdx + 4]
lea rcx, [rax + rcx*4]
jmp 0x1004018f4
add rax, 4
movsxd rdx, dword [rdx]
add r10, rdx
mov rdx, rax
cmp rcx, rax
jne 0x1004018f0
movzx edx, word [rsi + 0x3c]
test edx, edx
je 0x10040180c
mov rax, qword [rsi + 0x20]
sub edx, 1
lea r11, [rax + 8]
lea r8, [r11 + rdx*8]
mov rdx, qword [rax]
cmp rdx, 0xffffffffffffffff
je 0x10040196a
nop word cs:[rax + rax]
test rdx, rdx
je 0x100401951
movzx eax, byte [rdx]
test al, al
je 0x100401951
xor ecx, ecx
nop
add rdx, 1
add rcx, rax
movzx eax, byte [rdx]
test al, al
jne 0x100401940
add r10, rcx
mov rax, r11
cmp r8, r11
je 0x10040180c
mov rdx, qword [rax]
add r11, 8
cmp rdx, 0xffffffffffffffff
jne 0x100401930
sub r10, 1
jmp 0x100401951
add rdx, 6
lea rax, [rdx + rdx]
shl rdx, 6
mov qword [0x100408008], rax
call qword [sym.imp.msys_ncursesw6.dll__nc_doalloc]
mov qword [0x100408018], rax
mov rcx, rax
test rax, rax
je 0x1004019c0
mov rdx, qword [0x100408010]
lea rax, [rdx + 1]
jmp 0x1004017f3
mov r10, 0xffffffffffffffff
jmp 0x10040189e
lea rcx, str.strmalloc
call fcn.100401080
lea rcx, str.ptr_termdata
call fcn.100401080
nop
nop
nop
nop
jmp qword [sym.imp.msys_ticw6.dll__nc_read_entry_source]