#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(unsigned long **, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned long int Matriz[5][5] = {{0, 6, 10, 4294967295, 4294967295},
                                    {6, 0, 4294967295, 2, 4294967295},
                                    {10, 4294967295, 0, 1, 3},
                                    {4294967295, 2, 1, 0, 8},
                                    {4294967295, 4294967295, 3, 8, 0}};
  Dijkstra(Matriz, 5);
  printf("Total caminho mais curto do vertice 0 ao 4: %lu\n", Matriz[4][0]);
  printf("Matriz:\n");
  for (int i = 0; i < 5; ++i) {
    for (int e = 0; e < 5; ++e) {
      if (Matriz[i][e] < 10)
        printf(" %lu ", Matriz[i][e]);
      else
        printf("%lu ", Matriz[i][e]);
    }
    printf("\n");
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0xc8,%edx
call   1050 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
mov    $0x5,%esi
call   1030 <Dijkstra@plt>
mov    -0x30(%rbp),%rsi
lea    0xf52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x5,-0xd4(%rbp)
jge    127c <main+0x14c>
movl   $0x0,-0xd8(%rbp)
cmpl   $0x5,-0xd8(%rbp)
jge    125a <main+0x12a>
movslq -0xd4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
cmpq   $0xa,(%rax,%rcx,8)
jae    1213 <main+0xe3>
movslq -0xd4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1241 <main+0x111>
movslq -0xd4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0xd8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1246 <main+0x116>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    11ac <main+0x7c>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1195 <main+0x65>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
lea    0xe9d(%rip),%rsi
mov    %rsp,%rbx
mov    $0xc8,%edx
mov    %rbx,%rdi
call   1070 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <Dijkstra@plt>
mov    0xa0(%rsp),%rsi
lea    0xf39(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf62(%rip),%rdi
call   1040 <puts@plt>
mov    $0x20,%ebx
lea    0xf4b(%rip),%r14
lea    0xf45(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    -0x20(%rsp,%rbx,1),%rsi
cmp    $0xa,%rsi
mov    %r15,%rdi
cmovb  %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x18(%rsp,%rbx,1),%rsi
cmp    $0xa,%rsi
mov    %r15,%rdi
cmovb  %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x10(%rsp,%rbx,1),%rsi
cmp    $0xa,%rsi
mov    %r15,%rdi
cmovb  %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x8(%rsp,%rbx,1),%rsi
cmp    $0xa,%rsi
mov    %r15,%rdi
cmovb  %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp,%rbx,1),%rsi
cmp    $0xa,%rsi
mov    %r15,%rdi
cmovb  %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x28,%rbx
cmp    $0xe8,%rbx
jne    11c0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.Matriz = [5 x [5 x i64]] [[5 x i64] [i64 0, i64 6, i64 10, i64 4294967295, i64 4294967295], [5 x i64] [i64 6, i64 0, i64 4294967295, i64 2, i64 4294967295], [5 x i64] [i64 10, i64 4294967295, i64 0, i64 1, i64 3], [5 x i64] [i64 4294967295, i64 2, i64 1, i64 0, i64 8], [5 x i64] [i64 4294967295, i64 4294967295, i64 3, i64 8, i64 0]]
@.str = [49 x i8] c"Total caminho mais curto do vertice 0 ao 4: %lu\0A\00"
@.str.1 = [9 x i8] c"Matriz:\0A\00"
@.str.2 = [6 x i8] c" %lu \00"
@.str.3 = [5 x i8] c"%lu \00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i64]]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x [5 x i64]]* %2 to i8*
%6 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %2, i64 0, i64 0
%7 = bitcast [5 x i64]* %6 to i64**
%8 = call i32 @Dijkstra(i64** %7, i32 5)
%9 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %2, i64 0, i64 4
%10 = getelementptr inbounds [5 x i64], [5 x i64]* %9, i64 0, i64 0
%11 = load i64, i64* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %14
14: ; preds = %54, %0
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 5
br i1 %16, label %17, label %57
17: ; preds = %14
store i32 0, i32* %4
br label %18
18: ; preds = %49, %17
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 5
br i1 %20, label %21, label %52
21: ; preds = %18
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %2, i64 0, i64 %23
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [5 x i64], [5 x i64]* %24, i64 0, i64 %26
%28 = load i64, i64* %27
%29 = icmp ult i64 %28, 10
br i1 %29, label %30, label %39
30: ; preds = %21
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %2, i64 0, i64 %32
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i64], [5 x i64]* %33, i64 0, i64 %35
%37 = load i64, i64* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %37)
br label %48
39: ; preds = %21
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %2, i64 0, i64 %41
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [5 x i64], [5 x i64]* %42, i64 0, i64 %44
%46 = load i64, i64* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 %46)
br label %48
48: ; preds = %39, %30
br label %49
49: ; preds = %48
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 1
store i32 %51, i32* %4
br label %18
52: ; preds = %18
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %52
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %14
57: ; preds = %14
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.Matriz = [5 x [5 x i64]] [[5 x i64] [i64 0, i64 6, i64 10, i64 4294967295, i64 4294967295], [5 x i64] [i64 6, i64 0, i64 4294967295, i64 2, i64 4294967295], [5 x i64] [i64 10, i64 4294967295, i64 0, i64 1, i64 3], [5 x i64] [i64 4294967295, i64 2, i64 1, i64 0, i64 8], [5 x i64] [i64 4294967295, i64 4294967295, i64 3, i64 8, i64 0]]
@.str = [49 x i8] c"Total caminho mais curto do vertice 0 ao 4: %lu\0A\00"
@.str.2 = [6 x i8] c" %lu \00"
@.str.3 = [5 x i8] c"%lu \00"
@str = [8 x i8] c"Matriz:\00"
define i32 @main() {
%1 = alloca [5 x [5 x i64]]
%2 = bitcast [5 x [5 x i64]]* %1 to i8*
%3 = bitcast [5 x [5 x i64]]* %1 to i64**
%4 = call i32 @Dijkstra(i64** %3, i32 5)
%5 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %1, i64 0, i64 4, i64 0
%6 = load i64, i64* %5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %0, %9
%10 = phi i64 [ 0, %0 ], [ %37, %9 ]
%11 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %1, i64 0, i64 %10, i64 0
%12 = load i64, i64* %11
%13 = icmp ult i64 %12, 10
%14 = select i1 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %14, i64 %12)
%16 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %1, i64 0, i64 %10, i64 1
%17 = load i64, i64* %16
%18 = icmp ult i64 %17, 10
%19 = select i1 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %19, i64 %17)
%21 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %1, i64 0, i64 %10, i64 2
%22 = load i64, i64* %21
%23 = icmp ult i64 %22, 10
%24 = select i1 %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %24, i64 %22)
%26 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %1, i64 0, i64 %10, i64 3
%27 = load i64, i64* %26
%28 = icmp ult i64 %27, 10
%29 = select i1 %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %29, i64 %27)
%31 = getelementptr inbounds [5 x [5 x i64]], [5 x [5 x i64]]* %1, i64 0, i64 %10, i64 4
%32 = load i64, i64* %31
%33 = icmp ult i64 %32, 10
%34 = select i1 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %34, i64 %32)
%36 = call i32 @putchar(i32 10)
%37 = add nuw nsw i64 %10, 1
%38 = icmp eq i64 %37, 5
br i1 %38, label %39, label %9
39: ; preds = %9
%40 = call i32 @putchar(i32 10)
ret i32 0
}