// File: AndreiBarsan[P]uShell/command.cc
// Function: microshell::core::DiskCommand::handle_child(microshell::core::Shell*)
void DiskCommand::handle_child(Shell *shell) {
  char **argv = util::get_raw_array(this->argv);
  // TODO(andrei) Pass environment to child, while ensuring no shenanigans can
  // take place (no Shellshock risk).
  char **parent_env = nullptr; //environ;
  execve(argv[0], argv, parent_env);
  // Note: 'execve' doesn't return if it's successful.
  shell->eout("Failed to 'execve'. OS says [" + string(strerror(errno))
               + "]. errno = " + to_string(errno));
  shell->eout("Terminating child.");
  exit(-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
callq 0x206a0
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rsi
movq (%rsi), %rdi
movq -0x20(%rbp), %rdx
callq 0x5440
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x50d0
movq %rax, -0x110(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x5470
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x5360
jmp 0x62b9
leaq 0x1bdef(%rip), %rsi     # 0x220af
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x6c50
jmp 0x62d2
leaq 0x1bd9b(%rip), %rdx     # 0x22074
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x69b0
jmp 0x62e8
callq 0x5070
movl (%rax), %esi
leaq -0xd8(%rbp), %rdi
callq 0x6ca0
jmp 0x62fd
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x6b80
jmp 0x6313
movq -0x118(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1aa60
jmp 0x6325
leaq -0x40(%rbp), %rdi
callq 0x5190
leaq -0xd8(%rbp), %rdi
callq 0x5190
leaq -0x60(%rbp), %rdi
callq 0x5190
leaq -0x80(%rbp), %rdi
callq 0x5190
leaq -0xa0(%rbp), %rdi
callq 0x5190
leaq -0xa1(%rbp), %rdi
callq 0x52c0
movq -0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x5470
movq -0x120(%rbp), %rdx
leaq 0x1bd3d(%rip), %rsi     # 0x220cd
leaq -0xf8(%rbp), %rdi
callq 0x5360
jmp 0x639e
movq -0x128(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x1aa60
jmp 0x63b3
leaq -0xf8(%rbp), %rdi
callq 0x5190
leaq -0xf9(%rbp), %rdi
callq 0x52c0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x5300
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x6481
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x6475
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x646c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x6463
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x6457
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5190
leaq -0xd8(%rbp), %rdi
callq 0x5190
leaq -0x60(%rbp), %rdi
callq 0x5190
leaq -0x80(%rbp), %rdi
callq 0x5190
leaq -0xa0(%rbp), %rdi
callq 0x5190
leaq -0xa1(%rbp), %rdi
callq 0x52c0
jmp 0x64cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x64c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x5190
leaq -0xf9(%rbp), %rdi
callq 0x52c0
movq -0xb0(%rbp), %rdi
callq 0x5460
nopl (%rax)