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, 0x88
mov qword [rsp + 0xe8], r9
mov r13d, ecx
test ecx, ecx
jle 0x10040176b
mov qword [rsp + 0xd8], rdx
mov rbx, rdx
xor r12d, r12d
mov dword [rsp + 0xe0], r8d
jmp 0x1004011b1
add r12d, 1
add rbx, 8
cmp r13d, r12d
je 0x100401288
mov rcx, qword [rbx]
call qword [sym.imp.msys_ncursesw6.dll__nc_is_dir_path]
test al, al
je 0x1004011a0
mov rcx, qword [rbx]
call sub.msys_2.0.dll_opendir
mov rdi, rax
test rax, rax
je 0x1004014a8
mov eax, dword [rsp + 0xe0]
test eax, eax
jne 0x100401450
lea rax, [rsp + 0x30]
xor esi, esi
mov qword [rsp + 0x20], rax
mov rcx, rdi
call sub.msys_2.0.dll_readdir
test rax, rax
je 0x100401257
lea rbp, [rax + 0x18]
mov rcx, rbp
call sub.msys_2.0.dll_strlen
lea rcx, [rax + 1]
mov r15, rax
call sub.msys_2.0.dll_malloc
mov r14, rax
test rax, rax
je 0x1004017bf
mov r8, r15
mov rdx, rbp
mov rcx, rax
call sub.msys_2.0.dll_memcpy
mov byte [r14 + r15], 0
cmp byte [r14], 0x2e
jne 0x1004012c0
cmp byte [r14 + 1], 0
jne 0x1004012c0
mov rcx, r14
call sub.msys_2.0.dll_free
mov rcx, rdi
call sub.msys_2.0.dll_readdir
test rax, rax
jne 0x1004011fa
mov rcx, rdi
call sub.msys_2.0.dll_closedir
test rsi, rsi
je 0x1004011a0
mov rcx, rsi
add r12d, 1
add rbx, 8
call sub.msys_2.0.dll_free
cmp r13d, r12d
jne 0x1004011b1
nop dword [rax]
mov r14, qword [rsp + 0xd8]
lea rdx, [0x1004017e0]
cmp qword [rsp + 0xe8], rdx
je 0x1004014ed
xor eax, eax
add rsp, 0x88
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
cmp byte [r14], 0x2e
jne 0x1004012e0
cmp byte [r14 + 1], 0x2e
jne 0x1004012e0
cmp byte [r14 + 2], 0
je 0x100401242
nop dword [rax + rax]
mov rcx, rbp
call sub.msys_2.0.dll_strlen
mov rcx, qword [rbx]
mov rbp, rax
call sub.msys_2.0.dll_strlen
mov rcx, rsi
lea rdx, [rbp + rax + 3]
call qword [sym.imp.msys_ncursesw6.dll__nc_doalloc]
mov rsi, rax
test rax, rax
je 0x1004017cb
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, rsi
call sub.msys_2.0.dll_chdir
test eax, eax
jne 0x1004011ed
lea rcx, [0x100404076]
call sub.msys_2.0.dll_opendir
mov rbp, rax
test rax, rax
je 0x1004014e0
mov qword [rsp + 0x28], rbx
jmp 0x100401376
cmp byte [r14 + 1], 0x2e
jne 0x1004013d1
cmp byte [r14 + 2], 0
jne 0x1004013d1
mov rcx, r14
call sub.msys_2.0.dll_free
mov rcx, rbp
call sub.msys_2.0.dll_readdir
test rax, rax
je 0x100401438
lea r15, [rax + 0x18]
mov rcx, r15
call sub.msys_2.0.dll_strlen
lea rcx, [rax + 1]
mov rbx, rax
call sub.msys_2.0.dll_malloc
mov r14, rax
test rax, rax
je 0x1004017bf
mov r8, rbx
mov rdx, r15
mov rcx, rax
call sub.msys_2.0.dll_memcpy
mov byte [r14 + rbx], 0
cmp byte [r14], 0x2e
jne 0x1004013cb
cmp byte [r14 + 1], 0
je 0x10040136e
cmp byte [r14], 0x2e
je 0x100401360
mov rcx, r14
call qword [sym.imp.msys_ncursesw6.dll__nc_is_file_path]
test al, al
je 0x10040136e
mov rdx, qword [rsp + 0x20]
mov rcx, r14
call qword [sym.imp.msys_ncursesw6.dll__nc_read_file_entry]
test eax, eax
jle 0x100401468
mov rcx, qword [rsp + 0x30]
call qword [sym.imp.msys_ncursesw6.dll__nc_first_name]
mov rdx, r14
mov rcx, rax
mov r15, rax
call sub.msys_2.0.dll_strcmp
test eax, eax
jne 0x100401422
mov r9, qword [rsp + 0x20]
mov r8, r15
mov edx, r13d
mov ecx, r12d
call qword [rsp + 0xe8]
mov rcx, qword [rsp + 0x20]
call qword [sym.imp.msys_ncursesw6.dll__nc_free_termtype2]
jmp 0x10040136e
mov rcx, rbp
mov rbx, qword [rsp + 0x28]
call sub.msys_2.0.dll_closedir
jmp 0x1004011ed
mov rdx, qword [rbx]
lea rcx, str._n_s:_n_n
call sub.msys_2.0.dll_printf
jmp 0x1004011e1
call sub.msys_2.0.dll___getreent
mov rcx, qword [rax + 0x10]
call sub.msys_2.0.dll_fflush
mov r15, 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, r15
call sub.msys_2.0.dll_fprintf
mov rcx, r14
call sub.msys_2.0.dll_free
jmp 0x100401376
call sub.msys_2.0.dll___getreent
mov rcx, qword [rax + 0x10]
call sub.msys_2.0.dll_fflush
mov rdi, qword [rbx]
mov rsi, 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, rdi
mov r8, rsi
call sub.msys_2.0.dll_fprintf
jmp 0x1004011a0
mov rcx, rsi
call sub.msys_2.0.dll_perror
jmp 0x1004011ed
mov rdx, qword [0x100408010]
test rdx, rdx
je 0x1004016e7
cmp r13d, 1
je 0x100401790
movsxd r12, r13d
xor esi, esi
lea rdi, [0x10040409d]
lea rbp, [0x1004040a0]
nop word [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 [r14 + 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 0x10040179a
test rdx, rdx
je 0x1004016e7
mov dword [rsp + 0xd0], r13d
xor edi, edi
jmp 0x1004015bb
mov rsi, rdi
mov r12, rdi
add rdi, 1
shl rsi, 5
movsxd r12, r12d
mov rdx, qword [r13 + rsi + 0x10]
lea rcx, str.__10s_t_s_n
shl r12, 5
mov r8, qword [r13 + r12 + 0x18]
call sub.msys_2.0.dll_printf
mov rbx, qword [0x100408010]
cmp rdi, rbx
jae 0x10040170e
cmp dword [rsp + 0xd0], 1
mov r13, qword [0x100408018]
jle 0x100401580
mov rsi, rdi
xor r15d, r15d
xor ebx, ebx
mov r12d, 0xffffffff
lea rbp, [0x10040409d]
shl rsi, 5
test r15, r15
jne 0x100401682
nop
mov eax, r12d
mov r15d, 0x2a
shr eax, 0x1f
mov r14d, eax
cmp ebx, dword [r13 + rsi]
jge 0x100401627
nop word cs:[rax + rax]
mov rcx, rbp
add ebx, 1
call sub.msys_2.0.dll_printf
mov rax, qword [0x100408018]
cmp ebx, dword [rax + rsi]
jl 0x100401610
mov edx, r15d
lea rcx, [0x1004040a3]
call sub.msys_2.0.dll_printf
mov r13, qword [0x100408018]
test r14b, r14b
lea r14, [rdi + 1]
cmovne r12d, edi
add ebx, 1
cmp r14, qword [0x100408010]
lea rax, [r13 + rsi]
mov r15, qword [rax + 8]
jae 0x10040169b
mov rdx, qword [r13 + rsi + 0x30]
mov rcx, qword [rax + 0x10]
call sub.msys_2.0.dll_strcmp
test eax, eax
jne 0x10040169b
mov rdi, r14
mov rsi, rdi
shl rsi, 5
test r15, r15
je 0x1004015f0
cmp r15, qword [r13 + rsi + 8]
jne 0x1004015f0
xor r14d, r14d
mov r15d, 0x2b
jmp 0x1004015ff
lea rbp, [0x10040409d]
cmp dword [rsp + 0xd0], ebx
jle 0x1004016c4
nop dword [rax + rax]
mov rcx, rbp
add ebx, 1
call sub.msys_2.0.dll_printf
cmp dword [rsp + 0xd0], ebx
jne 0x1004016b0
lea rcx, [0x1004040a7]
call sub.msys_2.0.dll_printf
test r12d, r12d
jns 0x1004016d8
mov r12, rdi
mov r13, qword [0x100408018]
mov rdi, r14
jmp 0x10040158e
mov rdi, qword [0x100408018]
test rdi, rdi
jne 0x100401756
mov qword [0x100408010], 0
mov qword [0x100408008], 0
jmp 0x1004012a5
mov rdi, qword [0x100408018]
test rdi, rdi
je 0x1004016f3
test rbx, rbx
je 0x100401756
mov rsi, rbx
shl rsi, 5
add rsi, rdi
nop dword [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, rdi
call sub.msys_2.0.dll_free
mov qword [0x100408018], 0
jmp 0x1004016f3
lea rdx, [0x1004017e0]
cmp qword [rsp + 0xe8], rdx
jne 0x1004012a5
mov rdx, qword [0x100408010]
test rdx, rdx
je 0x1004016e7
cmp rdx, 1
je 0x10040156b
mov rcx, qword [0x100408018]
lea r9, [0x1004010a0]
mov r8d, 0x20
call sub.msys_2.0.dll_qsort
mov rdx, qword [0x100408010]
jmp 0x100401562
lea rcx, str.copy_entryname
call fcn.100401080
lea rcx, str.realloc_cwd_buf
call fcn.100401080
nop
nop dword [rax + rax]
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x20
mov ebp, edx
mov rdx, qword [0x100408010]
mov r12d, ecx
mov rsi, r8
mov rcx, qword [0x100408018]
mov rdi, r9
lea rax, [rdx + 1]
cmp rax, qword [0x100408008]
jae 0x100401990
shl rdx, 5
mov qword [0x100408010], rax
xor r10d, r10d
lea rbx, [rcx + rdx]
mov dword [rbx], r12d
cmp ebp, 1
jg 0x100401890
mov qword [rbx + 8], r10
mov rcx, rsi
call sub.msys_2.0.dll_strdup
test rax, rax
je 0x1004019d4
mov qword [rbx + 0x10], rax
mov rcx, qword [rdi]
lea rsi, str._No_description_
test rcx, rcx
je 0x10040186f
mov edx, 0x7c
call sub.msys_2.0.dll_strrchr
test rax, rax
je 0x10040186f
cmp byte [rax + 1], 0
je 0x10040186f
lea rsi, [rax + 1]
mov rcx, rsi
call sub.msys_2.0.dll_strdup
test rax, rax
je 0x1004019d4
mov qword [rbx + 0x18], rax
add rsp, 0x20
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
ret
mov rdx, qword [rdi]
cmp rdx, 0xffffffffffffffff
je 0x1004019c8
test rdx, rdx
je 0x1004018be
movzx eax, byte [rdx]
test al, al
je 0x1004018be
nop dword [rax]
add rdx, 1
add r10, rax
movzx eax, byte [rdx]
test al, al
jne 0x1004018b0
movzx eax, word [rdi + 0x38]
test eax, eax
je 0x1004018f3
mov rdx, qword [rdi + 0x10]
lea ecx, [rax - 1]
lea rax, [rdx + 1]
add rcx, rax
jmp 0x1004018e4
add rax, 1
movsx rdx, byte [rdx]
add r10, rdx
mov rdx, rax
cmp rax, rcx
jne 0x1004018e0
movzx ecx, word [rdi + 0x3a]
test cx, cx
je 0x100401922
mov rdx, qword [rdi + 0x18]
sub ecx, 1
lea rax, [rdx + 4]
lea rcx, [rax + rcx*4]
jmp 0x100401914
add rax, 4
movsxd rdx, dword [rdx]
add r10, rdx
mov rdx, rax
cmp rcx, rax
jne 0x100401910
movzx edx, word [rdi + 0x3c]
test dx, dx
je 0x10040182e
mov rax, qword [rdi + 0x20]
sub edx, 1
lea r11, [rax + 8]
lea r8, [r11 + rdx*8]
mov rdx, qword [rax]
cmp rdx, 0xffffffffffffffff
je 0x10040198a
nop word [rax + rax]
test rdx, rdx
je 0x100401971
movzx eax, byte [rdx]
test al, al
je 0x100401971
xor ecx, ecx
nop
add rdx, 1
add rcx, rax
movzx eax, byte [rdx]
test al, al
jne 0x100401960
add r10, rcx
mov rax, r11
cmp r8, r11
je 0x10040182e
mov rdx, qword [rax]
add r11, 8
cmp rdx, 0xffffffffffffffff
jne 0x100401950
sub r10, 1
jmp 0x100401971
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 0x1004019e0
mov rdx, qword [0x100408010]
lea rax, [rdx + 1]
jmp 0x100401814
mov r10, 0xffffffffffffffff
jmp 0x1004018be
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]