// File: /workspace/github_c_makefile_star2_O2/ffoissey[P]minishell_42/srcs/ft_process_out.c
// Function: ft_process_out
void		ft_process_out(t_list_ex *lst, char *process, char **tab)
{
	char		**env;
	char		*exec;
	int			status;

	env = ft_lst_to_tab(lst);
	exec = NULL;
	if (!(exec = ft_bin(lst, tab[0])))
		exec = ft_strdup(tab[0]);
	if ((g_glob.pid = fork()) == -1)
		ft_dprintf(2, "%s: %s: Command failed\n", process, tab[0]);
	else if (g_glob.pid == 0)
	{
		ft_strdel(&tab[0]);
		tab[0] = ft_strdup(exec);
		if ((g_glob.ret = execve(exec, tab, env)) == -1)
			ft_rights(process, exec);
		exit(g_glob.ret);
	}
	else
	{
		waitpid(g_glob.pid, &status, 0);
		ft_signal(status);
	}
	ft_free_tab_str(env);
	ft_strdel(&exec);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
callq 0x1c44
movq %rax, 0x10(%rsp)
movq (%r15), %r12
leaq 0x4ad0(%rip), %rsi      # 0x7169
movq %rbx, %rdi
callq 0x22f9
pushq $0x3a
popq %rsi
movq %rax, %rdi
callq 0x2cf0
testq %rax, %rax
je 0x276c
movq %rax, %r13
xorl %ebx, %ebx
movq (%r13,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2758
callq 0x1060
testq %rax, %rax
je 0x2750
movq %rax, %r14
movq %r14, %rdi
callq 0x1110
testq %rax, %rax
je 0x2748
cmpb $0x2e, 0x13(%rax)
je 0x26d5
addq $0x13, %rax
movq %r12, %rdi
movq %rax, %rsi
callq 0x28e0
testl %eax, %eax
jne 0x26d5
movq (%r13,%rbx,8), %rbp
movq %rbp, %rdi
callq 0x2b7c
cmpb $0x2f, -0x1(%rbp,%rax)
movq (%r13,%rbx,8), %rdi
jne 0x271e
movq %r12, %rsi
callq 0x2a10
jmp 0x2738
leaq 0x4a5e(%rip), %rsi      # 0x7183
callq 0x2a10
movq %rax, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0x2aed
movq %rax, %rbp
movq %r14, %rdi
callq 0x10b0
testq %rbp, %rbp
jne 0x275a
movq %r14, %rdi
callq 0x10b0
incq %rbx
jmp 0x26ba
xorl %ebp, %ebp
movq %r13, %rdi
callq 0x2bc4
movq %rbp, 0x18(%rsp)
testq %rbp, %rbp
jne 0x277c
movq (%r15), %rdi
callq 0x29d0
movq %rax, %rbp
movq %rax, 0x18(%rsp)
callq 0x1160
leaq 0x9948(%rip), %r14      # 0xc0d0
movl %eax, (%r14)
cmpl $-0x1, %eax
je 0x27f8
testl %eax, %eax
je 0x2834
leaq 0x24(%rsp), %rbx
movl %eax, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1130
andl $0x0, (%r14)
movl (%rbx), %eax
movzbl %ah, %ecx
movl %ecx, 0x4(%r14)
andl $0x7f, %eax
movl %eax, %ecx
shll $0x18, %ecx
addl $0x1000000, %ecx        # imm = 0x1000000
cmpl $0x2000000, %ecx        # imm = 0x2000000
jl 0x2811
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x2811
movl $0x2d7, %ecx            # imm = 0x2D7
btl %eax, %ecx
jae 0x2811
movl %eax, %eax
leaq 0x4add(%rip), %rcx      # 0x72c4
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
pushq $0x2
popq %rsi
callq 0x3078
jmp 0x2811
movq (%r15), %rcx
leaq 0x4a11(%rip), %rsi      # 0x7213
pushq $0x2
popq %rdi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x38b8
movq 0x10(%rsp), %rdi
callq 0x2bc4
leaq 0x18(%rsp), %rdi
callq 0x2ba8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x2ba8
movq %rbp, %rdi
callq 0x29d0
movq %rax, (%r15)
movq %rbp, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
callq 0x10d0
movl %eax, 0x4(%r14)
cmpl $-0x1, %eax
jne 0x28a5
movq %rbp, %rdi
xorl %esi, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x2888
pushq $0x1
popq %rsi
movq %rbp, %rdi
callq 0x1140
cmpl $-0x1, %eax
jne 0x2888
leaq 0x49a5(%rip), %rsi      # 0x722b
jmp 0x288f
leaq 0x49b7(%rip), %rsi      # 0x7246
pushq $0x2
popq %rdi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x38b8
movl 0x4(%r14), %eax
movl %eax, %edi
callq 0x1150