// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/unix.cpp
// Function: ash::unix::shell[abi:cxx11]()
const string unix::shell() {
  if (exists("/proc")) {
    LOG(DEBUG) << "looking for shell name in /proc/" << shell_pid() << "/stat.";
    string sh = proc_stat(1, shell_pid());
    // If the shell name is wrapped in parentheses, strip them.
    if (!sh.empty() && sh[0] == '(' && sh[sh.length() - 1] == ')') {
      sh = sh.substr(1, sh.length() - 2);
    }
    return DBObject::quote(sh);
  } else {
    // This is expected on OSX - no procfs so no /proc directory.
    string sh = ps("ho command", shell_pid());
    return sh == "null" ? sh : DBObject::quote(sh);
  }
  return "null";
}

// Assembly:
subq $0x448, %rsp            # imm = 0x448
movq %rdi, 0x80(%rsp)
movq %rdi, %rax
movq %rax, 0x88(%rsp)
movq %rdi, 0x440(%rsp)
leaq 0xc71d(%rip), %rdi      # 0xb4316
callq 0xa7560
testb $0x1, %al
jne 0xa7c07
jmp 0xa7e1a
leaq 0x128(%rsp), %rdi
movq %rdi, 0x70(%rsp)
xorl %esi, %esi
callq 0xa1800
movq 0x70(%rsp), %rdi
leaq 0xc6fd(%rip), %rsi      # 0xb4324
callq 0x945b0
movq %rax, 0x78(%rsp)
jmp 0xa7c33
callq 0xa7b10
movl %eax, 0x6c(%rsp)
jmp 0xa7c3e
movl 0x6c(%rsp), %esi
movq 0x78(%rsp), %rdi
callq 0x8780
movq %rax, 0x60(%rsp)
jmp 0xa7c53
movq 0x60(%rsp), %rdi
leaq 0xc6e6(%rip), %rsi      # 0xb4345
callq 0x8400
jmp 0xa7c66
leaq 0x128(%rsp), %rdi
callq 0xa1f50
callq 0xa7b10
movl %eax, %edx
leaq 0xf8(%rsp), %rdi
movq %rdi, 0x50(%rsp)
movl $0x1, %esi
callq 0xa7230
movq 0x50(%rsp), %rdi
callq 0x8730
movb %al, 0x5f(%rsp)
jmp 0xa7ca1
movb 0x5f(%rsp), %al
testb $0x1, %al
jne 0xa7ddd
jmp 0xa7caf
xorl %eax, %eax
movl %eax, %esi
leaq 0xf8(%rsp), %rdi
callq 0x88e0
movq %rax, 0x48(%rsp)
jmp 0xa7cc7
movq 0x48(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x28, %eax
jne 0xa7ddd
leaq 0xf8(%rsp), %rdi
callq 0x8670
movq %rax, 0x40(%rsp)
jmp 0xa7cec
movq 0x40(%rsp), %rsi
decq %rsi
leaq 0xf8(%rsp), %rdi
callq 0x88e0
movq %rax, 0x38(%rsp)
jmp 0xa7d08
movq 0x38(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
jne 0xa7ddd
leaq 0xf8(%rsp), %rdi
callq 0x8670
movq %rax, 0x30(%rsp)
jmp 0xa7d2d
movq 0x30(%rsp), %rcx
addq $-0x2, %rcx
leaq 0xd8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
movl $0x1, %edx
callq 0x8450
jmp 0xa7d52
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x8050
jmp 0xa7d69
leaq 0xd8(%rsp), %rdi
callq 0x88f8
jmp 0xa7d78
jmp 0xa7ddd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0x128(%rsp), %rdi
callq 0xa1f50
jmp 0xa7d9d
jmp 0xa7fc8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0xa7e06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x88f8
jmp 0xa7ddb
jmp 0xa7e06
movq 0x80(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x91920
jmp 0xa7df4
leaq 0xf8(%rsp), %rdi
callq 0x88f8
jmp 0xa7fb8
leaq 0xf8(%rsp), %rdi
callq 0x88f8
jmp 0xa7e15
jmp 0xa7fc8
leaq 0x97(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x87f0
movq 0x28(%rsp), %rdx
leaq 0xc514(%rip), %rsi      # 0xb434c
leaq 0x98(%rsp), %rdi
callq 0x85b0
jmp 0xa7e47
callq 0xa7b10
movl %eax, 0x24(%rsp)
jmp 0xa7e52
movl 0x24(%rsp), %esi
leaq 0x98(%rsp), %rdi
callq 0xa7660
movq %rax, 0x18(%rsp)
jmp 0xa7e6a
leaq 0x96(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x87f0
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0xb8(%rsp), %rdi
callq 0x85b0
jmp 0xa7e95
leaq 0x96(%rsp), %rdi
callq 0x84a0
leaq 0x98(%rsp), %rdi
callq 0x88f8
jmp 0xa7eb1
leaq 0x97(%rsp), %rdi
callq 0x84a0
leaq 0xae73(%rip), %rsi      # 0xb2d38
leaq 0xb8(%rsp), %rdi
callq 0x8d0c0
movb %al, 0xf(%rsp)
jmp 0xa7ed8
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0xa7ee2
jmp 0xa7efb
movq 0x80(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x81a0
jmp 0xa7ef9
jmp 0xa7f14
movq 0x80(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x91920
jmp 0xa7f12
jmp 0xa7f14
leaq 0xb8(%rsp), %rdi
callq 0x88f8
jmp 0xa7fb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0xa7f84
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0xa7f73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0x96(%rsp), %rdi
callq 0x84a0
leaq 0x98(%rsp), %rdi
callq 0x88f8
jmp 0xa7f82
jmp 0xa7f84
leaq 0x97(%rsp), %rdi
callq 0x84a0
jmp 0xa7fc8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x88f8
jmp 0xa7fb6
jmp 0xa7fc8
movq 0x88(%rsp), %rax
addq $0x448, %rsp            # imm = 0x448
retq
movq 0x120(%rsp), %rdi
callq 0x87d0
movq %rax, %rdi
callq 0x8cf60
nopl (%rax)