#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*/ printf(char *);
void menu(int adt) {
  switch (adt) {
  case 1:
    printf("\n\t-----------------STACK ADT OPERATIONS-----------------");
    printf("\n\n\t1. Push  \t2. Pop \t\t3. isEmpty \t4. isFull");
    printf("\n\t5. Display\t6. atTop");
    printf("\n\t______________________________________________________\n");
    break;
  case 2:
    printf("\n\t-----------------QUEUE ADT OPERATIONS-----------------");
    printf("\n\n\t1. Insert  \t2. Delete \t3. isEmpty \t4. isFull");
    printf("\n\t5. Display\t6. Front\t7. Rear");
    printf("\n\t______________________________________________________\n");
    break;
  case 3:
    printf("\n\t------------CIRCULAR QUEUE ADT OPERATIONS-------------");
    printf("\n\n\t1.Insert  \t2. Delete \t3. isEmpty \t4. isFull");
    printf("\n\t5. Display\t6. Front\t7. Rear");
    printf("\n\t______________________________________________________\n");
    break;
  }
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1151 <menu+0x41>
jmp    112f <menu+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     1186 <menu+0x76>
jmp    1140 <menu+0x30>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     11bb <menu+0xab>
jmp    11eb <menu+0xdb>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
call   1030 <printf@plt>
jmp    11eb <menu+0xdb>
lea    0xf28(%rip),%rdi
call   1030 <printf@plt>
lea    0xf55(%rip),%rdi
call   1030 <printf@plt>
lea    0xf79(%rip),%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    11eb <menu+0xdb>
lea    0xf7a(%rip),%rdi
call   1030 <printf@plt>
lea    0xfa7(%rip),%rdi
call   1030 <printf@plt>
lea    0xf44(%rip),%rdi
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     118a <menu+0x6a>
push   %r15
push   %r14
push   %rbx
movslq %edi,%rax
lea    0x106d(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
lea    0x106b(%rip),%rcx
movslq (%rcx,%rax,4),%r15
add    %rcx,%r15
lea    0x1069(%rip),%rcx
movslq (%rcx,%rax,4),%r14
add    %rcx,%r14
lea    0x1067(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
call   1040 <printf@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>
ret

LLVM IR (-O0):
@.str = [57 x i8] c"\0A\09-----------------STACK ADT OPERATIONS-----------------\00"
@.str.1 = [44 x i8] c"\0A\0A\091. Push \092. Pop \09\093. isEmpty \094. isFull\00"
@.str.2 = [22 x i8] c"\0A\095. Display\096. atTop\00"
@.str.3 = [58 x i8] c"\0A\09______________________________________________________\0A\00"
@.str.4 = [57 x i8] c"\0A\09-----------------QUEUE ADT OPERATIONS-----------------\00"
@.str.5 = [48 x i8] c"\0A\0A\091. Insert \092. Delete \093. isEmpty \094. isFull\00"
@.str.6 = [30 x i8] c"\0A\095. Display\096. Front\097. Rear\00"
@.str.7 = [57 x i8] c"\0A\09------------CIRCULAR QUEUE ADT OPERATIONS-------------\00"
@.str.8 = [47 x i8] c"\0A\0A\091.Insert \092. Delete \093. isEmpty \094. isFull\00"
define void @menu(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %19 [
i32 1, label %4
i32 2, label %9
i32 3, label %14
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
br label %19
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
br label %19
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %1, %14, %9, %4
ret void
}

LLVM IR (-O2):
@.str = [57 x i8] c"\0A\09-----------------STACK ADT OPERATIONS-----------------\00"
@.str.1 = [44 x i8] c"\0A\0A\091. Push \092. Pop \09\093. isEmpty \094. isFull\00"
@.str.2 = [22 x i8] c"\0A\095. Display\096. atTop\00"
@.str.4 = [57 x i8] c"\0A\09-----------------QUEUE ADT OPERATIONS-----------------\00"
@.str.5 = [48 x i8] c"\0A\0A\091. Insert \092. Delete \093. isEmpty \094. isFull\00"
@.str.6 = [30 x i8] c"\0A\095. Display\096. Front\097. Rear\00"
@.str.7 = [57 x i8] c"\0A\09------------CIRCULAR QUEUE ADT OPERATIONS-------------\00"
@.str.8 = [47 x i8] c"\0A\0A\091.Insert \092. Delete \093. isEmpty \094. isFull\00"
@str.10 = [57 x i8] c"\0A\09______________________________________________________\00"
@reltable.menu = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.menu to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @.str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @.str.7 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu to i64)) to i32)]
@reltable.menu.14 = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([44 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.14 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([48 x i8]* @.str.5 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.14 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([47 x i8]* @.str.8 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.14 to i64)) to i32)]
@reltable.menu.15 = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.15 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str.6 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.15 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str.6 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.15 to i64)) to i32)]
@reltable.menu.16 = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @str.10 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.16 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @str.10 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.16 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @str.10 to i64), i64 ptrtoint ([3 x i32]* @reltable.menu.16 to i64)) to i32)]
define void @menu(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %21
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.menu to i8*), i64 %6)
%8 = sext i32 %2 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.menu.14 to i8*), i64 %9)
%11 = sext i32 %2 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.menu.15 to i8*), i64 %12)
%14 = sext i32 %2 to i64
%15 = shl i64 %14, 2
%16 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.menu.16 to i8*), i64 %15)
%17 = tail call i32 @printf(i8* dereferenceable(1) %7)
%18 = tail call i32 @printf(i8* dereferenceable(1) %10)
%19 = tail call i32 @printf(i8* dereferenceable(1) %13)
%20 = tail call i32 @puts(i8* dereferenceable(1) %16)
br label %21
21: ; preds = %1, %4
ret void
}