#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*/ part1_main();
int /*<<< orphan*/ part2_main();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int input = 0;
  while (1) {
    printf("\nChoose a Part of the Lab to Run:\n 1- Part 1\n 2- Part 2\n 3- "
           "Quit\n");
    scanf(" %d", &input);
    if (input == 1)
      part1_main();
    else if (input == 2)
      part2_main();
    else if (input == 3)
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1188 <main+0x48>
mov    $0x0,%al
call   1040 <part1_main@plt>
jmp    11b7 <main+0x77>
cmpl   $0x2,-0x8(%rbp)
jne    119e <main+0x5e>
mov    $0x0,%al
call   1060 <part2_main@plt>
jmp    11b2 <main+0x72>
cmpl   $0x3,-0x8(%rbp)
jne    11ad <main+0x6d>
jmp    11bc <main+0x7c>
jmp    11b2 <main+0x72>
jmp    11b7 <main+0x77>
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xeac(%rip),%r14
lea    0xea1(%rip),%r15
lea    0xc(%rsp),%rbx
jmp    1177 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <part2_main@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     11a0 <main+0x60>
cmp    $0x2,%eax
je     1170 <main+0x30>
cmp    $0x3,%eax
jne    1177 <main+0x37>
jmp    11a9 <main+0x69>
nop
xor    %eax,%eax
call   1040 <part1_main@plt>
jmp    1177 <main+0x37>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [66 x i8] c"\0AChoose a Part of the Lab to Run:\0A 1- Part 1\0A 2- Part 2\0A 3- Quit\0A\00"
@.str.1 = [4 x i8] c" %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %0, %21
%4 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, 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 (...) @part1_main()
br label %21
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 (...) @part2_main()
br label %20
15: ; preds = %10
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %19
18: ; preds = %15
br label %22
19: ; preds = %15
br label %20
20: ; preds = %19, %13
br label %21
21: ; preds = %20, %8
br label %3
22: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c" %d\00"
@str = [65 x i8] c"\0AChoose a Part of the Lab to Run:\0A 1- Part 1\0A 2- Part 2\0A 3- Quit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
switch i32 %6, label %7 [
i32 1, label %8
i32 2, label %10
i32 3, label %12
]
7: ; preds = %3, %10, %8
br label %3
8: ; preds = %3
%9 = call i32 (...) @part1_main()
br label %7
10: ; preds = %3
%11 = call i32 (...) @part2_main()
br label %7
12: ; preds = %3
ret i32 0
}