LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parser_root.c
// Function: parser_pipe_priority
void		parser_pipe_priority(t_btree **ast)
{
	if (!ast || !*ast)
		return ;
	parser_pipe_priority(&(*ast)->left);
	parser_pipe_priority(&(*ast)->right);
	if (btree_id(*ast) == PIPE)
		parser_btree_reverse_pipe(ast);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x5db4
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x5db4
callq 0x5d7c
movq (%rbx), %rdi
addq $0x8, %rdi
callq 0x5d7c
movq (%rbx), %rdi
callq 0x5fe9
cmpl $0x2, %eax
jne 0x5db4
movq %rbx, %rdi
popq %rbx
jmp 0x5d2d
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parser_root.c
// Function: parser_root
t_btree		*parser_root(t_list *tklst, t_control *control)
{
	t_dlist		*dlst;
	t_btree		*ast;
	t_list		*tkcpy;

	ast = NULL;
	if (!(tkcpy = tklst))
		return (NULL);
//	debug_tokens_list(tklst);
	if ((dlst = ft_memalloc(sizeof(*dlst))) &&
		(ast = parser_create_ast(dlst, &tkcpy)))
	{
//		btree_debug(ast, parser_disp);
		ft_lstremove_if(&tklst, NULL, tkcmp_braces, del_token);
		ft_lstclear(&tklst, NULL);
		ft_dlstclear(&dlst, NULL);
		parser_pipe_priority(&ast);
//		btree_debug(ast, parser_disp);
	}
	else
	{
		printf("AST FAILED\n");
		control->quit = 1;
		ft_lstclear(&tklst, del_token);
		ft_dlstclearback_addr(&dlst, (void (*)(void **))&del_ast);
	}
//	parser_LIST_to_CMD_root(ast, control);
	return (ast);
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
testq %rdi, %rdi
je 0x5e6b
movq %rsi, %rbx
pushq $0x18
popq %rdi
callq 0x9fb0
movq %rax, (%rsp)
testq %rax, %rax
je 0x5e3c
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x5bf1
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x5e3c
leaq -0xe8(%rip), %rdx       # 0x5d18
leaq -0x36c0(%rip), %rcx     # 0x2747
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa338
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9de8
movq %rsp, %rdi
xorl %esi, %esi
callq 0xa200
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x5d7c
movq (%rbx), %rax
jmp 0x5e6d
leaq 0x556b(%rip), %rdi      # 0xb3ae
callq 0x2050
orb $0x1, (%rbx)
leaq -0x370b(%rip), %rsi     # 0x2747
leaq 0x8(%rsp), %rdi
callq 0x9de8
leaq -0x407(%rip), %rsi      # 0x5a5c
movq %rsp, %rdi
callq 0xa2e8
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parser_cmd.c
// Function: parser_cmd_state
int		parser_cmd_state(t_btree *new, t_list **tklst)
{
	if (tklst_id(*tklst) == AND)
	{
		if (!(new->right = btree_new((*tklst)->content)))
			return (0);
		(*tklst) = (*tklst)->next;
	}
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rsi), %rdi
callq 0x5fd5
pushq $0x1
popq %rbx
cmpl $0x4, %eax
jne 0x5eb1
movq (%r14), %rax
movq (%rax), %rdi
callq 0xa3f8
movq %rax, 0x8(%r15)
testq %rax, %rax
je 0x5eaf
movq (%r14), %rax
movq 0x8(%rax), %rax
movq %rax, (%r14)
jmp 0x5eb1
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parser_cmd.c
// Function: parser_cmdlst
int		parser_cmdlst(t_list **args, t_list **tklst)
{
	t_list *tmp;

	if (!(tmp = ft_lstnew((*tklst)->content)))
		return (0);
	ft_lstadd_back(args, tmp);
	while (((*tklst) = (*tklst)->next) && parser_is_cmd_param(tklst_id(*tklst))
			&& (tmp = ft_lstnew((*tklst)->content)))
		ft_lstadd_back(args, tmp);
	if (!tmp)
	{
		ft_lstclear(args, NULL);
		return (0);
	}
	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movq (%rsi), %rax
movq (%rax), %rdi
callq 0x9e58
testq %rax, %rax
je 0x5f4d
pushq $0x1
popq %rbx
movl $0x3f11, %ebp           # imm = 0x3F11
movq %r14, %rdi
movq %rax, %rsi
callq 0x9dac
movq (%r15), %rax
movq 0x8(%rax), %rdi
movq %rdi, (%r15)
testq %rdi, %rdi
je 0x5f4f
callq 0x5fd5
cmpl $0xd, %eax
ja 0x5f4f
btl %eax, %ebp
jae 0x5f4f
movq (%r15), %rax
movq (%rax), %rdi
callq 0x9e58
testq %rax, %rax
jne 0x5f06
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x9de8
jmp 0x5f4f
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parser_cmd.c
// Function: parser_cmd
int		parser_cmd(t_list **tklst, t_btree **new)
{
	if (!(*new = btree_new(NULL)))
		return (-1);
	if (!((*new)->item = lexer_init_token()))
	{
		ft_free((void **)new);
		return (-1);
	}
	((t_token *)((*new)->item))->id = LIST;
	if (!parser_cmdlst((t_list **)&((t_token *)((*new)->item))->str, tklst))
	{
		ft_free((void **)&(*new)->item);
		ft_free((void **)new);
		return (-1);
	}
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %edi, %edi
callq 0xa3f8
movq %rax, (%r14)
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x5fbd
callq 0x27a3
movq (%r14), %rcx
movq %rax, 0x10(%rcx)
testq %rax, %rax
je 0x5fb5
movq (%r14), %rax
movq 0x10(%rax), %rdi
movl $0xf, 0x8(%rdi)
movq %r15, %rsi
callq 0x5ee1
testl %eax, %eax
je 0x5fa9
pushq $0x1
popq %rbx
jmp 0x5fbd
movq (%r14), %rdi
addq $0x10, %rdi
callq 0xa018
movq %r14, %rdi
callq 0xa018
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parser_utils.c
// Function: parser_disp
void		parser_disp(t_token *node, t_btree *parent)
{
	int		i;
	int		fd;
	char	*str;

	fd = 1;
	if (token_id(node) == LIST)
		str = (char	[5]){'l', 's', 't', 47 \
			+ ft_lstsize((t_list *)node->str), '\0'};
	else if (token_id(node) == SUBSHELL)
		str = "shell";
	else
		str = (node ? node->str : "null");
	i = -1;
	ft_putstr_fd("[", fd);
	while (++i < SIZE_LEAF - 2 && str[i])
		ft_putchar_fd(str[i], fd);
	while (i++ < SIZE_LEAF - 2)
		ft_putchar_fd(' ', fd);
	ft_putstr_fd("]", fd);
	(void)parent;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x6041
movl 0x8(%rdi), %eax
cmpl $0xe, %eax
je 0x604a
cmpl $0xf, %eax
jne 0x6053
leaq 0xb(%rsp), %r14
movw $0x736c, (%r14)         # imm = 0x736C
movb $0x74, 0x2(%r14)
movq (%rdi), %rdi
callq 0x9e74
addb $0x2f, %al
movb %al, 0x3(%r14)
movb $0x0, 0x4(%r14)
jmp 0x6056
leaq 0x53b2(%rip), %r14      # 0xb3fa
jmp 0x6056
leaq 0x53a3(%rip), %r14      # 0xb3f4
jmp 0x6056
movq (%rdi), %r14
leaq 0x53a2(%rip), %rdi      # 0xb3ff
pushq $0x1
popq %rbx
movl %ebx, %esi
callq 0x9668
xorl %r12d, %r12d
pushq $0x4
popq %r15
cmpq $0x4, %r12
je 0x608e
movb (%r14,%r12), %al
testb %al, %al
je 0x608b
movsbl %al, %edi
movl %ebx, %esi
callq 0x95b4
incq %r12
jmp 0x606e
movl %r12d, %r15d
addl $-0x4, %r15d
pushq $0x20
popq %rbx
pushq $0x1
popq %rbp
testl %r15d, %r15d
je 0x60ab
movl %ebx, %edi
movl %ebp, %esi
callq 0x95b4
incl %r15d
jmp 0x6098
leaq 0x5489(%rip), %rdi      # 0xb53b
pushq $0x1
popq %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9668
nop
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_root.c
// Function: exe_root
void	exe_root(t_btree *ast, t_control *control)
{
	int i;
	int current_id;

//	printf("\033[36mENTERING THE EXE_ROOT FUNC\033[0m\n");
	if (!ast || control->quit)
		return ;
	i = 0;
	current_id = btree_id(ast);
	while (g_exec[i].fct != NULL && g_exec[i].id != current_id)
		i++;
	if (g_exec[i].fct)
		g_exec[i].fct(ast, control);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x610f
movq %rsi, %rbx
testb $0x1, (%rsi)
jne 0x610f
movq %rdi, %r14
callq 0x5fe9
movq 0xd040(%rip), %rcx      # 0x13128
addq $0x8, %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x610f
leaq 0x10(%rcx), %rsi
cmpl %eax, -0x8(%rcx)
movq %rsi, %rcx
jne 0x60ec
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rdx
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_ope.c
// Function: exe_and
int		exe_and(t_btree *ast, t_control *control)
{
	exe_root(ast->left, control);
	if (control->exit_status == 0)
		exe_root(ast->right, control);
	return (control->exit_status);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x60c8
movl 0x4(%rbx), %eax
testl %eax, %eax
jne 0x615c
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x60c8
movl 0x4(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_ope.c
// Function: exe_or
int		exe_or(t_btree *ast, t_control *control)
{
	exe_root(ast->left, control);
	if (control->exit_status != 0)
		exe_root(ast->right, control);
	return (control->exit_status);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x60c8
cmpl $0x0, 0x4(%rbx)
je 0x618d
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x60c8
movl 0x4(%rbx), %eax
jmp 0x618f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_ope.c
// Function: exe_subshell
int		exe_subshell(t_btree *ast, t_control *control)
{
	pid_t	pid;
	int		status;

	ft_fork(&pid);
	if (pid == 0)
	{
		ft_signalhandler_disable();
		exe_root(ast->left, control);
		exit(control->exit_status);
	}
	else
	{
		waitpid(pid, &status, 0);
		control->exit_status = WIFEXITED(status) ? WEXITSTATUS(status) : g_sig;
	}
	return (control->exit_status);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %r15
movq %r15, %rdi
callq 0x2494
movl (%r15), %edi
testl %edi, %edi
je 0x6229
leaq 0x8(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x21b0
movl (%r14), %eax
testb $0x7f, %al
je 0x6219
leaq 0xcf1f(%rip), %rax      # 0x13134
movl (%rax), %eax
jmp 0x621c
movzbl %ah, %eax
movl %eax, 0x4(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x87f8
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x60c8
movl 0x4(%rbx), %edi
callq 0x2200
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_pipe.c
// Function: exe_pipe_child
void	exe_pipe_child(t_btree *ast, t_control *control)
{
	t_pipe pipe;

	ft_fork_pipe(&pipe);
	if (pipe.pid == 0)
	{
		close(pipe.fildes[0]);
		if (dup2(pipe.fildes[1], STDOUT_FILENO) == -1)
			ft_exit("dup2", NULL, strerror(errno), EXIT_FAILURE);
		exe_root(ast->left, control);
		close(pipe.fildes[1]);
	}
	else
	{
		close(pipe.fildes[1]);
		if (dup2(pipe.fildes[0], STDIN_FILENO) == -1)
			ft_exit("dup2", NULL, strerror(errno), EXIT_FAILURE);
		exe_root(ast->right, control);
		close(pipe.fildes[0]);
		waitpid(pipe.pid, &pipe.status, 0);
	}
	exit(control->exit_status);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rdi
callq 0x24d2
cmpl $0x0, (%r15)
jne 0x62b4
movl 0x4(%rsp), %edi
callq 0x2100
movl 0x8(%rsp), %edi
pushq $0x1
popq %rsi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x629e
callq 0x2040
movl (%rax), %edi
callq 0x2210
leaq 0x5170(%rip), %rdi      # 0xb401
pushq $0x1
popq %rcx
xorl %esi, %esi
movq %rax, %rdx
callq 0x2485
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x60c8
movl 0x8(%rsp), %edi
callq 0x2100
jmp 0x6315
movl 0x8(%rsp), %edi
callq 0x2100
movl 0x4(%rsp), %edi
xorl %esi, %esi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x62ed
callq 0x2040
movl (%rax), %edi
callq 0x2210
leaq 0x5121(%rip), %rdi      # 0xb401
pushq $0x1
popq %rcx
xorl %esi, %esi
movq %rax, %rdx
callq 0x2485
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x60c8
leaq 0xc(%rsp), %r14
movl -0x8(%r14), %edi
callq 0x2100
movl -0xc(%r14), %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21b0
movl 0x4(%rbx), %edi
callq 0x2200
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_pipe.c
// Function: exe_pipe
int		exe_pipe(t_btree *ast, t_control *control)
{
	pid_t	pid;
	int		status;

	ft_fork(&pid);
	if (pid == 0)
		exe_pipe_child(ast, control);
	else
	{
		waitpid(pid, &status, 0);
		control->exit_status = WIFEXITED(status) ? WEXITSTATUS(status) : g_sig;
	}
	return (control->exit_status);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %r15
movq %r15, %rdi
callq 0x2494
movl (%r15), %edi
testl %edi, %edi
je 0x6371
leaq 0x8(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x21b0
movl (%r14), %eax
testb $0x7f, %al
je 0x6361
leaq 0xcdd7(%rip), %rax      # 0x13134
movl (%rax), %eax
jmp 0x6364
movzbl %ah, %eax
movl %eax, 0x4(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6244
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_simple_cmd_root.c
// Function: exe_simple_cmd_root
int	exe_simple_cmd_root(t_token *token, t_control *control)
{
	int builtin;
	int res;

	res = exe_prepare_simple_cmd(token, control);
	if (res == 1)
		return (1);
	//check the exit status is working the same way as the last Return here.
	else if (res == 2)
		return (0);
	//need to make sure the control->quit is raised inside this function..
	if (!exe_perform_arrow((t_simple_cmd *)token->str, control))
	{
		exe_cancel_arrows(control);
		return (0);
	}
	//HERE function that does all the redirections.
	//need to operate the redirections list just before executing the simple
	//command. note: the stdin and stdout, should be saved then restored.
	if (!((t_simple_cmd *)token->str)->argv[0])
		;
	else if ((builtin = exe_is_builtin(((t_simple_cmd *)token->str)->argv[0])))
	{
//		printf("\033[35mthis is a builtin\033[0m\n");
		//check the returned value here;
		exe_call_builtin(((t_simple_cmd *)token->str), builtin, control);
	}
	else
		exe_binary((t_simple_cmd *)token->str, control);
	//try execute the non builtin commands here.
	//always make sure we set the exit status.
	//always restore the stdion and stdout, to original value.
	exe_cancel_arrows(control);
	return (!!control->exit_status);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x63f8
cmpl $0x1, %eax
je 0x63f0
cmpl $0x2, %eax
je 0x63d3
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x6568
testl %eax, %eax
je 0x63cb
movq (%r14), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x63df
callq 0x643e
movq (%r14), %rdi
testl %eax, %eax
je 0x63d7
movl %eax, %esi
movq %rbx, %rdx
callq 0x64f1
jmp 0x63df
movq %rbx, %rdi
callq 0x6736
xorl %eax, %eax
jmp 0x63f0
movq %rbx, %rsi
callq 0x6a80
movq %rbx, %rdi
callq 0x6736
xorl %eax, %eax
cmpl $0x0, 0x4(%rbx)
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_simple_cmd_root.c
// Function: exe_prepare_simple_cmd
int	exe_prepare_simple_cmd(t_token *token, t_control *control)
{
	int res;

//	printf("\033[34mBEFORE WORD EXPAND:\033[0m\n");
//	debug_tokens_list((t_list *)token->str);
	res = word_expand_root(((t_list **)&token->str), control);
	if (res)
	{
		control->exit_status = 1;
		if (res == 2)
			control->quit = 1;
		return (res);
	}
//	printf("\033[34mAFTER WORD EXPAND:\033[0m\n");
//	debug_tokens_list((t_list *)token->str);
	if (!list_to_cmd_root(token))
	{
		control->exit_status = 1;
		control->quit = 1;
		return (2);
	}
//	debug_simple_cmd(((t_simple_cmd *)token->str));
	return (0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x6b64
testl %eax, %eax
je 0x6419
movl $0x1, 0x4(%rbx)
cmpl $0x2, %eax
je 0x6430
jmp 0x6436
movq %r14, %rdi
callq 0x847c
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x6436
movl $0x1, 0x4(%rbx)
orb $0x1, (%rbx)
pushq $0x2
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_simple_cmd_root.c
// Function: exe_is_builtin
int	exe_is_builtin(char *argv0) //OK
{
	if (!argv0)
		return (0);
	if (!ft_strcmp(argv0, "echo"))
		return (B_ECHO);
	else if (!ft_strcmp(argv0, "cd"))
		return (B_CD);
	else if (!ft_strcmp(argv0, "pwd"))
		return (B_PWD);
	else if (!ft_strcmp(argv0, "export"))
		return (B_EXPORT);
	else if (!ft_strcmp(argv0, "unset"))
		return (B_UNSET);
	else if (!ft_strcmp(argv0, "env"))
		return (B_ENV);
	else if (!ft_strcmp(argv0, "exit"))
		return (B_EXIT);
	else
		return (0);
}

// Assembly:
testq %rdi, %rdi
je 0x64d5
pushq %rbx
movq %rdi, %rbx
leaq 0x4fd2(%rip), %rsi      # 0xb424
callq 0x9ffc
testl %eax, %eax
je 0x64d8
leaq 0x4d27(%rip), %rsi      # 0xb189
movq %rbx, %rdi
callq 0x9ffc
testl %eax, %eax
je 0x64dc
leaq 0x4fb4(%rip), %rsi      # 0xb429
movq %rbx, %rdi
callq 0x9ffc
testl %eax, %eax
je 0x64e0
leaq 0x4cae(%rip), %rsi      # 0xb136
movq %rbx, %rdi
callq 0x9ffc
testl %eax, %eax
je 0x64e4
leaq 0x4ca9(%rip), %rsi      # 0xb144
movq %rbx, %rdi
callq 0x9ffc
testl %eax, %eax
je 0x64e8
leaq 0x4f7f(%rip), %rsi      # 0xb42d
movq %rbx, %rdi
callq 0x9ffc
testl %eax, %eax
je 0x64ec
leaq 0x4d1b(%rip), %rsi      # 0xb1dc
movq %rbx, %rdi
callq 0x9ffc
xorl %ecx, %ecx
testl %eax, %eax
pushq $0x7
popq %rax
cmovnel %ecx, %eax
jmp 0x64ef
xorl %eax, %eax
retq
pushq $0x1
jmp 0x64ee
pushq $0x2
jmp 0x64ee
pushq $0x3
jmp 0x64ee
pushq $0x4
jmp 0x64ee
pushq $0x5
jmp 0x64ee
pushq $0x6
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_simple_cmd_root.c
// Function: exe_call_builtin
int	exe_call_builtin(t_simple_cmd *cmd, int id, t_control *control)
{
	if (id == B_ECHO)
		return (echo_builtin(cmd->argv, control));
	else if (id == B_ENV)
		return (env_builtin(control->env, control));
	else if (id == B_EXPORT)
		return (export_builtin(&control->env, cmd->argv, control));
	else if (id == B_UNSET)
		return (unset_builtin(&control->env, cmd->argv, control));
	else if (id == B_CD)
		return (cd_builtin(control->env, cmd->argv, control));
	else if (id == B_EXIT)
		return (exit_builtin(cmd->argv, control));
	else if (id == B_PWD)
		return (pwd_builtin(control));
	return (0);
}

// Assembly:
decl %esi
cmpl $0x6, %esi
ja 0x653c
leaq 0x4f09(%rip), %rax      # 0xb408
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x8(%rdi), %rdi
movq %rdx, %rsi
jmp 0x34d8
leaq 0x20(%rdx), %rax
movq 0x8(%rdi), %rsi
movq %rax, %rdi
jmp 0x33dc
movq %rdx, %rdi
jmp 0x3b08
leaq 0x20(%rdx), %rax
movq 0x8(%rdi), %rsi
movq %rax, %rdi
jmp 0x355c
xorl %eax, %eax
retq
movq 0x20(%rdx), %rax
movq 0x8(%rdi), %rsi
movq %rax, %rdi
jmp 0x37e8
movq 0x20(%rdx), %rdi
movq %rdx, %rsi
jmp 0x3118
movq 0x8(%rdi), %rdi
movq %rdx, %rsi
jmp 0x3b20
nop
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_perform_arrow.c
// Function: exe_perform_arrow
int	exe_perform_arrow(t_simple_cmd *cmd, t_control *control)
{
	t_list const	*arrows = cmd->arrows;
	t_arrow			*arrow;

	while (arrows && (arrow = arrows->content))
	{
		if ((arrow->id != LESS && !exe_perform_redirections(arrow, control)) ||
			(arrow->id == LESS && !exe_perform_indirections(arrow, control)))
		{
			control->exit_status = 1;
			return (0);
		}
		arrows = arrows->next;
	}
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
pushq $0x1
popq %rbx
movq (%r15), %r15
testq %r15, %r15
je 0x65c7
movq (%r15), %r12
testq %r12, %r12
je 0x65c7
cmpl $0xa, 0x10(%r12)
je 0x65a8
movq %r12, %rdi
movq %r14, %rsi
callq 0x65d5
testl %eax, %eax
je 0x65bd
cmpl $0xa, 0x10(%r12)
jne 0x65b7
movq %r12, %rdi
movq %r14, %rsi
callq 0x6691
testl %eax, %eax
je 0x65bd
addq $0x8, %r15
jmp 0x6579
movl $0x1, 0x4(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_perform_arrow.c
// Function: exe_perform_redirections
int	exe_perform_redirections(t_arrow *arrow, t_control *control)
{
	int			fd;
	int			src;
	int			options;
	const int	signals = S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR;

	src = ft_isdigit(arrow->src[0]) ? ft_atoi(arrow->src) : 1;
	options = (arrow->id == GREAT ? O_TRUNC : O_APPEND);
	if ((fd = open(arrow->dest, O_WRONLY | O_CREAT | options, signals)) < 0)
	{
		ft_perror("open", arrow->dest, strerror(errno));
		return (0);
	}
	if (dup2(fd, src) == -1)
	{
		ft_perror("dup2", NULL, NULL);
		control->quit = 1;
		close(fd);
		return (0);
	}
	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %rax
movsbl (%rax), %edi
callq 0x940c
testl %eax, %eax
je 0x65fe
movq (%r15), %rdi
callq 0x9374
movl %eax, %ebp
jmp 0x6601
pushq $0x1
popq %rbp
xorl %esi, %esi
cmpl $0xc, 0x10(%r15)
setne %sil
movq 0x8(%r15), %rdi
shll $0x9, %esi
addl $0x241, %esi            # imm = 0x241
xorl %r14d, %r14d
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x21f0
testl %eax, %eax
js 0x6643
movl %eax, %r12d
movl %eax, %edi
movl %ebp, %esi
callq 0x20b0
cmpl $-0x1, %eax
je 0x6667
pushq $0x1
popq %r14
jmp 0x6685
movq 0x8(%r15), %rbx
callq 0x2040
movl (%rax), %edi
callq 0x2210
leaq 0x4dd7(%rip), %rdi      # 0xb431
movq %rbx, %rsi
movq %rax, %rdx
callq 0x24e8
jmp 0x6685
leaq 0x4d93(%rip), %rdi      # 0xb401
xorl %r14d, %r14d
xorl %esi, %esi
xorl %edx, %edx
callq 0x24e8
orb $0x1, (%rbx)
movl %r12d, %edi
callq 0x2100
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_perform_arrow.c
// Function: exe_perform_indirections
int	exe_perform_indirections(t_arrow *arrow, t_control *control)
{
	int		fd;
	int		src;

	src = ft_isdigit(arrow->src[0]) ? ft_atoi(arrow->src) : 0;
	if ((fd = open(arrow->dest, O_RDONLY)) < 0)
	{
		ft_perror("open", arrow->dest, strerror(errno));
		return (0);
	}
	if (dup2(fd, src) == -1)
	{
		ft_perror("dup2", NULL, NULL);
		control->quit = 1;
		close(fd);
		return (0);
	}
	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %rax
movsbl (%rax), %edi
callq 0x940c
testl %eax, %eax
je 0x66bb
movq (%r15), %rdi
callq 0x9374
movl %eax, %r12d
jmp 0x66be
xorl %r12d, %r12d
movq 0x8(%r15), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
xorl %eax, %eax
callq 0x21f0
testl %eax, %eax
js 0x66e9
movl %eax, %ebp
movl %eax, %edi
movl %r12d, %esi
callq 0x20b0
cmpl $-0x1, %eax
je 0x670d
pushq $0x1
popq %r14
jmp 0x672a
movq 0x8(%r15), %rbx
callq 0x2040
movl (%rax), %edi
callq 0x2210
leaq 0x4d31(%rip), %rdi      # 0xb431
movq %rbx, %rsi
movq %rax, %rdx
callq 0x24e8
jmp 0x672a
leaq 0x4ced(%rip), %rdi      # 0xb401
xorl %r14d, %r14d
xorl %esi, %esi
xorl %edx, %edx
callq 0x24e8
orb $0x1, (%rbx)
movl %ebp, %edi
callq 0x2100
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_perform_arrow.c
// Function: exe_cancel_arrows
int	exe_cancel_arrows(t_control *control)
{
	if ((dup2(control->truefd[STDIN_FILENO], STDIN_FILENO)) == -1 ||
		(dup2(control->truefd[STDOUT_FILENO], STDOUT_FILENO)) == -1 ||
		(dup2(control->truefd[STDERR_FILENO], STDERR_FILENO)) == -1)
	{
		control->quit = 1;
		control->exit_status = 1;
		ft_perror("dup2", NULL, strerror(errno));
		return (0);
	}
	return (1);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x30(%rdi), %edi
xorl %esi, %esi
callq 0x20b0
cmpl $-0x1, %eax
je 0x676d
movl 0x34(%rbx), %edi
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x20b0
cmpl $-0x1, %eax
je 0x676d
movl 0x38(%rbx), %edi
pushq $0x2
popq %rsi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x6796
orb $0x1, (%rbx)
movl $0x1, 0x4(%rbx)
callq 0x2040
movl (%rax), %edi
callq 0x2210
leaq 0x4c77(%rip), %rdi      # 0xb401
xorl %esi, %esi
movq %rax, %rdx
callq 0x24e8
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_binary.c
// Function: build_env2d
char	**build_env2d(t_list *env, t_control *control)
{
	int			i;
	const int	lstsize = ft_lstsize(env);
	char		**res;
	t_env		*tmp;

	if (!(res = (char **)ft_memalloc(sizeof(char *) * (lstsize + 1))))
	{
		control->quit = 1;
		return (NULL);
	}
	i = -1;
	while (env)
	{
		tmp = env->content;
		if (!(res[++i] = ft_strjoin_free(tmp->label, (char	[2]){'=', '\0'}, 0))
		|| !(res[i] = ft_strjoin_free(res[i], tmp->value, 1)))
		{
			control->quit = 1;
			ft_array_free(res, lstsize);
			return (NULL);
		}
		env = env->next;
	}
	return (res);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r15
callq 0x9e74
movl %eax, %ebp
cltq
leaq 0x8(,%rax,8), %rdi
callq 0x9fb0
testq %rax, %rax
je 0x6843
movq %rax, %r14
movl %ebp, 0xc(%rsp)
movq %rbx, 0x10(%rsp)
leaq 0xa(%rsp), %r12
pushq $0x1
popq %r13
movq %rax, %rbx
testq %r15, %r15
je 0x6849
movq (%r15), %rbp
movq (%rbp), %rdi
movw $0x3d, 0xa(%rsp)
movq %r12, %rsi
xorl %edx, %edx
callq 0x9b9c
movq %rax, (%rbx)
testq %rax, %rax
je 0x682d
movq 0x8(%rbp), %rsi
movq %rax, %rdi
movl %r13d, %edx
callq 0x9b9c
movq %rax, (%rbx)
testq %rax, %rax
je 0x682d
movq 0x8(%r15), %r15
addq $0x8, %rbx
jmp 0x67e7
movq 0x10(%rsp), %rax
orb $0x1, (%rax)
movq %r14, %rdi
movl 0xc(%rsp), %esi
callq 0x9ed4
jmp 0x6846
orb $0x1, (%rbx)
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_binary.c
// Function: exe_binary_fork
int		exe_binary_fork(char *prog, char **argv, t_control *control)
{
	char	**env;
	pid_t	pid;
	int		status;

	ft_fork(&pid);
	if (pid == 0)
	{
		if (!(env = build_env2d(control->env, control)) && control->quit)
			ft_exit("malloc", NULL, strerror(errno), 1);
		if (execve(prog, argv, env) == -1)
			ft_perror(prog, NULL, strerror(errno));
		ft_array_free(env, ft_array_len(env));
		ft_errno_exit();
	}
	else
	{
		waitpid(pid, &status, 0);
		control->exit_status = WIFEXITED(status) ? WEXITSTATUS(status) : g_sig;
//		printf("Exit status of the child was %d\n", control->exit_status);
	}
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x4(%rsp), %r14
movq %r14, %rdi
callq 0x2494
movl (%r14), %edi
testl %edi, %edi
je 0x68a2
movq %rsp, %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x21b0
movl (%rbx), %eax
testb $0x7f, %al
je 0x6923
movl 0xc897(%rip), %eax      # 0x13134
jmp 0x6926
movq 0x20(%r12), %rdi
movq %r12, %rsi
callq 0x67a0
movq %rax, %r14
testq %rax, %rax
jne 0x68de
testb $0x1, (%r12)
je 0x68de
callq 0x2040
movl (%rax), %edi
callq 0x2210
leaq 0x4b65(%rip), %rdi      # 0xb436
pushq $0x1
popq %rcx
xorl %esi, %esi
movq %rax, %rdx
callq 0x2485
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2140
cmpl $-0x1, %eax
jne 0x690a
callq 0x2040
movl (%rax), %edi
callq 0x2210
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x24e8
movq %r14, %rdi
callq 0x9f50
movq %r14, %rdi
movl %eax, %esi
callq 0x9ed4
callq 0x6117
jmp 0x692b
movzbl %ah, %eax
movl %eax, 0x4(%r12)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_binary.c
// Function: exe_given_path
int		exe_given_path(char **argv0, t_control *control, char **path_to_binary)
{
	char *new;

	if (!(new = ft_strrchr(*argv0, '/')))
		return (0);
	if (!(new = ft_strdup(new + 1)))
	{
		control->quit = 1;
		return (-1);
	}
	*path_to_binary = *argv0;
	*argv0 = new;
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rdi
pushq $0x2f
popq %rsi
callq 0x9c34
testq %rax, %rax
je 0x6975
incq %rax
movq %rax, %rdi
callq 0x9aec
testq %rax, %rax
je 0x6979
movq (%r14), %rcx
movq %rcx, (%rbx)
movq %rax, (%r14)
pushq $0x1
jmp 0x697f
xorl %eax, %eax
jmp 0x6980
orb $0x1, (%r15)
pushq $-0x1
popq %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_binary.c
// Function: exe_search_path
int		exe_search_path(char *argv0, t_control *control, char **path_to_binary)
{
	int			i;
	int			ret;
	char		*path;
	char		**split;
	struct stat	buf;

	if (!(split = ft_split(env_get("PATH", 4, control->env), ':')))
		return (errno ? -1 : 0);
	i = -1;
	ret = 0;
	while (ret == 0 && split[++i])
	{
		if (!(path = ft_strjoin(split[i], argv0)))
			ret = -1;
		else if (!stat(path, &buf) && S_ISREG(buf.st_mode))
		{
			*path_to_binary = path;
			ret = 1;
		}
		else
			ft_free((void **)&path);
	}
	errno = 0;
	ft_array_free(split, ft_array_len(split));
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, 0x10(%rsp)
movq %rdi, %r14
movq 0x20(%rsi), %rdx
leaq 0x4a93(%rip), %rdi      # 0xb43d
pushq $0x4
popq %rsi
callq 0x3285
pushq $0x3a
popq %rsi
movq %rax, %rdi
callq 0x9690
testq %rax, %rax
je 0x6a61
movq %rax, %rbx
xorl %ebp, %ebp
movb $0x1, %al
leaq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %rbx, %r15
testb $0x1, %al
je 0x6a45
movq (%r15), %rdi
testq %rdi, %rdi
je 0x6a45
movq %r14, %rsi
callq 0x9b2c
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x6a3a
movq %rax, %rdi
movq %r12, %rsi
callq 0x2160
testl %eax, %eax
jne 0x6a2c
movl 0x30(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x6a2c
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
xorl %eax, %eax
pushq $0x1
jmp 0x6a3e
movq %r13, %rdi
callq 0xa018
xorl %ebp, %ebp
movb $0x1, %al
jmp 0x6a3f
xorl %eax, %eax
pushq $-0x1
popq %rbp
addq $0x8, %r15
jmp 0x69da
callq 0x2040
andl $0x0, (%rax)
movq %rbx, %rdi
callq 0x9f50
movq %rbx, %rdi
movl %eax, %esi
callq 0x9ed4
jmp 0x6a6c
callq 0x2040
xorl %ebp, %ebp
cmpl (%rax), %ebp
sbbl %ebp, %ebp
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/exe_binary.c
// Function: exe_binary
int		exe_binary(t_simple_cmd *cmd, t_control *control)
{
	int		ret;
	char	*argv0;
	char	*path_to_binary;

	g_sig = 1;
//	printf("\e[95mThis is a binary !\e[0m\n");
	path_to_binary = NULL;
	if ((ret = exe_given_path(&cmd->argv[0], control, &path_to_binary)) == -1)
		return (ret);
	else if (ret == 0)
	{
		if (!(argv0 = ft_strjoin((char	[]){'/', '\0'}, cmd->argv[0])) ||
			((ret = exe_search_path(argv0, control, &path_to_binary)) == -1))
			control->quit = 1;
		else if (ret == 0 && (control->exit_status = 127))
			ft_perror(cmd->argv[0], NULL, "Command not found");
		free(argv0);
		if (ret != 1)
			return (ret);
	}
	ret = exe_binary_fork(path_to_binary, cmd->argv, control);
	free(path_to_binary);
	return (ret);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, 0xc699(%rip)      # 0x13134
leaq 0x10(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x8(%rdi), %rdi
callq 0x693a
movl %eax, %r15d
cmpl $-0x1, %eax
je 0x6b53
testl %r15d, %r15d
jne 0x6b33
leaq 0xe(%rsp), %rdi
movw $0x2f, (%rdi)
movq 0x8(%r14), %rax
movq (%rax), %rsi
callq 0x9b2c
movq %rax, %r12
testq %rax, %rax
je 0x6afe
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6986
testl %eax, %eax
je 0x6b06
movl %eax, %r15d
cmpl $-0x1, %eax
je 0x6b01
pushq $0x1
popq %r15
jmp 0x6b25
xorl %r15d, %r15d
orb $0x1, (%rbx)
jmp 0x6b25
movl $0x7f, 0x4(%rbx)
movq 0x8(%r14), %rax
movq (%rax), %rdi
leaq 0x4927(%rip), %rdx      # 0xb442
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x24e8
movq %r12, %rdi
callq 0x2230
cmpl $0x1, %r15d
jne 0x6b53
pushq $0x1
popq %r15
movq 0x10(%rsp), %r12
movq 0x8(%r14), %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x685b
movq %r12, %rdi
callq 0x2230
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/word_expand_root_v2.c
// Function: word_expand_root
int		word_expand_root(t_list **tokens, t_control *control)
{
	int id;
	int res;

	while (*tokens)
	{
		id = tklst_id(*tokens);
		if (id == GREAT || id == DGREAT || id == LESS)
		{
			tokens = &(*tokens)->next;
			((t_token*)(*tokens)->content)->is_filename = 1;
		}
		res = word_expand_and_replace(&tokens, control);
		if (res == 1 || res == 2)
			return (res);
		if (res == 3)
			;
		else
			tokens = &(*tokens)->next;
	}
	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
movq %rsp, %r14
movq %rdi, (%r14)
movl $0x3400, %ebp           # imm = 0x3400
movq (%r15), %rdi
testq %rdi, %rdi
je 0x6bd5
callq 0x5fd5
cmpl $0xd, %eax
ja 0x6bac
btl %eax, %ebp
jae 0x6bac
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rax
movq (%rax), %rax
movl $0x1, 0xc(%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6be2
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6bd7
movq (%rsp), %r15
cmpl $0x3, %eax
je 0x6b7c
movq (%r15), %r15
addq $0x8, %r15
movq %r15, (%rsp)
jmp 0x6b7c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/word_expand_root_v2.c
// Function: word_expand_and_replace
int		word_expand_and_replace(t_list ***tokens, t_control *control)
{
	t_list	*expanded_word;
	int		res;
	t_list 	*del_me;

	if (!(expanded_word = dup_token((**tokens)->content)))
		return (2);
	if ((res = word_expand_stage1(&expanded_word, control)))
	{
		if (res == 1)
			ft_ambiguous_redirect(((t_token *)(**tokens)->content)->str, 2);
		if (res < 3)
			ft_lstclear(&expanded_word, del_token);
		if (res == 3)
		{
			del_me = **tokens;
			**tokens = (**tokens)->next;
			del_token(del_me->content);
			ft_free((void **)&del_me);
		}
		return (res);
	}
	word_expand_replace(tokens, expanded_word);
	return (0);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movq (%rax), %rax
movq (%rax), %rdi
callq 0x6c99
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x6c35
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x6ced
testl %eax, %eax
je 0x6c3a
movl %eax, %ebx
cmpl $0x1, %eax
jne 0x6c4b
movq (%r14), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rdi
pushq $0x2
popq %rsi
callq 0x25c0
jmp 0x6c50
pushq $0x2
popq %rbx
jmp 0x6c61
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x6d63
xorl %ebx, %ebx
jmp 0x6c61
cmpl $0x2, %ebx
jg 0x6c6b
leaq -0x4510(%rip), %rsi     # 0x2747
leaq 0x8(%rsp), %rdi
callq 0x9de8
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
cmpl $0x3, %ebx
jne 0x6c61
movq (%r14), %rax
movq (%rax), %rcx
leaq 0x10(%rsp), %rbx
movq %rcx, (%rbx)
movq 0x8(%rcx), %rdx
movq %rdx, (%rax)
movq (%rcx), %rdi
callq 0x2747
movq %rbx, %rdi
callq 0xa018
pushq $0x3
jmp 0x6c37
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/word_expand_root_v2.c
// Function: dup_token
t_list	*dup_token(const t_token *token)
{
	t_list	*new_list;
	t_token	*new_token;

	if (!(new_token = malloc(sizeof(t_token))))
		return (NULL);
	ft_memcpy(new_token, token, sizeof(t_token));
	if (!(new_token->str = ft_strdup(token->str)))
	{
		del_token(new_token);
		return (NULL);
	}
	if (!(new_list = ft_lstnew(new_token)))
	{
		del_token(new_token);
		return (NULL);
	}
	return (new_list);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x2180
testq %rax, %rax
je 0x6ce3
movq %rax, %rbx
pushq $0x20
popq %rdx
movq %rax, %rdi
movq %r14, %rsi
callq 0x9550
movq (%r14), %rdi
callq 0x9aec
movq %rax, (%rbx)
testq %rax, %rax
je 0x6cdb
movq %rbx, %rdi
callq 0x9e58
testq %rax, %rax
jne 0x6ce5
movq %rbx, %rdi
callq 0x2747
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/word_expand_root_v2.c
// Function: word_expand_stage1
int		word_expand_stage1(t_list **tokens, t_control *control)
{
	int res;
	int is_filename;

	//printf("word_exp_stage1: BEFORE: token list is:\n");
	//debug_tokens_list(*tokens);
	if (!tild_expansion_root(control->env, \
				&((t_token*)(*tokens)->content)->str))
		return (2);
	is_filename = ((t_token *)((*tokens)->content))->is_filename;
	if ((res = parameter_expansion_root(*tokens, control, is_filename)))
		return (res);
	skim_empty_tokens(tokens);
	if (!*tokens)
		return (3);
	if (is_filename && ft_strlen(((t_token*)(*tokens)->content)->str) == 0)
		return (1);
	res = pathname_expansion_root(tokens, is_filename);
	//printf("word_exp_stage1: AFTER: token list is:\n");
	//debug_tokens_list(*tokens);
	return (res);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rsi), %rdi
movq (%rbx), %rax
movq (%rax), %rsi
callq 0x75f4
testl %eax, %eax
je 0x6d53
movq (%rbx), %rdi
movq (%rdi), %rax
movl 0xc(%rax), %ebp
movq %r14, %rsi
movl %ebp, %edx
callq 0x6e04
testl %eax, %eax
jne 0x6d56
movq %rbx, %rdi
callq 0x6db8
movq (%rbx), %rax
testq %rax, %rax
je 0x6d5b
testl %ebp, %ebp
je 0x6d45
movq (%rax), %rax
movq (%rax), %rdi
callq 0x9be0
testq %rax, %rax
je 0x6d5f
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x7454
pushq $0x2
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x3
jmp 0x6d55
pushq $0x1
jmp 0x6d55
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/word_expand_root_v2.c
// Function: word_expand_replace
void	word_expand_replace(t_list ***tokens, t_list *expanded)
{
	t_list *last;
	t_list *del_me;

	last = ft_lstlast(expanded);
	last->next = (**tokens)->next;
	del_me = **tokens;
	**tokens = expanded;
	*tokens = &last;
	del_token(del_me->content);
	free(del_me);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x9e40
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq (%r14), %rdx
movq (%rdx), %rdx
movq 0x8(%rdx), %rdx
movq %rdx, 0x8(%rax)
movq (%r14), %rax
movq (%rax), %r15
movq %rbx, (%rax)
movq %rcx, (%r14)
movq (%r15), %rdi
callq 0x2747
movq %r15, %rdi
callq 0x2230
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/word_expand_assist.c
// Function: skim_empty_tokens
void	skim_empty_tokens(t_list **tokens)
{
	t_list	*del_me;

	while (*tokens)
	{
		if (!ft_strlen(((t_token *)((*tokens)->content))->str))
		{
			del_me = *tokens;
			*tokens = (*tokens)->next;
			del_token((t_token *)(del_me->content));
			free(del_me);
		}
		else
			tokens = &(*tokens)->next;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rbx), %rax
testq %rax, %rax
je 0x6dfc
movq (%rax), %rax
movq (%rax), %rdi
callq 0x9be0
movq (%rbx), %r14
testq %rax, %rax
jne 0x6df3
movq 0x8(%r14), %rax
movq %rax, (%rbx)
movq (%r14), %rdi
callq 0x2747
movq %r14, %rdi
callq 0x2230
jmp 0x6dbf
addq $0x8, %r14
movq %r14, %rbx
jmp 0x6dbf
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion_root.c
// Function: parameter_exp
int		parameter_exp(t_list *token, t_control *ctrl, t_expansion exp, int res)
{
	char *insert;
	char *str;

	while ((exp.start = param_exp_find_start(token, exp.start, &exp.quoted)) \
			!= -1)
	{
		str = ((t_token *)token->content)->str;
		if ((exp.end = param_exp_find_end(token, exp.start)) == exp.start)
		{
			exp.start++;
			continue;
		}
		if (!(insert = param_exp_get_env(ctrl, str + exp.start + 1, \
				exp.end - exp.start)))
			return (2);
		//printf("expanded variable = [%s]\n", insert);
		ft_memmove(str + exp.start, str + exp.end + 1, \
				ft_strlen(str + exp.end));
		if ((res = parameter_expansion2(&token, &insert, &exp)))
		{
			free(insert);
			return (res);
		}
		free(insert);
	}
	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x50(%rsp), %r15
leaq 0x10(%rsp), %r12
movq %rdi, (%r12)
leaq 0x58(%rsp), %r13
movl -0x8(%r13), %eax
movq %rbx, %rdi
movl %eax, %esi
movq %r13, %rdx
callq 0x6f64
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x6f4a
movq (%rbx), %rcx
movq (%rcx), %rbp
movq %rbx, %rdi
movl %eax, %esi
callq 0x6fe7
movl %eax, 0x4(%r15)
movslq (%r15), %rcx
cmpl %ecx, %eax
jne 0x6ed9
incl %eax
movl %eax, (%r15)
jmp 0x6f40
leaq (%rcx,%rbp), %rsi
incq %rsi
subl %ecx, %eax
movq %r14, %rdi
movl %eax, %edx
callq 0x7032
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x6f4e
movslq (%r15), %rbx
addq %rbp, %rbx
movslq 0x4(%r15), %rax
leaq (%rax,%rbp), %rdi
addq %rax, %rbp
incq %rbp
callq 0x9be0
movq %rbx, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x9568
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x7090
movl %eax, %ebx
movq 0x8(%rsp), %rdi
callq 0x2230
testl %ebx, %ebx
jne 0x6f53
movl (%r15), %eax
movq 0x10(%rsp), %rbx
jmp 0x6e9e
xorl %eax, %eax
jmp 0x6f55
pushq $0x2
popq %rax
jmp 0x6f55
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion_root.c
// Function: param_exp_find_start
int		param_exp_find_start(t_list *token, int start, char *quot)
{
	int		esc_next;
	char	*str;

	str = ((t_token*)token->content)->str;
	*quot = 0;
	esc_next = 0;
	while (str[start])
	{
		if (!esc_next && !*quot && (str[start] == '\'' || str[start] == '\"'))
			*quot = str[start];
		else if (!esc_next && *quot && str[start] == *quot)
			*quot = 0;
		if (!esc_next && str[start] == '\\')
		{
			esc_next = 1;
			start++;
			continue;
		}
		if (!esc_next && *quot != '\'' && str[start] == '$')
			return (start);
		esc_next = 0;
		start++;
	}
	return (-1);
}

// Assembly:
movq (%rdi), %rax
movslq %esi, %rcx
addq (%rax), %rcx
movb $0x0, (%rdx)
movb $0x1, %r11b
xorl %edi, %edi
pushq $-0x1
popq %rax
xorl %r9d, %r9d
movzbl (%rcx), %r10d
testl %r10d, %r10d
je 0x6fe6
movb $0x1, %r8b
testb $0x1, %r11b
je 0x6fda
testb %r9b, %r9b
jne 0x6fa3
cmpl $0x22, %r10d
je 0x6fab
cmpl $0x27, %r10d
je 0x6fab
xorl %r9d, %r9d
jmp 0x6fb4
cmpb %r9b, %r10b
jne 0x6fb4
xorl %r10d, %r10d
movb %r10b, (%rdx)
movl %r10d, %edi
movl %r10d, %r9d
movb (%rcx), %r10b
cmpb $0x5c, %r10b
jne 0x6fc2
xorl %r8d, %r8d
jmp 0x6fda
cmpb $0x27, %dil
sete %r9b
cmpb $0x24, %r10b
setne %r10b
orb %r9b, %r10b
movl %edi, %r9d
je 0x6fe4
incl %esi
incq %rcx
movl %r8d, %r11d
jmp 0x6f7b
movl %esi, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion_root.c
// Function: param_exp_find_end
int		param_exp_find_end(t_list *token, int start)
{
	int		end;
	char	*str;

	str = ((t_token*)token->content)->str;
	end = start + 1;
	while (str[end])
	{
		if (str[start + 1] == '?')
			return (start + 1);
		if (!ft_isalnum(str[end]) && str[end] != '_')
			break ;
		end++;
	}
	return (end - 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq (%rdi), %rax
leal 0x1(%rbx), %ebp
movslq %ebp, %r14
addq (%rax), %r14
movq %r14, %r15
movsbl (%r15), %edi
testl %edi, %edi
je 0x7025
cmpb $0x3f, (%r14)
je 0x7023
callq 0x93d8
testl %eax, %eax
jne 0x701c
cmpb $0x5f, (%r15)
jne 0x7025
incl %ebx
incq %r15
jmp 0x6fff
movl %ebp, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion_root.c
// Function: param_exp_get_env
char	*param_exp_get_env(t_control *control, char *str, int len)
{
	char *value;
	char **addr_value;

	if (!ft_strncmp(str, "?", len))
		return (ft_itoa(control->exit_status));
	addr_value = env_get_addr(str, len, control->env);
	//printf("str: [%s], len: %d\n", str,  len);
	//printf("value: %s\n", value);
	if (!addr_value)
		value = ft_strdup("");
	else
		value = ft_strdup(*addr_value);
	return (value);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
movslq %edx, %r14
leaq 0x4411(%rip), %rsi      # 0xb458
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9bf8
testl %eax, %eax
je 0x706f
movq 0x20(%r15), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32e3
testq %rax, %rax
je 0x707d
movq (%rax), %rdi
jmp 0x7084
movl 0x4(%r15), %edi
popq %rbx
popq %r14
popq %r15
jmp 0x9490
leaq 0x4157(%rip), %rdi      # 0xb1db
popq %rbx
popq %r14
popq %r15
jmp 0x9aec
nop
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion2.c
// Function: parameter_expansion2
int	parameter_expansion2(t_list **token, char **var, t_expansion *exp)
{
	int field_split;

	((t_token *)(*token)->content)->unquote_protected = 1;
	((t_token *)(*token)->content)->protect_s = exp->start;
	field_split = need_to_field_split1(var, exp);
	if (field_split == 2 || (field_split == 1 && exp->is_filename))
		return (field_split);
	if (!field_split)
	{
		if (!param_exp_no_fsplit(*token, *var, exp))
			return (2);
	}
	else
	{
		if (!field_splitting_root(token, *var, exp))
			return (2);
	}
	return (0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rax
movq (%rax), %rax
movl $0x1, 0x14(%rax)
movl (%rdx), %ecx
movl %ecx, 0x18(%rax)
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x70fd
testl %eax, %eax
je 0x70ce
cmpl $0x2, %eax
je 0x70f7
cmpl $0x0, 0xc(%rbx)
je 0x70de
pushq $0x1
jmp 0x70f6
movq (%r14), %rdi
movq (%r15), %rsi
movq %rbx, %rdx
callq 0x719e
jmp 0x70ec
movq (%r15), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x7248
testl %eax, %eax
je 0x70f4
xorl %eax, %eax
jmp 0x70f7
pushq $0x2
popq %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion2.c
// Function: need_to_field_split1
int	need_to_field_split1(char **str, t_expansion *exp)
{
	char *tmp;

	tmp = *str;
	if (exp->quoted || (exp->ifs && !ft_strlen(exp->ifs)))
		return (0);
	if (!exp->ifs)
	{
		if (!(*str = ft_strtrim(*str, " \t\n")))
		{
			free(tmp);
			return (2);
		}
		free(tmp);
		if (-1 != ft_stristr(*str, " \t\n"))
			return (1);
		return (0);
	}
	else
	{
		return (need_to_field_split2(str, exp));
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebp, %ebp
cmpb $0x0, 0x8(%rsi)
je 0x7119
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x10(%rsi), %rax
movq %r14, %rdi
testq %rax, %rax
je 0x715a
movq %rax, %rdi
callq 0x9be0
testq %rax, %rax
je 0x710c
cmpq $0x0, 0x10(%r15)
je 0x7157
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x71f0
movq (%rbx), %rdi
leaq 0x42f9(%rip), %rsi      # 0xb45a
callq 0x9c68
movq %rax, %r15
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x2230
testq %r15, %r15
je 0x7196
movq (%rbx), %rdi
leaq 0x42d7(%rip), %rsi      # 0xb45a
callq 0x9f14
xorl %ebp, %ebp
cmpl $-0x1, %eax
setne %bpl
jmp 0x710c
pushq $0x2
popq %rbp
jmp 0x710c
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion2.c
// Function: param_exp_no_fsplit
int	param_exp_no_fsplit(t_list *token, char *var, t_expansion *exp)
{
	char **ptr_str;

	ptr_str = &((t_token*)token->content)->str;
	((t_token *)token->content)->protect_e = ft_strlen(var) + exp->start;
	if (!ft_strstradd(ptr_str, exp->start, var))
		return (0);
	exp->start += ft_strlen(var);
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %r12
movq %rsi, %rdi
callq 0x9be0
movl (%rbx), %esi
addl %esi, %eax
movq (%r15), %rcx
movl %eax, 0x1c(%rcx)
movq %r12, %rdi
movq %r14, %rdx
callq 0xa100
testl %eax, %eax
je 0x71e2
movq %r14, %rdi
callq 0x9be0
addl %eax, (%rbx)
pushq $0x1
popq %rax
jmp 0x71e4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/charMstr[P]minishell/sources/parameter_expansion2.c
// Function: need_to_field_split2
int	need_to_field_split2(char **str, t_expansion *exp)
{
	char *tmp;

	tmp = *str;
	if (!(*str = ft_strtrim(*str, exp->ifs)))
	{
		free(tmp);
		return (2);
	}
	free(tmp);
	if (-1 != ft_stristr(*str, exp->ifs))
		return (1);
	return (0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r15
movq 0x10(%rsi), %rsi
movq %r15, %rdi
callq 0x9c68
movq %rax, %r12
movq %rax, (%r14)
movq %r15, %rdi
callq 0x2230
testq %r12, %r12
je 0x7238
movq (%r14), %rdi
movq 0x10(%rbx), %rsi
callq 0x9f14
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
setne %al
jmp 0x723b
pushq $0x2
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop