#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 print_graph(int G[][20], int no_of_nodes) {
  int i, j;
  for (i = 0; i < no_of_nodes; i++) {
    printf("%d--->", i);
    for (j = 0; j < no_of_nodes; j++) {
      if (G[i][j] != 0) {
        printf("(%d,%d) ", j, G[i][j]);
      }
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_graph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c9 <print_graph+0xb9>
mov    -0x10(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ad <print_graph+0x9d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     119a <print_graph+0x8a>
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119f <print_graph+0x8f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <print_graph+0x3a>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_graph+0x16>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_graph>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11a0 <print_graph+0x80>
mov    %rdi,%r13
mov    %esi,%ebp
lea    0xec5(%rip),%r14
lea    0xec5(%rip),%r15
xor    %r12d,%r12d
jmp    1167 <print_graph+0x47>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
add    $0x50,%r13
cmp    %rbp,%r12
je     11a0 <print_graph+0x80>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebx,%ebx
jmp    1189 <print_graph+0x69>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1150 <print_graph+0x30>
mov    0x0(%r13,%rbx,4),%edx
test   %edx,%edx
je     1180 <print_graph+0x60>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <print_graph+0x60>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d--->\00"
@.str.1 = [9 x i8] c"(%d,%d) \00"
define void @print_graph([20 x i32]* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %25
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %21, %4
%7 = phi i64 [ 0, %4 ], [ %23, %21 ]
%8 = trunc i64 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %6, %18
%11 = phi i64 [ 0, %6 ], [ %19, %18 ]
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %7, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = trunc i64 %11 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %13)
br label %18
18: ; preds = %10, %15
%19 = add nuw nsw i64 %11, 1
%20 = icmp eq i64 %19, %5
br i1 %20, label %21, label %10
21: ; preds = %18
%22 = tail call i32 @putchar(i32 10)
%23 = add nuw nsw i64 %7, 1
%24 = icmp eq i64 %23, %5
br i1 %24, label %25, label %6
25: ; preds = %21, %2
%26 = tail call i32 @putchar(i32 10)
ret void
}