// File: /workspace/github_cpp_makefile_star2_O2/AndreiBarsan[P]uShell/command.cc
// Function: microshell::core::DiskCommand::invoke(microshell::core::Shell*)
int DiskCommand::invoke(Shell *shell) {
  string comma_args =
    util::merge_with(argv.begin() + 1, argv.end(), ", ");
  shell->out("Invoking program [" + argv[0] + "] with args [" +
              comma_args + "]");
  //signal(SIGCHLD, handle_sigchld);
  pid_t child_pid = fork();
  if(-1 == child_pid) {
    // TODO(andrei) Shell::perror().
    shell->eout("Could not crete a child to run the command. "
                "OS says [" + string(strerror(errno)) + "]. errno = " +
                to_string(errno));
    return -1;
  }
  else if(0 == child_pid) {
    this->handle_child(shell);
    // No return, the child will just 'exec' or 'exit' (on error).
  }

  return this->handle_parent(shell, child_pid);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xf0, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
movq 0x10(%rdi), %rax
movq %rax, -0x38(%rbp)
leaq 0x8a74(%rip), %rsi      # 0xe415
leaq -0xd8(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x50d0
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0xd8(%rbp), %rcx
callq 0xc317
leaq -0xd8(%rbp), %rdi
callq 0x5100
movq 0x8(%r14), %rdx
leaq 0x7638(%rip), %rsi      # 0xd01b
leaq -0x98(%rbp), %rdi
callq 0x5fd1
leaq 0x7638(%rip), %rdx      # 0xd02e
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5f7f
leaq -0x38(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0x5fa8
leaq 0x761b(%rip), %rdx      # 0xd03c
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x5f7f
leaq -0x58(%rbp), %rsi
movq %rbx, %rdi
callq 0xaf7e
leaq -0x58(%rbp), %rdi
callq 0x5100
leaq -0x38(%rbp), %rdi
callq 0x5100
leaq -0x78(%rbp), %rdi
callq 0x5100
leaq -0x98(%rbp), %rdi
callq 0x5100
callq 0x5090
cmpl $-0x1, %eax
je 0x5a84
testl %eax, %eax
je 0x5b50
movq %rbx, %rsi
movl %eax, %edx
callq 0x5d4c
movl %eax, %ebx
jmp 0x5b36
callq 0x5050
movq %rax, %r14
movl (%rax), %edi
callq 0x50b0
leaq -0x98(%rbp), %rdi
leaq -0x11(%rbp), %rdx
movq %rax, %rsi
callq 0x50d0
leaq 0x7591(%rip), %rsi      # 0xd03e
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x60b8
leaq 0x75b0(%rip), %rdx      # 0xd074
leaq -0x38(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5f7f
movl (%r14), %esi
leaq -0xb8(%rbp), %rdi
callq 0x60e6
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x6047
leaq -0x58(%rbp), %rsi
movq %rbx, %rdi
callq 0xa9c4
leaq -0x58(%rbp), %rdi
callq 0x5100
leaq -0xb8(%rbp), %rdi
callq 0x5100
leaq -0x38(%rbp), %rdi
callq 0x5100
leaq -0x78(%rbp), %rdi
callq 0x5100
leaq -0x98(%rbp), %rdi
callq 0x5100
pushq $-0x1
popq %rbx
leaq -0xf8(%rbp), %rdi
callq 0x5100
movl %ebx, %eax
addq $0xf0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5be2
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x5100
jmp 0x5b6c
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
jmp 0x5b86
jmp 0x5b8d
jmp 0x5b9b
jmp 0x5ba9
jmp 0x5bba
jmp 0x5bba
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x5100
jmp 0x5b90
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x5100
jmp 0x5b9e
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x5100
jmp 0x5bac
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x5100
jmp 0x5bbd
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x5100
movq %rbx, %rdi
callq 0x53a0
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
jmp 0x5bc4
movq %rax, %rbx
jmp 0x5bc9