#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 */
struct pqNode {
  int dummy;
};
struct graph {
  int dummy;
};

/* Variables and functions */
struct graph *buildGraph();
int deleteMin(struct pqNode **);
int /*<<< orphan*/ dijkstra(struct graph *, int /*<<< orphan*/);
int /*<<< orphan*/ displayGraph(struct graph *);
int /*<<< orphan*/ displayPQ(struct pqNode *);
scalar_t__ isEmptyPQ(struct pqNode *);
int peekQ(struct pqNode *);
int /*<<< orphan*/ popQ(struct pqNode **);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pushQ(struct pqNode **, int, int);
int main() {
  struct pqNode *head = NULL;
  pushQ(&head, 12, 1);
  pushQ(&head, 22, 2);
  pushQ(&head, 42, 4);
  pushQ(&head, 62, 6);
  pushQ(&head, 72, 7);
  pushQ(&head, 52, 5);
  pushQ(&head, 82, 8);
  pushQ(&head, 92, 9);
  pushQ(&head, 32, 3);
  displayPQ(head);
  if (isEmptyPQ(head) == 0)
    printf("top node is %d\n", peekQ(head));
  popQ(&head);
  popQ(&head);
  popQ(&head);
  popQ(&head);
  displayPQ(head);
  if (isEmptyPQ(head) == 0)
    printf("top node is %d\n", peekQ(head));
  int minVal = deleteMin(&head);
  printf("min node  val is %d\n", minVal);
  displayPQ(head);
  struct graph *grp = NULL;
  grp = buildGraph();
  displayGraph(grp);
  dijkstra(grp, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x16,%esi
mov    $0x2,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x2a,%esi
mov    $0x4,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3e,%esi
mov    $0x6,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x48,%esi
mov    $0x7,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x34,%esi
mov    $0x5,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x52,%esi
mov    $0x8,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x5c,%esi
mov    $0x9,%edx
call   10a0 <pushQ@plt>
lea    -0x10(%rbp),%rdi
mov    $0x20,%esi
mov    $0x3,%edx
call   10a0 <pushQ@plt>
mov    -0x10(%rbp),%rdi
call   1080 <displayPQ@plt>
mov    -0x10(%rbp),%rdi
call   1090 <isEmptyPQ@plt>
cmp    $0x0,%rax
jne    1295 <main+0xf5>
mov    -0x10(%rbp),%rdi
call   1030 <peekQ@plt>
mov    %eax,%esi
lea    0xd70(%rip),%rdi
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
call   10c0 <popQ@plt>
lea    -0x10(%rbp),%rdi
call   10c0 <popQ@plt>
lea    -0x10(%rbp),%rdi
call   10c0 <popQ@plt>
lea    -0x10(%rbp),%rdi
call   10c0 <popQ@plt>
mov    -0x10(%rbp),%rdi
call   1080 <displayPQ@plt>
mov    -0x10(%rbp),%rdi
call   1090 <isEmptyPQ@plt>
cmp    $0x0,%rax
jne    12ec <main+0x14c>
mov    -0x10(%rbp),%rdi
call   1030 <peekQ@plt>
mov    %eax,%esi
lea    0xd19(%rip),%rdi
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1070 <deleteMin@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xd0e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <displayPQ@plt>
movq   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <buildGraph@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <displayGraph@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   10b0 <dijkstra@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x1,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x16,%esi
mov    $0x2,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    $0x4,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x3e,%esi
mov    $0x6,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x48,%esi
mov    $0x7,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x34,%esi
mov    $0x5,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x52,%esi
mov    $0x8,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x5c,%esi
mov    $0x9,%edx
call   10a0 <pushQ@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x3,%edx
call   10a0 <pushQ@plt>
mov    0x8(%rsp),%rdi
call   1080 <displayPQ@plt>
mov    0x8(%rsp),%rdi
call   1090 <isEmptyPQ@plt>
test   %rax,%rax
jne    1286 <main+0xe6>
mov    0x8(%rsp),%rdi
call   1030 <peekQ@plt>
lea    0xd81(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <popQ@plt>
mov    %rbx,%rdi
call   10c0 <popQ@plt>
mov    %rbx,%rdi
call   10c0 <popQ@plt>
mov    %rbx,%rdi
call   10c0 <popQ@plt>
mov    0x8(%rsp),%rdi
call   1080 <displayPQ@plt>
mov    0x8(%rsp),%rdi
call   1090 <isEmptyPQ@plt>
test   %rax,%rax
jne    12dc <main+0x13c>
mov    0x8(%rsp),%rdi
call   1030 <peekQ@plt>
lea    0xd2b(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1070 <deleteMin@plt>
lea    0xd23(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x8(%rsp),%rdi
call   1080 <displayPQ@plt>
xor    %eax,%eax
call   1050 <buildGraph@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <displayGraph@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <dijkstra@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.pqNode = type { i32 }
%struct.graph = type { i32 }
@.str = [16 x i8] c"top node is %d\0A\00"
@.str.1 = [21 x i8] c"min node val is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.pqNode*
%3 = alloca i32
%4 = alloca %struct.graph*
store i32 0, i32* %1
store %struct.pqNode* null, %struct.pqNode** %2
%5 = call i32 @pushQ(%struct.pqNode** %2, i32 12, i32 1)
%6 = call i32 @pushQ(%struct.pqNode** %2, i32 22, i32 2)
%7 = call i32 @pushQ(%struct.pqNode** %2, i32 42, i32 4)
%8 = call i32 @pushQ(%struct.pqNode** %2, i32 62, i32 6)
%9 = call i32 @pushQ(%struct.pqNode** %2, i32 72, i32 7)
%10 = call i32 @pushQ(%struct.pqNode** %2, i32 52, i32 5)
%11 = call i32 @pushQ(%struct.pqNode** %2, i32 82, i32 8)
%12 = call i32 @pushQ(%struct.pqNode** %2, i32 92, i32 9)
%13 = call i32 @pushQ(%struct.pqNode** %2, i32 32, i32 3)
%14 = load %struct.pqNode*, %struct.pqNode** %2
%15 = call i32 @displayPQ(%struct.pqNode* %14)
%16 = load %struct.pqNode*, %struct.pqNode** %2
%17 = call i64 @isEmptyPQ(%struct.pqNode* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %0
%20 = load %struct.pqNode*, %struct.pqNode** %2
%21 = call i32 @peekQ(%struct.pqNode* %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %0
%24 = call i32 @popQ(%struct.pqNode** %2)
%25 = call i32 @popQ(%struct.pqNode** %2)
%26 = call i32 @popQ(%struct.pqNode** %2)
%27 = call i32 @popQ(%struct.pqNode** %2)
%28 = load %struct.pqNode*, %struct.pqNode** %2
%29 = call i32 @displayPQ(%struct.pqNode* %28)
%30 = load %struct.pqNode*, %struct.pqNode** %2
%31 = call i64 @isEmptyPQ(%struct.pqNode* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %23
%34 = load %struct.pqNode*, %struct.pqNode** %2
%35 = call i32 @peekQ(%struct.pqNode* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %33, %23
%38 = call i32 @deleteMin(%struct.pqNode** %2)
store i32 %38, i32* %3
%39 = load i32, i32* %3
%40 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = load %struct.pqNode*, %struct.pqNode** %2
%42 = call i32 @displayPQ(%struct.pqNode* %41)
store %struct.graph* null, %struct.graph** %4
%43 = call %struct.graph* (...) @buildGraph()
store %struct.graph* %43, %struct.graph** %4
%44 = load %struct.graph*, %struct.graph** %4
%45 = call i32 @displayGraph(%struct.graph* %44)
%46 = load %struct.graph*, %struct.graph** %4
%47 = call i32 @dijkstra(%struct.graph* %46, i32 0)
ret i32 0
}

LLVM IR (-O2):
%struct.pqNode = type { i32 }
%struct.graph = type { i32 }
@.str = [16 x i8] c"top node is %d\0A\00"
@.str.1 = [21 x i8] c"min node val is %d\0A\00"
define i32 @main() {
%1 = alloca %struct.pqNode*
%2 = bitcast %struct.pqNode** %1 to i8*
store %struct.pqNode* null, %struct.pqNode** %1
%3 = call i32 @pushQ(%struct.pqNode** %1, i32 12, i32 1)
%4 = call i32 @pushQ(%struct.pqNode** %1, i32 22, i32 2)
%5 = call i32 @pushQ(%struct.pqNode** %1, i32 42, i32 4)
%6 = call i32 @pushQ(%struct.pqNode** %1, i32 62, i32 6)
%7 = call i32 @pushQ(%struct.pqNode** %1, i32 72, i32 7)
%8 = call i32 @pushQ(%struct.pqNode** %1, i32 52, i32 5)
%9 = call i32 @pushQ(%struct.pqNode** %1, i32 82, i32 8)
%10 = call i32 @pushQ(%struct.pqNode** %1, i32 92, i32 9)
%11 = call i32 @pushQ(%struct.pqNode** %1, i32 32, i32 3)
%12 = load %struct.pqNode*, %struct.pqNode** %1
%13 = call i32 @displayPQ(%struct.pqNode* %12)
%14 = load %struct.pqNode*, %struct.pqNode** %1
%15 = call i64 @isEmptyPQ(%struct.pqNode* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %0
%18 = load %struct.pqNode*, %struct.pqNode** %1
%19 = call i32 @peekQ(%struct.pqNode* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %0
%22 = call i32 @popQ(%struct.pqNode** %1)
%23 = call i32 @popQ(%struct.pqNode** %1)
%24 = call i32 @popQ(%struct.pqNode** %1)
%25 = call i32 @popQ(%struct.pqNode** %1)
%26 = load %struct.pqNode*, %struct.pqNode** %1
%27 = call i32 @displayPQ(%struct.pqNode* %26)
%28 = load %struct.pqNode*, %struct.pqNode** %1
%29 = call i64 @isEmptyPQ(%struct.pqNode* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %21
%32 = load %struct.pqNode*, %struct.pqNode** %1
%33 = call i32 @peekQ(%struct.pqNode* %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %31, %21
%36 = call i32 @deleteMin(%struct.pqNode** %1)
%37 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load %struct.pqNode*, %struct.pqNode** %1
%39 = call i32 @displayPQ(%struct.pqNode* %38)
%40 = call %struct.graph* (...) @buildGraph()
%41 = call i32 @displayGraph(%struct.graph* %40)
%42 = call i32 @dijkstra(%struct.graph* %40, i32 0)
ret i32 0
}