// File: /workspace/github_c_makefile_star2_O2/ebiggers[P]mysh/mysh_main.c
// Function: start_child
static void __attribute__((noreturn))
start_child(const struct list_head *cmd_args,
	    const struct list_head *redirs,
	    const struct list_head *var_assignments,
	    unsigned cmd_nargs,
	    unsigned pipeline_cmd_idx,
	    unsigned pipeline_ncommands,
	    const int pipe_fds[2],
	    int prev_read_end)
{
	char *argv[cmd_nargs + 1];
	struct string *s;
	unsigned i;

	/* Set up stdin and stdout for this component of the pipeline */

	if (pipeline_cmd_idx != pipeline_ncommands - 1) {
		/* Not the last command in the pipeline; close the read end of
		 * pipe we are writing to, then assign the write end of the pipe
		 * to stdout */
		close(pipe_fds[0]);
		if (dup2(pipe_fds[1], STDOUT_FILENO) < 0) {
			mysh_error_with_errno("Failed to set up stdout "
					      "for pipeline");
			goto fail;
		}
	}

	if (pipeline_cmd_idx != 0) {
		/* Not the first command in the pipeline; assign the read end of
		 * the previous pipe to stdin. */
		if (dup2(prev_read_end, STDIN_FILENO) < 0) {
			mysh_error_with_errno("Failed to set up stdin "
					      "for pipeline");
			goto fail;
		}
	}

	/* Apply other redirections */
	if (do_redirections(redirs, NULL) != 0)
		goto fail;

	/* Set up argv */
	i = 0;
	list_for_each_entry(s, cmd_args, list)
		argv[i++] = s->chars;
	argv[i] = NULL;
	mysh_assert(i == cmd_nargs);

	/* Set any environmental variables for this command */
	list_for_each_entry(s, var_assignments, list) {
		if (putenv(s->chars)) {
			mysh_error_with_errno("Failed to set environmental "
					      "variable %s", s->chars);
			goto fail;
		}
	}

	/* Use the default SIGINT handler (the shell may be using a different
	 * one) */
	install_handler(SIGINT, SIG_DFL);

	/* Execute the new program.  execvp() automatically searches $PATH.
	 * Note: this shell does not attempt to save time by remembering the
	 * locations of executable programs on the $PATH. */
	execvp(argv[0], argv);

	/* Only reached if execvp() failed */
	if (errno == ENOENT)
		mysh_error("%s: command not found", argv[0]);
	else
		mysh_error_with_errno("Failed to execute %s", argv[0]);
fail:
	exit(-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r13d
movl %ecx, %r15d
movq %rdx, %r14
movq %rsi, -0x30(%rbp)
movq %rdi, %r12
leal 0x1(%r15), %eax
movq %rsp, %rbx
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
decl %r9d
cmpl %r8d, %r9d
je 0x3f99
movq 0x10(%rbp), %rax
movl (%rax), %edi
callq 0x21c0
movq 0x10(%rbp), %rax
movl 0x4(%rax), %edi
pushq $0x1
popq %rsi
callq 0x2120
testl %eax, %eax
jns 0x3f99
leaq 0x369f(%rip), %rdi      # 0x7636
jmp 0x3fb3
testl %r13d, %r13d
je 0x3fbf
movl 0x18(%rbp), %edi
xorl %esi, %esi
callq 0x2120
testl %eax, %eax
jns 0x3fbf
leaq 0x36a8(%rip), %rdi      # 0x765b
xorl %eax, %eax
callq 0x5fb7
jmp 0x407b
xorl %r13d, %r13d
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x5dd5
testl %eax, %eax
jne 0x407b
movq %r12, %rax
movq (%rax), %rax
movl %r13d, %ecx
cmpq %r12, %rax
je 0x3ff0
movq -0x18(%rax), %rdx
incl %r13d
movq %rdx, (%rbx,%rcx,8)
jmp 0x3fd8
andq $0x0, (%rbx,%rcx,8)
cmpl %r13d, %r15d
jne 0x401f
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x403e
movq -0x18(%r15), %rdi
callq 0x2220
testl %eax, %eax
je 0x3ffd
movq -0x18(%r15), %rsi
leaq 0x370c(%rip), %rdi      # 0x7729
jmp 0x4074
leaq 0x3659(%rip), %rdi      # 0x767f
leaq 0x3502(%rip), %rsi      # 0x752f
leaq 0x365a(%rip), %rcx      # 0x768e
movl $0xff, %edx
callq 0x2160
xorl %edi, %edi
callq 0x4083
movq (%rbx), %rdi
movq %rbx, %rsi
callq 0x2300
callq 0x2060
cmpl $0x2, (%rax)
movq (%rbx), %rsi
jne 0x406d
leaq 0x36ed(%rip), %rdi      # 0x7751
xorl %eax, %eax
callq 0x5ef8
jmp 0x407b
leaq 0x36f3(%rip), %rdi      # 0x7767
xorl %eax, %eax
callq 0x5fb7
pushq $-0x1
popq %rdi
callq 0x2350