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
xor esi, esi
mov dword [rsp + 0xd0], ecx
mov rbx, rdx
mov qword [rsp + 0xd8], rdx
mov dword [rsp + 0xe0], r8d
mov qword [rsp + 0xe8], r9
test ecx, ecx
jg 0x1004011b4
jmp 0x100401280
add esi, 1
add rbx, 8
cmp dword [rsp + 0xd0], esi
je 0x100401280
mov rcx, qword [rbx]
call sub.msys_ncursesw6.dll__nc_is_dir_path
test al, al
je 0x1004011a0
mov rcx, qword [rbx]
call sub.msys_2.0.dll_opendir
mov r13, rax
test rax, rax
je 0x1004014a0
mov eax, dword [rsp + 0xe0]
test eax, eax
jne 0x100401450
xor r12d, r12d
mov rcx, r13
call sub.msys_2.0.dll_readdir
test rax, rax
je 0x100401250
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 0x10040174a
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 0x1004012b0
cmp byte [r14 + 1], 0
jne 0x1004012b0
mov rcx, r14
call sub.msys_2.0.dll_free
mov rcx, r13
call sub.msys_2.0.dll_readdir
test rax, rax
jne 0x1004011f3
mov rcx, r13
call sub.msys_2.0.dll_closedir
test r12, r12
je 0x1004011a0
mov rcx, r12
add esi, 1
add rbx, 8
call sub.msys_2.0.dll_free
cmp dword [rsp + 0xd0], esi
jne 0x1004011b4
nop dword [rax]
lea rax, [0x100401770]
cmp qword [rsp + 0xe8], rax
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 0x1004012d0
cmp byte [r14 + 1], 0x2e
jne 0x1004012d0
cmp byte [r14 + 2], 0
je 0x10040123b
nop dword [rax + rax]
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 sub.msys_ncursesw6.dll__nc_doalloc
mov r12, rax
test rax, rax
je 0x100401756
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 0x1004011e6
lea rcx, [0x100404076]
mov rdi, r12
call sub.msys_2.0.dll_opendir
mov r15, rax
lea rax, [rsp + 0x30]
mov qword [rsp + 0x28], rax
test r15, r15
je 0x1004014e0
mov rcx, r15
call sub.msys_2.0.dll_readdir
test rax, rax
je 0x1004013c8
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 0x10040174a
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 0x10040139f
cmp byte [r14 + 1], 0
je 0x1004013b3
cmp byte [r14], 0x2e
jne 0x1004013e0
cmp byte [r14 + 1], 0x2e
jne 0x1004013e0
cmp byte [r14 + 2], 0
jne 0x1004013e0
mov rcx, r14
call sub.msys_2.0.dll_free
mov rcx, r15
call sub.msys_2.0.dll_readdir
test rax, rax
jne 0x10040135b
mov rcx, r15
mov r12, rdi
call sub.msys_2.0.dll_closedir
jmp 0x1004011e6
mov rcx, r14
call sub.msys_ncursesw6.dll__nc_is_file_path
test al, al
je 0x1004013b3
mov rdx, qword [rsp + 0x28]
mov rcx, r14
call sub.msys_ncursesw6.dll__nc_read_file_entry
test eax, eax
jle 0x100401468
mov rcx, qword [rsp + 0x30]
call sub.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 0x100401431
mov r9, qword [rsp + 0x28]
mov edx, dword [rsp + 0xd0]
mov r8, rbp
mov ecx, esi
call qword [rsp + 0xe8]
mov rcx, qword [rsp + 0x28]
call sub.msys_ncursesw6.dll__nc_free_termtype2
mov rcx, r14
call sub.msys_2.0.dll_free
jmp 0x10040134e
mov rdx, qword [rbx]
lea rcx, str._n_s:_n_n
call sub.msys_2.0.dll_printf
jmp 0x1004011e3
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 0x1004013b3
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 0x1004011a0
mov rcx, r12
call sub.msys_2.0.dll_perror
jmp 0x1004011e6
mov rdx, qword [0x100408010]
test rdx, rdx
je 0x10040169e
cmp dword [rsp + 0xd0], 1
jle 0x10040171b
xor esi, esi
movsxd r13, dword [rsp + 0xd0]
mov rdi, qword [rsp + 0xd8]
lea rbp, [0x10040409d]
lea r12, [0x1004040a0]
nop dword [rax + rax]
xor ebx, ebx
nop word [rax + rax]
mov rcx, rbp
add ebx, 1
call sub.msys_2.0.dll_printf
cmp ebx, esi
jle 0x100401538
mov rcx, r12
call sub.msys_2.0.dll_printf
mov rcx, qword [rdi + rsi*8]
add rsi, 1
call sub.msys_2.0.dll_puts
cmp r13, rsi
jne 0x100401530
mov rdx, qword [0x100408010]
cmp rdx, 1
ja 0x100401725
test rdx, rdx
je 0x10040169e
xor esi, esi
lea r13, [0x1004040a3]
lea r12, [0x10040409d]
lea rdi, [0x1004040a7]
jmp 0x1004015d1
mov r14, rsi
add rsi, 1
shl r14, 5
mov rax, qword [0x100408018]
lea rcx, str.__10s_t_s_n
add rax, r14
mov rdx, qword [rax + 0x10]
mov r8, qword [rax + 0x18]
call sub.msys_2.0.dll_printf
mov rbx, qword [0x100408010]
cmp rbx, rsi
jbe 0x1004016c5
cmp dword [rsp + 0xd0], 1
jle 0x100401598
mov rbx, qword [0x100408018]
xor r15d, r15d
xor eax, eax
nop word [rax + rax]
mov r14, rsi
lea ebp, [rax + 1]
shl r14, 5
add rbx, r14
cmp eax, dword [rbx]
jl 0x100401688
mov edx, 0x2a
test r15, r15
je 0x10040161b
xor edx, edx
cmp r15, qword [rbx + 8]
sete dl
add edx, 0x2a
mov rcx, r13
add rsi, 1
call sub.msys_2.0.dll_printf
mov rbx, qword [0x100408018]
cmp rsi, qword [0x100408010]
lea rax, [rbx + r14]
mov r15, qword [rax + 8]
jae 0x100401655
mov rdx, qword [rbx + r14 + 0x30]
mov rcx, qword [rax + 0x10]
call sub.msys_2.0.dll_strcmp
test eax, eax
jne 0x100401655
mov eax, ebp
jmp 0x1004015f0
cmp dword [rsp + 0xd0], ebp
jle 0x100401674
nop
mov rcx, r12
add ebp, 1
call sub.msys_2.0.dll_printf
cmp dword [rsp + 0xd0], ebp
jne 0x100401660
mov rcx, rdi
call sub.msys_2.0.dll_printf
jmp 0x1004015a3
mov rcx, r12
call sub.msys_2.0.dll_printf
mov rbx, qword [0x100408018]
mov eax, ebp
jmp 0x1004015f0
mov r12, qword [0x100408018]
test r12, r12
jne 0x100401706
mov qword [0x100408010], 0
mov qword [0x100408008], 0
jmp 0x100401295
mov r12, qword [0x100408018]
test r12, r12
je 0x1004016aa
test rbx, rbx
je 0x100401706
mov rsi, rbx
shl rsi, 5
add rsi, r12
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 0x1004016e0
mov rcx, r12
call sub.msys_2.0.dll_free
mov qword [0x100408018], 0
jmp 0x1004016aa
cmp rdx, 1
je 0x10040157b
mov rcx, qword [0x100408018]
lea r9, [0x1004010a0]
mov r8d, 0x20
call sub.msys_2.0.dll_qsort
mov rdx, qword [0x100408010]
jmp 0x100401572
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 0x100401920
shl rdx, 5
mov qword [0x100408010], rax
xor r10d, r10d
lea rbx, [rcx + rdx]
mov dword [rbx], ebp
cmp edi, 1
jg 0x100401820
mov qword [rbx + 8], r10
mov rcx, r12
call sub.msys_2.0.dll_strdup
test rax, rax
je 0x100401963
mov qword [rbx + 0x10], rax
mov rcx, qword [rsi]
lea r12, str._No_description_
test rcx, rcx
je 0x1004017fd
mov edx, 0x7c
call sub.msys_2.0.dll_strrchr
test rax, rax
je 0x1004017fd
cmp byte [rax + 1], 0
je 0x1004017fd
lea r12, [rax + 1]
mov rcx, r12
call sub.msys_2.0.dll_strdup
test rax, rax
je 0x100401963
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 0x100401957
test rdx, rdx
je 0x10040184e
movzx eax, byte [rdx]
test al, al
je 0x10040184e
nop dword [rax]
add rdx, 1
add r10, rax
movzx eax, byte [rdx]
test al, al
jne 0x100401840
movzx eax, word [rsi + 0x38]
test eax, eax
je 0x100401883
mov rdx, qword [rsi + 0x10]
lea ecx, [rax - 1]
lea rax, [rdx + 1]
add rcx, rax
jmp 0x100401874
add rax, 1
movsx rdx, byte [rdx]
add r10, rdx
mov rdx, rax
cmp rax, rcx
jne 0x100401870
movzx eax, word [rsi + 0x3a]
test eax, eax
je 0x1004018b2
mov rdx, qword [rsi + 0x18]
lea ecx, [rax - 1]
lea rax, [rdx + 4]
lea rcx, [rax + rcx*4]
jmp 0x1004018a4
add rax, 4
movsxd rdx, dword [rdx]
add r10, rdx
mov rdx, rax
cmp rcx, rax
jne 0x1004018a0
movzx edx, word [rsi + 0x3c]
test edx, edx
je 0x1004017bc
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 0x10040191a
nop word cs:[rax + rax]
test rdx, rdx
je 0x100401901
movzx eax, byte [rdx]
test al, al
je 0x100401901
xor ecx, ecx
nop
add rdx, 1
add rcx, rax
movzx eax, byte [rdx]
test al, al
jne 0x1004018f0
add r10, rcx
mov rax, r11
cmp r8, r11
je 0x1004017bc
mov rdx, qword [rax]
add r11, 8
cmp rdx, 0xffffffffffffffff
jne 0x1004018e0
sub r10, 1
jmp 0x100401901
add rdx, 6
lea rax, [rdx + rdx]
shl rdx, 6
mov qword [0x100408008], rax
call sub.msys_ncursesw6.dll__nc_doalloc
mov qword [0x100408018], rax
mov rcx, rax
test rax, rax
je 0x10040196f
mov rdx, qword [0x100408010]
lea rax, [rdx + 1]
jmp 0x1004017a3
mov r10, 0xffffffffffffffff
jmp 0x10040184e
lea rcx, str.strmalloc
call fcn.100401080
lea rcx, str.ptr_termdata
call fcn.100401080
nop
nop
nop
nop
nop