#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 *, ...);
void printSolution(int dist[][4]) {
  printf("Following matrix shows the shortest distances"
         " between every pair of vertices \n");
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (dist[i][j] == 99999)
        printf("%7s", "INF");
      else
        printf("%7d", dist[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printSolution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11d9 <printSolution+0xc9>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11bd <printSolution+0xad>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x1869f,(%rax,%rcx,4)
jne    1186 <printSolution+0x76>
lea    0xedc(%rip),%rdi
lea    0xed9(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11aa <printSolution+0x9a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11af <printSolution+0x9f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <printSolution+0x32>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <printSolution+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSolution>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r13
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb1(%rip),%r14
lea    0xeae(%rip),%r15
lea    0xeab(%rip),%r12
xor    %ebx,%ebx
jmp    1195 <printSolution+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rbx
cmp    $0x40,%rbx
je     124a <printSolution+0x11a>
mov    0x0(%r13,%rbx,1),%esi
cmp    $0x1869f,%esi
jne    11c0 <printSolution+0x90>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ca <printSolution+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%r13,%rbx,1),%esi
cmp    $0x1869f,%esi
jne    11f0 <printSolution+0xc0>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11fa <printSolution+0xca>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r13,%rbx,1),%esi
cmp    $0x1869f,%esi
jne    1220 <printSolution+0xf0>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    122a <printSolution+0xfa>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%r13,%rbx,1),%esi
cmp    $0x1869f,%esi
je     1170 <printSolution+0x40>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    117d <printSolution+0x4d>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [79 x i8] c"Following matrix shows the shortest distances between every pair of vertices \0A\00"
@.str.1 = [4 x i8] c"%7s\00"
@.str.2 = [4 x i8] c"INF\00"
@.str.3 = [4 x i8] c"%7d\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @printSolution([4 x i32]* %0) {
%2 = alloca [4 x i32]*
%3 = alloca i32
%4 = alloca i32
store [4 x i32]* %0, [4 x i32]** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %41, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %44
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %36, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %39
13: ; preds = %10
%14 = load [4 x i32]*, [4 x i32]** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 99999
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %35
25: ; preds = %13
%26 = load [4 x i32]*, [4 x i32]** %2
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 %28
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %29, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %25, %23
br label %36
36: ; preds = %35
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %10
39: ; preds = %10
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %39
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %6
44: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%7s\00"
@.str.2 = [4 x i8] c"INF\00"
@.str.3 = [4 x i8] c"%7d\00"
@str = [78 x i8] c"Following matrix shows the shortest distances between every pair of vertices \00"
define void @printSolution([4 x i32]* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %1, %37
%4 = phi i64 [ 0, %1 ], [ %39, %37 ]
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 99999
br i1 %7, label %9, label %11
8: ; preds = %37
ret void
9: ; preds = %3
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %13
11: ; preds = %3
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %6)
br label %13
13: ; preds = %9, %11
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 1
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 99999
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %21
19: ; preds = %13
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 2
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 99999
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %29
27: ; preds = %21
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 3
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 99999
br i1 %32, label %35, label %33
33: ; preds = %29
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %37
35: ; preds = %29
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
%38 = tail call i32 @putchar(i32 10)
%39 = add nuw nsw i64 %4, 1
%40 = icmp eq i64 %39, 4
br i1 %40, label %8, label %3
}