// File: brandoncanaday[P]1730sh/1730sh.cpp
// Function: prompt()
void prompt() {
  char cwd[PATH_MAX];
  const char * homedir = nullptr;
  string s_cwd = "";
  string s_homedir = "";
  string prompt = "";
  // home dir stuff
  if((homedir = getenv("HOME")) == NULL) {
    homedir = getpwuid(getuid())->pw_dir;
  } // if
  s_homedir = string(homedir);
  // current dir stuff
  if(getcwd(cwd,sizeof(cwd)) == nullptr) { nope_out("getcwd"); } // if
  s_cwd = string(cwd);
  // prompt stuff
  prompt = s_cwd;
  size_t pos;
  if((pos = prompt.find(s_homedir)) != string::npos) {
    prompt.replace(pos,s_homedir.size(),"~");
  } // if
  cout << "1730sh:" << prompt << "$ ";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1180, %rsp           # imm = 0x1180
movq $0x0, -0x1008(%rbp)
leaq -0x1029(%rbp), %rdi
movq %rdi, -0x1118(%rbp)
callq 0x3590
movq -0x1118(%rbp), %rdx
leaq 0xfdf7(%rip), %rsi      # 0x15ace
leaq -0x1028(%rbp), %rdi
callq 0x3440
jmp 0x5ce5
leaq -0x1029(%rbp), %rdi
callq 0x3340
leaq -0x1061(%rbp), %rdi
movq %rdi, -0x1120(%rbp)
callq 0x3590
movq -0x1120(%rbp), %rdx
leaq 0xfdbc(%rip), %rsi      # 0x15ace
leaq -0x1060(%rbp), %rdi
callq 0x3440
jmp 0x5d20
leaq -0x1061(%rbp), %rdi
callq 0x3340
leaq -0x1089(%rbp), %rdi
movq %rdi, -0x1128(%rbp)
callq 0x3590
movq -0x1128(%rbp), %rdx
leaq 0xfd81(%rip), %rsi      # 0x15ace
leaq -0x1088(%rbp), %rdi
callq 0x3440
jmp 0x5d5b
leaq -0x1089(%rbp), %rdi
callq 0x3340
leaq 0xe2d6(%rip), %rdi      # 0x14044
callq 0x33a0
movq %rax, -0x1008(%rbp)
cmpq $0x0, %rax
jne 0x5e30
callq 0x3150
movl %eax, %edi
callq 0x3370
movq %rax, -0x1130(%rbp)
jmp 0x5d99
movq -0x1130(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x1008(%rbp)
jmp 0x5e30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
leaq -0x1029(%rbp), %rdi
callq 0x3340
jmp 0x610a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
leaq -0x1061(%rbp), %rdi
callq 0x3340
jmp 0x60fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
leaq -0x1089(%rbp), %rdi
callq 0x3340
jmp 0x60f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
jmp 0x60e6
movq -0x1008(%rbp), %rax
movq %rax, -0x1140(%rbp)
leaq -0x10b1(%rbp), %rdi
movq %rdi, -0x1138(%rbp)
callq 0x3590
movq -0x1140(%rbp), %rsi
movq -0x1138(%rbp), %rdx
leaq -0x10b0(%rbp), %rdi
callq 0x3440
jmp 0x5e6d
leaq -0x1060(%rbp), %rdi
leaq -0x10b0(%rbp), %rsi
callq 0x33b0
leaq -0x10b0(%rbp), %rdi
callq 0x31e0
leaq -0x10b1(%rbp), %rdi
callq 0x3340
leaq -0x1000(%rbp), %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x3160
cmpq $0x0, %rax
jne 0x5f70
leaq -0x10d9(%rbp), %rdi
movq %rdi, -0x1148(%rbp)
callq 0x3590
movq -0x1148(%rbp), %rdx
leaq 0xe175(%rip), %rsi      # 0x14049
leaq -0x10d8(%rbp), %rdi
callq 0x3440
jmp 0x5ee2
leaq -0x10d8(%rbp), %rdi
callq 0xb4d0
jmp 0x5ef0
leaq -0x10d8(%rbp), %rdi
callq 0x31e0
leaq -0x10d9(%rbp), %rdi
callq 0x3340
jmp 0x5f70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
leaq -0x10b1(%rbp), %rdi
callq 0x3340
jmp 0x60e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
jmp 0x5f5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
leaq -0x10d8(%rbp), %rdi
callq 0x31e0
leaq -0x10d9(%rbp), %rdi
callq 0x3340
jmp 0x60e6
leaq -0x1101(%rbp), %rdi
movq %rdi, -0x1150(%rbp)
callq 0x3590
movq -0x1150(%rbp), %rdx
leaq -0x1100(%rbp), %rdi
leaq -0x1000(%rbp), %rsi
callq 0x3440
jmp 0x5f9f
leaq -0x1028(%rbp), %rdi
movq %rdi, -0x1158(%rbp)
leaq -0x1100(%rbp), %rsi
movq %rsi, -0x1160(%rbp)
callq 0x33b0
movq -0x1160(%rbp), %rdi
callq 0x31e0
leaq -0x1101(%rbp), %rdi
callq 0x3340
movq -0x1158(%rbp), %rsi
leaq -0x1088(%rbp), %rdi
callq 0x3050
jmp 0x5fed
leaq -0x1088(%rbp), %rdi
leaq -0x1060(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3620
movq %rax, -0x1110(%rbp)
cmpq $-0x1, %rax
je 0x606c
movq -0x1110(%rbp), %rax
movq %rax, -0x1168(%rbp)
leaq -0x1060(%rbp), %rdi
callq 0x3210
movq -0x1168(%rbp), %rsi
movq %rax, %rdx
leaq 0xe82a(%rip), %rcx      # 0x14866
leaq -0x1088(%rbp), %rdi
callq 0x31c0
jmp 0x604a
jmp 0x606c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1038(%rbp)
movl %eax, -0x103c(%rbp)
leaq -0x1101(%rbp), %rdi
callq 0x3340
jmp 0x60e6
movq 0x15f55(%rip), %rdi     # 0x1bfc8
leaq 0xdfd6(%rip), %rsi      # 0x14050
callq 0x32e0
movq %rax, -0x1170(%rbp)
jmp 0x6088
movq -0x1170(%rbp), %rdi
leaq -0x1088(%rbp), %rsi
callq 0x32a0
movq %rax, -0x1178(%rbp)
jmp 0x60a4
movq -0x1178(%rbp), %rdi
leaq 0xdfa6(%rip), %rsi      # 0x14058
callq 0x32e0
jmp 0x60b9
leaq -0x1088(%rbp), %rdi
callq 0x31e0
leaq -0x1060(%rbp), %rdi
callq 0x31e0
leaq -0x1028(%rbp), %rdi
callq 0x31e0
addq $0x1180, %rsp           # imm = 0x1180
popq %rbp
retq
leaq -0x1088(%rbp), %rdi
callq 0x31e0
leaq -0x1060(%rbp), %rdi
callq 0x31e0
leaq -0x1028(%rbp), %rdi
callq 0x31e0
movq -0x1038(%rbp), %rdi
callq 0x3580
nopw %cs:(%rax,%rax)