#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*/ printf(char *, int);
int /*<<< orphan*/ shortpath(int **, int *, int *);
int main() {
  int cost[7][7] = {
      {998, 2, 4, 7, 998, 5, 998},     {2, 998, 998, 6, 3, 998, 8},
      {4, 998, 998, 998, 998, 6, 998}, {7, 6, 998, 998, 998, 1, 6},
      {998, 3, 998, 998, 998, 998, 7}, {5, 998, 6, 1, 998, 998, 6},
      {998, 8, 998, 6, 7, 6, 998}};
  int i, preced[7] = {0}, distance[7];
  shortpath(cost, preced, distance);
  for (i = 0; i < 7; i++)
    printf("%d\n", distance[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0xc4,%edx
call   1050 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
lea    -0xd0(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
lea    -0x110(%rbp),%rdx
call   1060 <shortpath@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x7,-0xd4(%rbp)
jge    11dc <main+0x9c>
movslq -0xd4(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%esi
lea    0xf01(%rip),%rdi
call   1030 <printf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11a1 <main+0x61>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x110,%rsp
lea    0xec1(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    $0xc4,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
xorps  %xmm0,%xmm0
movups %xmm0,0x2c(%rsp)
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <shortpath@plt>
mov    (%rsp),%esi
lea    0xf4c(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
ret

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

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