#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 */
typedef int /*<<< orphan*/ input;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf_s(char *, char *, int);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char input[256] = "hi.";
  puts("BTSOOT version 0.1.0");
  for (;;) {
    printf(">");
    scanf_s("%s", input, sizeof(input));
    if (strcmp(input, "help") == 0) {
      puts("This should display help!");
    } else if (strcmp(input, "quit") == 0) {
      return 0;
    } else if (strcmp(input, "exit") == 0) {
      return 0;
    } else {
      printf("Command '%s' not recognized.\n", input);
    }
  }
  puts("EXITING.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
movb   $0x68,-0x110(%rbp)
movb   $0x69,-0x10f(%rbp)
movb   $0x2e,-0x10e(%rbp)
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xe65(%rip),%rdi
mov    $0x100,%edx
call   1070 <scanf_s@plt>
lea    -0x110(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11ea <main+0x9a>
lea    0xe3f(%rip),%rdi
call   1030 <puts@plt>
jmp    125b <main+0x10b>
lea    -0x110(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1213 <main+0xc3>
movl   $0x0,-0x4(%rbp)
jmp    1260 <main+0x110>
lea    -0x110(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    123c <main+0xec>
movl   $0x0,-0x4(%rbp)
jmp    1260 <main+0x110>
lea    -0x110(%rbp),%rsi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1256 <main+0x106>
jmp    125b <main+0x10b>
jmp    1196 <main+0x46>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movw   $0x6968,(%rsp)
movb   $0x2e,0x2(%rsp)
lea    0xe23(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2c(%rip),%r14
mov    %rsp,%rbx
lea    0xe25(%rip),%r15
lea    0xe3d(%rip),%r13
lea    0xe3b(%rip),%rbp
lea    0xe39(%rip),%r12
jmp    121c <main+0xcc>
nopw   0x0(%rax,%rax,1)
lea    0xe06(%rip),%rdi
call   1040 <puts@plt>
mov    $0x3e,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1070 <scanf_s@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1210 <main+0xc0>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1275 <main+0x125>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1275 <main+0x125>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    121c <main+0xcc>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"BTSOOT version 0.1.0\00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [5 x i8] c"help\00"
@.str.4 = [26 x i8] c"This should display help!\00"
@.str.5 = [5 x i8] c"quit\00"
@.str.6 = [5 x i8] c"exit\00"
@.str.7 = [30 x i8] c"Command '%s' not recognized.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
store i32 0, i32* %1
%3 = bitcast [256 x i8]* %2 to i8*
%4 = bitcast i8* %3 to [256 x i8]*
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i32 0, i32 0
store i8 104, i8* %5
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i32 0, i32 1
store i8 105, i8* %6
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i32 0, i32 2
store i8 46, i8* %7
%8 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %33, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%12 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %11, i32 256)
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %33
18: ; preds = %9
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %1
br label %34
23: ; preds = %18
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 0, i32* %1
br label %34
28: ; preds = %23
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32, %16
br label %9
34: ; preds = %27, %22
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [21 x i8] c"BTSOOT version 0.1.0\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [5 x i8] c"help\00"
@.str.4 = [26 x i8] c"This should display help!\00"
@.str.5 = [5 x i8] c"quit\00"
@.str.6 = [5 x i8] c"exit\00"
@.str.7 = [30 x i8] c"Command '%s' not recognized.\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
store i8 104, i8* %2
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 1
store i8 105, i8* %3
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 2
store i8 46, i8* %4
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %21, %0
%7 = call i32 @putchar(i32 62)
%8 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 256)
%9 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %21
13: ; preds = %6
%14 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %2)
br label %21
21: ; preds = %19, %11
br label %6
22: ; preds = %16, %13
ret i32 0
}