// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq %rdi, %r14
callq 0x1ce8
movq %rax, %rbp
movq $0x0, 0x8(%rsp)
movq (%r15), %r12
leaq 0x4997(%rip), %rsi      # 0x7169
movq %r14, %rdi
callq 0x2417
movq %rax, %rdi
movl $0x3a, %esi
callq 0x2efc
testq %rax, %rax
movq %rbx, 0x10(%rsp)
je 0x28c2
movq %rax, %r13
movq %rbp, 0x18(%rsp)
movq (%rax), %rdi
testq %rdi, %rdi
je 0x28b0
xorl %ebx, %ebx
callq 0x1060
testq %rax, %rax
je 0x289f
movq %rax, %rbp
movq %rbp, %rdi
callq 0x1120
testq %rax, %rax
je 0x2866
cmpb $0x2e, 0x13(%rax)
je 0x281c
addq $0x13, %rax
movq %r12, %rdi
movq %rax, %rsi
callq 0x2a9c
testl %eax, %eax
jne 0x281c
movq (%r13,%rbx,8), %r14
movq %r14, %rdi
callq 0x2d5c
cmpb $0x2f, -0x1(%r14,%rax)
movq (%r13,%rbx,8), %rdi
jne 0x286b
movq %r12, %rsi
callq 0x2bf0
jmp 0x2887
xorl %r14d, %r14d
jmp 0x2892
leaq 0x4911(%rip), %rsi      # 0x7183
callq 0x2bf0
movq %rax, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x2ccd
movq %rax, %r14
movq %rbp, %rdi
callq 0x10c0
testq %r14, %r14
jne 0x28b3
movq %rbp, %rdi
callq 0x10c0
movq 0x8(%r13,%rbx,8), %rdi
incq %rbx
testq %rdi, %rdi
jne 0x280b
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x2da8
movq 0x18(%rsp), %rbp
jmp 0x28c5
xorl %r14d, %r14d
movq %r14, 0x8(%rsp)
testq %r14, %r14
jne 0x28dc
movq (%r15), %rdi
callq 0x2bb0
movq %rax, 0x8(%rsp)
callq 0x1170
leaq 0x97f0(%rip), %rbx      # 0xc0d8
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0x294e
testl %eax, %eax
je 0x29ca
leaq 0x24(%rsp), %r14
movl %eax, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x1140
movl (%r14), %eax
movl $0x0, (%rbx)
movzbl %ah, %ecx
movl %ecx, 0x4(%rbx)
andl $0x7f, %eax
movl %eax, %ecx
shll $0x18, %ecx
addl $0x1000000, %ecx        # imm = 0x1000000
cmpl $0x2000000, %ecx        # imm = 0x2000000
jl 0x29a9
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x29a9
leaq 0x48d8(%rip), %rcx      # 0x7214
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x4977(%rip), %rdi      # 0x72c3
jmp 0x299f
movq (%r15), %rcx
leaq 0x48e4(%rip), %rsi      # 0x723c
movl $0x2, %edi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x3af8
jmp 0x29a9
leaq 0x4918(%rip), %rdi      # 0x728a
jmp 0x299f
leaq 0x4964(%rip), %rdi      # 0x72df
jmp 0x299f
leaq 0x490d(%rip), %rdi      # 0x7291
jmp 0x299f
leaq 0x493e(%rip), %rdi      # 0x72cb
jmp 0x299f
leaq 0x4927(%rip), %rdi      # 0x72bd
jmp 0x299f
leaq 0x4905(%rip), %rdi      # 0x72a4
movl $0x2, %esi
callq 0x3220
movq %rbp, %rdi
callq 0x2da8
leaq 0x8(%rsp), %rdi
callq 0x2d88
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x2d88
movq 0x8(%rsp), %rdi
callq 0x2bb0
movq %rax, (%r15)
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x10e0
movl %eax, 0x4(%rbx)
cmpl $-0x1, %eax
jne 0x2a06
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x2a0e
movl 0x4(%rbx), %edi
callq 0x1160