Function at 0x1004039b7
Capabilities:
Query environment variable
Set current directory
Terminate process

Disassembly:
push rbp
push rdi
sub rsp, 0x98
lea rbp, [rsp + 0x80]
mov qword [rbp + 0x30], rcx
mov qword [rbp + 0x38], rdx
mov qword [rbp + 0x40], r8
mov eax, dword [0x100405010]
test eax, eax
jns 0x1004039fd
lea r9, str.master___0
lea r8, str.run_program_in_pty
mov edx, 0x42
lea rcx, str.pty.c
call sub.cygwin1.dll___assert_func
mov byte [0x10040afff], 0
mov eax, dword [0x100405010]
mov ecx, eax
call sub.cygwin1.dll_ptsname
mov r8d, 0xfff
mov rdx, rax
lea rcx, [section..bss]
call sub.cygwin1.dll_strncpy
mov edx, 0x8002
lea rcx, [section..bss]
call sub.cygwin1.dll_open
mov dword [rbp + 4], eax
cmp dword [rbp + 4], 0
jns 0x100403a56
lea rcx, str.slave_pty:_open
call sub.cygwin1.dll_perror
mov eax, 1
jmp 0x100403d0c
call sub.cygwin1.dll_fork
mov dword [rbp], eax
cmp dword [rbp], 0
jns 0x100403a7a
lea rcx, str.fork
call sub.cygwin1.dll_perror
mov eax, 1
jmp 0x100403d0c
cmp dword [rbp], 0
jne 0x100403cfc
mov eax, dword [0x100405010]
mov ecx, eax
call sub.cygwin1.dll_close
mov eax, dword [rbp + 4]
mov r8d, 0
mov edx, 2
mov ecx, eax
call sub.cygwin1.dll_fcntl
mov eax, dword [rbp + 4]
mov edx, 0
mov ecx, eax
call sub.cygwin1.dll_dup2
mov eax, dword [rbp + 4]
mov edx, 1
mov ecx, eax
call sub.cygwin1.dll_dup2
cmp dword [rbp + 4], 0
je 0x100403ada
cmp dword [rbp + 4], 1
je 0x100403ada
mov eax, dword [rbp + 4]
mov ecx, eax
call sub.cygwin1.dll_close
mov edx, 2
mov ecx, 1
call sub.cygwin1.dll_dup2
call sub.cygwin1.dll_setsid
call sub.cygwin1.dll_setpgrp
mov dword [rbp - 0x34], 0
mov edx, 2
lea rcx, [section..bss]
call sub.cygwin1.dll_open
mov dword [rbp - 4], eax
cmp dword [rbp - 4], 0
js 0x100403b79
lea rdx, [rbp - 0x34]
mov eax, dword [rbp - 4]
mov r8, rdx
mov edx, 0x540e
mov ecx, eax
call sub.cygwin1.dll_ioctl
mov eax, dword [rbp - 4]
mov ecx, eax
call sub.cygwin1.dll_close
call sub.cygwin1.dll_getpgrp
mov edx, eax
mov ecx, 0
call sub.cygwin1.dll_tcsetpgrp
lea rdx, [rbp - 0x60]
mov eax, 0
mov ecx, 5
mov rdi, rdx
rep stosq qword [rdi], rax
mov rdx, rdi
mov dword [rdx], eax
add rdx, 4
lea rax, [rbp - 0x60]
mov rdx, rax
mov ecx, 0
call sub.cygwin1.dll_tcgetattr
test eax, eax
jne 0x100403bae
jmp 0x100403b8f
lea rcx, str.slave_pty:_open
call sub.cygwin1.dll_perror
mov ecx, 0x7f
call sub.cygwin1.dll_exit
mov eax, dword [rbp - 0x60]
or ah, 0x80
mov dword [rbp - 0x60], eax
lea rax, [rbp - 0x60]
mov r8, rax
mov edx, 2
mov ecx, 0
call sub.cygwin1.dll_tcsetattr
mov dword [rbp - 0x34], 0
jmp 0x100403bdf
mov rax, qword [rbp + 0x30]
mov rax, qword [rax]
mov edx, dword [rbp - 0x34]
movsxd rdx, edx
shl rdx, 3
add rax, rdx
mov rax, qword [rax]
mov rcx, rax
call sub.cygwin1.dll_putenv
mov eax, dword [rbp - 0x34]
add eax, 1
mov dword [rbp - 0x34], eax
mov rax, qword [rbp + 0x30]
mov edx, dword [rax + 8]
mov eax, dword [rbp - 0x34]
cmp edx, eax
jg 0x100403bb7
mov rax, qword [rbp + 0x30]
mov rax, qword [rax + 0x10]
test rax, rax
je 0x100403c0a
mov rax, qword [rbp + 0x30]
mov rax, qword [rax + 0x10]
mov rcx, rax
call sub.cygwin1.dll_putenv
cmp qword [rbp + 0x38], 0
je 0x100403c1d
mov rax, qword [rbp + 0x38]
mov rcx, rax
call sub.cygwin1.dll_chdir
cmp qword [rbp + 0x40], 0
jne 0x100403cd3
lea rcx, str.SHELL
call sub.cygwin1.dll_getenv
mov qword [rbp + 8], rax
cmp qword [rbp + 8], 0
jne 0x100403ca9
call sub.cygwin1.dll_getuid
mov dword [rbp - 8], eax
call sub.cygwin1.dll_getlogin
mov qword [rbp - 0x10], rax
cmp qword [rbp - 0x10], 0
je 0x100403c88
mov rax, qword [rbp - 0x10]
mov rcx, rax
call sub.cygwin1.dll_getpwnam
mov qword [rbp - 0x18], rax
cmp qword [rbp - 0x18], 0
je 0x100403c88
mov rax, qword [rbp - 0x18]
mov eax, dword [rax + 0x10]
cmp eax, dword [rbp - 8]
jne 0x100403c88
mov rax, qword [rbp - 0x18]
mov rax, qword [rax + 0x30]
mov qword [rbp + 8], rax
jmp 0x100403ca9
mov eax, dword [rbp - 8]
mov ecx, eax
call sub.cygwin1.dll_getpwuid
mov qword [rbp - 0x18], rax
cmp qword [rbp - 0x18], 0
je 0x100403ca9
mov rax, qword [rbp - 0x18]
mov rax, qword [rax + 0x30]
mov qword [rbp + 8], rax
cmp qword [rbp + 8], 0
jne 0x100403cbb
lea rax, str._bin_sh
mov qword [rbp + 8], rax
mov rax, qword [rbp + 8]
mov qword [rbp - 0x30], rax
mov qword [rbp - 0x28], 0
lea rax, [rbp - 0x30]
mov qword [rbp + 0x40], rax
mov rax, qword [rbp + 0x40]
mov rax, qword [rax]
mov rdx, qword [rbp + 0x40]
mov rcx, rax
call sub.cygwin1.dll_execv
lea rcx, str.exec
call sub.cygwin1.dll_perror
mov ecx, 0x7f
call sub.cygwin1.dll_exit
mov eax, dword [rbp + 4]
mov ecx, eax
call sub.cygwin1.dll_close
mov eax, dword [0x100405010]
add rsp, 0x98
pop rdi
pop rbp
ret