// File: /workspace/github_cpp_makefile_star2_O3/mukul-mehta[P]meta/shell.cc
// Function: getShellPrompt()
const char* getShellPrompt() {
    string username = getUsername();
    string hostname = getHostname();
    char timeBuffer[12];

    auto t = time(nullptr);
    struct tm* ltime = localtime(&t);
    strftime(timeBuffer, sizeof(timeBuffer), "%H:%M:%S", ltime);

    char* prompt = (char*)malloc(BUFSIZE * sizeof(char));

    // Check width of terminal
    // Needed because some part of the prompt is on the right end and need to fill with correct num spaces in between
    struct winsize size;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &size);
    int width = size.ws_col;
    int numSpaces = width - (strlen(__CWD) + 2) - (hostname.size()) - (strlen(timeBuffer));

    string spaces(numSpaces, ' ');
    sprintf(prompt, ": %s%s%s%s%s%s%s [%s%s@%s%s] \n%s@%s ", GREEN, __CWD, NORM, spaces.c_str(),
            GRAY, timeBuffer, NORM, CYAN, username.c_str(), hostname.c_str(), NORM, RED, NORM);
    sprintf(prompt, "%s%s%s: %s%s%s%s%s%s%s\n%s%s%s %s@%s ", YELLOW, hostname.c_str(), NORM,
            GREENIT, __CWD, NORM, spaces.c_str(), GRAY, timeBuffer, NORM, CYAN, username.c_str(),
            NORM, RED, NORM);
    return prompt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq 0x48(%rsp), %rdi
callq 0x46eb
leaq 0x8(%rsp), %rdi
callq 0x4718
xorl %edi, %edi
callq 0x2240
leaq 0x78(%rsp), %rdi
movq %rax, (%rdi)
callq 0x21a0
leaq 0x33b7(%rip), %rdx      # 0x615f
leaq 0x6c(%rsp), %r13
movl $0xc, %esi
movq %r13, %rdi
movq %rax, %rcx
callq 0x21f0
movl $0x1000, %edi           # imm = 0x1000
callq 0x2380
movq %rax, %rbx
leaq 0x80(%rsp), %r15
movl $0x5413, %esi           # imm = 0x5413
movl $0x1, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x23c0
movzwl 0x2(%r15), %r15d
leaq 0x68ce(%rip), %rdi      # 0x96c0
movq %rdi, %r14
callq 0x20f0
movq %rax, %r12
addl 0x10(%rsp), %r12d
movq %r13, %rdi
callq 0x20f0
addl %r12d, %eax
negl %eax
addl %r15d, %eax
addl $-0x2, %eax
movslq %eax, %rsi
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x28(%rsp), %rdi
movl $0x20, %edx
callq 0x22c0
movq 0x28(%rsp), %r9
subq $0x8, %rsp
leaq 0x3353(%rip), %r12      # 0x6193
leaq 0x335d(%rip), %r15      # 0x61a4
leaq 0x3350(%rip), %r13      # 0x619e
leaq 0x3343(%rip), %r11      # 0x6198
leaq 0x330c(%rip), %rsi      # 0x6168
leaq 0x332a(%rip), %rdx      # 0x618d
movq %rbx, %rdi
movq %r14, %rcx
movq %r12, %r8
xorl %eax, %eax
pushq %r12
pushq %r15
pushq %r12
pushq 0x28(%rsp)
pushq 0x70(%rsp)
pushq %r13
pushq %r12
leaq 0xac(%rsp), %rbp
pushq %rbp
pushq %r11
callq 0x2070
addq $0x50, %rsp
movq 0x8(%rsp), %rcx
subq $0x8, %rsp
leaq 0x3306(%rip), %rsi      # 0x61aa
leaq 0x3324(%rip), %rdx      # 0x61cf
leaq 0x3323(%rip), %r9       # 0x61d5
movq %rbx, %rdi
movq %r12, %r8
movl $0x0, %eax
pushq %r12
pushq %r15
pushq %r12
pushq 0x68(%rsp)
pushq %r13
pushq %r12
pushq %rbp
leaq 0x32c5(%rip), %r10      # 0x6198
pushq %r10
pushq 0x70(%rsp)
pushq %r12
pushq %r14
callq 0x2070
addq $0x60, %rsp
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2f02
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2290
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f1d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2290
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f38
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2290
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f70
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2290
jmp 0x2f70
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f8b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2290
movq %rbx, %rdi
callq 0x2490