#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *getWorkingDirectory();
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ stdout;
void displayStandardLine() {
  char *cwd = getWorkingDirectory();
  char *username = getenv("USER");
  if (username == NULL)
    printf("\x1b[32mUSER:\x1b[0m%s$ ", cwd);
  else
    printf("\x1b[32m%s:\x1b[0m%s$ ", username, cwd);
  free(cwd);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<displayStandardLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <getWorkingDirectory@plt>
mov    %rax,-0x8(%rbp)
lea    0xe96(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1195 <displayStandardLine+0x45>
mov    -0x8(%rbp),%rsi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11ab <displayStandardLine+0x5b>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <free@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayStandardLine>:
push   %rbx
xor    %eax,%eax
call   1070 <getWorkingDirectory@plt>
mov    %rax,%rbx
lea    0xe9e(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1182 <displayStandardLine+0x32>
lea    0xea5(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1193 <displayStandardLine+0x43>
lea    0xe7c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1060 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"USER\00"
@.str.1 = [19 x i8] c"\1B[32mUSER:\1B[0m%s$ \00"
@.str.2 = [17 x i8] c"\1B[32m%s:\1B[0m%s$ \00"
@stdout = global i32 0
define void @displayStandardLine() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* (...) @getWorkingDirectory()
store i8* %3, i8** %1
%4 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i8*, i8** %1
%9 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %14
10: ; preds = %0
%11 = load i8*, i8** %2
%12 = load i8*, i8** %1
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %11, i8* %12)
br label %14
14: ; preds = %10, %7
%15 = load i8*, i8** %1
%16 = call i32 @free(i8* %15)
%17 = load i32, i32* @stdout
%18 = call i32 @fflush(i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"USER\00"
@.str.1 = [19 x i8] c"\1B[32mUSER:\1B[0m%s$ \00"
@.str.2 = [17 x i8] c"\1B[32m%s:\1B[0m%s$ \00"
@stdout = global i32 0
define void @displayStandardLine() {
%1 = tail call i8* (...) @getWorkingDirectory()
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %8
6: ; preds = %0
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* %1)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @free(i8* %1)
%10 = load i32, i32* @stdout
%11 = tail call i32 @fflush(i32 %10)
ret void
}