#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 getOption();
int getSize();
int /*<<< orphan*/ patternFour(int);
int /*<<< orphan*/ patternOne(int);
int /*<<< orphan*/ patternThree(int);
int /*<<< orphan*/ patternTwo(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int patternOption;
  int patternSize;
  patternOption = getOption();
  while (patternOption != 5) {
    patternSize = getSize();
    switch (patternOption) {
    case 1:
      patternOne(patternSize);
      break;
    case 2:
      patternTwo(patternSize);
      break;
    case 3:
      patternThree(patternSize);
      break;
    case 4:
      patternFour(patternSize);
      break;
    default:
      printf("ERROR!!!");
    }
    patternOption = getOption();
  }
  printf("\n\nEnd of Program.  Thank you for playing!\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getOption@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     1215 <main+0xa5>
xor    %eax,%eax
call   1090 <getSize@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     11fa <main+0x8a>
mov    -0x18(%rbp),%rax
lea    0xe43(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xc(%rbp),%edi
call   1070 <patternOne@plt>
jmp    1206 <main+0x96>
mov    -0xc(%rbp),%edi
call   1040 <patternTwo@plt>
jmp    1206 <main+0x96>
mov    -0xc(%rbp),%edi
call   1080 <patternThree@plt>
jmp    1206 <main+0x96>
mov    -0xc(%rbp),%edi
call   1060 <patternFour@plt>
jmp    1206 <main+0x96>
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <getOption@plt>
mov    %eax,-0x8(%rbp)
jmp    1189 <main+0x19>
lea    0xdfd(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getOption@plt>
cmp    $0x5,%eax
jne    11a5 <main+0x25>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %eax,%ebx
lea    0xe62(%rip),%r14
lea    0xe4b(%rip),%r15
jmp    11de <main+0x5e>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <printf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getOption@plt>
mov    %eax,%ebx
cmp    $0x5,%eax
je     1191 <main+0x11>
xor    %eax,%eax
call   10a0 <getSize@plt>
add    $0xffffffff,%ebx
cmp    $0x3,%ebx
ja     11c0 <main+0x40>
movslq (%r15,%rbx,4),%rcx
add    %r15,%rcx
jmp    *%rcx
mov    %eax,%edi
call   1080 <patternOne@plt>
jmp    11d0 <main+0x50>
nop
mov    %eax,%edi
call   1050 <patternTwo@plt>
jmp    11d0 <main+0x50>
nopl   0x0(%rax)
mov    %eax,%edi
call   1090 <patternThree@plt>
jmp    11d0 <main+0x50>
nopl   0x0(%rax)
mov    %eax,%edi
call   1070 <patternFour@plt>
jmp    11d0 <main+0x50>

LLVM IR (-O0):
@.str = [9 x i8] c"ERROR!!!\00"
@.str.1 = [44 x i8] c"\0A\0AEnd of Program. Thank you for playing!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @getOption()
store i32 %4, i32* %2
br label %5
5: ; preds = %25, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 5
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = call i32 (...) @getSize()
store i32 %9, i32* %3
%10 = load i32, i32* %2
switch i32 %10, label %23 [
i32 1, label %11
i32 2, label %14
i32 3, label %17
i32 4, label %20
]
11: ; preds = %8
%12 = load i32, i32* %3
%13 = call i32 @patternOne(i32 %12)
br label %25
14: ; preds = %8
%15 = load i32, i32* %3
%16 = call i32 @patternTwo(i32 %15)
br label %25
17: ; preds = %8
%18 = load i32, i32* %3
%19 = call i32 @patternThree(i32 %18)
br label %25
20: ; preds = %8
%21 = load i32, i32* %3
%22 = call i32 @patternFour(i32 %21)
br label %25
23: ; preds = %8
%24 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %20, %17, %14, %11
%26 = call i32 (...) @getOption()
store i32 %26, i32* %2
br label %5
27: ; preds = %5
%28 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"ERROR!!!\00"
@str = [43 x i8] c"\0A\0AEnd of Program. Thank you for playing!\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getOption()
%2 = icmp eq i32 %1, 5
br i1 %2, label %19, label %3
3: ; preds = %0, %16
%4 = phi i32 [ %17, %16 ], [ %1, %0 ]
%5 = tail call i32 (...) @getSize()
switch i32 %4, label %14 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
]
6: ; preds = %3
%7 = tail call i32 @patternOne(i32 %5)
br label %16
8: ; preds = %3
%9 = tail call i32 @patternTwo(i32 %5)
br label %16
10: ; preds = %3
%11 = tail call i32 @patternThree(i32 %5)
br label %16
12: ; preds = %3
%13 = tail call i32 @patternFour(i32 %5)
br label %16
14: ; preds = %3
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %10, %8, %6
%17 = tail call i32 (...) @getOption()
%18 = icmp eq i32 %17, 5
br i1 %18, label %19, label %3
19: ; preds = %16, %0
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
ret i32 0
}