#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 **graph, int nodes) {
  for (int i = 0; i < nodes; i++) {
    if (i == 0) {
      printf("\n");
      for (int n = 0; n < nodes; n++)
        printf("\t%3i", n);
      printf("\n\n");
    }
    for (int j = 0; j < nodes; j++) {
      if (j == 0)
        printf("%3i\t", i);
      printf("%3i\t", graph[i][j]);
    }
    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    1203 <print_graph+0xf3>
cmpl   $0x0,-0x10(%rbp)
jne    118a <print_graph+0x7a>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117c <print_graph+0x6c>
mov    -0x14(%rbp),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <print_graph+0x41>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e7 <print_graph+0xd7>
cmpl   $0x0,-0x18(%rbp)
jne    11b8 <print_graph+0xa8>
mov    -0x10(%rbp),%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1191 <print_graph+0x81>
lea    0xe18(%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>
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    11ff <print_graph+0xcf>
mov    %esi,%r13d
mov    %rdi,%r12
mov    %esi,%r14d
lea    0xead(%rip),%rbx
lea    0xeab(%rip),%r15
xor    %ebp,%ebp
jmp    117e <print_graph+0x4e>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %r14,%rbp
lea    0xe88(%rip),%rbx
je     11ff <print_graph+0xcf>
test   %rbp,%rbp
jne    11b9 <print_graph+0x89>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15d
cmp    %r15d,%r13d
jne    1190 <print_graph+0x60>
lea    0xe5d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4c(%rip),%r15
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12,%rbp,8),%rax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%r13d
je     1160 <print_graph+0x30>
mov    $0x1,%ebx
mov    (%r12,%rbp,8),%rax
mov    (%rax,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    11e0 <print_graph+0xb0>
jmp    1160 <print_graph+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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