#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*/ deleteleft2();
int /*<<< orphan*/ display2();
int /*<<< orphan*/ insertleft2();
int /*<<< orphan*/ insertright2();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void outputdeque2() {
  printf("\n\t\t\t\t\t\t\t\t\tOUTPUT RESTRICTED DEQUE");
  printf("\n\t\t\t\t\t\t\t\t\t1.Insert at right");
  printf("\n\t\t\t\t\t\t\t\t\t2.Delete at left");
  printf("\n\t\t\t\t\t\t\t\t\t3.Delete from left");
  printf("\n\t\t\t\t\t\t\t\t\t4.Display");
  printf("\n\t\t\t\t\t\t\t\t\t5.Quit");
  int option;
  do {
    printf("\n\t\t\t\t\t\t\t\t\t   Enter the option: ");
    scanf("%d", &option);
    switch (option) {
    case 1:
      insertright2();
      break;
    case 2:
      insertleft2();
      break;
    case 3:
      deleteleft2();
      break;
    case 4:
      display2();
      break;
    case 5:
      break;
    default:
      printf("\n\t\t\t\t\t\t\t\t\tOPTION DOESN\'T EXIST TRY AGAIN");
    }
  } while (option != 5);
}


x86 assembly (clang, -O0):
<outputdeque2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
lea    0xeda(%rip),%rdi
call   1040 <printf@plt>
lea    0xeeb(%rip),%rdi
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
call   1040 <printf@plt>
lea    0xef8(%rip),%rdi
call   1040 <printf@plt>
lea    0xf0c(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     122a <outputdeque2+0xca>
mov    -0x10(%rbp),%rax
lea    0xe14(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <insertright2@plt>
jmp    1236 <outputdeque2+0xd6>
mov    $0x0,%al
call   1070 <insertleft2@plt>
jmp    1236 <outputdeque2+0xd6>
mov    $0x0,%al
call   1030 <deleteleft2@plt>
jmp    1236 <outputdeque2+0xd6>
mov    $0x0,%al
call   1050 <display2@plt>
jmp    1236 <outputdeque2+0xd6>
jmp    1236 <outputdeque2+0xd6>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
jmp    123b <outputdeque2+0xdb>
cmpl   $0x5,-0x4(%rbp)
jne    11b0 <outputdeque2+0x50>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputdeque2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
call   1040 <printf@plt>
lea    0xeee(%rip),%rdi
call   1040 <printf@plt>
lea    0xef3(%rip),%r14
lea    0xf0c(%rip),%r15
lea    0xc(%rsp),%r13
lea    0xf03(%rip),%r12
lea    0xe2a(%rip),%rbx
jmp    11f7 <outputdeque2+0x97>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <printf@plt>
nopl   0x0(%rax,%rax,1)
cmpl   $0x5,0xc(%rsp)
je     1259 <outputdeque2+0xf9>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11e0 <outputdeque2+0x80>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <insertright2@plt>
jmp    11f0 <outputdeque2+0x90>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <insertleft2@plt>
jmp    11f0 <outputdeque2+0x90>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <deleteleft2@plt>
jmp    11f0 <outputdeque2+0x90>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <display2@plt>
jmp    11f0 <outputdeque2+0x90>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0A\09\09\09\09\09\09\09\09\09OUTPUT RESTRICTED DEQUE\00"
@.str.1 = [28 x i8] c"\0A\09\09\09\09\09\09\09\09\091.Insert at right\00"
@.str.2 = [27 x i8] c"\0A\09\09\09\09\09\09\09\09\092.Delete at left\00"
@.str.3 = [29 x i8] c"\0A\09\09\09\09\09\09\09\09\093.Delete from left\00"
@.str.4 = [20 x i8] c"\0A\09\09\09\09\09\09\09\09\094.Display\00"
@.str.5 = [17 x i8] c"\0A\09\09\09\09\09\09\09\09\095.Quit\00"
@.str.6 = [32 x i8] c"\0A\09\09\09\09\09\09\09\09\09 Enter the option: \00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [41 x i8] c"\0A\09\09\09\09\09\09\09\09\09OPTION DOESN'T EXIST TRY AGAIN\00"
define void @outputdeque2() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %8
8: ; preds = %24, %0
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
switch i32 %11, label %21 [
i32 1, label %12
i32 2, label %14
i32 3, label %16
i32 4, label %18
i32 5, label %20
]
12: ; preds = %8
%13 = call i32 (...) @insertright2()
br label %23
14: ; preds = %8
%15 = call i32 (...) @insertleft2()
br label %23
16: ; preds = %8
%17 = call i32 (...) @deleteleft2()
br label %23
18: ; preds = %8
%19 = call i32 (...) @display2()
br label %23
20: ; preds = %8
br label %23
21: ; preds = %8
%22 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
br label %23
23: ; preds = %21, %20, %18, %16, %14, %12
br label %24
24: ; preds = %23
%25 = load i32, i32* %1
%26 = icmp ne i32 %25, 5
br i1 %26, label %8, label %27
27: ; preds = %24
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"\0A\09\09\09\09\09\09\09\09\09OUTPUT RESTRICTED DEQUE\00"
@.str.1 = [28 x i8] c"\0A\09\09\09\09\09\09\09\09\091.Insert at right\00"
@.str.2 = [27 x i8] c"\0A\09\09\09\09\09\09\09\09\092.Delete at left\00"
@.str.3 = [29 x i8] c"\0A\09\09\09\09\09\09\09\09\093.Delete from left\00"
@.str.4 = [20 x i8] c"\0A\09\09\09\09\09\09\09\09\094.Display\00"
@.str.5 = [17 x i8] c"\0A\09\09\09\09\09\09\09\09\095.Quit\00"
@.str.6 = [32 x i8] c"\0A\09\09\09\09\09\09\09\09\09 Enter the option: \00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [41 x i8] c"\0A\09\09\09\09\09\09\09\09\09OPTION DOESN'T EXIST TRY AGAIN\00"
define void @outputdeque2() {
%1 = alloca i32
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%8 = bitcast i32* %1 to i8*
br label %9
9: ; preds = %23, %0
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
switch i32 %12, label %21 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %19
i32 5, label %26
]
13: ; preds = %9
%14 = call i32 (...) @insertright2()
br label %23
15: ; preds = %9
%16 = call i32 (...) @insertleft2()
br label %23
17: ; preds = %9
%18 = call i32 (...) @deleteleft2()
br label %23
19: ; preds = %9
%20 = call i32 (...) @display2()
br label %23
21: ; preds = %9
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
br label %23
23: ; preds = %13, %15, %17, %19, %21
%24 = load i32, i32* %1
%25 = icmp eq i32 %24, 5
br i1 %25, label %26, label %9
26: ; preds = %9, %23
ret void
}