#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*/ display(int **, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ warshall(int **, int);
int main() {
  printf("Warshall Algorithm\n");
  int arr[100][100], N;
  int i, j;
  printf("Enter number of vertices\n");
  scanf("%d", &N);
  printf("Enter %d X %d adj matrix\n", N, N);
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      scanf("%d", &arr[i][j]);
  warshall(arr, N);
  display(arr, N);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x9c54(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x9c54(%rbp),%esi
mov    -0x9c54(%rbp),%edx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x9c58(%rbp)
mov    -0x9c58(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    1232 <main+0xf2>
movl   $0x0,-0x9c5c(%rbp)
mov    -0x9c5c(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    1219 <main+0xd9>
movslq -0x9c58(%rbp),%rax
lea    -0x9c50(%rbp),%rsi
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0x9c5c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe2e(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x9c5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c5c(%rbp)
jmp    11c1 <main+0x81>
jmp    121e <main+0xde>
mov    -0x9c58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c58(%rbp)
jmp    11a5 <main+0x65>
lea    -0x9c50(%rbp),%rdi
mov    -0x9c54(%rbp),%esi
call   1060 <warshall@plt>
lea    -0x9c50(%rbp),%rdi
mov    -0x9c54(%rbp),%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x9c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9c50,%rsp
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edx
lea    0xe6f(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11ff <main+0xaf>
lea    0x10(%rsp),%r15
xor    %r12d,%r12d
lea    0xe4c(%rip),%r14
jmp    11d3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
movslq %esi,%rax
add    $0x1,%r12
add    $0x190,%r15
cmp    %rax,%r12
jge    11ff <main+0xaf>
test   %esi,%esi
jle    11c0 <main+0x70>
mov    %r15,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r13
cmp    %rsi,%rbx
jl     11e0 <main+0x90>
jmp    11c0 <main+0x70>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <warshall@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <display@plt>
xor    %eax,%eax
add    $0x9c50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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