#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 /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ warshal(int **, int);
int main() {
  int p[10][10] = {0}, n, i, j;
  printf("Enter the size of matrix\n");
  scanf("%d", &n);
  printf("Enter the Adjacency matrix\n");
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      scanf("%d", p[i][j]);
  warshal(p, n);
  printf("\n Transitive closure: \n");
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++)
      printf("%d\t", p[i][j]);
    printf("\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jg     1228 <main+0xe8>
movl   $0x1,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jg     120f <main+0xcf>
movslq -0x1a8(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1ac(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    11bc <main+0x7c>
jmp    1214 <main+0xd4>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    11a0 <main+0x60>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1060 <warshal@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jg     12e3 <main+0x1a3>
movl   $0x1,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jg     12c1 <main+0x181>
movslq -0x1a8(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1ac(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    126e <main+0x12e>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    1252 <main+0x112>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0x10(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe81(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6e(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe7b(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    120e <main+0xae>
lea    0x3c(%rsp),%r12
mov    $0x1,%r15d
lea    0xe3c(%rip),%r14
jmp    11e3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
movslq %esi,%rax
lea    0x1(%r15),%rcx
add    $0x28,%r12
cmp    %rax,%r15
mov    %rcx,%r15
jge    120e <main+0xae>
test   %esi,%esi
jle    11d0 <main+0x70>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
movslq 0xc(%rsp),%rsi
add    $0x1,%rbx
cmp    %rsi,%rbx
jl     11f0 <main+0x90>
jmp    11d0 <main+0x70>
lea    0x10(%rsp),%rdi
call   1080 <warshal@plt>
lea    0xe1c(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    128e <main+0x12e>
lea    0x3c(%rsp),%r12
mov    $0x1,%r15d
lea    0xdc5(%rip),%r14
jmp    125f <main+0xff>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%rcx
movslq 0xc(%rsp),%rax
add    $0x28,%r12
cmp    %rax,%r15
mov    %rcx,%r15
jge    128e <main+0x12e>
test   %eax,%eax
jle    1240 <main+0xe0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0xc(%rsp),%rax
add    $0x1,%rbx
cmp    %rax,%rbx
jl     1270 <main+0x110>
jmp    1240 <main+0xe0>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Enter the size of matrix\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Enter the Adjacency matrix\0A\00"
@.str.3 = [24 x i8] c"\0A Transitive closure: \0A\00"
@.str.4 = [4 x i8] c"%d\09\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x [10 x i32]]* %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %4
br label %10
10: ; preds = %32, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %35
14: ; preds = %10
store i32 1, i32* %5
br label %15
15: ; preds = %28, %14
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %31
19: ; preds = %15
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %21
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %22, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %19
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %15
31: ; preds = %15
br label %32
32: ; preds = %31
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %10
35: ; preds = %10
%36 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%37 = bitcast [10 x i32]* %36 to i32**
%38 = load i32, i32* %3
%39 = call i32 @warshal(i32** %37, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %4
br label %41
41: ; preds = %64, %35
%42 = load i32, i32* %4
%43 = load i32, i32* %3
%44 = icmp sle i32 %42, %43
br i1 %44, label %45, label %67
45: ; preds = %41
store i32 1, i32* %5
br label %46
46: ; preds = %59, %45
%47 = load i32, i32* %5
%48 = load i32, i32* %3
%49 = icmp sle i32 %47, %48
br i1 %49, label %50, label %62
50: ; preds = %46
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %52
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [10 x i32], [10 x i32]* %53, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %50
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
br label %46
62: ; preds = %46
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %64
64: ; preds = %62
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %41
67: ; preds = %41
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\09\00"
@str = [25 x i8] c"Enter the size of matrix\00"
@str.6 = [27 x i8] c"Enter the Adjacency matrix\00"
@str.7 = [23 x i8] c"\0A Transitive closure: \00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca i32
%3 = bitcast [10 x [10 x i32]]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.6, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
br i1 %9, label %28, label %10
10: ; preds = %0, %23
%11 = phi i32 [ %24, %23 ], [ %8, %0 ]
%12 = phi i64 [ %26, %23 ], [ 1, %0 ]
%13 = icmp slt i32 %11, 1
br i1 %13, label %23, label %14
14: ; preds = %10, %14
%15 = phi i64 [ %19, %14 ], [ 1, %10 ]
%16 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %12, i64 %15
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = add nuw nsw i64 %15, 1
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %15, %21
br i1 %22, label %14, label %23
23: ; preds = %14, %10
%24 = phi i32 [ %11, %10 ], [ %20, %14 ]
%25 = sext i32 %24 to i64
%26 = add nuw nsw i64 %12, 1
%27 = icmp slt i64 %12, %25
br i1 %27, label %10, label %28
28: ; preds = %23, %0
%29 = phi i32 [ %8, %0 ], [ %24, %23 ]
%30 = bitcast [10 x [10 x i32]]* %1 to i32**
%31 = call i32 @warshal(i32** %30, i32 %29)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.7, i64 0, i64 0))
%33 = load i32, i32* %2
%34 = icmp slt i32 %33, 1
br i1 %34, label %54, label %35
35: ; preds = %28, %48
%36 = phi i32 [ %51, %48 ], [ %33, %28 ]
%37 = phi i64 [ %50, %48 ], [ 1, %28 ]
%38 = icmp slt i32 %36, 1
br i1 %38, label %48, label %39
39: ; preds = %35, %39
%40 = phi i64 [ %44, %39 ], [ 1, %35 ]
%41 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 %40
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = add nuw nsw i64 %40, 1
%45 = load i32, i32* %2
%46 = sext i32 %45 to i64
%47 = icmp slt i64 %40, %46
br i1 %47, label %39, label %48
48: ; preds = %39, %35
%49 = call i32 @putchar(i32 10)
%50 = add nuw nsw i64 %37, 1
%51 = load i32, i32* %2
%52 = sext i32 %51 to i64
%53 = icmp slt i64 %37, %52
br i1 %53, label %35, label %54
54: ; preds = %48, %28
ret i32 0
}