#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 EXIT_FAILURE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getenv(char *);
int /*<<< orphan*/ printPrompt();
int /*<<< orphan*/ processInput();
scalar_t__ readInput();
int /*<<< orphan*/ setSignalBehavior(int);
int setenv(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
scalar_t__ tokenize();
int main(int argc, const char *argv[], const char *envp[]) {
  if (setenv("PATH", getenv("PATH"), 1) == -1) {
    fprintf(stderr, "setenv error. Program exit.\n");
    return EXIT_FAILURE;
  }
  setSignalBehavior(false);
  while (true) {
    printPrompt();
    if (readInput()) {
      continue;
    }
    if (tokenize()) {
      processInput();
    }
  }
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xe5f(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%esi
lea    0xe51(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
cmp    $0xffffffff,%eax
jne    11e6 <main+0x66>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret
xor    %edi,%edi
call   10a0 <setSignalBehavior@plt>
mov    $0x0,%al
call   1050 <printPrompt@plt>
mov    $0x0,%al
call   1080 <readInput@plt>
cmp    $0x0,%rax
je     120a <main+0x8a>
jmp    11ed <main+0x6d>
mov    $0x0,%al
call   1070 <tokenize@plt>
cmp    $0x0,%rax
je     1222 <main+0xa2>
mov    $0x0,%al
call   1090 <processInput@plt>
jmp    11ed <main+0x6d>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xe78(%rip),%rbx
mov    %rbx,%rdi
call   1030 <getenv@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <setenv@plt>
cmp    $0xffffffff,%eax
je     11d8 <main+0x58>
xor    %edi,%edi
call   10a0 <setSignalBehavior@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <printPrompt@plt>
xor    %eax,%eax
call   1080 <readInput@plt>
test   %rax,%rax
jne    11b0 <main+0x30>
xor    %eax,%eax
call   1070 <tokenize@plt>
test   %rax,%rax
je     11b0 <main+0x30>
xor    %eax,%eax
call   1090 <processInput@plt>
jmp    11b0 <main+0x30>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"PATH\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"setenv error. Program exit.\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8, i32 1)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
ret i32 %14
15: ; preds = %3
%16 = call i32 @setSignalBehavior(i32 0)
br label %17
17: ; preds = %15, %21, %27
%18 = call i32 (...) @printPrompt()
%19 = call i64 (...) @readInput()
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
br label %17
22: ; preds = %17
%23 = call i64 (...) @tokenize()
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (...) @processInput()
br label %27
27: ; preds = %25, %22
br label %17
}

LLVM IR (-O2):
@.str = [5 x i8] c"PATH\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"setenv error. Program exit.\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %4, i32 1)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
ret i32 %10
11: ; preds = %3
%12 = tail call i32 @setSignalBehavior(i32 0)
br label %13
13: ; preds = %20, %11
%14 = tail call i32 (...) @printPrompt()
%15 = tail call i64 (...) @readInput()
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = tail call i64 (...) @tokenize()
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17, %21, %13
br label %13
21: ; preds = %17
%22 = tail call i32 (...) @processInput()
br label %20
}