#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*/ alt_a();
int /*<<< orphan*/ alt_b();
int /*<<< orphan*/ ctrl_a();
int /*<<< orphan*/ ctrl_g();
int /*<<< orphan*/ down_arrow();
int /*<<< orphan*/ f2();
int /*<<< orphan*/ f3();
int /*<<< orphan*/ f4();
int /*<<< orphan*/ func1();
int /*<<< orphan*/ func2();
int /*<<< orphan*/ left_arrow();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ right_arrow();
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
char toupper(char);
int /*<<< orphan*/ up_arrow();
int main(void) {
  char word[80];
  char ch;
  do {
    puts("Enter some text :");
    scanf("%s", word);
    if (!strcmp(word, "foo")) {
      func1();
    } else if (!strcmp(word, "bar")) {
      func2();
    } else if (!strcmp(word, "\x1b\x61")) {
      alt_a();
    } else if (!strcmp(word, "\x1b\x62")) {
      alt_b();
    } else if (!strcmp(word, "\x07")) {
      ctrl_g();
    } else if (!strcmp(word, "\x01")) {
      ctrl_a();
    } else if (!strcmp(word, "\x1b\x5b\x41")) {
      up_arrow();
    } else if (!strcmp(word, "\x1b\x5b\x42")) {
      down_arrow();
    } else if (!strcmp(word, "\x1b\x5b\x43")) {
      right_arrow();
    } else if (!strcmp(word, "\x1b\x5b\x44")) {
      left_arrow();
    } else if (!strcmp(word, "\x1b\x4f\x51")) {
      f2();
    } else if (!strcmp(word, "\x1b\x4f\x52")) {
      f3();
    } else if (!strcmp(word, "\x1b\x4f\x53")) {
      f4();
    } else {
      printf("Nope - I do not recognise that phrase.... \n");
    }
    printf("Try again? (y/n) : ");
    scanf(" %c%*c", &ch);
  } while (toupper(ch) != 'N');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xdca(%rip),%rdi
call   1080 <puts@plt>
lea    -0x60(%rbp),%rsi
lea    0xdcc(%rip),%rdi
call   1100 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1270 <main+0x50>
mov    $0x0,%al
call   1050 <func1@plt>
jmp    1474 <main+0x254>
lea    -0x60(%rbp),%rdi
lea    0xd9e(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1295 <main+0x75>
mov    $0x0,%al
call   10f0 <func2@plt>
jmp    146f <main+0x24f>
lea    -0x60(%rbp),%rdi
lea    0xd7d(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    12ba <main+0x9a>
mov    $0x0,%al
call   1120 <alt_a@plt>
jmp    146a <main+0x24a>
lea    -0x60(%rbp),%rdi
lea    0xd5b(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    12df <main+0xbf>
mov    $0x0,%al
call   1140 <alt_b@plt>
jmp    1465 <main+0x245>
lea    -0x60(%rbp),%rdi
lea    0xd39(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1304 <main+0xe4>
mov    $0x0,%al
call   1040 <ctrl_g@plt>
jmp    1460 <main+0x240>
lea    -0x60(%rbp),%rdi
lea    0xd16(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1329 <main+0x109>
mov    $0x0,%al
call   1110 <ctrl_a@plt>
jmp    145b <main+0x23b>
lea    -0x60(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    134e <main+0x12e>
mov    $0x0,%al
call   1090 <up_arrow@plt>
jmp    1456 <main+0x236>
lea    -0x60(%rbp),%rdi
lea    0xcd2(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1373 <main+0x153>
mov    $0x0,%al
call   10c0 <down_arrow@plt>
jmp    1451 <main+0x231>
lea    -0x60(%rbp),%rdi
lea    0xcb1(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1398 <main+0x178>
mov    $0x0,%al
call   1060 <right_arrow@plt>
jmp    144c <main+0x22c>
lea    -0x60(%rbp),%rdi
lea    0xc90(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    13bd <main+0x19d>
mov    $0x0,%al
call   10b0 <left_arrow@plt>
jmp    1447 <main+0x227>
lea    -0x60(%rbp),%rdi
lea    0xc6f(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    13e2 <main+0x1c2>
mov    $0x0,%al
call   1030 <f2@plt>
jmp    1442 <main+0x222>
lea    -0x60(%rbp),%rdi
lea    0xc4e(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1407 <main+0x1e7>
mov    $0x0,%al
call   10e0 <f3@plt>
jmp    143d <main+0x21d>
lea    -0x60(%rbp),%rdi
lea    0xc2d(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    142c <main+0x20c>
mov    $0x0,%al
call   1130 <f4@plt>
jmp    1438 <main+0x218>
lea    0xc10(%rip),%rdi
call   10a0 <printf@plt>
jmp    143d <main+0x21d>
jmp    1442 <main+0x222>
jmp    1447 <main+0x227>
jmp    144c <main+0x22c>
jmp    1451 <main+0x231>
jmp    1456 <main+0x236>
jmp    145b <main+0x23b>
jmp    1460 <main+0x240>
jmp    1465 <main+0x245>
jmp    146a <main+0x24a>
jmp    146f <main+0x24f>
jmp    1474 <main+0x254>
lea    0xbf4(%rip),%rdi
call   10a0 <printf@plt>
lea    0xbfc(%rip),%rdi
lea    -0x61(%rbp),%rsi
call   1100 <scanf@plt>
movsbl -0x61(%rbp),%edi
call   1070 <toupper@plt>
movsbl %al,%eax
cmp    $0x4e,%eax
jne    122f <main+0xf>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xddb(%rip),%r14
lea    0xde6(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xde3(%rip),%r13
lea    0xdf0(%rip),%rbx
lea    0xf(%rsp),%rbp
jmp    127c <main+0x6c>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <func2@plt>
mov    %r13,%rdi
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10f0 <scanf@plt>
movsbl 0xf(%rsp),%edi
call   1070 <toupper@plt>
cmp    $0x4e,%al
je     13ba <main+0x1aa>
mov    %r14,%rdi
call   1080 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10f0 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    $0x726162,%eax
je     1250 <main+0x40>
cmp    $0x6f6f66,%eax
jne    12b0 <main+0xa0>
xor    %eax,%eax
call   1050 <func1@plt>
jmp    1257 <main+0x47>
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%ecx
mov    $0x611b,%edx
xor    %edx,%ecx
movzbl 0x12(%rsp),%edx
or     %cx,%dx
je     12f2 <main+0xe2>
mov    0x10(%rsp),%ecx
mov    $0x621b,%edx
xor    %edx,%ecx
movzbl 0x12(%rsp),%edx
or     %cx,%dx
je     12fe <main+0xee>
cmp    $0x1,%ax
je     130a <main+0xfa>
cmp    $0x7,%ax
jne    1316 <main+0x106>
xor    %eax,%eax
call   1040 <ctrl_g@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
call   1110 <alt_a@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
call   1130 <alt_b@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
call   1100 <ctrl_a@plt>
jmp    1257 <main+0x47>
cmp    $0x445b1a,%eax
jle    133e <main+0x12e>
cmp    $0x524f1a,%eax
jg     135f <main+0x14f>
cmp    $0x445b1b,%eax
je     1379 <main+0x169>
cmp    $0x514f1b,%eax
jne    13a9 <main+0x199>
xor    %eax,%eax
call   1030 <f2@plt>
jmp    1257 <main+0x47>
cmp    $0x415b1b,%eax
je     1385 <main+0x175>
cmp    $0x425b1b,%eax
je     1391 <main+0x181>
cmp    $0x435b1b,%eax
jne    13a9 <main+0x199>
xor    %eax,%eax
call   1060 <right_arrow@plt>
jmp    1257 <main+0x47>
cmp    $0x524f1b,%eax
je     139d <main+0x18d>
cmp    $0x534f1b,%eax
jne    13a9 <main+0x199>
xor    %eax,%eax
call   1120 <f4@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
call   10b0 <left_arrow@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
call   1090 <up_arrow@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
call   10c0 <down_arrow@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
call   10d0 <f3@plt>
jmp    1257 <main+0x47>
lea    0xc86(%rip),%rdi
call   1080 <puts@plt>
jmp    1257 <main+0x47>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter some text :\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"foo\00"
@.str.3 = [4 x i8] c"bar\00"
@.str.4 = [3 x i8] c"\1Ba\00"
@.str.5 = [3 x i8] c"\1Bb\00"
@.str.6 = [2 x i8] c"\07\00"
@.str.7 = [2 x i8] c"\01\00"
@.str.8 = [4 x i8] c"\1B[A\00"
@.str.9 = [4 x i8] c"\1B[B\00"
@.str.10 = [4 x i8] c"\1B[C\00"
@.str.11 = [4 x i8] c"\1B[D\00"
@.str.12 = [4 x i8] c"\1BOQ\00"
@.str.13 = [4 x i8] c"\1BOR\00"
@.str.14 = [4 x i8] c"\1BOS\00"
@.str.15 = [44 x i8] c"Nope - I do not recognise that phrase.... \0A\00"
@.str.16 = [20 x i8] c"Try again? (y/n) : \00"
@.str.17 = [7 x i8] c" %c%*c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i8
store i32 0, i32* %1
br label %4
4: ; preds = %102, %0
%5 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %4
%12 = call i32 (...) @func1()
br label %99
13: ; preds = %4
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (...) @func2()
br label %98
19: ; preds = %13
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 (...) @alt_a()
br label %97
25: ; preds = %19
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = call i32 (...) @alt_b()
br label %96
31: ; preds = %25
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = call i32 (...) @ctrl_g()
br label %95
37: ; preds = %31
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %37
%42 = call i32 (...) @ctrl_a()
br label %94
43: ; preds = %37
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%45 = call i32 @strcmp(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %43
%48 = call i32 (...) @up_arrow()
br label %93
49: ; preds = %43
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%51 = call i32 @strcmp(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%52 = icmp ne i32 %51, 0
br i1 %52, label %55, label %53
53: ; preds = %49
%54 = call i32 (...) @down_arrow()
br label %92
55: ; preds = %49
%56 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%57 = call i32 @strcmp(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%58 = icmp ne i32 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %55
%60 = call i32 (...) @right_arrow()
br label %91
61: ; preds = %55
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%63 = call i32 @strcmp(i8* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %67, label %65
65: ; preds = %61
%66 = call i32 (...) @left_arrow()
br label %90
67: ; preds = %61
%68 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%69 = call i32 @strcmp(i8* %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%70 = icmp ne i32 %69, 0
br i1 %70, label %73, label %71
71: ; preds = %67
%72 = call i32 (...) @f2()
br label %89
73: ; preds = %67
%74 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%75 = call i32 @strcmp(i8* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%76 = icmp ne i32 %75, 0
br i1 %76, label %79, label %77
77: ; preds = %73
%78 = call i32 (...) @f3()
br label %88
79: ; preds = %73
%80 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%81 = call i32 @strcmp(i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
%82 = icmp ne i32 %81, 0
br i1 %82, label %85, label %83
83: ; preds = %79
%84 = call i32 (...) @f4()
br label %87
85: ; preds = %79
%86 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0))
br label %87
87: ; preds = %85, %83
br label %88
88: ; preds = %87, %77
br label %89
89: ; preds = %88, %71
br label %90
90: ; preds = %89, %65
br label %91
91: ; preds = %90, %59
br label %92
92: ; preds = %91, %53
br label %93
93: ; preds = %92, %47
br label %94
94: ; preds = %93, %41
br label %95
95: ; preds = %94, %35
br label %96
96: ; preds = %95, %29
br label %97
97: ; preds = %96, %23
br label %98
98: ; preds = %97, %17
br label %99
99: ; preds = %98, %11
%100 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%101 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %3)
br label %102
102: ; preds = %99
%103 = load i8, i8* %3
%104 = call signext i8 @toupper(i8 signext %103)
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 78
br i1 %106, label %4, label %107
107: ; preds = %102
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter some text :\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.4 = [3 x i8] c"\1Ba\00"
@.str.5 = [3 x i8] c"\1Bb\00"
@.str.16 = [20 x i8] c"Try again? (y/n) : \00"
@.str.17 = [7 x i8] c" %c%*c\00"
@str = [43 x i8] c"Nope - I do not recognise that phrase.... \00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca i8
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = bitcast [80 x i8]* %1 to i32*
br label %5
5: ; preds = %46, %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i16
switch i32 %8, label %14 [
i32 7303014, label %10
i32 7496034, label %12
]
10: ; preds = %5
%11 = call i32 (...) @func1()
br label %46
12: ; preds = %5
%13 = call i32 (...) @func2()
br label %46
14: ; preds = %5
%15 = call i32 @bcmp(i8* dereferenceable(3) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 3)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (...) @alt_a()
br label %46
19: ; preds = %14
%20 = call i32 @bcmp(i8* dereferenceable(3) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 3)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (...) @alt_b()
br label %46
24: ; preds = %19
switch i16 %9, label %29 [
i16 7, label %25
i16 1, label %27
]
25: ; preds = %24
%26 = call i32 (...) @ctrl_g()
br label %46
27: ; preds = %24
%28 = call i32 (...) @ctrl_a()
br label %46
29: ; preds = %24
switch i32 %8, label %44 [
i32 4283163, label %30
i32 4348699, label %32
i32 4414235, label %34
i32 4479771, label %36
i32 5328667, label %38
i32 5394203, label %40
i32 5459739, label %42
]
30: ; preds = %29
%31 = call i32 (...) @up_arrow()
br label %46
32: ; preds = %29
%33 = call i32 (...) @down_arrow()
br label %46
34: ; preds = %29
%35 = call i32 (...) @right_arrow()
br label %46
36: ; preds = %29
%37 = call i32 (...) @left_arrow()
br label %46
38: ; preds = %29
%39 = call i32 (...) @f2()
br label %46
40: ; preds = %29
%41 = call i32 (...) @f3()
br label %46
42: ; preds = %29
%43 = call i32 (...) @f4()
br label %46
44: ; preds = %29
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
br label %46
46: ; preds = %12, %22, %27, %32, %36, %40, %44, %42, %38, %34, %30, %25, %17, %10
%47 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%48 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8* %2)
%49 = load i8, i8* %2
%50 = call signext i8 @toupper(i8 signext %49)
%51 = icmp eq i8 %50, 78
br i1 %51, label %52, label %5
52: ; preds = %46
ret i32 0
}