#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*/ dijkstra(int **, int, int, int *, int *);
int /*<<< orphan*/ printPath(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int g[6][6] = {{0, 7, 9, 32767, 32767, 16},    {7, 0, 10, 15, 32767, 32767},
                 {9, 10, 0, 11, 32767, 2},       {32767, 15, 11, 0, 6, 32767},
                 {32767, 32767, 32767, 6, 0, 9}, {14, 32767, 2, 32767, 9, 0}};
  int v0 = 0;
  int dist[6];
  int prev[6];
  int i, j;
  dijkstra(g, 6, v0, dist, prev);
  for (i = 0; i < 6; i++) {
    printPath(prev, v0, i);
    printf(" :%d\n", dist[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0x90,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0xa4(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xa4(%rbp),%edx
lea    -0xc0(%rbp),%rcx
lea    -0xe0(%rbp),%r8
mov    $0x6,%esi
call   1050 <dijkstra@plt>
movl   $0x0,-0xe4(%rbp)
cmpl   $0x6,-0xe4(%rbp)
jge    11f6 <main+0xb6>
lea    -0xe0(%rbp),%rdi
mov    -0xa4(%rbp),%esi
mov    -0xe4(%rbp),%edx
call   1060 <printPath@plt>
movslq -0xe4(%rbp),%rax
mov    -0xc0(%rbp,%rax,4),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    11a3 <main+0x63>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
lea    0xead(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    $0x90,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    %rsp,%rcx
lea    0x20(%rsp),%r15
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %edx,%edx
mov    %r15,%r8
call   1050 <dijkstra@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <printPath@plt>
mov    (%rsp),%esi
lea    0xefb(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1060 <printPath@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1060 <printPath@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1060 <printPath@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <printPath@plt>
mov    0x10(%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1060 <printPath@plt>
mov    0x14(%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.g = [6 x [6 x i32]] [[6 x i32] [i32 0, i32 7, i32 9, i32 32767, i32 32767, i32 16], [6 x i32] [i32 7, i32 0, i32 10, i32 15, i32 32767, i32 32767], [6 x i32] [i32 9, i32 10, i32 0, i32 11, i32 32767, i32 2], [6 x i32] [i32 32767, i32 15, i32 11, i32 0, i32 6, i32 32767], [6 x i32] [i32 32767, i32 32767, i32 32767, i32 6, i32 0, i32 9], [6 x i32] [i32 14, i32 32767, i32 2, i32 32767, i32 9, i32 0]]
@.str = [6 x i8] c" :%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x [6 x i32]]
%3 = alloca i32
%4 = alloca [6 x i32]
%5 = alloca [6 x i32]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [6 x [6 x i32]]* %2 to i8*
store i32 0, i32* %3
%9 = getelementptr inbounds [6 x [6 x i32]], [6 x [6 x i32]]* %2, i64 0, i64 0
%10 = bitcast [6 x i32]* %9 to i32**
%11 = load i32, i32* %3
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%14 = call i32 @dijkstra(i32** %10, i32 6, i32 %11, i32* %12, i32* %13)
store i32 0, i32* %6
br label %15
15: ; preds = %28, %0
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 6
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%20 = load i32, i32* %3
%21 = load i32, i32* %6
%22 = call i32 @printPath(i32* %19, i32 %20, i32 %21)
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %18
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %15
31: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@__const.main.g = [6 x [6 x i32]] [[6 x i32] [i32 0, i32 7, i32 9, i32 32767, i32 32767, i32 16], [6 x i32] [i32 7, i32 0, i32 10, i32 15, i32 32767, i32 32767], [6 x i32] [i32 9, i32 10, i32 0, i32 11, i32 32767, i32 2], [6 x i32] [i32 32767, i32 15, i32 11, i32 0, i32 6, i32 32767], [6 x i32] [i32 32767, i32 32767, i32 32767, i32 6, i32 0, i32 9], [6 x i32] [i32 14, i32 32767, i32 2, i32 32767, i32 9, i32 0]]
@.str = [6 x i8] c" :%d\0A\00"
define i32 @main() {
%1 = alloca [6 x [6 x i32]]
%2 = alloca [6 x i32]
%3 = alloca [6 x i32]
%4 = bitcast [6 x [6 x i32]]* %1 to i8*
%5 = bitcast [6 x i32]* %2 to i8*
%6 = bitcast [6 x i32]* %3 to i8*
%7 = bitcast [6 x [6 x i32]]* %1 to i32**
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%10 = call i32 @dijkstra(i32** %7, i32 6, i32 0, i32* %8, i32* %9)
%11 = call i32 @printPath(i32* %9, i32 0, i32 0)
%12 = load i32, i32* %8
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @printPath(i32* %9, i32 0, i32 1)
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 1
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @printPath(i32* %9, i32 0, i32 2)
%19 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 2
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = call i32 @printPath(i32* %9, i32 0, i32 3)
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 3
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = call i32 @printPath(i32* %9, i32 0, i32 4)
%27 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 4
%28 = load i32, i32* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = call i32 @printPath(i32* %9, i32 0, i32 5)
%31 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 5
%32 = load i32, i32* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %32)
ret i32 0
}