#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*/ delete ();
int /*<<< orphan*/ display();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ insert();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int choice;
  while (1) {
    printf("1. Insert element to queue\n");
    printf("2. Delete element from queue\n");
    printf("3. Display all elements of queue\n");
    printf("4. Quit \n");
    printf("Enter your choice: ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      insert();
      break;
    case 2:
      delete ();
      break;
    case 3:
      display();
      break;
    case 4:
      exit(1);
      break;
    default:
      printf("Wrong choice\n");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1212 <main+0xb2>
mov    -0x10(%rbp),%rax
lea    0xe25(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <insert@plt>
jmp    121e <main+0xbe>
mov    $0x0,%al
call   1070 <delete@plt>
jmp    121e <main+0xbe>
mov    $0x0,%al
call   1030 <display@plt>
jmp    121e <main+0xbe>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
jmp    116f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xedd(%rip),%r12
lea    0xef7(%rip),%r13
lea    0xe80(%rip),%rbx
lea    0xe8d(%rip),%rbp
lea    0x4(%rsp),%r14
lea    0xe5d(%rip),%r15
jmp    11b7 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <display@plt>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1210 <main+0xa0>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <insert@plt>
jmp    11b7 <main+0x47>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
jmp    11b7 <main+0x47>
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <delete@plt>
jmp    11b7 <main+0x47>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"1. Insert element to queue\0A\00"
@.str.1 = [30 x i8] c"2. Delete element from queue\0A\00"
@.str.2 = [34 x i8] c"3. Display all elements of queue\0A\00"
@.str.3 = [10 x i8] c"4. Quit \0A\00"
@.str.4 = [20 x i8] c"Enter your choice: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [14 x i8] c"Wrong choice\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %21
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
switch i32 %10, label %19 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
]
11: ; preds = %3
%12 = call i32 (...) @insert()
br label %21
13: ; preds = %3
%14 = call i32 (...) @delete()
br label %21
15: ; preds = %3
%16 = call i32 (...) @display()
br label %21
17: ; preds = %3
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %3
%20 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %19, %15, %13, %11
br label %3
}

LLVM IR (-O2):
@.str.4 = [20 x i8] c"Enter your choice: \00"
@.str.5 = [3 x i8] c"%d\00"
@str = [27 x i8] c"1. Insert element to queue\00"
@str.7 = [29 x i8] c"2. Delete element from queue\00"
@str.8 = [33 x i8] c"3. Display all elements of queue\00"
@str.9 = [9 x i8] c"4. Quit \00"
@str.10 = [13 x i8] c"Wrong choice\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %21, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.7, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %19 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
]
11: ; preds = %3
%12 = call i32 (...) @insert()
br label %21
13: ; preds = %3
%14 = call i32 (...) @delete()
br label %21
15: ; preds = %3
%16 = call i32 (...) @display()
br label %21
17: ; preds = %3
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %3
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
br label %21
21: ; preds = %19, %15, %13, %11
br label %3
}