#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ _PC_PATH_MAX;
int /*<<< orphan*/ free(char *);
char *get_Hostname();
char *get_Username(int /*<<< orphan*/);
char *getcwd(char *, long);
int /*<<< orphan*/ getuid();
long pathconf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void print_Prompt() {
  char *username, *hostname, *cwd;
  long path_len;
  username = get_Username(getuid());
  hostname = get_Hostname();
  path_len = pathconf("/", _PC_PATH_MAX);
  cwd = getcwd((char *)NULL, path_len);
  printf("%s@%s:%s$ ", username, hostname, cwd);
  free(hostname);
  free(cwd);
}


x86 assembly (clang, -O0):
<print_Prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <getuid@plt>
mov    %eax,%edi
call   1080 <get_Username@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1090 <get_Hostname@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
lea    0xe5b(%rip),%rdi
call   1040 <pathconf@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1070 <getcwd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe30(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_Prompt>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <getuid@plt>
mov    %eax,%edi
call   1080 <get_Username@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1090 <get_Hostname@plt>
mov    %rax,%r15
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
lea    0xe60(%rip),%rdi
call   1040 <pathconf@plt>
xor    %edi,%edi
mov    %rax,%rsi
call   1070 <getcwd@plt>
mov    %rax,%rbx
lea    0xe49(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
call   1060 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@_PC_PATH_MAX = global i32 0
@.str.1 = [11 x i8] c"%s@%s:%s$ \00"
define void @print_Prompt() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = call i32 (...) @getuid()
%6 = call i8* @get_Username(i32 %5)
store i8* %6, i8** %1
%7 = call i8* (...) @get_Hostname()
store i8* %7, i8** %2
%8 = load i32, i32* @_PC_PATH_MAX
%9 = call i64 @pathconf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %8)
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = call i8* @getcwd(i8* null, i64 %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %1
%13 = load i8*, i8** %2
%14 = load i8*, i8** %3
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13, i8* %14)
%16 = load i8*, i8** %2
%17 = call i32 @free(i8* %16)
%18 = load i8*, i8** %3
%19 = call i32 @free(i8* %18)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@_PC_PATH_MAX = global i32 0
@.str.1 = [11 x i8] c"%s@%s:%s$ \00"
define void @print_Prompt() {
%1 = tail call i32 (...) @getuid()
%2 = tail call i8* @get_Username(i32 %1)
%3 = tail call i8* (...) @get_Hostname()
%4 = load i32, i32* @_PC_PATH_MAX
%5 = tail call i64 @pathconf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i8* @getcwd(i8* null, i64 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3, i8* %6)
%8 = tail call i32 @free(i8* %3)
%9 = tail call i32 @free(i8* %6)
ret void
}