// File: /workspace/github_c_makefile_star2_O3/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, 0x10(%rsp)
movq %rdi, %r14
callq 0x1cf0
movq %rax, %rbp
movq $0x0, 0x18(%rsp)
movq (%r15), %r12
leaq 0x49a9(%rip), %rsi      # 0x7169
movq %r14, %rdi
callq 0x23f7
movq %rax, %rdi
movl $0x3a, %esi
callq 0x2eb0
testq %rax, %rax
je 0x28a5
movq %rax, %r13
movq %rbp, 0x8(%rsp)
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2898
xorl %ebx, %ebx
callq 0x1060
testq %rax, %rax
je 0x2887
movq %rax, %rbp
movq %rbp, %rdi
callq 0x1120
testq %rax, %rax
je 0x287f
cmpb $0x2e, 0x13(%rax)
je 0x2805
addq $0x13, %rax
movq %r12, %rdi
movq %rax, %rsi
callq 0x2a50
testl %eax, %eax
jne 0x2805
movq (%r13,%rbx,8), %r14
movq %r14, %rdi
callq 0x2d18
cmpb $0x2f, -0x1(%r14,%rax)
movq (%r13,%rbx,8), %rdi
jne 0x284f
movq %r12, %rsi
callq 0x2bac
jmp 0x286b
leaq 0x492d(%rip), %rsi      # 0x7183
callq 0x2bac
movq %rax, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x2c89
movq %rax, %r14
movq %rbp, %rdi
callq 0x10c0
testq %r14, %r14
jne 0x2970
movq %rbp, %rdi
callq 0x10c0
movq 0x8(%r13,%rbx,8), %rdi
incq %rbx
testq %rdi, %rdi
jne 0x27f4
movq %r13, %rdi
callq 0x2d70
movq 0x8(%rsp), %rbp
movq (%r15), %rdi
callq 0x2b6c
movq %rax, %r14
movq %r14, 0x18(%rsp)
callq 0x1170
leaq 0x9817(%rip), %rbx      # 0xc0d8
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0x2934
testl %eax, %eax
je 0x2982
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 0x294f
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x294f
movl $0x2d7, %ecx            # imm = 0x2D7
btl %eax, %ecx
jae 0x294f
movl %eax, %eax
leaq 0x49a3(%rip), %rcx      # 0x72c4
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
movl $0x2, %esi
callq 0x321c
jmp 0x294f
movq (%r15), %rcx
leaq 0x48d5(%rip), %rsi      # 0x7213
movl $0x2, %edi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x3ad4
movq %rbp, %rdi
callq 0x2d70
leaq 0x18(%rsp), %rdi
callq 0x2d50
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x2d70
movq 0x8(%rsp), %rbp
jmp 0x28b0
movq %r15, %rdi
callq 0x2d50
movq %r14, %rdi
callq 0x2b6c
movq %rax, (%r15)
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x10e0
movl %eax, 0x4(%rbx)
cmpl $-0x1, %eax
jne 0x29bb
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x29c2
movl 0x4(%rbx), %eax
movl %eax, %edi
callq 0x1160