LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: maybe_execute_builtin
bool maybe_execute_builtin(const struct list_head *cmd_args,
			   const struct list_head *redirs,
			   unsigned cmd_nargs, int *status_ret)
{
	const char *name;
	size_t i;

	mysh_assert(!list_empty(cmd_args));
	mysh_assert(cmd_nargs == list_size(cmd_args));
	name = list_entry(cmd_args->next, struct string, list)->chars;
	for (i = 0; i < NUM_BUILTINS; i++) {
		if (strcmp(builtins[i].name, name) == 0) {
			/* The command matched a builtin.  Execute it. */
			*status_ret = execute_builtin(&builtins[i],
						      cmd_args->next,
						      redirs, cmd_nargs - 1);
			return true;
		}
	}
	/* Not a builtin command */
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %r15
cmpq %rdi, %r15
je 0x2786
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movl %edx, %eax
incq %rax
movq %rdi, %rcx
movq (%rcx), %rcx
decq %rax
cmpq %rdi, %rcx
jne 0x26e3
testq %rax, %rax
jne 0x27a5
movq -0x18(%r15), %r13
leaq 0x4a65(%rip), %rdi      # 0x7167
movq %r13, %rsi
callq 0x2230
testl %eax, %eax
je 0x2750
movq %r14, (%rsp)
movq %rbx, %r14
leaq 0x80f4(%rip), %r12      # 0xa810
xorl %ebx, %ebx
cmpq $0x10, %rbx
je 0x2770
movq 0x18(%r12), %rdi
addq $0x18, %r12
movq %r13, %rsi
callq 0x2230
incq %rbx
testl %eax, %eax
jne 0x271e
decq %rbx
cmpq $0x10, %rbx
setb %r13b
movq %r14, %rbx
movq (%rsp), %r14
jmp 0x275a
leaq 0x80b9(%rip), %r12      # 0xa810
movb $0x1, %r13b
decl %ebp
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x27c4
movl %eax, (%rbx)
jmp 0x2774
setb %r13b
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4877(%rip), %rdi      # 0x7004
leaq 0x4886(%rip), %rsi      # 0x701a
leaq 0x488e(%rip), %rcx      # 0x7029
movl $0x1da, %edx            # imm = 0x1DA
callq 0x2160
leaq 0x48e2(%rip), %rdi      # 0x708e
leaq 0x4867(%rip), %rsi      # 0x701a
leaq 0x486f(%rip), %rcx      # 0x7029
movl $0x1db, %edx            # imm = 0x1DB
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: execute_builtin
static int execute_builtin(const struct builtin *builtin,
			   const struct list_head *cmd_args,
			   const struct list_head *redirs,
			   unsigned cmd_nargs)
{
	struct orig_fds orig;
	const char *argv[cmd_nargs + 1];
	struct string *s;
	unsigned i;
	int status;
	int ret;

	/* Do redirections for the builtin */
	status = do_redirections(redirs, &orig);
	if (status)
		return status;

	/* Prepare argv for the builtin */
	for (i = 0, s = list_entry(cmd_args->next, struct string, list);
	     i < cmd_nargs;
	     i++, s = list_entry(s->list.next, struct string, list))
	{
		argv[i] = s->chars;
	}
	argv[i] = NULL;

	/* Call the built-in function */
	status = builtin->func(cmd_nargs, argv);

	/* Undo redirections for the builtin, unless this was the 'exec' builtin */
	if (builtin->func != builtin_exec) {
		ret = undo_redirections(&orig);
		if (ret) {
			if (status == 0)
				status = ret;
			mysh_error_with_errno("Failed to restore redirections");
		}
	}
	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, -0x30(%rbp)
leal 0x1(%r14), %eax
movq %rsp, %r12
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
leaq -0x3c(%rbp), %rsi
movq %rdx, %rdi
callq 0x662d
movl %eax, %r13d
testl %eax, %eax
je 0x2824
movq -0x30(%rbp), %rsp
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
je 0x2843
movl %r14d, %ecx
xorl %eax, %eax
movq (%r15), %r15
movq -0x18(%r15), %rdx
movq %rdx, (%r12,%rax,8)
incq %rax
cmpq %rax, %rcx
jne 0x282e
jmp 0x2845
xorl %eax, %eax
movq $0x0, (%r12,%rax,8)
movl %r14d, %edi
movq %r12, %rsi
callq *0x8(%rbx)
movl %eax, %r13d
leaq 0x2aa(%rip), %rax       # 0x2b0a
cmpq %rax, 0x8(%rbx)
je 0x280e
leaq -0x3c(%rbp), %rdi
callq 0x65e0
testl %eax, %eax
je 0x280e
testl %r13d, %r13d
cmovel %eax, %r13d
leaq 0x4b00(%rip), %rdi      # 0x7381
xorl %eax, %eax
callq 0x249f
jmp 0x280e
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: set_pwd
int set_pwd()
{
	char *wd = getcwd(NULL, 0);
	int ret;
	if (wd) {
		const char *setenv_argv[] = {"PWD", wd, NULL};
		ret = builtin_setenv(ARRAY_SIZE(setenv_argv) - 1, setenv_argv);
		free(wd);
	} else {
		mysh_error("getcwd()");
		ret = 1;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
xorl %edi, %edi
xorl %esi, %esi
callq 0x21a0
testq %rax, %rax
je 0x28d0
movq %rax, %rbx
leaq 0x4807(%rip), %rax      # 0x70af
movq %rsp, %rsi
movq %rax, (%rsi)
movq %rbx, 0x8(%rsi)
movq $0x0, 0x10(%rsi)
movl $0x2, %edi
callq 0x28ec
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2050
jmp 0x28e3
leaq 0x47dc(%rip), %rdi      # 0x70b3
xorl %eax, %eax
callq 0x23e0
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_setenv
static int builtin_setenv(unsigned argc, const char **argv)
{
	int ret;
	if (argc < 2) {
		mysh_error("usage: setenv VARIABLE VALUE");
		ret = 2;
	} else {
		if (setenv(argv[0], argv[1], 1)) {
			mysh_error_with_errno("setenv %s", argv[0]);
			ret = 1;
		} else {
			insert_shell_param(argv[0], argv[1]);
			ret = 0;
		}
	}
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x1, %edi
ja 0x290a
leaq 0x4aa4(%rip), %rdi      # 0x73a0
xorl %eax, %eax
callq 0x23e0
movl $0x2, %ebx
jmp 0x294b
movq %rsi, %r14
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movl $0x1, %ebx
movl $0x1, %edx
callq 0x20d0
movq (%r14), %rsi
testl %eax, %eax
je 0x293a
leaq 0x4a8c(%rip), %rdi      # 0x73bd
xorl %eax, %eax
callq 0x249f
jmp 0x294b
movq 0x8(%r14), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x4b32
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_alias
static int builtin_alias(unsigned argc, const char **argv)
{
	int ret;
	if (argc == 0) {
		ret = print_all_shell_aliases();
	} else {
		ret = 0;
		do {
			ret |= do_alias(*argv++);
		} while (--argc);
	}
	return ret;
}

// Assembly:
testl %edi, %edi
je 0x2a03
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r12d
leaq 0x48b9(%rip), %r14      # 0x725a
xorl %r13d, %r13d
xorl %ebp, %ebp
movq (%rbx,%r13,8), %r15
movq %r15, %rdi
movl $0x3d, %esi
callq 0x2130
testq %rax, %rax
je 0x29d6
movq %rax, %rsi
subq %r15, %rsi
incq %rax
movq %r15, %rdi
movq %rax, %rdx
callq 0x4b62
xorl %ecx, %ecx
testb %al, %al
jne 0x29e8
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x23e0
movl $0x1, %ecx
orl %ecx, %ebp
incq %r13
cmpl %r13d, %r12d
jne 0x29a6
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x5108
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_cd
static int builtin_cd(unsigned argc, const char **argv)
{
	int ret = 1;
	const char *dest_dir;

	if (argc) {
		dest_dir = argv[0];
	} else {
		dest_dir = lookup_shell_param("HOME");
		if (!dest_dir) {
			mysh_error("cd: HOME not set");
			goto out;
		}
	}
	if (chdir(dest_dir) != 0)
		mysh_error_with_errno("cd: %s", dest_dir);
	else
		ret = set_pwd();
out:
	return ret;
}

// Assembly:
pushq %rbx
testl %edi, %edi
je 0x2a14
movq (%rsi), %rbx
jmp 0x2a28
leaq 0x485c(%rip), %rdi      # 0x7277
callq 0x4c5b
movq %rax, %rbx
testq %rax, %rax
je 0x2a4d
movq %rbx, %rdi
callq 0x2110
testl %eax, %eax
je 0x2a47
leaq 0x4852(%rip), %rdi      # 0x728d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x249f
jmp 0x2a5b
popq %rbx
jmp 0x288a
leaq 0x4828(%rip), %rdi      # 0x727c
xorl %eax, %eax
callq 0x23e0
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_eval
static int builtin_eval(unsigned argc, const char **argv)
{
	size_t total_len = 0;
	unsigned i;
	char *p;

	if (argc == 0)
		return 0;
	i = 0;
	do {
		total_len += strlen(argv[i]);
	} while (++i != argc);
	total_len += argc - 1;

	char input[total_len + 1];
	p = input;
	i = 0;
	do {
		p = stpcpy(p, argv[i]);
		if (i != argc - 1)
			p = stpcpy(p, " ");
	} while (++i != argc);
	return execute_full_shell_input(input, total_len);
}

// Assembly:
testl %edi, %edi
je 0x2b07
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %r14d
movl %edi, %r13d
xorl %r12d, %r12d
xorl %r15d, %r15d
movq (%rbx,%r12,8), %rdi
callq 0x2100
addq %rax, %r15
incq %r12
cmpq %r12, %r13
jne 0x2a8a
movq %rsp, -0x38(%rbp)
decl %r14d
leaq (%r15,%r14), %rax
addq $0x10, %rax
addq %r14, %r15
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, %rsp
xorl %r12d, %r12d
movq %rcx, -0x30(%rbp)
movq %rcx, %rax
movq (%rbx,%r12,8), %rsi
movq %rax, %rdi
callq 0x20f0
cmpq %r12, %r14
je 0x2ae0
movw $0x20, (%rax)
incq %rax
incq %r12
cmpq %r12, %r13
jne 0x2ac7
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x3470
movq -0x38(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_export
static int builtin_export(unsigned argc, const char **argv)
{
	int ret = 0;
	unsigned i;
	for (i = 0; i < argc; i++) {
		ret = do_export(argv[i]);
		if (ret)
			break;
	}
	return ret;
}

// Assembly:
testl %edi, %edi
je 0x2bb1
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %r12d
xorl %r13d, %r13d
movq (%rbx,%r13,8), %r15
movq %r15, %rdi
movl $0x3d, %esi
callq 0x2130
movq %rax, %r14
testq %rax, %rax
je 0x2b88
movq %r15, %rdi
callq 0x4bc1
movb $0x0, (%r14)
movq %r15, %rdi
callq 0x4c07
testq %r14, %r14
je 0x2b99
movb $0x3d, (%r14)
testl %eax, %eax
jne 0x2ba7
incq %r13
cmpq %r13, %r12
jne 0x2b63
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_getenv
static int builtin_getenv(unsigned argc, const char **argv)
{
	int ret = 0;
	if (argc) {
		const char *value = getenv(argv[0]);
		if (value) {
			if (puts(value) == EOF) {
				mysh_error_with_errno("getenv: write error");
				ret = 1;
			}
		} else
			ret = 2;
	} else {
		const char **env_p;
		for (env_p = environ; *env_p; env_p++) {
			if (puts(*env_p) == EOF) {
				mysh_error_with_errno("getenv: write error");
				ret = 1;
				break;
			}
		}
	}
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testl %edi, %edi
je 0x2bed
movq (%rsi), %rdi
callq 0x2030
testq %rax, %rax
je 0x2c1d
movq %rax, %rdi
callq 0x2080
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x2c22
leaq 0x46ca(%rip), %rdi      # 0x72a9
xorl %eax, %eax
callq 0x249f
movl $0x1, %ebx
jmp 0x2c22
movq 0x83dc(%rip), %rax      # 0xafd0
movq (%rax), %r14
movq (%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x2c22
addq $0x8, %r14
callq 0x2080
cmpl $-0x1, %eax
je 0x2bd8
movq (%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x2c05
jmp 0x2c22
movl $0x2, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_help
static int builtin_help(unsigned argc, const char **argv)
{
	size_t i;
	if (argc) {
		for (i = 0; i < NUM_BUILTINS; i++) {
			if (strcmp(builtins[i].name, argv[0]) == 0) {
				print_help(&builtins[i]);
				return 0;
			}
		}
	}
	for (i = 0; i < NUM_BUILTINS; i++)
		print_help(&builtins[i]);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testl %edi, %edi
je 0x2c63
movq (%rsi), %rbx
movl $0x10, %r14d
leaq 0x7bcb(%rip), %r15      # 0xa810
movq -0x10(%r14,%r15), %rdi
movq %rbx, %rsi
callq 0x2230
testl %eax, %eax
je 0x2c94
addq $0x18, %r14
cmpq $0x1a8, %r14            # imm = 0x1A8
jne 0x2c45
movl $0x10, %r14d
leaq 0x7ba0(%rip), %r15      # 0xa810
leaq 0x4646(%rip), %rbx      # 0x72bd
movq (%r14,%r15), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
addq $0x18, %r14
cmpq $0x1a8, %r14            # imm = 0x1A8
jne 0x2c77
jmp 0x2ca6
movq (%r14,%r15), %rsi
leaq 0x461e(%rip), %rdi      # 0x72bd
xorl %eax, %eax
callq 0x2140
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_pwd
static int builtin_pwd(unsigned argc, const char **argv)
{
	char *buf;
	int ret = 1;

	buf = getcwd(NULL, 0);
	if (!buf) {
		mysh_error_with_errno("pwd: can't get current working directory");
		goto out;
	}
	if (puts(buf) == EOF)
		mysh_error_with_errno("pwd: write error");
	else
		ret = 0;
	free(buf);
out:
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x21a0
testq %rax, %rax
je 0x2cef
movq %rax, %r14
movq %rax, %rdi
callq 0x2080
cmpl $-0x1, %eax
jne 0x2ce5
leaq 0x4618(%rip), %rdi      # 0x72f1
xorl %eax, %eax
callq 0x249f
movl $0x1, %ebx
movq %r14, %rdi
callq 0x2050
jmp 0x2d02
leaq 0x45d2(%rip), %rdi      # 0x72c8
xorl %eax, %eax
callq 0x249f
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_set
static int builtin_set(unsigned argc, const char **argv)
{
	const char *pos_params[argc];
	unsigned pos_params_idx;
	unsigned i;
	int ret;

	if (argc == 0) {
		ret = print_all_shell_variables();
		goto out;
	}
	pos_params_idx = 0;
	for (i = 0; i < argc; i++) {
		switch (argv[i][0]) {
		case '-':
			if (argv[i][1] == '-' && argv[i][2] == '\0') {
				i++;
				goto remaining_params;
			}
			/* Fall through */
		case '+':
			ret = set_or_unset_options_in_string(argv[i] + 1, (argv[i][0] == '-'));
			if (ret)
				goto out;
			break;
		default:
			pos_params[pos_params_idx++] = argv[i];
			break;
		}
	}
remaining_params:
	for (; i < argc; i++)
		pos_params[pos_params_idx++] = argv[i];
	if (pos_params_idx != 0) {
		set_positional_params(pos_params_idx,
				      positional_parameters[0],
				      pos_params);
	}
	ret = 0;
out:
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, -0x48(%rbp)
movl %edi, %r9d
movq %rsp, %rcx
leaq 0xf(,%r9,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, %rsp
testl %edi, %edi
je 0x2e3f
movl %edi, -0x3c(%rbp)
movq %rcx, -0x38(%rbp)
leaq 0x45b3(%rip), %r13      # 0x7302
xorl %ebx, %ebx
movl $0x0, -0x2c(%rbp)
movq %r9, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq (%rax,%rbx,8), %r14
movzbl (%r14), %eax
cmpl $0x2b, %eax
je 0x2d84
cmpl $0x2d, %eax
jne 0x2ddd
cmpb $0x2d, 0x1(%r14)
jne 0x2d84
cmpb $0x0, 0x2(%r14)
je 0x2e86
xorl %r15d, %r15d
cmpb $0x2d, %al
sete %cl
movb 0x1(%r14), %al
testb %al, %al
je 0x2df1
movb %cl, %r15b
addq $0x2, %r14
xorl %r12d, %r12d
cmpb $0x7e, %al
ja 0x2dbc
movzbl %al, %ecx
leaq 0x7c04(%rip), %rdx      # 0xa9b0
movq (%rdx,%rcx,8), %rcx
testq %rcx, %rcx
je 0x2dbc
movl %r15d, (%rcx)
xorl %eax, %eax
jmp 0x2dce
movsbl %al, %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x23e0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orl %eax, %r12d
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x2d9e
jmp 0x2df4
movl -0x2c(%rbp), %ecx
movl %ecx, %eax
incl %ecx
movl %ecx, -0x2c(%rbp)
movq -0x38(%rbp), %rcx
movq %r14, (%rcx,%rax,8)
jmp 0x2dfd
xorl %r12d, %r12d
testl %r12d, %r12d
movq -0x50(%rbp), %r9
jne 0x2e74
incq %rbx
cmpq %r9, %rbx
jne 0x2d5c
cmpl -0x3c(%rbp), %ebx
jae 0x2e54
movl %ebx, %ecx
movq -0x48(%rbp), %rax
leaq (%rax,%rcx,8), %rax
subq %rcx, %r9
movl -0x2c(%rbp), %edi
movl %edi, %r8d
xorl %ecx, %ecx
movq -0x38(%rbp), %rdx
leal (%r8,%rcx), %esi
movq (%rax,%rcx,8), %r10
movq %r10, (%rdx,%rsi,8)
incq %rcx
cmpq %rcx, %r9
jne 0x2e27
addl %ecx, %edi
jmp 0x2e5b
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5099
movq -0x38(%rbp), %rdx
movl -0x2c(%rbp), %edi
xorl %r12d, %r12d
testl %edi, %edi
je 0x2e74
leaq 0x868f(%rip), %rax      # 0xb4f8
movq (%rax), %rax
movq (%rax), %rsi
callq 0x53c0
movl %r12d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl %ebx
jmp 0x2e09
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_shift
static int builtin_shift(unsigned argc, const char **argv)
{
	unsigned amount;
	unsigned i;
	if (argc) {
		int iamount = atoi(argv[0]);
		if (iamount < 0) {
			mysh_error("shift: shift count cannot be negative");
			return 1;
		}
		amount = iamount;
		if (amount > num_positional_parameters) {
			mysh_error("shift: shift count greater than "
				   "number of positional parameters");
			return 1;
		}
	} else {
		if (num_positional_parameters == 0)
			return 0;
		amount = 1;
	}

	for (i = 1; i <= amount; i++)
		free(positional_parameters[i]);
	for (; i <= num_positional_parameters; i++)
		positional_parameters[i - amount] = positional_parameters[i];
	num_positional_parameters -= amount;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testl %edi, %edi
je 0x2ebc
movq (%rsi), %rdi
callq 0x2310
testl %eax, %eax
js 0x2f30
movl %eax, %ebx
leaq 0x8645(%rip), %rax      # 0xb4f4
cmpl (%rax), %ebx
jbe 0x2ecd
leaq 0x4487(%rip), %rdi      # 0x7341
jmp 0x2f37
leaq 0x8631(%rip), %rax      # 0xb4f4
movl $0x1, %ebx
cmpl $0x0, (%rax)
je 0x2f2c
movl $0x1, %r14d
testl %ebx, %ebx
je 0x2ef5
leaq 0x861a(%rip), %r15      # 0xb4f8
movq (%r15), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x2050
incl %r14d
cmpl %ebx, %r14d
jbe 0x2ede
leaq 0x85f8(%rip), %rax      # 0xb4f4
movl (%rax), %ecx
cmpl %ecx, %r14d
ja 0x2f28
movl %ebx, %edx
negl %edx
leaq 0x85ea(%rip), %rsi      # 0xb4f8
movq (%rsi), %rdi
movl %r14d, %r8d
movq (%rdi,%r8,8), %r8
leal (%rdx,%r14), %r9d
movq %r8, (%rdi,%r9,8)
incl %r14d
cmpl %ecx, %r14d
jbe 0x2f0e
subl %ebx, %ecx
movl %ecx, (%rax)
xorl %eax, %eax
jmp 0x2f43
leaq 0x43e4(%rip), %rdi      # 0x731b
xorl %eax, %eax
callq 0x23e0
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_lex.c
// Function: free_tok_list
void free_tok_list(struct list_head *tok_list)
{
	struct token *tok, *tmp;
	list_for_each_entry_safe(tok, tmp, tok_list, list) {
		list_del(&tok->list);
		free_token(tok);
	}
}

// Assembly:
movq (%rdi), %rax
cmpq %rdi, %rax
je 0x3000
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq -0x10(%rax), %r14
movq (%rax), %r15
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq %r15, (%rcx)
movq -0x8(%rax), %rdi
callq 0x2050
movq %r14, %rdi
callq 0x2050
movq %r15, %rax
cmpq %rbx, %r15
jne 0x2fd0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_lex.c
// Function: lex_string
static int lex_string(const char *p, scan_string_t scan_string,
		      size_t *bytes_remaining_p, char **string_ret)
{
	ssize_t len;
	char *buf;
	size_t bytes_remaining = *bytes_remaining_p;

	/* get string length */
	len = scan_string(p, &bytes_remaining, NULL);
	if (len < 0)
		return len; /* parse error or not enough input */
	buf = xmalloc(len + 1);
	/* get the string */
	scan_string(p, bytes_remaining_p, buf);
	buf[len] = '\0';
	*string_ret = buf;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r13
movq (%rdx), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
xorl %r14d, %r14d
xorl %edx, %edx
callq *%r15
movq %rax, %rbp
testq %rax, %rax
js 0x324d
movq %rbp, %rdi
incq %rdi
callq 0x6754
movq %rbx, 0x8(%rsp)
movq %rax, %rbx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq *%r15
movb $0x0, (%rbx,%rbp)
movq 0x8(%rsp), %rax
movq %rbx, (%rax)
jmp 0x3250
movl %ebp, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_lex.c
// Function: scan_single_quoted_string
static ssize_t
scan_single_quoted_string(const char *p, size_t *bytes_remaining_p, char *out_buf)
{
	const char *term_quote;
	ssize_t len;

 	term_quote = memchr(p, '\'', *bytes_remaining_p);
	if (!term_quote)
		return LEX_NOT_ENOUGH_INPUT;

	len = term_quote - p;
	if (memchr(p, '\0', len)) {
		mysh_error("illegal null byte in single-quoted string");
		return LEX_ERROR;
	}
	if (out_buf)
		memcpy(out_buf, p, len);
	*bytes_remaining_p -= (len + 1);
	return len;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
movq (%rsi), %rdx
movl $0x27, %esi
callq 0x2200
testq %rax, %rax
je 0x32b4
movq %rax, %rbx
subq %r12, %rbx
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x2200
testq %rax, %rax
je 0x32bd
leaq 0x413c(%rip), %rdi      # 0x73e0
xorl %eax, %eax
callq 0x23e0
movq $-0x3e8, %rbx           # imm = 0xFC18
jmp 0x32d9
movq $-0x7d0, %rbx           # imm = 0xF830
jmp 0x32d9
testq %r15, %r15
je 0x32d0
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2260
movq %rbx, %rax
notq %rax
addq %rax, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_lex.c
// Function: scan_double_quoted_string
static ssize_t
scan_double_quoted_string(const char *p, size_t *bytes_remaining_p, char *out_buf)
{
	bool escape = false;
	ssize_t len = 0;
	size_t bytes_remaining = *bytes_remaining_p;
	char c;

	for (;;) {
		if (!bytes_remaining)
			return LEX_NOT_ENOUGH_INPUT;
		bytes_remaining--;
		c = *p++;
		if (c == '\0') {
			mysh_error("illegal null byte in double-quoted string");
			return LEX_ERROR;
		} else if (c == '\\' && !escape) {
			/* backslash: try to escape the next character */
			escape = true;
		} else if (c == '"' && !escape) {
			/* found terminating double-quote */
			break;
		} else if (c == '\n' && escape) {
			/* Remove escaped newline */
			escape = false;
		} else {
			if (escape && !(shell_char_type(c) & SHELL_DOUBLE_QUOTE_SPECIAL)) {
				/* backslash followed by a character that does
				 * not give backslash a special meaning means
				 * that the backslash has to be output
				 * literally. */
				if (out_buf)
					*out_buf++ = '\\';
				len++;
			}
			/* literal character in the string */
			if (out_buf)
				*out_buf++ = c;
			len++;
			/* clear the escape flag */
			escape = false;
		}
	}
	*bytes_remaining_p = bytes_remaining;
	return len;
}

// Assembly:
movq (%rsi), %rcx
testq %rcx, %rcx
je 0x339a
pushq %rbp
pushq %rbx
pushq %rax
xorl %r8d, %r8d
leaq 0x480f(%rip), %r9       # 0x7b10
xorl %eax, %eax
xorl %r11d, %r11d
movb (%rdi,%r8), %r10b
movzbl %r10b, %ebx
cmpl $0x21, %ebx
jle 0x333e
cmpl $0x22, %ebx
je 0x3330
cmpl $0x5c, %ebx
jne 0x334f
movb $0x1, %bpl
testb $0x1, %r11b
je 0x3382
cmpl $0xa, %ebx
je 0x3343
cmpl $0x22, %ebx
jne 0x334f
testb $0x1, %r11b
je 0x33a2
cmpb $0xa, %r10b
je 0x3343
jmp 0x334f
cmpl $0xa, %ebx
jne 0x334b
testb $0x1, %r11b
je 0x334f
jmp 0x3380
testl %ebx, %ebx
je 0x33ad
testb $0x1, %r11b
je 0x336e
testb $0x20, (%r9,%rbx)
jne 0x336e
testq %rdx, %rdx
je 0x3369
movb $0x5c, (%rdx)
incq %rdx
jmp 0x336b
xorl %edx, %edx
incq %rax
testq %rdx, %rdx
je 0x337b
movb %r10b, (%rdx)
incq %rdx
jmp 0x337d
xorl %edx, %edx
incq %rax
xorl %ebp, %ebp
incq %r8
movl %ebp, %r11d
cmpq %r8, %rcx
jne 0x3306
movq $-0x7d0, %rax           # imm = 0xF830
jmp 0x33c2
movq $-0x7d0, %rax           # imm = 0xF830
retq
notq %r8
addq %rcx, %r8
movq %r8, (%rsi)
jmp 0x33c2
leaq 0x4056(%rip), %rdi      # 0x740a
xorl %eax, %eax
callq 0x23e0
movq $-0x3e8, %rax           # imm = 0xFC18
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_lex.c
// Function: scan_unquoted_string
static ssize_t
scan_unquoted_string(const char *p, size_t *bytes_remaining_p, char *out_buf)
{
	const char *orig_p = p;
	ssize_t len = 0;
	bool escape = false;
	size_t bytes_remaining = *bytes_remaining_p;
	for (;; p++, bytes_remaining--) {
		if (!bytes_remaining)
			return LEX_NOT_ENOUGH_INPUT;
		if (shell_char_type(*p) & SHELL_UNQUOTED_SPECIAL) {
			if (*p == '\0') {
				mysh_error("illegal null byte in unquoted string");
				return LEX_ERROR;
			}
			if (!escape) {
				if (*p == '\\') {
					escape = true;
					continue;
					/* special case to not start a comment
					 * at the # of $# */
				} else if (!(*p == '#' && p != orig_p && *(p - 1) == '$'))
					break;
			} else if (escape && *p == '\n') {
				/* Remove escaped newline */
				escape = false;
				continue;
			}
		}
		if (out_buf)
			*out_buf++ = *p;
		len++;
		escape = false;
	}
	*bytes_remaining_p = bytes_remaining;
	return len;
}

// Assembly:
movq (%rsi), %rcx
testq %rcx, %rcx
je 0x3443
pushq %rax
xorl %r8d, %r8d
leaq 0x4734(%rip), %r9       # 0x7b10
xorl %r10d, %r10d
xorl %eax, %eax
movzbl (%rdi,%r8), %r11d
testb $0x40, (%r9,%r11)
jne 0x33fa
testq %rdx, %rdx
je 0x340d
movb %r11b, (%rdx)
incq %rdx
jmp 0x340f
testb %r11b, %r11b
je 0x3454
testb $0x1, %r10b
je 0x341f
cmpb $0xa, %r11b
jne 0x33ed
jmp 0x3412
xorl %edx, %edx
incq %rax
xorl %r10d, %r10d
incq %r8
cmpq %r8, %rcx
jne 0x33e1
jmp 0x344b
movb $0x1, %r10b
cmpl $0x5c, %r11d
je 0x3415
cmpl $0x23, %r11d
jne 0x343b
testq %r8, %r8
je 0x343b
cmpb $0x24, -0x1(%rdi,%r8)
je 0x33ed
subq %r8, %rcx
movq %rcx, (%rsi)
jmp 0x3469
movq $-0x7d0, %rax           # imm = 0xF830
retq
movq $-0x7d0, %rax           # imm = 0xF830
jmp 0x3469
leaq 0x3fd9(%rip), %rdi      # 0x7434
xorl %eax, %eax
callq 0x23e0
movq $-0x3e8, %rax           # imm = 0xFC18
addq $0x8, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_main.c
// Function: execute_full_shell_input
int execute_full_shell_input(const char *input, size_t len)
{
	int ret;
	LIST_HEAD(tok_list);

	/* hack: overwrite null terminator with a newline so that the end of
	 * input is seen as the end of a shell statement */
	((char*)input)[len++] = '\n';
	ret = execute_shell_input(&tok_list, input, &len);
	switch (ret) {
	case LEX_ERROR:
		mysh_last_exit_status = -1;
		break;
	case LEX_NOT_ENOUGH_INPUT:
		mysh_error("unexpected end of input");
		mysh_last_exit_status = -1;
		break;
	default:
		mysh_last_exit_status = ret;
		break;
	}
	return mysh_last_exit_status;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rax
leaq 0x8(%rsp), %rdx
movq %rsi, (%rdx)
leaq 0x10(%rsp), %rdi
movq %rdi, (%rdi)
movq %rdi, 0x8(%rdi)
leaq 0x1(%rsi), %rcx
movq %rcx, (%rdx)
movb $0xa, (%rax,%rsi)
movq %rax, %rsi
callq 0x34d2
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0xfffffc18, %eax       # imm = 0xFFFFFC18
je 0x34c4
cmpl $0xfffff830, %eax       # imm = 0xFFFFF830
jne 0x34c2
leaq 0x3fb7(%rip), %rdi      # 0x7470
xorl %eax, %eax
callq 0x23e0
jmp 0x34c4
movl %eax, %ebx
movl %ebx, 0x7d56(%rip)      # 0xb220
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_main.c
// Function: execute_shell_input
static int execute_shell_input(struct list_head *cur_tok_list,
			       const char *input,
			       size_t *bytes_remaining_p)
{
	int ret = 0;
	size_t bytes_remaining = *bytes_remaining_p;
	while (bytes_remaining) {
		struct token *tok;
		do {
			size_t bytes_lexed;

			ret = lex_next_token(input, bytes_remaining_p, &tok);
			if (ret)
				return ret;
			bytes_lexed = bytes_remaining - *bytes_remaining_p;
			if (mysh_write_input_to_stderr)
				fwrite(input, 1, bytes_lexed, stderr);
			input += bytes_lexed;
			bytes_remaining -= bytes_lexed;
			list_add_tail(&tok->list, cur_tok_list);
		} while (tok->type != TOK_END_OF_SHELL_STATEMENT);
		ret = execute_tok_list(cur_tok_list);
		if (ret && mysh_exit_on_error)
			return ret;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq (%rdx), %r12
testq %r12, %r12
je 0x35b1
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %r12, %r13
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x10(%rsp), %rdx
callq 0x3001
movl %eax, %ebp
testl %eax, %eax
je 0x3517
movq %r13, %r12
movl %ebp, 0xc(%rsp)
jmp 0x3545
movq (%rbx), %r12
subq %r12, %r13
cmpl $0x0, 0x7d10(%rip)      # 0xb234
jne 0x355c
addq %r13, %r14
movq 0x10(%rsp), %rax
leaq 0x10(%rax), %rcx
movq 0x8(%r15), %rdx
movq %rcx, 0x8(%r15)
movq %r15, 0x10(%rax)
movq %rdx, 0x18(%rax)
movq %rcx, (%rdx)
testl %ebp, %ebp
jne 0x3578
movq 0x10(%rsp), %rax
cmpl $0x400, 0x4(%rax)       # imm = 0x400
movq %r12, %r13
jne 0x34f8
jmp 0x357c
movq 0x7a8d(%rip), %rax      # 0xaff0
movq (%rax), %rcx
movl $0x1, %esi
movq %r14, %rdi
movq %r13, %rdx
callq 0x2360
jmp 0x3526
xorl %eax, %eax
jmp 0x35a2
movq %r15, %rdi
callq 0x3d2b
movl %eax, %ebp
testl %eax, %eax
sete %cl
cmpl $0x0, 0x7c9a(%rip)      # 0xb22c
sete %al
orb %cl, %al
movl 0xc(%rsp), %ecx
cmovel %ebp, %ecx
movl %ecx, 0xc(%rsp)
testb %al, %al
je 0x35b5
testq %r12, %r12
jne 0x34f5
jmp 0x35b9
xorl %ebp, %ebp
jmp 0x35b9
movl 0xc(%rsp), %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_main.c
// Function: do_source
int do_source(const char *filename, unsigned nargs, const char * const *args)
{
	int in_fd;
	char **pos_params_save;
	unsigned num_pos_params_save;
	int ret;

	in_fd = open(filename, O_RDONLY);
	if (in_fd < 0) {
		mysh_error_with_errno("can't open %s", filename);
		return 1;
	}

	pos_params_save = positional_parameters;
	num_pos_params_save = num_positional_parameters;
	positional_parameters = NULL;
	set_positional_params(nargs, filename, args);
	ret = read_loop(in_fd, false);
	destroy_positional_params();
	positional_parameters = pos_params_save;
	num_positional_parameters = num_pos_params_save;
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
xorl %esi, %esi
xorl %eax, %eax
callq 0x22c0
testl %eax, %eax
js 0x3b16
movl %eax, %r15d
leaq 0x7a2e(%rip), %rax      # 0xb4f8
movq (%rax), %r13
leaq 0x7a20(%rip), %rcx      # 0xb4f4
movl (%rcx), %r12d
movq $0x0, (%rax)
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x53c0
movl %r15d, %edi
xorl %esi, %esi
callq 0x35ca
movl %eax, %ebx
xorl %eax, %eax
callq 0x5437
leaq 0x79f3(%rip), %rax      # 0xb4f8
movq %r13, (%rax)
leaq 0x79e5(%rip), %rax      # 0xb4f4
movl %r12d, (%rax)
movl %ebx, %eax
jmp 0x3b2c
leaq 0x3982(%rip), %rdi      # 0x749f
movq %rbx, %rsi
xorl %eax, %eax
callq 0x249f
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_main.c
// Function: add_background_pipeline
static int add_background_pipeline(const pid_t child_pids[], unsigned npids)
{
	struct background_pipeline *p;

	mysh_assert(npids != 0);
	p = xmalloc(sizeof(*p) + npids * sizeof(pid_t));

	p->num = get_next_job_number();
	p->npids = npids;
	p->last_pid = mysh_last_background_pid = child_pids[npids - 1];
	memcpy(p->pids, child_pids, npids * sizeof(pid_t));
	list_add_tail(&p->list, &background_pipelines);

	printf("[%u] %d\n", p->num, p->last_pid);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r12d
movq %rdi, %r14
movl %esi, %ebx
leaq 0x20(,%rbx,4), %rdi
shlq $0x2, %rbx
callq 0x6754
movq %rax, %r15
movq 0x6dc7(%rip), %rax      # 0xb1f8
leaq 0x6dc0(%rip), %r13      # 0xb1f8
movl $0x1, %ebp
cmpq %r13, %rax
je 0x4452
movl 0x10(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl %ecx, %ebp
cmovbel %edx, %ebp
movq (%rax), %rax
jmp 0x443d
movl %ebp, 0x10(%r15)
movl %r12d, 0x14(%r15)
decl %r12d
movl (%r14,%r12,4), %r12d
movl %r12d, 0x6dd4(%rip)     # 0xb23c
movl %r12d, 0x18(%r15)
movq %r15, %rdi
addq $0x1c, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2260
movq 0x6d7b(%rip), %rax      # 0xb200
movq %r15, 0x6d74(%rip)      # 0xb200
movq %r13, (%r15)
movq %rax, 0x8(%r15)
movq %r15, (%rax)
leaq 0x32df(%rip), %rdi      # 0x777c
movl %ebp, %esi
movl %r12d, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2140
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_main.c
// Function: wait_for_children
static int wait_for_children(const pid_t child_pids[], unsigned npids)
{
	int ret;
	unsigned i = 0;
	int status;
	set_up_onetime_sigint_handler();
	do {
	again:
		if (waitpid(child_pids[i], &status, 0) == -1) {
			if (errno == EINTR && sigint_occurred) {
				interrupt_children(&child_pids[i], npids - i);
				goto again;
			} else {
				ret = -1;
				mysh_error_with_errno("failed to wait for child "
						      "process (pid %d) to terminate ",
						      child_pids[i]);
			}
		} else {
			if (WIFEXITED(status))
				ret = WEXITSTATUS(status);
			else
				ret = -1;
		}
	} while (++i != npids);
	if (!sigint_occurred)
		remove_sigint_handler();
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %esi, %ebx
movq %rdi, %r14
movb $0x0, 0x6d54(%rip)      # 0xb228
leaq 0x20(%rsp), %r15
movl $0x98, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2180
leaq 0x147(%rip), %rax       # 0x4636
movq %rax, (%r15)
leaq 0x28(%rsp), %rdi
movl $0x2, %esi
callq 0x23a0
movl $0x2, %edi
movq %r15, %rsi
xorl %edx, %edx
callq 0x20a0
movl %ebx, 0x1c(%rsp)
movl %ebx, %r13d
leaq 0x329f(%rip), %r12      # 0x77bd
movq %r14, 0x10(%rsp)
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
movl (%rax,%r15,4), %edi
leaq 0xc(%rsp), %rsi
xorl %edx, %edx
callq 0x22b0
cmpl $-0x1, %eax
je 0x4552
movl 0xc(%rsp), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb $0x7f, %al
jne 0x45cb
movzbl %ah, %ebp
jmp 0x45cb
callq 0x2060
movq %rax, %rbp
cmpl $0x4, (%rbp)
jne 0x45af
cmpb $0x1, 0x6cc1(%rip)      # 0xb228
jne 0x45af
xorl %ebx, %ebx
movl (%r14,%rbx,4), %edi
movl $0x2, %esi
callq 0x2270
testl %eax, %eax
je 0x458b
movl (%r14,%rbx,4), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x249f
incq %rbx
cmpl %ebx, %r13d
jne 0x456b
movq 0x10(%rsp), %rax
movl (%rax,%r15,4), %edi
leaq 0xc(%rsp), %rsi
xorl %edx, %edx
callq 0x22b0
cmpl $-0x1, %eax
je 0x455a
jmp 0x4540
movq 0x10(%rsp), %rax
movl (%rax,%r15,4), %esi
leaq 0x31c6(%rip), %rdi      # 0x7785
xorl %eax, %eax
callq 0x249f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
incq %r15
decq %r13
addq $0x4, %r14
cmpl 0x1c(%rsp), %r15d
jne 0x4526
cmpb $0x0, 0x6c41(%rip)      # 0xb228
jne 0x4622
leaq 0x20(%rsp), %rbx
movl $0x98, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2180
movq $0x1, (%rbx)
leaq 0x28(%rsp), %rdi
movl $0x2, %esi
callq 0x23a0
movl $0x2, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x20a0
movl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_main.c
// Function: source_myshrc
static void source_myshrc()
{
	/* source $HOME/.myshrc */
	char *home = getenv("HOME");
	if (home) {
		size_t len = strlen(home);
		char filename[len + sizeof("/.myshrc")];
		stpcpy(filename, home);
		strcat(filename, "/.myshrc");
		do_source(filename, 0, NULL);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x29c4(%rip), %rdi      # 0x7277
callq 0x2030
testq %rax, %rax
je 0x4912
movq %rax, %rbx
movq %rax, %rdi
callq 0x2100
movq %rsp, %r15
movq %rsp, %r14
addq $0x18, %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2070
movq %r14, %rdi
callq 0x2100
movabsq $0x63726873796d2e2f, %rcx # imm = 0x63726873796D2E2F
movq %rcx, (%rax,%r14)
movb $0x0, 0x8(%rax,%r14)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3aa0
movq %r15, %rsp
leaq -0x18(%rbp), %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: export_variable
int export_variable(const char *name)
{
	const char *value = lookup_shell_param(name);
	int ret;
	if (value)
		ret = setenv(name, value, 1);
	else
		ret = unsetenv(name);
	if (ret)
		mysh_error_with_errno("can't export variable %s", name);
	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2100
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x4e18
movq %rbx, %rdi
testq %rax, %rax
je 0x4c36
movq %rax, %rsi
movl $0x1, %edx
callq 0x20d0
jmp 0x4c3b
callq 0x22f0
movl %eax, %ebp
testl %eax, %eax
je 0x4c52
leaq 0x2c30(%rip), %rdi      # 0x7878
movq %rbx, %rsi
xorl %eax, %eax
callq 0x249f
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: init_param_map
static void init_trie_slot_tabs()
{
	unsigned i, n;
	for (i = 0; i < 256; i++)
		trie_char_to_slot_tab[i] = -1;
	n = 0;
	for (i = 0; i < ARRAY_SIZE(trie_slot_ranges); i++) {
		unsigned char range_begin = trie_slot_ranges[i][0];
		unsigned char range_end = trie_slot_ranges[i][1];
		unsigned char c;
		for (c = range_begin; c <= range_end; c++) {
			trie_char_to_slot_tab[c] = n;
			trie_slot_to_char_tab[n] = c;
			n++;
		}
	}
	mysh_assert(n == NUM_SHELL_PARAM_VALID_CHARS);
}

// Assembly:
pushq %rbx
leaq 0x6896(%rip), %rbx      # 0xb510
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
movl $0xff, %esi
callq 0x2180
xorl %eax, %eax
leaq 0x2e6c(%rip), %rcx      # 0x7b01
leaq 0x6974(%rip), %rdx      # 0xb610
xorl %esi, %esi
movb (%rcx,%rax,2), %dil
movb 0x1(%rcx,%rax,2), %r8b
cmpb %r8b, %dil
ja 0x4cc2
movzbl %dil, %edi
movb %sil, (%rdi,%rbx)
movl %esi, %r9d
movb %dil, (%r9,%rdx)
incl %esi
incb %dil
jmp 0x4ca7
incq %rax
cmpq $0x4, %rax
jne 0x4c9e
cmpl $0x3f, %esi
jne 0x4cf9
movq 0x62f9(%rip), %rax      # 0xafd0
movq (%rax), %rbx
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4cf7
addq $0x8, %rbx
callq 0x4bc1
movq (%rbx), %rdi
addq $0x8, %rbx
testq %rdi, %rdi
jne 0x4ce6
popq %rbx
retq
leaq 0x2d27(%rip), %rdi      # 0x7a27
leaq 0x2bcf(%rip), %rsi      # 0x78d6
leaq 0x2d3a(%rip), %rcx      # 0x7a48
movl $0x40, %edx
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: free_param_trie
static void free_param_trie(struct param_trie_node *node)
{
	size_t i, j;
	for (i = 0; i < ARRAY_SIZE(node->children); i++) {
		if (node->children[i]) {
			free_param_trie(node->children[i]);


			for (j = 0; j < NUM_VALUES; j++)
				free(node->children[i]->values[j]);
			free(node->children[i]);
			node->children[i] = NULL;
			mysh_assert(node->num_children > 0);
			node->num_children--;
		}
	}
	mysh_assert(node->num_children == 0);

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x4d7e
callq 0x4d21
xorl %r15d, %r15d
movq (%rbx,%r14,8), %rax
movq 0x208(%rax,%r15,8), %rdi
callq 0x2050
incq %r15
cmpq $0x1, %r15
je 0x4d3d
movq (%rbx,%r14,8), %rdi
callq 0x2050
movq $0x0, (%rbx,%r14,8)
movq 0x218(%rbx), %rax
testq %rax, %rax
je 0x4d97
decq %rax
movq %rax, 0x218(%rbx)
incq %r14
cmpq $0x3f, %r14
jne 0x4d2c
cmpq $0x0, 0x218(%rbx)
jne 0x4db6
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2cc5(%rip), %rdi      # 0x7a63
leaq 0x2b31(%rip), %rsi      # 0x78d6
leaq 0x2cce(%rip), %rcx      # 0x7a7a
movl $0xcc, %edx
callq 0x2160
leaq 0x2cec(%rip), %rdi      # 0x7aa9
leaq 0x2b12(%rip), %rsi      # 0x78d6
leaq 0x2caf(%rip), %rcx      # 0x7a7a
movl $0xd0, %edx
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: string_matches_param_assignment
bool string_matches_param_assignment(const struct string *s)
{
	size_t i;
	if (!(shell_char_type(s->chars[0]) & SHELL_NORMAL_PARAM_FIRST_CHAR))
		return false;
	for (i = 1; i < s->len; i++)
		if (!(shell_char_type(s->chars[i]) & SHELL_NORMAL_PARAM_CHAR))
			return (s->chars[i] == '=');
	return false;
}

// Assembly:
movq (%rdi), %rax
movzbl (%rax), %edx
leaq 0x2d2e(%rip), %rcx      # 0x7b10
testb $0x5, (%rcx,%rdx)
je 0x4e09
movq 0x8(%rdi), %rdx
cmpq $0x2, %rdx
jb 0x4e09
movl $0x1, %esi
movzbl (%rax,%rsi), %edi
testb $0x7, (%rcx,%rdi)
je 0x4e0c
incq %rsi
cmpq %rsi, %rdx
jne 0x4df7
xorl %eax, %eax
retq
cmpb $0x3d, %dil
sete %al
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: do_lookup_shell_variable
static const char *
do_lookup_shell_variable(const char *name, size_t len, int value_idx)
{
	struct param_trie_node *node = &param_trie_root;
	while (len--) {
		int slot = trie_get_slot(*name++);
		if (slot < 0)
			return NULL;
		mysh_assert(slot < ARRAY_SIZE(node->children));
		node = node->children[slot];
		if (!node)
			return NULL;
	}
	return node->values[value_idx];
}

// Assembly:
pushq %rax
leaq 0x64a0(%rip), %rcx      # 0xb2c0
movb 0x6763(%rip), %r8b      # 0xb58a
xorl %eax, %eax
leaq 0x66e0(%rip), %r9       # 0xb510
xorl %r10d, %r10d
cmpq %r10, %rsi
je 0x4e6c
testb %r8b, %r8b
je 0x4e78
movzbl (%rdi,%r10), %r11d
movsbq (%r11,%r9), %r11
testq %r11, %r11
js 0x4e5f
cmpb $0x3f, %r11b
jae 0x4e97
movq (%rcx,%r11,8), %rcx
testq %rcx, %rcx
setne %r11b
jmp 0x4e62
xorl %r11d, %r11d
incq %r10
testb %r11b, %r11b
jne 0x4e33
jmp 0x4e76
movl %edx, %eax
movq 0x208(%rcx,%rax,8), %rax
popq %rcx
retq
leaq 0x2b70(%rip), %rdi      # 0x79ef
leaq 0x2a50(%rip), %rsi      # 0x78d6
leaq 0x2b82(%rip), %rcx      # 0x7a0f
movl $0x45, %edx
callq 0x2160
leaq 0x2a8a(%rip), %rdi      # 0x7928
leaq 0x2a31(%rip), %rsi      # 0x78d6
leaq 0x2c15(%rip), %rcx      # 0x7ac1
movl $0x100, %edx            # imm = 0x100
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: do_print_all_shell_variables
static int do_print_all_shell_variables(struct param_trie_node *node,
					int value_idx, const char *format)
{
	size_t i;
	int ret = 0;

	if (node->values[value_idx]) {
		ret = node_print_variable(node, value_idx, format);
		if (ret)
			goto out;
	}
	for (i = 0; i < ARRAY_SIZE(node->children); i++) {
		if (node->children[i]) {
			ret = do_print_all_shell_variables(node->children[i],
							   value_idx, format);
			if (ret)
				goto out;
		}
	}
out:
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movl %esi, %eax
cmpq $0x0, 0x208(%rdi,%rax,8)
je 0x50d8
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x5495
testl %eax, %eax
jne 0x50fd
xorl %r15d, %r15d
movq (%r14,%r15,8), %rdi
testq %rdi, %rdi
je 0x50f2
movl %ebp, %esi
movq %rbx, %rdx
callq 0x50ab
testl %eax, %eax
jne 0x50fd
incq %r15
cmpq $0x3f, %r15
jne 0x50db
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: set_positional_params
void set_positional_params(int num_params, const char *param0,
			   const char * const *params)
{
	unsigned i;
	destroy_positional_params();
	num_positional_parameters = num_params;
	positional_parameters = xmalloc((num_positional_parameters + 1) * sizeof(char *));
	positional_parameters[0] = xstrdup(param0);
	for (i = 0; i < num_positional_parameters; i++)
		positional_parameters[i + 1] = xstrdup(params[i]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
callq 0x5437
movl %r15d, 0x611a(%rip)     # 0xb4f4
incl %r15d
shlq $0x3, %r15
movq %r15, %rdi
callq 0x6754
movq %rax, 0x6108(%rip)      # 0xb4f8
movq %r14, %rdi
callq 0x678f
movq 0x60f9(%rip), %rcx      # 0xb4f8
movq %rax, (%rcx)
cmpl $0x0, 0x60eb(%rip)      # 0xb4f4
je 0x5431
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x678f
movq 0x60da(%rip), %rcx      # 0xb4f8
movq %rax, 0x8(%rcx,%r14,8)
incq %r14
movl 0x60c8(%rip), %eax      # 0xb4f4
cmpq %rax, %r14
jb 0x540e
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: destroy_positional_params
void destroy_positional_params()
{
	unsigned i;
	if (positional_parameters) {
		for (i = 0; i <= num_positional_parameters; i++)
			free(positional_parameters[i]);
		free(positional_parameters);
		positional_parameters = NULL;
		if (all_positional_params) {
			free(all_positional_params);
			all_positional_params = NULL;
		}
	}
}

// Assembly:
cmpq $0x0, 0x60b9(%rip)      # 0xb4f8
je 0x5494
pushq %rbx
xorl %ebx, %ebx
movq 0x60ad(%rip), %rax      # 0xb4f8
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x2050
incl %ebx
cmpl 0x6096(%rip), %ebx      # 0xb4f4
jbe 0x5444
movq 0x6091(%rip), %rdi      # 0xb4f8
callq 0x2050
movq $0x0, 0x6081(%rip) # 0xb4f8
movq 0x6082(%rip), %rdi      # 0xb500
testq %rdi, %rdi
je 0x5493
callq 0x2050
movq $0x0, 0x606d(%rip) # 0xb500
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: node_print_variable
static int node_print_variable(struct param_trie_node *node,
			       int value_idx, const char *format)
{
	size_t len;
	size_t i;
	struct param_trie_node *p;
	int ret;

	p = node;
	len = 0;
	while (p != &param_trie_root) {
		p = p->parent;
		len++;
	}
	char name[len + 1];
	name[len] = '\0';

	p = node;
	i = len - 1;
	do {
		name[i] = trie_slot_to_char_tab[p->parent_child_ptr - p->parent->children];
		p = p->parent;
	} while (i-- != 0);

	ret = printf(format, name, node->values[value_idx]);
	if (ret >= 0)
		ret = 0;
	else
		mysh_error_with_errno("write error");
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %rcx
leaq 0x5e1a(%rip), %rax      # 0xb2c0
xorl %edx, %edx
cmpq %rax, %rdi
je 0x54bf
movq %rdi, %r8
movq 0x1f8(%r8), %r8
incq %rdx
cmpq %rax, %r8
jne 0x54b0
movq %rsp, %rax
leaq 0x10(%rdx), %r8
andq $-0x10, %r8
subq %r8, %rax
movq %rax, %rsp
movb $0x0, (%rdx,%rax)
leaq 0x6135(%rip), %r8       # 0xb610
movq %rdi, %r9
movq 0x200(%r9), %r10
subq 0x1f8(%r9), %r10
sarq $0x3, %r10
movb (%r10,%r8), %r10b
movb %r10b, -0x1(%rax,%rdx)
movq 0x1f8(%r9), %r9
decq %rdx
jne 0x54de
movl %esi, %edx
movq 0x208(%rdi,%rdx,8), %rdx
xorl %ebx, %ebx
movq %rcx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
jns 0x5536
movl %eax, %r14d
leaq 0x1dca(%rip), %rdi      # 0x72f6
xorl %eax, %eax
callq 0x249f
movl %r14d, %ebx
movl %ebx, %eax
leaq -0x10(%rbp), %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_parse.c
// Function: glue_strings
static int glue_strings(struct list_head *string_list)
{
	struct string *s, *tmp;
	LIST_HEAD(new_list);
	while (!list_empty(string_list)) {
		struct list_head *first = string_list->next;
		int flags;
		/* Glue one string */
		LIST_HEAD(glue_list);
		list_move_tail(first, &glue_list);
		list_for_each_entry_safe(s, tmp, string_list, list) {
			if (s->flags & STRING_FLAG_PRECEDING_WHITESPACE)
				break;
			else
				list_move_tail(&s->list, &glue_list);
		}
		/* Detect variable assignments
		 * TODO: Somehow make it so that unquoted strings where
		 * parameter expansion has occurred on the left side of the
		 * equals sign are not considered variable assignments. */
		s = list_entry(first, struct string, list);
		if (s->flags & STRING_FLAG_UNQUOTED &&
		    string_matches_param_assignment(s))
			flags = STRING_FLAG_VAR_ASSIGNMENT;
		else
			flags = 0;
		s = join_strings(&glue_list);
		s->flags = flags;
		list_add_tail(&s->list, &new_list);
	}
	/* Replace @string_list with the list of glued strings */
	list_splice_tail(&new_list, string_list);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %r15
movq %r15, (%r15)
movq %r15, 0x8(%r15)
movq (%rdi), %rdi
cmpq %rbx, %rdi
je 0x61ed
leaq 0x8(%rsp), %r14
movq %r14, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
movq 0x10(%rsp), %rax
movq %rdi, 0x10(%rsp)
movq %r14, (%rdi)
movq %rax, 0x8(%rdi)
movq %rdi, (%rax)
movq (%rbx), %rax
cmpq %rbx, %rax
je 0x61a3
testb $0x10, -0x8(%rax)
jne 0x61a3
movq (%rax), %rcx
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rcx)
movq %rcx, (%rdx)
movq 0x10(%rsp), %rdx
movq %rax, 0x10(%rsp)
movq %r14, (%rax)
movq %rdx, 0x8(%rax)
movq %rax, (%rdx)
movq %rcx, %rax
cmpq %rbx, %rcx
jne 0x6173
testb $0x1, -0x8(%rdi)
je 0x61bb
addq $-0x18, %rdi
callq 0x4dd5
movl $0x200, %ebp            # imm = 0x200
testb %al, %al
jne 0x61bd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x68cc
movl %ebp, 0x10(%rax)
leaq 0x18(%rax), %rcx
movq 0x20(%rsp), %rdx
movq %rcx, 0x20(%rsp)
movq %r15, 0x18(%rax)
movq %rdx, 0x20(%rax)
movq %rcx, (%rdx)
movq (%rbx), %rdi
cmpq %rbx, %rdi
jne 0x613f
movq 0x18(%rsp), %rax
cmpq %r15, %rax
je 0x620e
movq 0x8(%rbx), %rcx
movq 0x20(%rsp), %rdx
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
movq %rbx, (%rdx)
movq %rdx, 0x8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq