#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*/ print_options_main();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *);
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:
      printf("case 2\r\n");
      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    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jae    1204 <main+0xc4>
mov    $0x0,%al
call   1050 <print_options_main@plt>
lea    0xe8b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jne    119a <main+0x5a>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    1204 <main+0xc4>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11bf <main+0x7f>
jmp    11ae <main+0x6e>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11d2 <main+0x92>
jmp    11ea <main+0xaa>
mov    $0x0,%al
call   1060 <bit_manip_main@plt>
movl   $0x0,-0xc(%rbp)
jmp    11ff <main+0xbf>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    11ff <main+0xbf>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%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    0xea5(%rip),%r14
lea    0xc(%rsp),%rbx
lea    0xe9c(%rip),%r15
lea    0xe9d(%rip),%r12
xor    %ebp,%ebp
jmp    118f <main+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
cmp    $0x5,%ebp
jae    11d7 <main+0x97>
xor    %eax,%eax
call   1050 <print_options_main@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     11c0 <main+0x80>
cmp    $0x2,%eax
je     1180 <main+0x40>
test   %eax,%eax
je     11cb <main+0x8b>
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
jmp    118a <main+0x4a>
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <bit_manip_main@plt>
jmp    118a <main+0x4a>
lea    0xe54(%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 = [9 x i8] c"case 2\0D\0A\00"
@.str.3 = [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 = %24, %0
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 5
br i1 %6, label %7, label %25
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 %25
14: ; preds = %7
%15 = load i32, i32* %2
switch i32 %15, label %20 [
i32 1, label %16
i32 2, label %18
]
16: ; preds = %14
%17 = call i32 (...) @bit_manip_main()
store i32 0, i32* %3
br label %24
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %24
20: ; preds = %14
%21 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = add i32 %22, 1
store i32 %23, i32* %3
br label %24
24: ; preds = %20, %18, %16
br label %4
25: ; preds = %12, %4
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [8 x i8] c"case 2\0D\00"
@str.4 = [27 x i8] c"Wrong option!!! Try again\0D\00"
@str.5 = [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, %17
%4 = phi i32 [ 0, %0 ], [ %18, %17 ]
%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 %14 [
i32 0, label %8
i32 1, label %10
i32 2, label %12
]
8: ; preds = %3
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.5, i64 0, i64 0))
br label %20
10: ; preds = %3
%11 = call i32 (...) @bit_manip_main()
br label %17
12: ; preds = %3
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %17
14: ; preds = %3
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.4, i64 0, i64 0))
%16 = add nuw nsw i32 %4, 1
br label %17
17: ; preds = %14, %12, %10
%18 = phi i32 [ %16, %14 ], [ 0, %12 ], [ 0, %10 ]
%19 = icmp ult i32 %18, 5
br i1 %19, label %3, label %20
20: ; preds = %17, %8
ret i32 0
}