#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 deletecq();
int /*<<< orphan*/ display();
int /*<<< orphan*/ insertcq(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  do {
    int choice, val;
    printf("\nCircular Queue\n1.Insert\n2.Delete\n3.Display\n4.Exit\nEnter "
           "your choice : ");
    scanf("%d", &choice);
    if (choice == 1) {
      printf("\nEnter the value ");
      scanf("%d", &val);
      insertcq(val);
    } else if (choice == 2) {
      val = deletecq();
      if (val != -1) {
        printf("\nThe deleted element is %d", val);
      }
    } else if (choice == 3) {
      display();
    } else {
      break;
    }
  } while (1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11b2 <main+0x62>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1060 <insertcq@plt>
jmp    120b <main+0xbb>
cmpl   $0x2,-0x8(%rbp)
jne    11e6 <main+0x96>
mov    $0x0,%al
call   1070 <deletecq@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     11e1 <main+0x91>
mov    -0xc(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <main+0xb6>
cmpl   $0x3,-0x8(%rbp)
jne    11fc <main+0xac>
mov    $0x0,%al
call   1030 <display@plt>
jmp    1201 <main+0xb1>
jmp    121f <main+0xcf>
jmp    1206 <main+0xb6>
jmp    120b <main+0xbb>
jmp    1210 <main+0xc0>
mov    $0x1,%al
test   $0x1,%al
jne    115f <main+0xf>
jmp    121f <main+0xcf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe9e(%rip),%r14
lea    0xf09(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xee5(%rip),%r12
lea    0xecc(%rip),%r13
mov    %rsp,%rbp
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11d0 <main+0x80>
cmp    $0x2,%eax
je     11e0 <main+0x90>
cmp    $0x1,%eax
jne    11fd <main+0xad>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%edi
call   1060 <insertcq@plt>
jmp    1180 <main+0x30>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <display@plt>
jmp    1180 <main+0x30>
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <deletecq@plt>
mov    %eax,(%rsp)
cmp    $0xffffffff,%eax
je     1180 <main+0x30>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [72 x i8] c"\0ACircular Queue\0A1.Insert\0A2.Delete\0A3.Display\0A4.Exit\0AEnter your choice : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"\0AEnter the value \00"
@.str.3 = [27 x i8] c"\0AThe deleted element is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %34, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = call i32 @insertcq(i32 %12)
br label %33
14: ; preds = %4
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = call i32 (...) @deletecq()
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21, %17
br label %32
25: ; preds = %14
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @display()
br label %31
30: ; preds = %25
br label %35
31: ; preds = %28
br label %32
32: ; preds = %31, %24
br label %33
33: ; preds = %32, %9
br label %34
34: ; preds = %33
br i1 true, label %4, label %35
35: ; preds = %34, %30
ret i32 0
}

LLVM IR (-O2):
@.str = [72 x i8] c"\0ACircular Queue\0A1.Insert\0A2.Delete\0A3.Display\0A4.Exit\0AEnter your choice : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"\0AEnter the value \00"
@.str.3 = [27 x i8] c"\0AThe deleted element is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %21, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %22 [
i32 1, label %9
i32 2, label %14
i32 3, label %19
]
9: ; preds = %5
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = call i32 @insertcq(i32 %12)
br label %21
14: ; preds = %5
%15 = call i32 (...) @deletecq()
store i32 %15, i32* %2
%16 = icmp eq i32 %15, -1
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %21
19: ; preds = %5
%20 = call i32 (...) @display()
br label %21
21: ; preds = %9, %14, %17, %19
br label %5
22: ; preds = %5
ret i32 0
}