#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*/ Floyd(int **, int, int **);
int **allocmat(int);
int /*<<< orphan*/ printf(char *);
int **readmat(int **, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int **(tabledist), **tablesequence;
  int sizegr, i, j;
  printf("Please specify the number of vertices in the graph: ");
  scanf("%d", &sizegr);
  tabledist = allocmat(sizegr);
  tabledist = readmat(tabledist, sizegr);
  tablesequence = allocmat(sizegr);
  for (i = 0; i < sizegr; i++) {
    for (j = 0; j < sizegr; j++) {
      tablesequence[i][j] = j + 1;
    }
  }
  Floyd(tabledist, sizegr, tablesequence);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x1c(%rbp),%edi
call   1070 <allocmat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <readmat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <allocmat@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1203 <main+0xb3>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11f0 <main+0xa0>
mov    -0x24(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bd <main+0x6d>
jmp    11f5 <main+0xa5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11aa <main+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <Floyd@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1070 <allocmat@plt>
mov    0x4(%rsp),%esi
mov    %rax,%rdi
call   1060 <readmat@plt>
mov    %rax,%r14
mov    0x4(%rsp),%edi
call   1070 <allocmat@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11d6 <main+0x86>
xor    %ecx,%ecx
jmp    11ac <main+0x5c>
xchg   %ax,%ax
movslq %esi,%rdx
add    $0x1,%rcx
cmp    %rdx,%rcx
jge    11d6 <main+0x86>
test   %esi,%esi
jle    11a0 <main+0x50>
mov    (%rax,%rcx,8),%rdx
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rdi),%rbx
mov    %ebx,(%rdx,%rdi,4)
movslq 0x4(%rsp),%rsi
mov    %rbx,%rdi
cmp    %rsi,%rbx
jl     11c0 <main+0x70>
jmp    11a0 <main+0x50>
mov    %r14,%rdi
mov    %rax,%rdx
call   1040 <Floyd@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Please specify the number of vertices in the graph: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %4
%10 = call i32** @allocmat(i32 %9)
store i32** %10, i32*** %2
%11 = load i32**, i32*** %2
%12 = load i32, i32* %4
%13 = call i32** @readmat(i32** %11, i32 %12)
store i32** %13, i32*** %2
%14 = load i32, i32* %4
%15 = call i32** @allocmat(i32 %14)
store i32** %15, i32*** %3
store i32 0, i32* %5
br label %16
16: ; preds = %40, %0
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %43
20: ; preds = %16
store i32 0, i32* %6
br label %21
21: ; preds = %36, %20
%22 = load i32, i32* %6
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %39
25: ; preds = %21
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
%28 = load i32**, i32*** %3
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32*, i32** %28, i64 %30
%32 = load i32*, i32** %31
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
store i32 %27, i32* %35
br label %36
36: ; preds = %25
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %21
39: ; preds = %21
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %16
43: ; preds = %16
%44 = load i32**, i32*** %2
%45 = load i32, i32* %4
%46 = load i32**, i32*** %3
%47 = call i32 @Floyd(i32** %44, i32 %45, i32** %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"Please specify the number of vertices in the graph: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32** @allocmat(i32 %5)
%7 = load i32, i32* %1
%8 = call i32** @readmat(i32** %6, i32 %7)
%9 = load i32, i32* %1
%10 = call i32** @allocmat(i32 %9)
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %33
13: ; preds = %0, %28
%14 = phi i32 [ %29, %28 ], [ %11, %0 ]
%15 = phi i64 [ %31, %28 ], [ 0, %0 ]
%16 = icmp sgt i32 %14, 0
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = getelementptr inbounds i32*, i32** %10, i64 %15
%19 = load i32*, i32** %18
br label %20
20: ; preds = %17, %20
%21 = phi i64 [ 0, %17 ], [ %22, %20 ]
%22 = add nuw nsw i64 %21, 1
%23 = getelementptr inbounds i32, i32* %19, i64 %21
%24 = trunc i64 %22 to i32
store i32 %24, i32* %23
%25 = load i32, i32* %1
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %22, %26
br i1 %27, label %20, label %28
28: ; preds = %20, %13
%29 = phi i32 [ %14, %13 ], [ %25, %20 ]
%30 = sext i32 %29 to i64
%31 = add nuw nsw i64 %15, 1
%32 = icmp slt i64 %31, %30
br i1 %32, label %13, label %33
33: ; preds = %28, %0
%34 = phi i32 [ %11, %0 ], [ %29, %28 ]
%35 = call i32 @Floyd(i32** %8, i32 %34, i32** %10)
ret i32 0
}