#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 delete ();
int /*<<< orphan*/ display();
int /*<<< orphan*/ insert(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int opn, elem;
  do {
    printf("Linked List Implementation of QUEUE Operations ### \n\n");
    printf("Press 1-Insert, 2-Delete, 3-Display,4-Exit\n");
    printf("Your option ? ");
    scanf("%d", &opn);
    switch (opn) {
    case 1:
      printf("Insert value of node: ");
      scanf("%d", &elem);
      insert(elem);
      break;
    case 2:
      elem = delete ();
      if (elem != -1)
        printf("Deleted node: %d\n", elem);
      break;
    case 3:
      printf("Linked List Implementation of Queue: Status:\n");
      display();
      break;
    case 4:
      printf("Terminating.\n");
      break;
    default:
      printf("Invalid option\n");
    }
  } while (opn != 4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xee9(%rip),%rdi
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1249 <main+0xf9>
mov    -0x18(%rbp),%rax
lea    0xe42(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1060 <insert@plt>
jmp    1257 <main+0x107>
mov    $0x0,%al
call   1070 <delete@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     1217 <main+0xc7>
mov    -0xc(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1257 <main+0x107>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <display@plt>
jmp    1257 <main+0x107>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1257 <main+0x107>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125c <main+0x10c>
cmpl   $0x4,-0x8(%rbp)
jne    115f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed9(%rip),%r14
lea    0xf07(%rip),%r15
lea    0xe90(%rip),%r12
lea    0xe98(%rip),%rbx
lea    0x4(%rsp),%r13
lea    0xe6d(%rip),%rbp
jmp    11b7 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xf3e(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x4,0x4(%rsp)
je     127c <main+0x11c>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11a0 <main+0x40>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
lea    0xe29(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%edi
call   1070 <insert@plt>
jmp    11ac <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <delete@plt>
mov    %eax,(%rsp)
cmp    $0xffffffff,%eax
je     11ac <main+0x4c>
lea    0xdff(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ac <main+0x4c>
nopl   0x0(%rax,%rax,1)
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <display@plt>
jmp    11ac <main+0x4c>
nopl   0x0(%rax,%rax,1)
lea    0xe34(%rip),%rdi
jmp    11a7 <main+0x47>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Linked List Implementation of QUEUE Operations ### \0A\0A\00"
@.str.1 = [44 x i8] c"Press 1-Insert, 2-Delete, 3-Display,4-Exit\0A\00"
@.str.2 = [15 x i8] c"Your option ? \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [23 x i8] c"Insert value of node: \00"
@.str.5 = [18 x i8] c"Deleted node: %d\0A\00"
@.str.6 = [46 x i8] c"Linked List Implementation of Queue: Status:\0A\00"
@.str.7 = [14 x i8] c"Terminating.\0A\00"
@.str.8 = [16 x i8] c"Invalid option\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %31, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %28 [
i32 1, label %10
i32 2, label %15
i32 3, label %23
i32 4, label %26
]
10: ; preds = %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = call i32 @insert(i32 %13)
br label %30
15: ; preds = %4
%16 = call i32 (...) @delete()
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %15
br label %30
23: ; preds = %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 (...) @display()
br label %30
26: ; preds = %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %30
28: ; preds = %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %30
30: ; preds = %28, %26, %23, %22, %10
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = icmp ne i32 %32, 4
br i1 %33, label %4, label %34
34: ; preds = %31
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str.2 = [15 x i8] c"Your option ? \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [23 x i8] c"Insert value of node: \00"
@.str.5 = [18 x i8] c"Deleted node: %d\0A\00"
@str = [53 x i8] c"Linked List Implementation of QUEUE Operations ### \0A\00"
@str.9 = [43 x i8] c"Press 1-Insert, 2-Delete, 3-Display,4-Exit\00"
@str.10 = [13 x i8] c"Terminating.\00"
@str.11 = [45 x i8] c"Linked List Implementation of Queue: Status:\00"
@str.12 = [15 x i8] c"Invalid option\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 = %28, %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.9, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %26 [
i32 1, label %11
i32 2, label %16
i32 3, label %21
i32 4, label %24
]
11: ; preds = %5
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = call i32 @insert(i32 %14)
br label %28
16: ; preds = %5
%17 = call i32 (...) @delete()
store i32 %17, i32* %2
%18 = icmp eq i32 %17, -1
br i1 %18, label %28, label %19
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %17)
br label %28
21: ; preds = %5
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.11, i64 0, i64 0))
%23 = call i32 (...) @display()
br label %28
24: ; preds = %5
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
br label %28
26: ; preds = %5
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
br label %28
28: ; preds = %11, %21, %24, %26, %19, %16
%29 = load i32, i32* %1
%30 = icmp eq i32 %29, 4
br i1 %30, label %31, label %5
31: ; preds = %28
ret i32 0
}