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

Disassembly:
push rbp
mov rbp, rsp
sub rsp, 0x90
mov qword [rbp + 0x10], rcx
mov qword [rbp + 0x18], rdx
mov qword [rbp + 0x20], r8
mov eax, dword [0x100405010]
test eax, eax
jns 0x100403959
lea r9, str.master___0
lea r8, str.run_program_in_pty
mov edx, 0x42
lea rax, str.pty.c
mov rcx, rax
call sub.msys_2.0.dll___assert_func
mov byte [0x10040b05f], 0
mov eax, dword [0x100405010]
mov ecx, eax
call sub.msys_2.0.dll_ptsname
mov r8d, 0xfff
mov rdx, rax
lea rax, [0x10040a060]
mov rcx, rax
call sub.msys_2.0.dll_strncpy
mov edx, 0x8002
lea rax, [0x10040a060]
mov rcx, rax
call sub.msys_2.0.dll_open
mov dword [rbp - 0xc], eax
cmp dword [rbp - 0xc], 0
jns 0x1004039bb
lea rax, str.slave_pty:_open
mov rcx, rax
call sub.msys_2.0.dll_perror
mov eax, 1
jmp 0x100403c91
call sub.msys_2.0.dll_fork
mov dword [rbp - 0x10], eax
cmp dword [rbp - 0x10], 0
jns 0x1004039e2
lea rax, str.fork
mov rcx, rax
call sub.msys_2.0.dll_perror
mov eax, 1
jmp 0x100403c91
cmp dword [rbp - 0x10], 0
jne 0x100403c81
mov eax, dword [0x100405010]
mov ecx, eax
call sub.msys_2.0.dll_close
mov eax, dword [rbp - 0xc]
mov r8d, 0
mov edx, 2
mov ecx, eax
call sub.msys_2.0.dll_fcntl
mov eax, dword [rbp - 0xc]
mov edx, 0
mov ecx, eax
call sub.msys_2.0.dll_dup2
mov eax, dword [rbp - 0xc]
mov edx, 1
mov ecx, eax
call sub.msys_2.0.dll_dup2
cmp dword [rbp - 0xc], 0
je 0x100403a42
cmp dword [rbp - 0xc], 1
je 0x100403a42
mov eax, dword [rbp - 0xc]
mov ecx, eax
call sub.msys_2.0.dll_close
mov edx, 2
mov ecx, 1
call sub.msys_2.0.dll_dup2
call sub.msys_2.0.dll_setsid
call sub.msys_2.0.dll_setpgrp
mov dword [rbp - 0x44], 0
mov edx, 2
lea rax, [0x10040a060]
mov rcx, rax
call sub.msys_2.0.dll_open
mov dword [rbp - 0x14], eax
cmp dword [rbp - 0x14], 0
js 0x100403af6
lea rdx, [rbp - 0x44]
mov eax, dword [rbp - 0x14]
mov r8, rdx
mov edx, 0x540e
mov ecx, eax
call sub.msys_2.0.dll_ioctl
mov eax, dword [rbp - 0x14]
mov ecx, eax
call sub.msys_2.0.dll_close
call sub.msys_2.0.dll_getpgrp
mov edx, eax
mov ecx, 0
call sub.msys_2.0.dll_tcsetpgrp
mov qword [rbp - 0x70], 0
mov qword [rbp - 0x68], 0
mov qword [rbp - 0x60], 0
mov qword [rbp - 0x58], 0
mov qword [rbp - 0x50], 0
mov dword [rbp - 0x48], 0
lea rax, [rbp - 0x70]
mov rdx, rax
mov ecx, 0
call sub.msys_2.0.dll_tcgetattr
test eax, eax
jne 0x100403b2e
jmp 0x100403b0f
lea rax, str.slave_pty:_open
mov rcx, rax
call sub.msys_2.0.dll_perror
mov ecx, 0x7f
call sub.msys_2.0.dll_exit
mov eax, dword [rbp - 0x70]
or ah, 0x80
mov dword [rbp - 0x70], eax
lea rax, [rbp - 0x70]
mov r8, rax
mov edx, 2
mov ecx, 0
call sub.msys_2.0.dll_tcsetattr
mov dword [rbp - 0x44], 0
jmp 0x100403b5e
mov rax, qword [rbp + 0x10]
mov rdx, qword [rax]
mov eax, dword [rbp - 0x44]
cdqe
shl rax, 3
add rax, rdx
mov rax, qword [rax]
mov rcx, rax
call sub.msys_2.0.dll_putenv
mov eax, dword [rbp - 0x44]
add eax, 1
mov dword [rbp - 0x44], eax
mov rax, qword [rbp + 0x10]
mov edx, dword [rax + 8]
mov eax, dword [rbp - 0x44]
cmp edx, eax
jg 0x100403b37
mov rax, qword [rbp + 0x10]
mov rax, qword [rax + 0x10]
test rax, rax
je 0x100403b89
mov rax, qword [rbp + 0x10]
mov rax, qword [rax + 0x10]
mov rcx, rax
call sub.msys_2.0.dll_putenv
cmp qword [rbp + 0x18], 0
je 0x100403b9c
mov rax, qword [rbp + 0x18]
mov rcx, rax
call sub.msys_2.0.dll_chdir
cmp qword [rbp + 0x20], 0
jne 0x100403c55
lea rax, str.SHELL
mov rcx, rax
call sub.msys_2.0.dll_getenv
mov qword [rbp - 8], rax
cmp qword [rbp - 8], 0
jne 0x100403c2b
call sub.msys_2.0.dll_getuid
mov dword [rbp - 0x18], eax
call sub.msys_2.0.dll_getlogin
mov qword [rbp - 0x20], rax
cmp qword [rbp - 0x20], 0
je 0x100403c0a
mov rax, qword [rbp - 0x20]
mov rcx, rax
call sub.msys_2.0.dll_getpwnam
mov qword [rbp - 0x28], rax
cmp qword [rbp - 0x28], 0
je 0x100403c0a
mov rax, qword [rbp - 0x28]
mov eax, dword [rax + 0x10]
cmp dword [rbp - 0x18], eax
jne 0x100403c0a
mov rax, qword [rbp - 0x28]
mov rax, qword [rax + 0x30]
mov qword [rbp - 8], rax
jmp 0x100403c2b
mov eax, dword [rbp - 0x18]
mov ecx, eax
call sub.msys_2.0.dll_getpwuid
mov qword [rbp - 0x28], rax
cmp qword [rbp - 0x28], 0
je 0x100403c2b
mov rax, qword [rbp - 0x28]
mov rax, qword [rax + 0x30]
mov qword [rbp - 8], rax
cmp qword [rbp - 8], 0
jne 0x100403c3d
lea rax, str._bin_sh
mov qword [rbp - 8], rax
mov rax, qword [rbp - 8]
mov qword [rbp - 0x40], rax
mov qword [rbp - 0x38], 0
lea rax, [rbp - 0x40]
mov qword [rbp + 0x20], rax
mov rax, qword [rbp + 0x20]
mov rax, qword [rax]
mov rdx, qword [rbp + 0x20]
mov rcx, rax
call sub.msys_2.0.dll_execv
lea rax, str.exec
mov rcx, rax
call sub.msys_2.0.dll_perror
mov ecx, 0x7f
call sub.msys_2.0.dll_exit
mov eax, dword [rbp - 0xc]
mov ecx, eax
call sub.msys_2.0.dll_close
mov eax, dword [0x100405010]
add rsp, 0x90
pop rbp
ret