#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 /*<<< orphan*/, int *, int,
                            int *);
int /*<<< orphan*/ print_path(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ system(char *);
int main() {
  int d[100];
  int S[100];
  int pre[100];
  int G[][100] = {{0, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                  {5, 0, 0, 1, 3, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                  {3, 0, 0, 0, 8, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                  {0, 1, 0, 0, 0, 0, 0, 6, 8, 0, 0, 0, 0, 0, 0, 0},
                  {0, 3, 8, 0, 0, 0, 0, 3, 5, 0, 0, 0, 0, 0, 0, 0},
                  {0, 6, 7, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0},
                  {0, 0, 6, 0, 0, 0, 0, 0, 8, 4, 0, 0, 0, 0, 0, 0},
                  {0, 0, 0, 6, 3, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0},
                  {0, 0, 0, 0, 5, 3, 8, 0, 0, 0, 0, 1, 2, 0, 0, 0},
                  {0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 3, 3, 0, 0, 0},
                  {0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 3, 5, 0},
                  {0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 5, 2, 0},
                  {0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 6, 6, 0},
                  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 6, 0, 0, 4},
                  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 2, 6, 0, 0, 3},
                  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3}};
  int n = 16;
  DIJKSTRA(G, d, 0, S, n, pre);
  int source = 0;
  int destination = 15;
  printf("%-4d:", d[destination]);
  print_path(pre, source, destination);
  printf("%-4d\n", destination);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1dd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1dc0(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x1900,%edx
call   1050 <memcpy@plt>
movl   $0x10,-0x1dc4(%rbp)
lea    -0x1dc0(%rbp),%rdi
lea    -0x1a0(%rbp),%rsi
lea    -0x330(%rbp),%rcx
mov    -0x1dc4(%rbp),%r8d
lea    -0x4c0(%rbp),%r9
xor    %edx,%edx
call   1070 <DIJKSTRA@plt>
movl   $0x0,-0x1dc8(%rbp)
movl   $0xf,-0x1dcc(%rbp)
movslq -0x1dcc(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0x2729(%rip),%rdi
call   1040 <printf@plt>
lea    -0x4c0(%rbp),%rdi
mov    -0x1dc8(%rbp),%esi
mov    -0x1dcc(%rbp),%edx
call   1060 <print_path@plt>
mov    -0x1dcc(%rbp),%esi
lea    0x2705(%rip),%rdi
call   1040 <printf@plt>
lea    0x26ff(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x1dd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1db8,%rsp
lea    0xe9f(%rip),%rsi
lea    0x4b0(%rsp),%rbx
mov    $0x1900,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rsp,%rsi
lea    0x320(%rsp),%rcx
lea    0x190(%rsp),%r14
mov    %rbx,%rdi
xor    %edx,%edx
mov    $0x10,%r8d
mov    %r14,%r9
call   1070 <DIJKSTRA@plt>
mov    0x3c(%rsp),%esi
lea    0x2759(%rip),%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1060 <print_path@plt>
lea    0x2744(%rip),%rdi
mov    $0xf,%esi
call   1040 <printf@plt>
lea    0x2739(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x1db8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.G = <{ <{ i32, i32, i32, [97 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [94 x i32] }>, <{ i32, i32, i32, i32, i32, i32, i32, [93 x i32] }>, <{ [9 x i32], [91 x i32] }>, <{ [9 x i32], [91 x i32] }>, <{ [10 x i32], [90 x i32] }>, <{ [10 x i32], [90 x i32] }>, <{ [12 x i32], [88 x i32] }>, <{ [13 x i32], [87 x i32] }>, <{ [13 x i32], [87 x i32] }>, <{ [16 x i32], [84 x i32] }>, <{ [15 x i32], [85 x i32] }>, <{ [15 x i32], [85 x i32] }>, <{ [16 x i32], [84 x i32] }>, <{ [16 x i32], [84 x i32] }>, <{ [15 x i32], [85 x i32] }> }> <{ <{ i32, i32, i32, [97 x i32] }> <{ i32 0, i32 5, i32 3, [97 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [94 x i32] }> <{ i32 5, i32 0, i32 0, i32 1, i32 3, i32 6, [94 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, i32, [93 x i32] }> <{ i32 3, i32 0, i32 0, i32 0, i32 8, i32 7, i32 6, [93 x i32] zeroinitializer }>, <{ [9 x i32], [91 x i32] }> <{ [9 x i32] [i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 6, i32 8], [91 x i32] zeroinitializer }>, <{ [9 x i32], [91 x i32] }> <{ [9 x i32] [i32 0, i32 3, i32 8, i32 0, i32 0, i32 0, i32 0, i32 3, i32 5], [91 x i32] zeroinitializer }>, <{ [10 x i32], [90 x i32] }> <{ [10 x i32] [i32 0, i32 6, i32 7, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 3], [90 x i32] zeroinitializer }>, <{ [10 x i32], [90 x i32] }> <{ [10 x i32] [i32 0, i32 0, i32 6, i32 0, i32 0, i32 0, i32 0, i32 0, i32 8, i32 4], [90 x i32] zeroinitializer }>, <{ [12 x i32], [88 x i32] }> <{ [12 x i32] [i32 0, i32 0, i32 0, i32 6, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 2], [88 x i32] zeroinitializer }>, <{ [13 x i32], [87 x i32] }> <{ [13 x i32] [i32 0, i32 0, i32 0, i32 0, i32 5, i32 3, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2], [87 x i32] zeroinitializer }>, <{ [13 x i32], [87 x i32] }> <{ [13 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 4, i32 0, i32 0, i32 0, i32 0, i32 3, i32 3], [87 x i32] zeroinitializer }>, <{ [16 x i32], [84 x i32] }> <{ [16 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 5], [84 x i32] zeroinitializer }>, <{ [15 x i32], [85 x i32] }> <{ [15 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 5, i32 2], [85 x i32] zeroinitializer }>, <{ [15 x i32], [85 x i32] }> <{ [15 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 3, i32 0, i32 0, i32 0, i32 6, i32 6], [85 x i32] zeroinitializer }>, <{ [16 x i32], [84 x i32] }> <{ [16 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 5, i32 6, i32 0, i32 0, i32 4], [84 x i32] zeroinitializer }>, <{ [16 x i32], [84 x i32] }> <{ [16 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5, i32 2, i32 6, i32 0, i32 0, i32 3], [84 x i32] zeroinitializer }>, <{ [15 x i32], [85 x i32] }> <{ [15 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 4, i32 3], [85 x i32] zeroinitializer }> }>
@.str = [6 x i8] c"%-4d:\00"
@.str.1 = [6 x i8] c"%-4d\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca [100 x i32]
%4 = alloca [100 x i32]
%5 = alloca [16 x [100 x i32]]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [16 x [100 x i32]]* %5 to i8*
store i32 16, i32* %6
%10 = getelementptr inbounds [16 x [100 x i32]], [16 x [100 x i32]]* %5, i64 0, i64 0
%11 = bitcast [100 x i32]* %10 to i32**
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%14 = load i32, i32* %6
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%16 = call i32 @DIJKSTRA(i32** %11, i32* %12, i32 0, i32* %13, i32 %14, i32* %15)
store i32 0, i32* %7
store i32 15, i32* %8
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %18
%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 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 @print_path(i32* %22, i32 %23, i32 %24)
%26 = load i32, i32* %8
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.G = <{ <{ i32, i32, i32, [97 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [94 x i32] }>, <{ i32, i32, i32, i32, i32, i32, i32, [93 x i32] }>, <{ [9 x i32], [91 x i32] }>, <{ [9 x i32], [91 x i32] }>, <{ [10 x i32], [90 x i32] }>, <{ [10 x i32], [90 x i32] }>, <{ [12 x i32], [88 x i32] }>, <{ [13 x i32], [87 x i32] }>, <{ [13 x i32], [87 x i32] }>, <{ [16 x i32], [84 x i32] }>, <{ [15 x i32], [85 x i32] }>, <{ [15 x i32], [85 x i32] }>, <{ [16 x i32], [84 x i32] }>, <{ [16 x i32], [84 x i32] }>, <{ [15 x i32], [85 x i32] }> }> <{ <{ i32, i32, i32, [97 x i32] }> <{ i32 0, i32 5, i32 3, [97 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [94 x i32] }> <{ i32 5, i32 0, i32 0, i32 1, i32 3, i32 6, [94 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, i32, [93 x i32] }> <{ i32 3, i32 0, i32 0, i32 0, i32 8, i32 7, i32 6, [93 x i32] zeroinitializer }>, <{ [9 x i32], [91 x i32] }> <{ [9 x i32] [i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 6, i32 8], [91 x i32] zeroinitializer }>, <{ [9 x i32], [91 x i32] }> <{ [9 x i32] [i32 0, i32 3, i32 8, i32 0, i32 0, i32 0, i32 0, i32 3, i32 5], [91 x i32] zeroinitializer }>, <{ [10 x i32], [90 x i32] }> <{ [10 x i32] [i32 0, i32 6, i32 7, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 3], [90 x i32] zeroinitializer }>, <{ [10 x i32], [90 x i32] }> <{ [10 x i32] [i32 0, i32 0, i32 6, i32 0, i32 0, i32 0, i32 0, i32 0, i32 8, i32 4], [90 x i32] zeroinitializer }>, <{ [12 x i32], [88 x i32] }> <{ [12 x i32] [i32 0, i32 0, i32 0, i32 6, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 2], [88 x i32] zeroinitializer }>, <{ [13 x i32], [87 x i32] }> <{ [13 x i32] [i32 0, i32 0, i32 0, i32 0, i32 5, i32 3, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2], [87 x i32] zeroinitializer }>, <{ [13 x i32], [87 x i32] }> <{ [13 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 4, i32 0, i32 0, i32 0, i32 0, i32 3, i32 3], [87 x i32] zeroinitializer }>, <{ [16 x i32], [84 x i32] }> <{ [16 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 5], [84 x i32] zeroinitializer }>, <{ [15 x i32], [85 x i32] }> <{ [15 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 5, i32 2], [85 x i32] zeroinitializer }>, <{ [15 x i32], [85 x i32] }> <{ [15 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 3, i32 0, i32 0, i32 0, i32 6, i32 6], [85 x i32] zeroinitializer }>, <{ [16 x i32], [84 x i32] }> <{ [16 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 5, i32 6, i32 0, i32 0, i32 4], [84 x i32] zeroinitializer }>, <{ [16 x i32], [84 x i32] }> <{ [16 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5, i32 2, i32 6, i32 0, i32 0, i32 3], [84 x i32] zeroinitializer }>, <{ [15 x i32], [85 x i32] }> <{ [15 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 4, i32 3], [85 x i32] zeroinitializer }> }>
@.str = [6 x i8] c"%-4d:\00"
@.str.1 = [6 x i8] c"%-4d\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = alloca [100 x i32]
%4 = alloca [16 x [100 x i32]]
%5 = bitcast [100 x i32]* %1 to i8*
%6 = bitcast [100 x i32]* %2 to i8*
%7 = bitcast [100 x i32]* %3 to i8*
%8 = bitcast [16 x [100 x i32]]* %4 to i8*
%9 = bitcast [16 x [100 x i32]]* %4 to i32**
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%13 = call i32 @DIJKSTRA(i32** %9, i32* %10, i32 0, i32* %11, i32 16, i32* %12)
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 15
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @print_path(i32* %12, i32 0, i32 15)
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 15)
%19 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}