#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*/ displayHelloWorld();
int /*<<< orphan*/ displayLoops();
int /*<<< orphan*/ displayMenu();
int /*<<< orphan*/ nestedLoops();
int /*<<< orphan*/ printSquares();
int /*<<< orphan*/ printTriangle();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int choice;
  do {
    displayMenu();
    scanf("%d", &choice);
    if (choice == 1) {
      displayHelloWorld();
    } else if (choice == 2) {
      displayLoops();
    } else if (choice == 3) {
      printSquares();
    } else if (choice == 4) {
      printTriangle();
    } else if (choice == 5) {
      nestedLoops();
    } else
      return 0;
  } while (choice != 6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <displayMenu@plt>
lea    0xe73(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11ac <main+0x3c>
mov    $0x0,%al
call   1050 <displayHelloWorld@plt>
jmp    1224 <main+0xb4>
cmpl   $0x2,-0x8(%rbp)
jne    11c2 <main+0x52>
mov    $0x0,%al
call   1080 <displayLoops@plt>
jmp    121f <main+0xaf>
cmpl   $0x3,-0x8(%rbp)
jne    11d8 <main+0x68>
mov    $0x0,%al
call   1060 <printSquares@plt>
jmp    121a <main+0xaa>
cmpl   $0x4,-0x8(%rbp)
jne    11ee <main+0x7e>
mov    $0x0,%al
call   1070 <printTriangle@plt>
jmp    1215 <main+0xa5>
cmpl   $0x5,-0x8(%rbp)
jne    1204 <main+0x94>
mov    $0x0,%al
call   1030 <nestedLoops@plt>
jmp    1210 <main+0xa0>
movl   $0x0,-0x4(%rbp)
jmp    123a <main+0xca>
jmp    1215 <main+0xa5>
jmp    121a <main+0xaa>
jmp    121f <main+0xaf>
jmp    1224 <main+0xb4>
jmp    1229 <main+0xb9>
cmpl   $0x6,-0x8(%rbp)
jne    117f <main+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe94(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe74(%rip),%rbx
jmp    11a7 <main+0x37>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <nestedLoops@plt>
nopw   0x0(%rax,%rax,1)
cmpl   $0x6,0xc(%rsp)
je     1209 <main+0x99>
xor    %eax,%eax
call   1040 <displayMenu@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1209 <main+0x99>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1050 <displayHelloWorld@plt>
jmp    11a0 <main+0x30>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <displayLoops@plt>
jmp    11a0 <main+0x30>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <printSquares@plt>
jmp    11a0 <main+0x30>
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <printTriangle@plt>
jmp    11a0 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %36, %0
%4 = call i32 (...) @displayMenu()
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = call i32 (...) @displayHelloWorld()
br label %35
10: ; preds = %3
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @displayLoops()
br label %34
15: ; preds = %10
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (...) @printSquares()
br label %33
20: ; preds = %15
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 4
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @printTriangle()
br label %32
25: ; preds = %20
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 5
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @nestedLoops()
br label %31
30: ; preds = %25
store i32 0, i32* %1
br label %40
31: ; preds = %28
br label %32
32: ; preds = %31, %23
br label %33
33: ; preds = %32, %18
br label %34
34: ; preds = %33, %13
br label %35
35: ; preds = %34, %8
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = icmp ne i32 %37, 6
br i1 %38, label %3, label %39
39: ; preds = %36
store i32 0, i32* %1
br label %40
40: ; preds = %39, %30
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %17, %0
%4 = call i32 (...) @displayMenu()
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
switch i32 %6, label %20 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
]
7: ; preds = %3
%8 = call i32 (...) @displayHelloWorld()
br label %17
9: ; preds = %3
%10 = call i32 (...) @displayLoops()
br label %17
11: ; preds = %3
%12 = call i32 (...) @printSquares()
br label %17
13: ; preds = %3
%14 = call i32 (...) @printTriangle()
br label %17
15: ; preds = %3
%16 = call i32 (...) @nestedLoops()
br label %17
17: ; preds = %7, %11, %15, %13, %9
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, 6
br i1 %19, label %20, label %3
20: ; preds = %17, %3
ret i32 0
}