#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*/ getcwd(char *, int);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ memclr(char *, int);
int /*<<< orphan*/ parse_cmd(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  char buf[100];
  char path[100];
  while (1) {
    memclr(buf, 100);
    memclr(path, 100);
    getcwd(path, 100);
    printf("%s$ ", path);
    gets(buf);
    parse_cmd(buf);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1030 <memclr@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x64,%esi
call   1030 <memclr@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x64,%esi
call   1060 <getcwd@plt>
lea    -0xf0(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
lea    -0x80(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x80(%rbp),%rdi
call   1050 <parse_cmd@plt>
jmp    1169 <main+0x19>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
lea    0x70(%rsp),%r14
mov    %rsp,%rbx
lea    0xe95(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x64,%esi
call   1030 <memclr@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1030 <memclr@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1060 <getcwd@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1070 <gets@plt>
mov    %r14,%rdi
call   1050 <parse_cmd@plt>
jmp    1170 <main+0x20>

LLVM IR (-O0):
@.str = [5 x i8] c"%s$ \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %2, %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = call i32 @memclr(i8* %9, i32 100)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%12 = call i32 @memclr(i8* %11, i32 100)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = call i32 @getcwd(i8* %13, i32 100)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%18 = call i32 @gets(i8* %17)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%20 = call i32 @parse_cmd(i8* %19)
br label %8
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s$ \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %7, %2
%8 = call i32 @memclr(i8* %5, i32 100)
%9 = call i32 @memclr(i8* %6, i32 100)
%10 = call i32 @getcwd(i8* %6, i32 100)
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%12 = call i32 @gets(i8* %5)
%13 = call i32 @parse_cmd(i8* %5)
br label %7
}