#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*/ create();
int /*<<< orphan*/ delete_by_priority(int);
int /*<<< orphan*/ display_pqueue();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ insert_by_priority(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, ch;
  printf("\n1 Insert");
  printf("\n2 Delete");
  printf("\n3 Display");
  printf("\n4 Exit");
  create();
  while (1) {
    printf("\nEnter your choice : ");
    scanf("%d", &ch);
    switch (ch) {
    case 1:
      printf("\nInsert Element : ");
      scanf("%d", &n);
      insert_by_priority(n);
      break;
    case 2:
      printf("\nEnter Element to Delete : ");
      scanf("%d", &n);
      delete_by_priority(n);
      break;
    case 3:
      display_pqueue();
      break;
    case 4:
      exit(0);
    default:
      printf("\n Invalid Choice");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <create@plt>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1260 <main+0xf0>
mov    -0x18(%rbp),%rax
lea    0xe0e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe3f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <insert_by_priority@plt>
jmp    126c <main+0xfc>
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
lea    0xe16(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1060 <delete_by_priority@plt>
jmp    126c <main+0xfc>
mov    $0x0,%al
call   1070 <display_pqueue@plt>
jmp    126c <main+0xfc>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
jmp    11b6 <main+0x46>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <create@plt>
lea    0xe7e(%rip),%r14
lea    0xe8d(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xe34(%rip),%r13
mov    %rsp,%rbp
lea    0xe8d(%rip),%r12
jmp    11e7 <main+0x77>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <display_pqueue@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1240 <main+0xd0>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%edi
call   1030 <insert_by_priority@plt>
jmp    11e7 <main+0x77>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
jmp    11e7 <main+0x77>
xchg   %ax,%ax
mov    %r12,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%edi
call   1060 <delete_by_priority@plt>
jmp    11e7 <main+0x77>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"\0A1 Insert\00"
@.str.1 = [10 x i8] c"\0A2 Delete\00"
@.str.2 = [11 x i8] c"\0A3 Display\00"
@.str.3 = [8 x i8] c"\0A4 Exit\00"
@.str.4 = [22 x i8] c"\0AEnter your choice : \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [19 x i8] c"\0AInsert Element : \00"
@.str.7 = [28 x i8] c"\0AEnter Element to Delete : \00"
@.str.8 = [17 x i8] c"\0A Invalid Choice\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (...) @create()
br label %9
9: ; preds = %0, %29
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
switch i32 %12, label %27 [
i32 1, label %13
i32 2, label %18
i32 3, label %23
i32 4, label %25
]
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %2
%17 = call i32 @insert_by_priority(i32 %16)
br label %29
18: ; preds = %9
%19 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%21 = load i32, i32* %2
%22 = call i32 @delete_by_priority(i32 %21)
br label %29
23: ; preds = %9
%24 = call i32 (...) @display_pqueue()
br label %29
25: ; preds = %9
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %9
%28 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %29
29: ; preds = %27, %23, %18, %13
br label %9
}

LLVM IR (-O2):
@.str = [10 x i8] c"\0A1 Insert\00"
@.str.1 = [10 x i8] c"\0A2 Delete\00"
@.str.2 = [11 x i8] c"\0A3 Display\00"
@.str.3 = [8 x i8] c"\0A4 Exit\00"
@.str.4 = [22 x i8] c"\0AEnter your choice : \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [19 x i8] c"\0AInsert Element : \00"
@.str.7 = [28 x i8] c"\0AEnter Element to Delete : \00"
@.str.8 = [17 x i8] c"\0A Invalid Choice\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 (...) @create()
br label %10
10: ; preds = %30, %0
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
switch i32 %13, label %28 [
i32 1, label %14
i32 2, label %19
i32 3, label %24
i32 4, label %26
]
14: ; preds = %10
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = call i32 @insert_by_priority(i32 %17)
br label %30
19: ; preds = %10
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%22 = load i32, i32* %1
%23 = call i32 @delete_by_priority(i32 %22)
br label %30
24: ; preds = %10
%25 = call i32 (...) @display_pqueue()
br label %30
26: ; preds = %10
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %10
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %30
30: ; preds = %28, %24, %19, %14
br label %10
}