#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*/ bit_manip_main();
int /*<<< orphan*/ interesting_main();
int /*<<< orphan*/ print_options_main();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int /*<<< orphan*/ str_manip_main();
int /*<<< orphan*/ struct_union_main();
int main() {
  unsigned int option = 0;
  unsigned int exit_count = 0;
  while (exit_count < 5) {
    print_options_main();
    scanf("%d", &option);
    if (0 == option) {
      printf("Hope you enjoyed learning, Goodbye!!!\r\n");
      break;
    }
    switch (option) {
    case 1:
      bit_manip_main();
      exit_count = 0;
      break;
    case 2:
      exit_count = 0;
      break;
    case 3:
      struct_union_main();
      exit_count = 0;
      break;
    case 4:
      exit_count = 0;
      break;
    case 5:
      str_manip_main();
      exit_count = 0;
      break;
    case 6:
      interesting_main();
      exit_count = 0;
      break;
    default:
      printf("Wrong option!!! Try again\r\n");
      exit_count++;
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jae    1271 <main+0x101>
mov    $0x0,%al
call   1080 <print_options_main@plt>
lea    0xe73(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jne    11ca <main+0x5a>
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
jmp    1271 <main+0x101>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     1257 <main+0xe7>
mov    -0x18(%rbp),%rax
lea    0xe16(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <bit_manip_main@plt>
movl   $0x0,-0xc(%rbp)
jmp    126c <main+0xfc>
movl   $0x0,-0xc(%rbp)
jmp    126c <main+0xfc>
mov    $0x0,%al
call   1050 <struct_union_main@plt>
movl   $0x0,-0xc(%rbp)
jmp    126c <main+0xfc>
movl   $0x0,-0xc(%rbp)
jmp    126c <main+0xfc>
mov    $0x0,%al
call   1070 <str_manip_main@plt>
movl   $0x0,-0xc(%rbp)
jmp    126c <main+0xfc>
mov    $0x0,%al
call   1030 <interesting_main@plt>
movl   $0x0,-0xc(%rbp)
jmp    126c <main+0xfc>
lea    0xde5(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xe91(%rip),%r14
lea    0xc(%rsp),%r12
lea    0xe88(%rip),%r15
lea    0xe62(%rip),%rbx
xor    %ebp,%ebp
jmp    11b5 <main+0x45>
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
nopl   (%rax)
cmp    $0x5,%ebp
jae    1214 <main+0xa4>
xor    %eax,%eax
call   1080 <print_options_main@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x6,%rax
ja     11a2 <main+0x32>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
xor    %ebp,%ebp
jmp    *%rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1090 <bit_manip_main@plt>
jmp    11b0 <main+0x40>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <struct_union_main@plt>
jmp    11b0 <main+0x40>
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <str_manip_main@plt>
jmp    11b0 <main+0x40>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <interesting_main@plt>
jmp    11b0 <main+0x40>
lea    0xe2b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [40 x i8] c"Hope you enjoyed learning, Goodbye!!!\0D\0A\00"
@.str.2 = [28 x i8] c"Wrong option!!! Try again\0D\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %30, %0
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 5
br i1 %6, label %7, label %31
7: ; preds = %4
%8 = call i32 (...) @print_options_main()
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp eq i32 0, %10
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %31
14: ; preds = %7
%15 = load i32, i32* %2
switch i32 %15, label %26 [
i32 1, label %16
i32 2, label %18
i32 3, label %19
i32 4, label %21
i32 5, label %22
i32 6, label %24
]
16: ; preds = %14
%17 = call i32 (...) @bit_manip_main()
store i32 0, i32* %3
br label %30
18: ; preds = %14
store i32 0, i32* %3
br label %30
19: ; preds = %14
%20 = call i32 (...) @struct_union_main()
store i32 0, i32* %3
br label %30
21: ; preds = %14
store i32 0, i32* %3
br label %30
22: ; preds = %14
%23 = call i32 (...) @str_manip_main()
store i32 0, i32* %3
br label %30
24: ; preds = %14
%25 = call i32 (...) @interesting_main()
store i32 0, i32* %3
br label %30
26: ; preds = %14
%27 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* %3
%29 = add i32 %28, 1
store i32 %29, i32* %3
br label %30
30: ; preds = %26, %24, %22, %21, %19, %18, %16
br label %4
31: ; preds = %12, %4
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [27 x i8] c"Wrong option!!! Try again\0D\00"
@str.3 = [39 x i8] c"Hope you enjoyed learning, Goodbye!!!\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %21
%4 = phi i32 [ 0, %0 ], [ %22, %21 ]
%5 = call i32 (...) @print_options_main()
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %18 [
i32 0, label %8
i32 1, label %10
i32 2, label %21
i32 3, label %12
i32 4, label %21
i32 5, label %14
i32 6, label %16
]
8: ; preds = %3
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.3, i64 0, i64 0))
br label %24
10: ; preds = %3
%11 = call i32 (...) @bit_manip_main()
br label %21
12: ; preds = %3
%13 = call i32 (...) @struct_union_main()
br label %21
14: ; preds = %3
%15 = call i32 (...) @str_manip_main()
br label %21
16: ; preds = %3
%17 = call i32 (...) @interesting_main()
br label %21
18: ; preds = %3
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%20 = add nuw nsw i32 %4, 1
br label %21
21: ; preds = %3, %3, %18, %16, %14, %12, %10
%22 = phi i32 [ %20, %18 ], [ 0, %16 ], [ 0, %14 ], [ 0, %12 ], [ 0, %10 ], [ 0, %3 ], [ 0, %3 ]
%23 = icmp ult i32 %22, 5
br i1 %23, label %3, label %24
24: ; preds = %21, %8
ret i32 0
}