Function at 0x406c30
Capabilities:
Set current directory

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x4c
mov edi, dword [esp + 0x60]
mov esi, dword [edi]
test esi, esi
je 0x406d43
mov edx, dword [edi + 0x28]
test dh, 0x40
jne 0x406d43
movzx eax, word [esi + 0x3e]
mov ebp, 3
mov word [esi + 0x3e], bp
cmp ax, 1
je 0x406f80
cmp ax, 2
je 0x406d50
cmp word [esi + 0x3a], 1
jne 0x406cb5
cmp ax, 4
jne 0x406d6b
jmp 0x406d80
mov dword [edi], ebx
mov dword [esp], esi
call sub.msys_2.0.dll_free
mov ebp, dword [ebx + 0x30]
test ebp, ebp
je 0x406dc0
movzx eax, word [ebx + 0x3e]
mov esi, ebx
cmp ax, 4
jne 0x406ec0
mov ebx, dword [esi + 8]
test ebx, ebx
jne 0x406c90
mov ebx, dword [esi + 4]
mov eax, dword [ebx + 0xc]
test eax, eax
jne 0x407180
mov dword [edi], ebx
mov dword [esp], esi
call sub.msys_2.0.dll_free
cmp dword [ebx + 0x30], 0xffffffff
je 0x40704c
cmp word [ebx + 0x3a], 0xb
je 0x406f31
mov edx, dword [edi + 0x10]
mov eax, dword [ebx + 0x28]
mov byte [edx + eax], 0
mov ebp, dword [ebx + 0x30]
test ebp, ebp
je 0x406fef
movzx eax, word [ebx + 0x3c]
test al, 2
je 0x406fb1
mov eax, dword [edi + 0x28]
test al, 4
je 0x407000
mov eax, dword [ebx + 0x24]
mov dword [esp], eax
call sub.msys_2.0.dll_close
mov eax, dword [edi + 0x28]
cmp word [ebx + 0x3a], 2
je 0x406d3e
mov esi, dword [ebx + 0x20]
test esi, esi
je 0x406f96
mov edx, 7
mov word [ebx + 0x3a], dx
test ah, 0x40
je 0x406db5
add esp, 0x4c
xor ebx, ebx
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
movzx eax, word [esi + 0x3a]
lea ecx, [eax - 0xc]
cmp cx, 1
jbe 0x40701d
cmp ax, 1
jne 0x406cb5
test dl, 0x40
je 0x406f40
mov eax, dword [edi + 0xc]
cmp dword [esi + 0x40], eax
je 0x406f40
test byte [esi + 0x3c], 2
jne 0x407170
mov eax, dword [edi + 4]
test eax, eax
je 0x406d9d
call fcn.00405830
mov dword [edi + 4], 0
mov eax, dword [edi + 0x28]
mov ebx, 6
lea edx, [edi + 0x30]
mov word [esi + 0x3a], bx
mov ecx, esi
mov ebx, esi
call fcn.00405d60
add esp, 0x4c
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, edi
call fcn.00405910
test eax, eax
jne 0x4070dd
test dword [edi + 0x28], 0x102
mov eax, dword [edi + 0x30]
je 0x4070d0
test eax, eax
je 0x406deb
mov dword [esp], eax
call fcn.00408490
mov eax, dword [ebx + 0x34]
lea esi, [ebx + 0xa0]
mov dword [ebx + 0x28], eax
add eax, 1
mov dword [esp + 4], esi
mov dword [esp + 8], eax
mov eax, dword [edi + 0x10]
mov dword [esp], eax
call sub.msys_2.0.dll_memmove
mov dword [esp + 4], 0x2f
mov dword [esp], esi
call sub.msys_2.0.dll_strrchr
test eax, eax
je 0x406e54
cmp esi, eax
je 0x4070eb
lea ebp, [eax + 1]
mov dword [esp], ebp
call sub.msys_2.0.dll_strlen
mov edx, eax
lea eax, [eax + 1]
mov dword [esp + 4], ebp
mov dword [esp], esi
mov dword [esp + 0x2c], edx
mov dword [esp + 8], eax
call sub.msys_2.0.dll_memmove
mov edx, dword [esp + 0x2c]
mov dword [ebx + 0x34], edx
mov eax, dword [edi + 0x10]
lea edx, [edi + 0x30]
mov dword [ebx + 0x1c], eax
mov dword [ebx + 0x18], eax
mov eax, dword [edi + 0x28]
call fcn.00405a10
movzx eax, word [ebx + 0x3a]
cmp ax, 0xb
mov dword [edi], ebx
je 0x406f13
cmp ax, 1
jne 0x406db5
mov eax, dword [ebx + 0x30]
test eax, eax
jne 0x406e8f
mov eax, dword [ebx + 0x40]
mov dword [edi + 0xc], eax
mov eax, dword [edi + 0x28]
lea edx, [edi + 0x30]
mov ecx, ebx
call fcn.00405cb0
test al, al
jne 0x406db5
call sub.msys_2.0.dll___errno
xor ebx, ebx
mov dword [eax], 0xc
jmp 0x406db5
cmp ax, 2
je 0x4071e5
mov ecx, dword [ebx + 4]
mov edx, dword [ecx + 0x28]
mov ecx, dword [ecx + 0x1c]
cmp byte [ecx + edx - 1], 0x2f
lea eax, [edx - 1]
cmovne eax, edx
add eax, dword [edi + 0x10]
mov byte [eax], 0x2f
mov ecx, dword [ebx + 0x34]
add eax, 1
mov dword [esp], eax
lea edx, [ecx + 1]
mov dword [esp + 8], edx
lea edx, [ebx + 0xa0]
mov dword [esp + 4], edx
call sub.msys_2.0.dll_memmove
movzx eax, word [ebx + 0x3a]
mov dword [edi], ebx
cmp ax, 0xb
jne 0x406e78
mov eax, dword [ebx + 0x68]
mov edx, dword [ebx + 0x6c]
mov ecx, eax
xor ecx, 2
or ecx, edx
je 0x4070fd
xor eax, 1
or edx, eax
je 0x406db5
call sub.msys_2.0.dll_abort
lea esi, [esi]
lea edi, [edi]
mov eax, dword [edi + 4]
test eax, eax
je 0x40707e
test dh, 0x20
jne 0x40706c
mov eax, dword [esi + 0x18]
mov ecx, 0xffffffff
mov edx, esi
mov dword [esp], eax
mov eax, edi
call fcn.00405ae0
test eax, eax
jne 0x4071af
mov ebx, dword [edi + 4]
mov dword [edi + 4], 0
jmp 0x406eca
xor ecx, ecx
mov edx, esi
mov eax, edi
call fcn.00405540
mov ebx, esi
mov word [esi + 0x3a], ax
jmp 0x406db5
mov ecx, 6
lea edx, [edi + 0x30]
mov word [ebx + 0x3a], cx
mov ecx, ebx
call fcn.00405d60
mov eax, dword [edi + 0x28]
jmp 0x406d3e
test al, 1
jne 0x406d20
mov edx, dword [ebx + 4]
mov ecx, 0xffffffff
mov dword [esp], 0x40caa0
mov eax, edi
call fcn.00405ae0
test eax, eax
je 0x406d20
call sub.msys_2.0.dll___errno
mov eax, dword [eax]
mov dword [ebx + 0x20], eax
mov eax, dword [edi + 0x28]
or ah, 0x40
mov dword [edi + 0x28], eax
jmp 0x406d23
mov eax, edi
call fcn.00405910
test eax, eax
je 0x406d20
jmp 0x406fd7
test ah, 2
je 0x40720b
mov edx, dword [ebx + 0x24]
mov ecx, 1
mov eax, edi
call fcn.004058b0
jmp 0x406d15
mov ecx, 1
mov edx, esi
mov eax, edi
call fcn.00405540
cmp ax, 1
mov word [esi + 0x3a], ax
je 0x407246
cmp ax, 0xb
mov dword [edi], esi
mov ebx, esi
jne 0x406db5
jmp 0x406f13
mov dword [esp], ebx
xor ebx, ebx
call sub.msys_2.0.dll_free
call sub.msys_2.0.dll___errno
mov dword [eax], 0
mov dword [edi], 0
jmp 0x406db5
and dh, 0xdf
mov dword [edi + 0x28], edx
call fcn.00405830
mov dword [edi + 4], 0
mov edx, 3
mov eax, edi
call fcn.00405e00
test eax, eax
mov ebx, eax
mov dword [edi + 4], eax
jne 0x406f73
mov eax, dword [edi + 0x28]
test ah, 0x40
jne 0x406d43
mov ecx, dword [esi + 0x20]
test ecx, ecx
je 0x4070ba
cmp word [esi + 0x3a], 4
je 0x4070ba
mov edx, 7
mov word [esi + 0x3a], dx
lea edx, [edi + 0x30]
mov ecx, esi
mov ebx, esi
call fcn.00405d60
jmp 0x406db5
mov dword [esp], eax
call sub.msys_2.0.dll_free
jmp 0x406deb
or dword [edi + 0x28], 0x4000
xor ebx, ebx
jmp 0x406db5
cmp byte [ebx + 0xa1], 0
jne 0x406e29
jmp 0x406e54
mov ecx, dword [ebx + 0x30]
mov esi, dword [ebx + 4]
test ecx, ecx
jle 0x40711d
cmp word [esi + 0x38], 0
jne 0x40711d
mov eax, dword [edi + 0x28]
and eax, 0x18
cmp eax, 0x18
je 0x4072b8
xor ecx, ecx
mov edx, ebx
mov eax, edi
call fcn.00405540
mov edx, dword [ebx + 0x50]
mov word [ebx + 0x3a], ax
and edx, 0xf000
cmp edx, 0x4000
jne 0x406e78
mov edx, dword [ebx + 0x30]
test edx, edx
je 0x407281
movzx edx, word [esi + 0x38]
test dx, dx
je 0x40715c
sub edx, 1
mov word [esi + 0x38], dx
cmp ax, 1
jne 0x406db5
jmp 0x406e8f
mov eax, dword [esi + 0x24]
mov dword [esp], eax
call sub.msys_2.0.dll_close
jmp 0x406d8a
mov eax, dword [ebx + 0x28]
mov edx, dword [edi + 0x10]
mov dword [edi], ebx
mov byte [edx + eax], 0
mov edx, 3
mov eax, edi
call fcn.00405e00
test eax, eax
mov ebx, eax
je 0x407234
mov dword [esp], esi
call sub.msys_2.0.dll_free
jmp 0x406eca
call sub.msys_2.0.dll___errno
mov ebx, dword [edi + 4]
mov eax, dword [eax]
or word [esi + 0x3c], 1
test ebx, ebx
mov dword [esi + 0x20], eax
je 0x406f73
mov eax, ebx
nop
lea esi, [esi]
mov edx, dword [eax + 4]
mov edx, dword [edx + 0x18]
mov dword [eax + 0x18], edx
mov eax, dword [eax + 8]
test eax, eax
jne 0x4071d0
jmp 0x406f73
mov ecx, 1
mov edx, ebx
mov eax, edi
call fcn.00405540
cmp ax, 1
mov word [ebx + 0x3a], ax
je 0x407257
mov esi, 3
mov word [ebx + 0x3e], si
jmp 0x406eca
mov eax, dword [ebx + 0x24]
mov dword [esp], eax
call sub.msys_2.0.dll_fchdir
test eax, eax
je 0x406d15
call sub.msys_2.0.dll___errno
mov eax, dword [eax]
mov dword [ebx + 0x20], eax
or dword [edi + 0x28], 0x4000
jmp 0x406d15
test byte [edi + 0x29], 0x40
jne 0x406d43
mov ebx, dword [esi + 4]
jmp 0x406cca
mov edx, dword [edi + 0x28]
test dl, 4
je 0x407290
mov dword [edi], esi
mov ebx, esi
jmp 0x406e78
mov edx, dword [edi + 0x28]
test dl, 4
jne 0x4071fd
mov eax, dword [edi + 0x18]
mov ecx, 0x40caa4
call fcn.00405a80
test eax, eax
mov dword [ebx + 0x24], eax
js 0x407392
or word [ebx + 0x3c], 2
jmp 0x4071fd
cmp ax, 1
jne 0x406db5
jmp 0x406e89
mov eax, dword [edi + 0x18]
mov ecx, 0x40caa4
call fcn.00405a80
test eax, eax
mov dword [esi + 0x24], eax
js 0x4073a7
or word [esi + 0x3c], 2
movzx eax, word [esi + 0x3a]
mov ebx, esi
jmp 0x406e6c
mov ebp, dword [esi + 0x2c]
test byte [ebp + 0x29], 2
je 0x40711d
mov edx, dword [ebp + 0x2c]
test edx, edx
je 0x407347
mov eax, dword [esi + 0x40]
mov dword [esp], edx
mov dword [esp + 0x2c], edx
mov dword [esp + 0x38], eax
lea eax, [esp + 0x38]
mov dword [esp + 4], eax
call fcn.00408070
test eax, eax
mov edx, dword [esp + 0x2c]
je 0x407302
cmp byte [eax + 4], 0
je 0x40711d
movzx eax, word [ebx + 0x3a]
jmp 0x406e78
mov dword [esp], 8
mov dword [esp + 0x2c], edx
call sub.msys_2.0.dll_malloc
test eax, eax
mov ebp, eax
je 0x40711d
mov byte [eax + 4], 0
mov edx, dword [esp + 0x2c]
mov eax, dword [esi + 0x40]
mov dword [ebp], eax
mov dword [esp + 4], ebp
mov dword [esp], edx
call fcn.004088b0
test eax, eax
je 0x407385
cmp ebp, eax
je 0x40711d
jmp 0x406f31
mov dword [esp + 0x10], sub.msys_2.0.dll_free
mov dword [esp + 0xc], 0x4054d0
mov dword [esp + 8], 0x4054c0
mov dword [esp + 4], 0
mov dword [esp], 0xd
call fcn.004082b0
test eax, eax
mov edx, eax
mov dword [ebp + 0x2c], eax
jne 0x4072cc
jmp 0x40711d
mov dword [esp], ebp
call sub.msys_2.0.dll_free
jmp 0x40711d
call sub.msys_2.0.dll___errno
mov eax, dword [eax]
mov word [ebx + 0x3a], 7
mov dword [ebx + 0x20], eax
jmp 0x4071fd
call sub.msys_2.0.dll___errno
mov eax, dword [eax]
mov word [esi + 0x3a], 7
mov dword [esi + 0x20], eax
mov eax, 7
jmp 0x40724e