LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/terminfo_clipboard_action.c
// Function: terminfo_clipboard_right_move
int	terminfo_clipboard_right_move(t_control *control, t_clipboard *clipboard)
{
	if (control->term->inline_position + 2 == control->term->line_len)
		return (1);
	if (control->term->inline_position + 1 < clipboard->start)
	{
		if (!terminfo_clipboard_highlight_cur(control, 0))
			return (0);
		if (!terminfo_cursor_move_right(control))
			return (0);
	}
	else
	{
		if (!terminfo_cursor_move_right(control))
			return (0);
		if (!terminfo_clipboard_highlight_cur(control, 1))
			return (0);
	}
	clipboard->end++;
	return (1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x18(%rdi), %rcx
movl 0xc(%rcx), %eax
leal 0x2(%rax), %edx
movl $0x1, %ebp
cmpl 0x8(%rcx), %edx
je 0x5352
movq %rsi, %rbx
movq %rdi, %r14
incl %eax
cmpl 0x4(%rsi), %eax
jge 0x532b
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x50d2
testl %eax, %eax
je 0x5352
movq %r14, %rdi
callq 0x4698
jmp 0x5346
movq %r14, %rdi
callq 0x4698
xorl %ebp, %ebp
testl %eax, %eax
je 0x5352
movq %r14, %rdi
movl $0x1, %esi
callq 0x50d2
testl %eax, %eax
je 0x5352
incl 0x8(%rbx)
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/terminfo_clipboard_action.c
// Function: terminfo_clipboard_left_move
int	terminfo_clipboard_left_move(t_control *control, t_clipboard *clipboard)
{
	if (control->term->inline_position >= 0)
		clipboard->end--;
	if (control->term->inline_position + 1 > clipboard->start)
	{
		if (!terminfo_clipboard_highlight_cur(control, 0))
			return (0);
		if (!terminfo_cursor_move_left(control))
			return (0);
	}
	else
	{
		if (!terminfo_cursor_move_left(control))
			return (0);
		if (!terminfo_clipboard_highlight_cur(control, 1))
			return (0);
	}
	return (1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rax
movl 0xc(%rax), %eax
testl %eax, %eax
js 0x536e
decl 0x8(%rsi)
cmpl 0x4(%rsi), %eax
jge 0x5390
movq %r14, %rdi
callq 0x4790
xorl %ebx, %ebx
testl %eax, %eax
je 0x53b1
movq %r14, %rdi
movl $0x1, %esi
callq 0x50d2
jmp 0x53a8
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x50d2
testl %eax, %eax
je 0x53b1
movq %r14, %rdi
callq 0x4790
testl %eax, %eax
je 0x53b1
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/terminfo_clipboard_action.c
// Function: terminfo_clipboard_cut
int	terminfo_clipboard_cut(t_control *control, t_clipboard *clipboard)
{
	char	*str;
	int		len_rest;
	int		len_cut;
	int		i;

	str = control->term->line;
	len_rest = control->term->line_len - clipboard->end - 1;
	len_cut = clipboard->end - clipboard->start + 1;
	i = 1;
	if (!clipboard->swaped_end)
	{
		while (i < len_cut)
		{
			terminfo_cursor_track_position(control, 0);
			i++;
			control->term->inline_position--;
		}
	}
	ft_memmove(str + clipboard->start, str + clipboard->end + 1, len_rest + 1);
	control->term->line_len -= len_cut;
	if (!terminfo_refresh_screen_from_start(control))
		return (0);
	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movslq 0x8(%rax), %r14
movslq 0x8(%rsi), %r13
movl 0x4(%rsi), %eax
movl %r13d, %r12d
subl %eax, %r12d
cmpl $0x0, 0xc(%rsi)
setne %al
testl %r12d, %r12d
setle %cl
orb %al, %cl
jne 0x5411
movl %r12d, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x49f8
movq 0x18(%rbx), %rax
decl 0xc(%rax)
decl %ebp
jne 0x53fc
notl %r12d
subq %r13, %r14
movslq 0x4(%r15), %rdi
movq (%rsp), %rcx
addq %rcx, %rdi
movslq 0x8(%r15), %rax
leaq (%rcx,%rax), %rsi
incq %rsi
movq %r14, %rdx
callq 0x9e04
movq 0x18(%rbx), %rax
addl %r12d, 0x8(%rax)
movq %rbx, %rdi
callq 0x4448
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/terminfo_clipboard_action.c
// Function: terminfo_clipboard_paste
int	terminfo_clipboard_paste(t_control *control, t_clipboard *clipboard)
{
	int			len_paste_me;
	int			i;
	t_int_pair	cursor_end;

	if (!clipboard->paste_me)
		return (1);
	len_paste_me = ft_strlen(clipboard->paste_me);
	i = -1;
	if (!(ft_strstradd(&control->term->line, \
					control->term->inline_position + 1, clipboard->paste_me)))
		return (0);
	control->term->line_len += len_paste_me;
	cursor_end = terminfo_cursor_get_endl(control);
	while (clipboard->paste_me[++i] \
			&& cursor_end.y >= control->term->size_window.y)
	{
		if (clipboard->paste_me[i] == '\n' && (control->term->cursor.y--))
			cursor_end.y--;
	}
	control->term->clipboard.highlight = 0;
	if (!terminfo_refresh_screen_from_start(control))
		return (0);
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rsi), %rdi
testq %rdi, %rdi
je 0x54f7
movq %rsi, %r14
callq 0xa5c8
movq %rax, %r15
movq 0x18(%rbx), %rdi
movl 0xc(%rdi), %esi
incl %esi
movq 0x10(%r14), %rdx
callq 0xab9c
testl %eax, %eax
je 0x54fe
movq 0x18(%rbx), %rax
addl %r15d, 0x8(%rax)
movq %rbx, %rdi
callq 0x4657
movq 0x10(%r14), %rcx
movb (%rcx), %dil
testb %dil, %dil
je 0x54d9
shrq $0x20, %rax
movq 0x18(%rbx), %rdx
movl 0x2c(%rdx), %esi
incq %rcx
cmpl %esi, %eax
jl 0x54d9
cmpb $0xa, %dil
jne 0x54ce
addl $-0x1, 0x14(%rdx)
sbbl $0x0, %eax
movb (%rcx), %dil
incq %rcx
testb %dil, %dil
jne 0x54bd
movq 0x18(%rbx), %rax
movl $0x0, 0x60(%rax)
movq %rbx, %rdi
callq 0x4448
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x5500
movl $0x1, %eax
jmp 0x5500
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_root.c
// Function: read_root
void	read_root(t_control *control, int read_res, char c)
{
	while (1)
	{
		read_res = read(STDIN_FILENO, &c, 1);
		if (!read_res)
			continue;
		if (c == '\n')
			break ;
		if (read_need_to_stop(control, c, read_res))
			return ;
		read_dispatch_for_processing(control, c);
		if (read_need_to_stop(control, c, read_res))
			return ;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x7(%rsp), %r14
movb %dl, (%r14)
movl $0x1, %edx
xorl %edi, %edi
movq %r14, %rsi
callq 0x2140
movq %rax, %r15
testl %r15d, %r15d
je 0x551a
movsbl 0x7(%rsp), %ebp
cmpl $0xa, %ebp
je 0x5567
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x5572
testl %eax, %eax
jne 0x5567
movq %rbx, %rdi
movl %ebp, %esi
callq 0x55dc
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x5572
testl %eax, %eax
je 0x551a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_root.c
// Function: read_need_to_stop
int		read_need_to_stop(t_control *control, char c, int res)
{
	if (control->quit)
		;
	else if (res == -1)
	{
		control->quit = 1;
		//maybe display message for a read failure
		//maybe set control->exit_status...
	}
	else if (c == 4 && !control->term->line_len)
	{
		control->quit = 1;
		ft_putstr_fd("exit", 2);
	}
	else if (c == 3)
	{
		control->exit_status = (IS_APPLE ? 1 : 130);
		control->ctrl_c = 1;
	}
	else
		return (0);
	return (1);
}

// Assembly:
movb (%rdi), %cl
movl $0x1, %eax
testb $0x1, %cl
jne 0x55b4
cmpl $-0x1, %edx
je 0x55b5
movsbl %sil, %edx
cmpl $0x3, %edx
je 0x55a3
xorl %eax, %eax
cmpl $0x4, %edx
jne 0x55b4
movq 0x18(%rdi), %rdx
cmpl $0x0, 0x8(%rdx)
je 0x55bb
cmpb $0x3, %sil
jne 0x55b4
movl $0x82, 0x4(%rdi)
orb $0x2, %cl
movb %cl, (%rdi)
movl $0x1, %eax
retq
orb $0x1, %cl
movb %cl, (%rdi)
retq
pushq %rax
orb $0x1, %cl
movb %cl, (%rdi)
leaq 0x5c14(%rip), %rdi      # 0xb1dc
movl $0x2, %esi
callq 0x9f24
movl $0x1, %eax
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_root.c
// Function: read_dispatch_for_processing
void	read_dispatch_for_processing(t_control *control, int c)
{
	if (c == 27 && !(c = read_remap_esc_sequence_from_128(control, c)))
		return ;
	if (control->term->clipboard.highlight)
	{
		if (c != KEY_LEFT_ID && c != KEY_RIGHT_ID && c != CTRL_K_COMBO \
				&& c != CTRL_L_COMBO)
			terminfo_clipboard_copy_end(control, &control->term->clipboard);
		else
		{
			terminfo_clipboard_dispatch_action(control, c);
			return ;
		}
	}
	if (c == CTRL_K_COMBO)
		terminfo_clipboard_copy_start(control, &control->term->clipboard);
	else if (c >= 128)
		read_process_special_key(control, c);
	else if (c == 127)
		read_process_del_char(control);
	else if (!ft_isprint(c))
		read_process_control_combo(control, c);
	else
		read_process_add_char(control, c);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x1b, %esi
jne 0x5611
movq 0x18(%rbx), %rdi
movl $0x1b, %esi
callq 0x56e6
movl %eax, %r14d
subl $-0x80, %r14d
cmpl $-0x1, %r14d
jne 0x560c
orb $0x1, (%rbx)
xorl %r14d, %r14d
testl %r14d, %r14d
je 0x5642
movq 0x18(%rbx), %rsi
cmpl $0x0, 0x60(%rsi)
je 0x5656
leal -0xb(%r14), %eax
cmpl $0x2, %eax
jb 0x5630
leal -0x82(%r14), %eax
cmpl $0x2, %eax
jae 0x564a
movq %rbx, %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5236
addq $0x8, %rsp
popq %rbx
popq %r14
retq
addq $0x60, %rsi
movq %rbx, %rdi
callq 0x5183
cmpl $0xb, %r14d
jne 0x5673
movq 0x18(%rbx), %rsi
addq $0x60, %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5040
cmpl $0x80, %r14d
jl 0x568e
movq %rbx, %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5826
cmpl $0x7f, %r14d
jne 0x56a3
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x57f4
movl %r14d, %edi
callq 0x9c14
movsbl %r14b, %esi
movq %rbx, %rdi
addq $0x8, %rsp
testl %eax, %eax
je 0x56c2
popq %rbx
popq %r14
jmp 0x57b4
popq %rbx
popq %r14
jmp 0x58e6
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_root.c
// Function: read_get_esc_seq_id
int		read_get_esc_seq_id(t_term *term, int c)
{
	int		res_read;
	char	*str;
	int		i;

	str = NULL;
	if (!ft_strappend(&str, c))
		return (-1);
	while ((res_read = read(STDIN_FILENO, &c, 1)) && (i = -1))
	{
		if (res_read == -1 || !ft_strappend(&str, c))
		{
			free(str);
			return (-1);
		}
		while (++i < NUMBER_SPECIAL_KEYS)
		{
			if (!ft_strncmp(str, term->array_esc_seq[i], ft_strlen(str) + 1))
			{
				free(str);
				return (i);
			}
		}
	}
	free(str);
	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
movq $0x0, (%rdi)
movsbl %sil, %esi
callq 0xa9d0
testl %eax, %eax
je 0x578f
leaq 0xc(%rsp), %r14
leaq 0x10(%rsp), %r12
movl $0x1, %edx
xorl %edi, %edi
movq %r14, %rsi
callq 0x2140
movq %rax, %r15
cmpl $-0x1, %r15d
je 0x5783
testl %r15d, %r15d
je 0x57a7
movsbl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0xa9d0
testl %eax, %eax
je 0x57ac
xorl %r15d, %r15d
cmpq $0xe, %r15
je 0x571e
movq 0x10(%rsp), %r13
movq 0x50(%rbx), %rax
movq (%rax,%r15,8), %rbp
movq %r13, %rdi
callq 0xa5c8
leaq 0x1(%rax), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0xa5dc
incq %r15
testl %eax, %eax
jne 0x574f
decl %r15d
movq 0x10(%rsp), %rdi
callq 0x2240
jmp 0x5795
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x5783
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x5783
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_process_char.c
// Function: read_process_add_char
void	read_process_add_char(t_control *control, char c)
{
	if (!(ft_strcadd(&(control->term->line), c, \
					control->term->inline_position + 1)))
	{
		control->quit = 1;
		return ;
	}
	control->term->inline_position++;
	control->term->line_len++;
	if (!terminfo_insert_char(control, c))
	{
		control->quit = 1;
		return ;
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movslq 0xc(%rdi), %rdx
incq %rdx
callq 0xaab4
testl %eax, %eax
je 0x57ea
movq 0x18(%rbx), %rax
incl 0xc(%rax)
incl 0x8(%rax)
movsbl %bpl, %esi
movq %rbx, %rdi
callq 0x4c70
testl %eax, %eax
jne 0x57ed
orb $0x1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_process_char.c
// Function: read_process_del_char
void	read_process_del_char(t_control *control)
{
	if (control->term->inline_position == -1)
		return ;
	ft_strcdel(control->term->line, control->term->inline_position);
	if (!terminfo_del_char(control))
		return ;
	control->term->inline_position--;
	control->term->line_len--;
}

// Assembly:
pushq %rbx
movq 0x18(%rdi), %rax
movslq 0xc(%rax), %rsi
cmpq $-0x1, %rsi
je 0x5824
movq %rdi, %rbx
movq (%rax), %rdi
callq 0xab54
movq %rbx, %rdi
callq 0x4c40
testl %eax, %eax
je 0x5824
movq 0x18(%rbx), %rax
decl 0xc(%rax)
decl 0x8(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_process_char.c
// Function: read_process_special_key
void	read_process_special_key(t_control *control, int i)
{
	if (i == KEY_RIGHT_ID)
		terminfo_cursor_move_right(control);
	else if (i == KEY_LEFT_ID)
		terminfo_cursor_move_left(control);
	else if (i == KEY_HOME_ID)
		read_process_control_combo(control, CTRL_A_COMBO);
	else if (i == KEY_END_ID)
		read_process_control_combo(control, CTRL_E_COMBO);
	else if (i == KEY_UP_CTRL_ID)
		terminfo_cursor_move_up(control, &control->term->cursor);
	else if (i == KEY_DOWN_CTRL_ID)
		terminfo_cursor_move_down(control, &control->term->cursor);
	else if (i == KEY_RIGHT_CTRL_ID)
		terminfo_cursor_move_next_word(control);
	else if (i == KEY_LEFT_CTRL_ID)
		terminfo_cursor_move_previous_word(control);
	else if (i == KEY_UP_ID)
		history_search(control, 1);
	else if (i == KEY_DOWN_ID)
		history_search(control, 0);
}

// Assembly:
pushq %rbx
addl $0xffffff7f, %esi       # imm = 0xFFFFFF7F
cmpl $0xc, %esi
ja 0x58d2
movq %rdi, %rbx
leaq 0x5b04(%rip), %rax      # 0xb344
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %rbx, %rdi
movl $0x1, %esi
jmp 0x58a8
movq %rbx, %rdi
popq %rbx
jmp 0x4790
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4a31
testl %eax, %eax
je 0x58d2
movq 0x18(%rbx), %rax
movl 0x8(%rax), %ecx
decl %ecx
movl %ecx, 0xc(%rax)
jmp 0x58d2
movq %rbx, %rdi
popq %rbx
jmp 0x4698
movq 0x18(%rbx), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
popq %rbx
jmp 0x48a8
movq 0x18(%rbx), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
popq %rbx
jmp 0x4951
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x5ba8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x4a31
testl %eax, %eax
je 0x58d2
movq 0x18(%rbx), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movq 0x20(%rax), %rcx
movq %rcx, 0x10(%rax)
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x4b6c
movq %rbx, %rdi
popq %rbx
jmp 0x4aa0
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/read_process_char.c
// Function: read_process_control_combo
void	read_process_control_combo(t_control *control, char c)
{
	if (c == CTRL_A_COMBO)
	{
		if (!terminfo_cursor_move_endl(control, 1))
			return ;
		control->term->inline_position = -1;
		control->term->cursor = control->term->cursor_start;
	}
	else if (c == CTRL_E_COMBO)
	{
		if (!terminfo_cursor_move_endl(control, 0))
			return ;
		control->term->inline_position = control->term->line_len - 1;
	}
	else if (c == CTRL_P_COMBO)
	{
		terminfo_clipboard_paste(control, &control->term->clipboard);
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x10, %esi
je 0x593b
cmpl $0x5, %esi
je 0x591f
cmpl $0x1, %esi
jne 0x5939
movq %rbx, %rdi
movl $0x1, %esi
callq 0x4a31
testl %eax, %eax
je 0x5939
movq 0x18(%rbx), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movq 0x20(%rax), %rcx
movq %rcx, 0x10(%rax)
jmp 0x5939
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4a31
testl %eax, %eax
je 0x5939
movq 0x18(%rbx), %rax
movl 0x8(%rax), %ecx
decl %ecx
movl %ecx, 0xc(%rax)
popq %rbx
retq
movq 0x18(%rbx), %rsi
addq $0x60, %rsi
movq %rbx, %rdi
popq %rbx
jmp 0x545d
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_root.c
// Function: history_root
int			history_root(t_control *control, t_history *history)
{
	if (!control->term->line)
	{
		if (!(control->term->line = ft_strdup("")))
		{
			control->quit = 1;
			return (0);
		}
	}
	if (!history_update_line(control, history))
		return (0);
	if (history_decide_discard_new_link(control))
		return (0);
//	debug_history_list(control->history)
	return (1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
cmpq $0x0, (%rax)
jne 0x5978
leaq 0x5874(%rip), %rdi      # 0xb1db
callq 0xa4b4
movq 0x18(%rbx), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x599a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5a50
testl %eax, %eax
je 0x599d
movq %rbx, %rdi
callq 0x5b43
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %al
jmp 0x599f
orb $0x1, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_root.c
// Function: history_init_struct
t_history	*history_init_struct(void)
{
	t_history *hist;

	if (!(hist = (t_history*)malloc(sizeof(t_history))))
		return (NULL);
	hist->size = 0;
	hist->max_size = 255;
	hist->head = NULL;
	return (hist);
}

// Assembly:
pushq %rax
movl $0x18, %edi
callq 0x2190
testq %rax, %rax
je 0x59ce
movl $0x0, (%rax)
movl $0xff, 0x10(%rax)
movq $0x0, 0x8(%rax)
jmp 0x59d0
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_root.c
// Function: history_add_new_link
int			history_add_new_link(t_control *control)
{
	t_dlist	*history_new;
	char	*str;

	if (!(str = ft_strdup("")))
	{
		control->quit = 1;
		return (0);
	}
	if (!(history_new = ft_dlstnew(str)))
	{
		free(str);
		control->quit = 1;
		return (0);
	}
	ft_dlstadd_front(&(control->history->head), history_new);
	control->history->size++;
	if (control->history->size > control->history->max_size)
	{
		control->history->size--;
		ft_dlstpop_back(&control->history->head, history_del_content);
	}
	return (1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x57f6(%rip), %rdi      # 0xb1db
callq 0xa4b4
testq %rax, %rax
je 0x5a40
movq %rax, %r14
movq %rax, %rdi
callq 0xac5c
testq %rax, %rax
je 0x5a38
movq 0x10(%rbx), %rdi
addq $0x8, %rdi
movq %rax, %rsi
callq 0xac80
movq 0x10(%rbx), %rdi
movl (%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%rdi)
movl $0x1, %ebx
cmpl 0x10(%rdi), %eax
jl 0x5a45
movl %eax, (%rdi)
addq $0x8, %rdi
leaq -0x5f(%rip), %rsi       # 0x59d2
callq 0xad5c
jmp 0x5a45
movq %r14, %rdi
callq 0x2240
orb $0x1, (%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_update.c
// Function: history_update_line
int	history_update_line(t_control *control, t_history *history)
{
	char *current_hist;
	char *str;

	current_hist = (char *)(history->head->content);
	if (control->lexer_end.backslash)
		current_hist[ft_strlen(current_hist) - 1] = '\0';
	if (control->lexer_end.quote || control->lexer_end.add_semi)
	{
		if (!history_update_line_insert_sep(control, history))
			return (0);
	}
	else
	{
		if (!(str = ft_strjoin_free(current_hist, control->term->line, 1)))
		{
			control->quit = 1;
			return (0);
		}
		history->head->content = str;
	}
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rax
movq (%rax), %r15
testb $0x4, 0x28(%rdi)
je 0x5a76
movq %r15, %rdi
callq 0xa5c8
movb $0x0, -0x1(%r15,%rax)
testb $0x12, 0x28(%r14)
je 0x5a8e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5ac1
testl %eax, %eax
jne 0x5aae
jmp 0x5ab9
movq 0x18(%r14), %rax
movq (%rax), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0xa584
testq %rax, %rax
je 0x5ab5
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movl $0x1, %eax
jmp 0x5abb
orb $0x1, (%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_update.c
// Function: history_update_line_insert_sep
int	history_update_line_insert_sep(t_control *control, t_history *history)
{
	char *str;
	char c;

	if (control->lexer_end.quote)
		c = '\n';
	else
		c = ';';
	str = (char *)(history->head->content);
	if (!ft_strappend(&str, c))
	{
		control->quit = 1;
		return (0);
	}
	if (!(str = ft_strjoin_free(str, control->term->line, 1)))
	{
		control->quit = 1;
		free(str);
		return (0);
	}
	history->head->content = str;
	return (1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
testb $0x2, 0x28(%rdi)
movq 0x8(%rsi), %rax
movq (%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movl $0x3b, %eax
movl $0xa, %esi
cmovel %eax, %esi
callq 0xa9d0
testl %eax, %eax
je 0x5b26
movq 0x8(%rsp), %rdi
movq 0x18(%rbx), %rax
movq (%rax), %rsi
movl $0x1, %ebp
movl $0x1, %edx
callq 0xa584
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x5b2b
movq 0x8(%r14), %rcx
movq %rax, (%rcx)
jmp 0x5b38
orb $0x1, (%rbx)
jmp 0x5b36
orb $0x1, (%rbx)
movq %rax, %rdi
callq 0x2240
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_update.c
// Function: history_decide_discard_new_link
int	history_decide_discard_new_link(t_control *control)
{
	char	*str;
	int		i;
	int		len;

	str = (char *)(control->history->head->content);
	if (!str || !(len = ft_strlen(str)) || control->ctrl_c)
	{
		control->history->size--;
		ft_dlstpop_front(&control->history->head, history_del_content);
		control->ctrl_c = 1;
		return (1);
	}
	i = 0;
	while (str[i] && str[i] == ' ')
		i++;
	if (i == len)
	{
		control->history->size--;
		ft_dlstpop_front(&control->history->head, history_del_content);
		control->ctrl_c = 1;
		return (1);
	}
	return (0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movq 0x8(%rax), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x5b80
movq %r14, %rdi
callq 0xa5c8
testl %eax, %eax
je 0x5b80
testb $0x2, (%rbx)
jne 0x5b80
xorl %edx, %edx
cmpb $0x20, (%r14,%rdx)
leaq 0x1(%rdx), %rdx
je 0x5b6d
incl %eax
xorl %ecx, %ecx
cmpl %edx, %eax
jne 0x5b9e
movq 0x10(%rbx), %rdi
decl (%rdi)
addq $0x8, %rdi
leaq -0x1bf(%rip), %rsi      # 0x59d2
callq 0xad28
orb $0x2, (%rbx)
movl $0x1, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_search.c
// Function: history_search
void	history_search(t_control *control, int direction)
{
	t_int_pair cursor_end;

	if (!history_swap_line_in_term_struct(control, direction))
		return ;
	if (!terminfo_refresh_screen_from_start(control))
		return ;
	cursor_end = terminfo_cursor_get_endl(control);
	control->term->cursor = cursor_end;
	terminfo_cursor_move(control, cursor_end.x, cursor_end.y);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x5be5
testl %eax, %eax
je 0x5be3
movq %rbx, %rdi
callq 0x4448
testl %eax, %eax
je 0x5be3
movq %rbx, %rdi
callq 0x4657
movq 0x18(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq %rax, %rdx
shrq $0x20, %rdx
movl %eax, %esi
movq %rbx, %rdi
popq %rbx
jmp 0x4859
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/historic_search.c
// Function: history_swap_line_in_term_struct
int		history_swap_line_in_term_struct(t_control *control, int up)
{
	t_dlist	*new_link;
	char	*old_str;

	if (up == 1)
		new_link = control->term->current_history_link->next;
	else
		new_link = control->term->current_history_link->previous;
	if (!new_link)
		return (0);
	old_str = control->term->line;
	if (!(control->term->line = ft_strdup((char *)(new_link->content))))
	{
		control->quit = 1;
		return (0);
	}
	ft_free((void **)&old_str);
	control->term->current_history_link = new_link;
	control->term->line_len = ft_strlen((char*)(new_link->content));
	control->term->inline_position = control->term->line_len - 1;
	return (1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
xorl %eax, %eax
cmpl $0x1, %esi
setne %al
movq 0x18(%rdi), %rcx
movq 0x58(%rcx), %rcx
movq 0x8(%rcx,%rax,8), %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0x5c5c
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq (%r14), %rdi
callq 0xa4b4
movq 0x18(%rbx), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x5c59
leaq 0x8(%rsp), %rdi
callq 0xaa9c
movq 0x18(%rbx), %rax
movq %r14, 0x58(%rax)
movq (%r14), %rdi
callq 0xa5c8
movq 0x18(%rbx), %rcx
movl %eax, 0x8(%rcx)
decl %eax
movl %eax, 0xc(%rcx)
movl $0x1, %ebp
jmp 0x5c5c
orb $0x1, (%rbx)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/control_structure.c
// Function: control_init_struct
int		control_init_struct(t_control *control)
{
	extern char **environ;

	ft_bzero(control, sizeof(*control));
	control->parent_pid = getpid();
	if (!(control->history = history_init_struct()) ||
		!(control->term = terminfo_init_database()) ||
		!(control->env = env_build_linked_list(environ)))
		return (0);
	if (!control_load_start_prompts(&control->env, \
				"\033[93m⚡\033[5;92m mli_&_charmstr \033[0;93m⚡\033[m ", \
				"🍝 > "))
		return (0);
	if (!env_shlvl_update(&control->env, control))
		return (0);
	if (!(control->cwd = getcwd(NULL, 0)))
		return (0);
	if ((control->truefd[STDIN_FILENO] = dup(STDIN_FILENO)) == -1 ||
		(control->truefd[STDOUT_FILENO] = dup(STDOUT_FILENO)) == -1 ||
		(control->truefd[STDERR_FILENO] = dup(STDERR_FILENO)) == -1)
		return (0);
	if (tcgetattr(STDIN_FILENO, &control->termios_default) == -1)
		return (0);
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x80, %esi
callq 0x9bc0
callq 0x2070
movl %eax, 0x8(%rbx)
callq 0x59a7
movq %rax, 0x10(%rbx)
xorl %r14d, %r14d
testq %rax, %rax
je 0x5d55
callq 0x421c
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x5d55
movq 0xc338(%rip), %rax      # 0x11fe8
movq (%rax), %rdi
callq 0x3270
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x5d55
leaq 0x20(%rbx), %r15
leaq 0x56a8(%rip), %rsi      # 0xb378
leaq 0x56cf(%rip), %rdx      # 0xb3a6
movq %r15, %rdi
callq 0x5d5e
testl %eax, %eax
je 0x5d55
movq %r15, %rdi
movq %rbx, %rsi
callq 0x346a
testl %eax, %eax
je 0x5d55
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
callq 0x2100
movq %rax, 0x78(%rbx)
testq %rax, %rax
je 0x5d55
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x20d0
movl %eax, 0x30(%rbx)
cmpl $-0x1, %eax
je 0x5d55
movl $0x1, %edi
callq 0x20d0
movl %eax, 0x34(%rbx)
cmpl $-0x1, %eax
je 0x5d55
movl $0x2, %edi
callq 0x20d0
movl %eax, 0x38(%rbx)
cmpl $-0x1, %eax
je 0x5d55
addq $0x3c, %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x21d0
xorl %r14d, %r14d
cmpl $-0x1, %eax
setne %r14b
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/control_structure.c
// Function: control_load_start_prompts
int	control_load_start_prompts(t_list **env, char *ps1, char *ps2)
{
	unset_in_env_list(env, "PS1");
	unset_in_env_list(env, "PS2");
	 if (!export_builtin_new_env("PS1", ps1, env))
			return (0);
	 if (!export_builtin_new_env("PS2", ps2, env))
			return (0);
	return (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x5514(%rip), %r12      # 0xb28a
movq %r12, %rsi
callq 0x35b8
leaq 0x5501(%rip), %rsi      # 0xb286
movq %r14, %rdi
callq 0x35b8
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3804
testl %eax, %eax
je 0x5dbc
leaq 0x54e0(%rip), %rdi      # 0xb286
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3804
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x5dbe
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/control_structure.c
// Function: control_free_struct
void	control_free_struct(t_control *control)
{
	terminfo_free_struct(control->term);
	ft_dlstclear(&(control->history->head), history_del_content);
	ft_free((void **)&control->history);
	ft_free((void **)&control->cwd);
	ft_lstclear(&control->env, env_del_struct);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x433d
leaq 0x10(%rbx), %r14
movq 0x10(%rbx), %rdi
addq $0x8, %rdi
leaq -0x41b(%rip), %rsi      # 0x59d2
callq 0xaca8
movq %r14, %rdi
callq 0xaa9c
leaq 0x78(%rbx), %rdi
callq 0xaa9c
addq $0x20, %rbx
leaq -0x2a9a(%rip), %rsi     # 0x3374
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xa820
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/parser_root.c
// Function: ast_add
void		ast_add(t_btree **ast, t_btree *add)
{
	if (add == NULL)
		return ;
	if (*ast == NULL)
		*ast = add;
	else if ((*ast)->left == NULL)
		(*ast)->left = add;
	else if ((*ast)->item == NULL)
	{
		(*ast)->item = add->item;
		ft_free((void **)&add);
	}
	else if ((*ast)->right == NULL)
		(*ast)->right = add;
	else
	{
		add->left = *ast;
		*ast = add;
	}
}

// Assembly:
pushq %rax
movq %rsi, (%rsp)
testq %rsi, %rsi
je 0x5e70
movq (%rdi), %rax
testq %rax, %rax
je 0x5e50
cmpq $0x0, (%rax)
je 0x5e55
cmpq $0x0, 0x10(%rax)
je 0x5e5a
cmpq $0x0, 0x8(%rax)
je 0x5e6c
movq %rax, (%rsi)
movq %rsi, (%rdi)
jmp 0x5e70
movq %rsi, (%rax)
jmp 0x5e70
movq 0x10(%rsi), %rcx
movq %rcx, 0x10(%rax)
movq %rsp, %rdi
callq 0xaa9c
jmp 0x5e70
movq %rsi, 0x8(%rax)
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/parser_root.c
// Function: parser_be_subshell
int			parser_be_subshell(t_btree **new)
{
	t_btree *tmp;
	t_token *token;

	tmp = NULL;
	if (!(token = ft_memalloc(sizeof(t_token))))
		return (-1);
	token->id = SUBSHELL;
	if ((*new)->item != NULL)
	{
		if (!(tmp = btree_new(token)))
		{
			ft_free((void **)&token);
			return (-1);
		}
		tmp->left = *new;
		*new = tmp;
	}
	else
		(*new)->item = token;
	return (1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x20, %edi
callq 0xaa1c
movq %rax, (%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x5ed6
movl $0xe, 0x8(%rax)
movq (%r14), %rcx
cmpq $0x0, 0x10(%rcx)
je 0x5ec3
movq %rax, %rdi
callq 0xaeb4
testq %rax, %rax
je 0x5ece
movq (%r14), %rcx
movq %rcx, (%rax)
movq %rax, (%r14)
jmp 0x5ec7
movq %rax, 0x10(%rcx)
movl $0x1, %ebx
jmp 0x5ed6
movq %rsp, %rdi
callq 0xaa9c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/parser_root.c
// Function: parser_next_child
int			parser_next_child(t_dlist **dlst, t_list **tklst, t_btree **new)
{
//	printf("ENTER WITH : [%d]\t'%s'\n",
//		token_id((*tklst)->content), ((t_token *)(*tklst)->content)->str);
	if (parser_is_cmd_start(tklst_id(*tklst)))
		return (parser_cmd(tklst, new));
	if (parser_do_subtree(token_id((*tklst)->content)))
	{
		*tklst = (*tklst)->next;
		if (!*tklst)
			return (0);
		if (!((*dlst)->next = ft_dlstnew(NULL)))
			return (-1);
		(*dlst)->next->previous = *dlst;
		if (!(*new = parser_create_ast((*dlst)->next, tklst)))
			return (-1);
		if (parser_be_subshell(new) == -1)
			return (-1);
		ft_free((void **)&((*dlst)->next));
//	printf("\nNEW CONTAINS\n");
//		btree_debug(*new, parser_disp);
	}
	else
	{
		if (!(*new = btree_new((*tklst)->content)))
			return (-1);
	}
	if (*tklst)
		*tklst = (*tklst)->next;
//	if ((*new)->item)
//		printf("New is : [%d]\t'%s'\n", token_id((*new)->item), ((t_token *)(*new)->item)->str);
	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq (%rsi), %rdi
callq 0x63f7
movl %eax, %edi
callq 0x62cb
testl %eax, %eax
je 0x5f18
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6374
movq (%rbx), %rax
movq (%rax), %rdi
callq 0x63e8
movq (%rbx), %rcx
cmpl $0x6, %eax
jne 0x5f8c
movq 0x8(%rcx), %rax
movq %rax, (%rbx)
testq %rax, %rax
je 0x5fb2
xorl %edi, %edi
callq 0xac5c
movq (%r15), %rcx
movq %rax, 0x8(%rcx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x5fbb
movq (%r15), %rax
movq 0x8(%rax), %rcx
movq %rax, 0x10(%rcx)
movq (%r15), %rax
movq 0x8(%rax), %rdi
movq %rbx, %rsi
callq 0x5fc8
movq %rax, (%r14)
testq %rax, %rax
je 0x5fbb
movq %r14, %rdi
callq 0x5e7b
cmpl $-0x1, %eax
je 0x5fbb
movq (%r15), %rdi
addq $0x8, %rdi
callq 0xaa9c
jmp 0x5f9c
movq (%rcx), %rdi
callq 0xaeb4
movq %rax, (%r14)
testq %rax, %rax
je 0x5fb6
movq (%rbx), %rax
movl $0x1, %ebp
testq %rax, %rax
je 0x5fbb
movq 0x8(%rax), %rax
movq %rax, (%rbx)
jmp 0x5fbb
xorl %ebp, %ebp
jmp 0x5fbb
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/parser_root.c
// Function: parser_create_ast
t_btree		*parser_create_ast(t_dlist *dlst, t_list **tklst)
{
	t_btree		*new;
	int			state;

	if (!(dlst->content = btree_new(NULL)))
		return (NULL);
	while (*tklst && token_id((*tklst)->content) != RBRACE)
	{
//		printf("%d\n", token_id(tklst->content));
		if ((state = parser_next_child(&dlst, tklst, &new)) == 1)
			ast_add((t_btree **)&dlst->content, new);
		else if (state == -1)
			return (NULL);
		else if (parser_handle_semi(&dlst, tklst) == -1)
			return (NULL);
	}
	return (dlst->content);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rsp)
xorl %r15d, %r15d
xorl %edi, %edi
callq 0xaeb4
movq %rax, (%rbx)
testq %rax, %rax
je 0x6053
movq (%r14), %rax
testq %rax, %rax
je 0x6050
leaq 0x8(%rsp), %r12
movq %rsp, %r13
xorl %r15d, %r15d
movq (%rax), %rdi
callq 0x63e8
cmpl $0x7, %eax
je 0x6050
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x5ee0
cmpl $0x1, %eax
je 0x603c
cmpl $-0x1, %eax
je 0x6053
movq %r12, %rdi
movq %r14, %rsi
callq 0x6064
cmpl $-0x1, %eax
jne 0x6048
jmp 0x6053
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x5e27
movq (%r14), %rax
testq %rax, %rax
jne 0x6005
movq (%rbx), %r15
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/parser_root.c
// Function: parser_handle_semi
int			parser_handle_semi(t_dlist **dlst, t_list **tklst)
{
	t_btree		*new;

	if (!(*tklst && token_id((*tklst)->content) == SEMI &&
		(tklst_id((*tklst)->next) != RBRACE) && (*tklst = (*tklst)->next)))
		return (0);
	if (!((*dlst)->next = ft_dlstnew(NULL)))
		return (-1);
	(*dlst)->next->previous = *dlst;
	if (!(new = parser_create_ast((*dlst)->next, tklst)))
		return (-1);
	ft_free((void **)&((*dlst)->next));
	ast_add((t_btree **)&(*dlst)->content, new);
	return (1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq (%rsi), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x60ff
movq %rsi, %r14
movq %rdi, %rbx
movq (%rax), %rdi
callq 0x63e8
cmpl $0x1, %eax
jne 0x60ff
movq (%r14), %rax
movq 0x8(%rax), %rdi
callq 0x63f7
cmpl $0x7, %eax
je 0x60ff
movq (%r14), %rax
movq 0x8(%rax), %rax
movq %rax, (%r14)
testq %rax, %rax
je 0x60ff
xorl %edi, %edi
callq 0xac5c
movq (%rbx), %rcx
movq %rax, 0x8(%rcx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x60ff
movq (%rbx), %rax
movq 0x8(%rax), %rcx
movq %rax, 0x10(%rcx)
movq (%rbx), %rax
movq 0x8(%rax), %rdi
movq %r14, %rsi
callq 0x5fc8
testq %rax, %rax
je 0x60ff
movq %rax, %r14
movq (%rbx), %rdi
addq $0x8, %rdi
callq 0xaa9c
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x5e27
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/charMstr[P]minishell/sources/parser_root.c
// Function: parser_btree_reverse_pipe
void		parser_btree_reverse_pipe(t_btree **ast)
{
	int		id;
	t_btree	*lchild;

	lchild = (*ast)->left;
	while (btree_id(lchild) == PIPE)
		lchild = lchild->left;
	if ((id = btree_id(lchild)) == -1)
		return ;
	if (id == LIST || id == SUBSHELL)
		return ;
	(*ast)->left = lchild->right;
	lchild->right = *ast;
	*ast = lchild;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
movq (%r14), %r14
movq %r14, %rdi
callq 0x640d
cmpl $0x2, %eax
je 0x6125
movq %r14, %rdi
callq 0x640d
incl %eax
cmpl $0x10, %eax
ja 0x614e
movl $0x18001, %ecx          # imm = 0x18001
btl %eax, %ecx
jb 0x6162
movq 0x8(%r14), %rax
movq (%rbx), %rcx
movq %rax, (%rcx)
movq (%rbx), %rax
movq %rax, 0x8(%r14)
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x61a2
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x61a2
callq 0x616a
movq (%rbx), %rdi
addq $0x8, %rdi
callq 0x616a
movq (%rbx), %rdi
callq 0x640d
cmpl $0x2, %eax
jne 0x61a2
movq %rbx, %rdi
popq %rbx
jmp 0x611b
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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, 0x10(%rsp)
movq $0x0, (%rsp)
movq %rdi, 0x18(%rsp)
testq %rdi, %rdi
je 0x6265
movq %rsi, %rbx
movl $0x18, %edi
callq 0xaa1c
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x622e
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x5fc8
movq %rax, (%rsp)
testq %rax, %rax
je 0x622e
leaq -0xf2(%rip), %rdx       # 0x6106
leaq -0x3a76(%rip), %rcx     # 0x2789
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xadf0
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa820
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0xaca8
movq %rsp, %rdi
callq 0x616a
jmp 0x625f
leaq 0x5179(%rip), %rdi      # 0xb3ae
callq 0x2050
orb $0x1, (%rbx)
leaq -0x3abb(%rip), %rsi     # 0x2789
leaq 0x10(%rsp), %rdi
callq 0xa820
leaq -0x435(%rip), %rsi      # 0x5e20
leaq 0x8(%rsp), %rdi
callq 0xad9c
movq (%rsp), %rax
jmp 0x6267
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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 0x63f7
movl $0x1, %ebx
cmpl $0x4, %eax
jne 0x62af
movq (%r14), %rax
movq (%rax), %rdi
callq 0xaeb4
movq %rax, 0x8(%r15)
testq %rax, %rax
je 0x62ad
movq (%r14), %rax
movq 0x8(%rax), %rax
movq %rax, (%r14)
jmp 0x62af
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq (%rax), %rdi
callq 0xa894
testq %rax, %rax
je 0x6359
movq %rbx, %rdi
movq %rax, %rsi
callq 0xa7e4
movq (%r14), %rax
movq 0x8(%rax), %rdi
movq %rdi, (%r14)
movl $0x1, %r15d
testq %rdi, %rdi
je 0x636b
callq 0x63f7
leal -0x8(%rax), %ecx
cmpl $0x6, %ecx
jae 0x634e
movq (%r14), %rax
movq (%rax), %rdi
callq 0xa894
testq %rax, %rax
je 0x635e
movq %rbx, %rdi
movq %rax, %rsi
callq 0xa7e4
movq (%r14), %rax
movq 0x8(%rax), %rdi
movq %rdi, (%r14)
jmp 0x6315
cmpl $0x4, %eax
je 0x6327
testl %eax, %eax
je 0x6327
jmp 0x636b
xorl %r15d, %r15d
jmp 0x636b
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa820
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %edi, %edi
callq 0xaeb4
movq %rax, %rcx
movq %rax, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x63e0
callq 0x27d6
movq (%rbx), %rcx
movq %rax, 0x10(%rcx)
testq %rax, %rax
je 0x63d3
movq (%rbx), %rax
movq 0x10(%rax), %rdi
movl $0xf, 0x8(%rdi)
movq %r14, %rsi
callq 0x62df
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x63e0
movq (%rbx), %rdi
addq $0x10, %rdi
callq 0xaa9c
movq %rbx, %rdi
callq 0xaa9c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x6462
cmpl $0xf, 0x8(%rdi)
jne 0x6454
leaq 0x3(%rsp), %rbx
movw $0x736c, (%rbx)         # imm = 0x736C
movb $0x74, 0x2(%rbx)
movq (%rdi), %rdi
callq 0xa8b8
addb $0x2f, %al
movb %al, 0x3(%rbx)
movb $0x0, 0x4(%rbx)
jmp 0x6487
testq %rdi, %rdi
je 0x6462
cmpl $0xe, 0x8(%rdi)
sete %al
jmp 0x6464
xorl %eax, %eax
testq %rdi, %rdi
sete %cl
orb %al, %cl
leaq 0x4f81(%rip), %rdx      # 0xb3f4
leaq 0x4f80(%rip), %rbx      # 0xb3fa
testb %al, %al
cmovneq %rdx, %rbx
testb %cl, %cl
jne 0x6487
movq (%rdi), %rbx
leaq 0x4f71(%rip), %rdi      # 0xb3ff
movl $0x1, %esi
callq 0x9f24
xorl %r14d, %r14d
movb (%rbx,%r14), %al
testb %al, %al
je 0x64bf
movsbl %al, %edi
movl $0x1, %esi
callq 0x9e5c
incq %r14
cmpq $0x4, %r14
jne 0x649b
movl $0x4, %r14d
cmpl $0x3, %r14d
jg 0x64dd
addl $-0x4, %r14d
movl $0x20, %edi
movl $0x1, %esi
callq 0x9e5c
incl %r14d
jne 0x64c9
leaq 0x5057(%rip), %rdi      # 0xb53b
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x9f24
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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 0x6557
movq %rsi, %rbx
testb $0x1, (%rsi)
jne 0x6557
movq %rdi, %r14
callq 0x640d
movq 0xbc18(%rip), %rcx      # 0x12130
cmpq $0x0, 0x8(%rcx)
je 0x6538
xorl %edx, %edx
movq %rcx, %rsi
cmpl %eax, (%rsi)
je 0x653a
incq %rdx
cmpq $0x0, 0x18(%rsi)
leaq 0x10(%rsi), %rsi
jne 0x6524
jmp 0x653a
xorl %edx, %edx
shlq $0x4, %rdx
movq 0x8(%rcx,%rdx), %rax
testq %rax, %rax
je 0x6557
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x64f8
cmpl $0x0, 0x4(%rbx)
jne 0x65a4
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x64f8
movl 0x4(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x64f8
cmpl $0x0, 0x4(%rbx)
je 0x65d3
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x64f8
movl 0x4(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x24b3
movl (%r15), %edi
testl %edi, %edi
je 0x6670
leaq 0x8(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x21c0
movl (%r14), %eax
testb $0x7f, %al
je 0x6660
leaq 0xbae0(%rip), %rax      # 0x1213c
movl (%rax), %eax
jmp 0x6663
movzbl %ah, %eax
movl %eax, 0x4(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x8ec9
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x64f8
movl 0x4(%rbx), %edi
callq 0x2210
// File: /workspace/github_c_makefile_star2_O1/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 0x24fb
cmpl $0x0, (%r15)
jne 0x66fc
movl 0x4(%rsp), %edi
callq 0x2110
movl 0x8(%rsp), %edi
movl $0x1, %esi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x66e6
callq 0x2040
movl (%rax), %edi
callq 0x2220
leaq 0x4d2a(%rip), %rdi      # 0xb401
xorl %esi, %esi
movq %rax, %rdx
movl $0x1, %ecx
callq 0x24a4
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x64f8
movl 0x8(%rsp), %edi
callq 0x2110
jmp 0x675f
movl 0x8(%rsp), %edi
callq 0x2110
movl 0x4(%rsp), %edi
xorl %esi, %esi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x6737
callq 0x2040
movl (%rax), %edi
callq 0x2220
leaq 0x4cd9(%rip), %rdi      # 0xb401
xorl %esi, %esi
movq %rax, %rdx
movl $0x1, %ecx
callq 0x24a4
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x64f8
leaq 0xc(%rsp), %r14
movl -0x8(%r14), %edi
callq 0x2110
movl -0xc(%r14), %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x21c0
movl 0x4(%rbx), %edi
callq 0x2210