#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*/ f1();
int /*<<< orphan*/ f2();
int /*<<< orphan*/ f3();
int /*<<< orphan*/ f4();
int getchar();
int /*<<< orphan*/ puts(char *);
int main(void) {
  int ch;
  puts("\nmain");
  while ((ch = getchar()) != 'Q') {
    if (ch == '\n')
      continue;
    else if (ch == '1')
      f1();
    else if (ch == '2')
      f2();
    else if (ch == '3')
      f3();
    else if (ch == '4')
      f4();
    else
      puts(":-P");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x51,%eax
je     121a <main+0xba>
cmpl   $0xa,-0x8(%rbp)
jne    119d <main+0x3d>
jmp    117b <main+0x1b>
cmpl   $0x31,-0x8(%rbp)
jne    11b3 <main+0x53>
mov    $0x0,%al
call   1070 <f1@plt>
jmp    1210 <main+0xb0>
cmpl   $0x32,-0x8(%rbp)
jne    11c9 <main+0x69>
mov    $0x0,%al
call   1030 <f2@plt>
jmp    120b <main+0xab>
cmpl   $0x33,-0x8(%rbp)
jne    11df <main+0x7f>
mov    $0x0,%al
call   1060 <f3@plt>
jmp    1206 <main+0xa6>
cmpl   $0x34,-0x8(%rbp)
jne    11f5 <main+0x95>
mov    $0x0,%al
call   1080 <f4@plt>
jmp    1201 <main+0xa1>
lea    0xe0a(%rip),%rdi
call   1040 <puts@plt>
jmp    1206 <main+0xa6>
jmp    120b <main+0xab>
jmp    1210 <main+0xb0>
jmp    1215 <main+0xb5>
jmp    117b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf19(%rip),%rdi
call   1040 <puts@plt>
lea    0xf13(%rip),%r14
lea    0xe82(%rip),%rbx
jmp    1190 <main+0x30>
mov    %r14,%rdi
call   1040 <puts@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x31(%rax),%ecx
cmp    $0x20,%ecx
ja     11c0 <main+0x60>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <f1@plt>
jmp    1190 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%eax
je     1190 <main+0x30>
jmp    1180 <main+0x20>
xor    %eax,%eax
call   1030 <f2@plt>
jmp    1190 <main+0x30>
xor    %eax,%eax
call   1060 <f3@plt>
jmp    1190 <main+0x30>
xor    %eax,%eax
call   1080 <f4@plt>
jmp    1190 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"\0Amain\00"
@.str.1 = [4 x i8] c":-P\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %37, %10, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = icmp ne i32 %5, 81
br i1 %6, label %7, label %38
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 10
br i1 %9, label %10, label %11
10: ; preds = %7
br label %4
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 49
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @f1()
br label %36
16: ; preds = %11
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 50
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @f2()
br label %35
21: ; preds = %16
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 51
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (...) @f3()
br label %34
26: ; preds = %21
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 52
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @f4()
br label %33
31: ; preds = %26
%32 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %24
br label %35
35: ; preds = %34, %19
br label %36
36: ; preds = %35, %14
br label %37
37: ; preds = %36
br label %4
38: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"\0Amain\00"
@.str.1 = [4 x i8] c":-P\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %8, %0
%3 = tail call i32 (...) @getchar()
switch i32 %3, label %13 [
i32 81, label %15
i32 10, label %8
i32 49, label %4
i32 50, label %6
i32 51, label %9
i32 52, label %11
]
4: ; preds = %2
%5 = tail call i32 (...) @f1()
br label %8
6: ; preds = %2
%7 = tail call i32 (...) @f2()
br label %8
8: ; preds = %6, %11, %13, %9, %4, %2
br label %2
9: ; preds = %2
%10 = tail call i32 (...) @f3()
br label %8
11: ; preds = %2
%12 = tail call i32 (...) @f4()
br label %8
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %8
15: ; preds = %2
ret i32 0
}