#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*/ banner();
int /*<<< orphan*/ credits();
int get_s(char *);
int /*<<< orphan*/ help();
scalar_t__ malloc(int);
scalar_t__ parse(char *, int *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  banner();
  char *exp = (char *)malloc(sizeof(char) * 100);
  while (1) {
    printf(">>");
    if (get_s(exp) == 1)
      continue;
    if (strcmp(exp, "q") == 0)
      return 0;
    else if (strcmp(exp, "banner") == 0)
      banner();
    else if (strcmp(exp, "help") == 0)
      help();
    else if (strcmp(exp, "credits") == 0)
      credits();
    else if (strcmp(exp, "clear") == 0)
      system("clear");
    else {
      int sol;
      if (parse(exp, &sol) == 0)
        printf("%i\n", sol);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <banner@plt>
mov    $0x64,%edi
call   1090 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <get_s@plt>
cmp    $0x1,%eax
jne    11d9 <main+0x49>
jmp    11b4 <main+0x24>
mov    -0x10(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    11fb <main+0x6b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1221 <main+0x91>
mov    $0x0,%al
call   1070 <banner@plt>
jmp    12d4 <main+0x144>
mov    -0x10(%rbp),%rdi
lea    0xde0(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1247 <main+0xb7>
mov    $0x0,%al
call   10a0 <help@plt>
jmp    12cf <main+0x13f>
mov    -0x10(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    126d <main+0xdd>
mov    $0x0,%al
call   1040 <credits@plt>
jmp    12ca <main+0x13a>
mov    -0x10(%rbp),%rdi
lea    0xda1(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1298 <main+0x108>
lea    0xd8b(%rip),%rdi
call   1050 <system@plt>
jmp    12c5 <main+0x135>
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   10b0 <parse@plt>
cmp    $0x0,%rax
jne    12c0 <main+0x130>
mov    -0x14(%rbp),%esi
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12c5 <main+0x135>
jmp    12ca <main+0x13a>
jmp    12cf <main+0x13f>
jmp    12d4 <main+0x144>
jmp    12d9 <main+0x149>
jmp    11b4 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <banner@plt>
mov    $0x64,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
lea    0xe4a(%rip),%r14
lea    0xe46(%rip),%r15
lea    0xe41(%rip),%r12
lea    0xe41(%rip),%r13
jmp    11e0 <main+0x50>
xor    %eax,%eax
call   1070 <banner@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <get_s@plt>
cmp    $0x1,%eax
je     11e0 <main+0x50>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12a8 <main+0x118>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     11cd <main+0x3d>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1283 <main+0xf3>
mov    %rbx,%rdi
lea    0xddc(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     128f <main+0xff>
mov    %rbx,%rdi
lea    0xdd0(%rip),%rbp
mov    %rbp,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     129b <main+0x10b>
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
call   10b0 <parse@plt>
test   %rax,%rax
jne    11e0 <main+0x50>
mov    0x4(%rsp),%esi
lea    0xda8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
call   10a0 <help@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
call   1040 <credits@plt>
jmp    11e0 <main+0x50>
mov    %rbp,%rdi
call   1050 <system@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c">>\00"
@.str.1 = [2 x i8] c"q\00"
@.str.2 = [7 x i8] c"banner\00"
@.str.3 = [5 x i8] c"help\00"
@.str.4 = [8 x i8] c"credits\00"
@.str.5 = [6 x i8] c"clear\00"
@.str.6 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @banner()
%5 = call i64 @malloc(i32 100)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
br label %7
7: ; preds = %0, %12, %54
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = call i32 @get_s(i8* %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %7
br label %7
13: ; preds = %7
%14 = load i8*, i8** %2
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
ret i32 0
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (...) @banner()
br label %53
24: ; preds = %18
%25 = load i8*, i8** %2
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 (...) @help()
br label %52
30: ; preds = %24
%31 = load i8*, i8** %2
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 (...) @credits()
br label %51
36: ; preds = %30
%37 = load i8*, i8** %2
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %50
42: ; preds = %36
%43 = load i8*, i8** %2
%44 = call i64 @parse(i8* %43, i32* %3)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = load i32, i32* %3
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %46, %42
br label %50
50: ; preds = %49, %40
br label %51
51: ; preds = %50, %34
br label %52
52: ; preds = %51, %28
br label %53
53: ; preds = %52, %22
br label %54
54: ; preds = %53
br label %7
}

LLVM IR (-O2):
@.str = [3 x i8] c">>\00"
@.str.1 = [2 x i8] c"q\00"
@.str.2 = [7 x i8] c"banner\00"
@.str.3 = [5 x i8] c"help\00"
@.str.4 = [8 x i8] c"credits\00"
@.str.5 = [6 x i8] c"clear\00"
@.str.6 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 (...) @banner()
%3 = tail call i64 @malloc(i32 100)
%4 = inttoptr i64 %3 to i8*
%5 = bitcast i32* %1 to i8*
br label %6
6: ; preds = %24, %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @get_s(i8* %4)
%9 = icmp eq i32 %8, 1
br i1 %9, label %24, label %10
10: ; preds = %6
%11 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
ret i32 0
14: ; preds = %10
%15 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (...) @banner()
br label %24
19: ; preds = %14
%20 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = call i32 (...) @help()
br label %24
24: ; preds = %22, %33, %41, %28, %17, %6
br label %6
25: ; preds = %19
%26 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @credits()
br label %24
30: ; preds = %25
%31 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %24
35: ; preds = %30
%36 = call i64 @parse(i8* %4, i32* %1)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* %1
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38, %35
br label %24
}