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


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    119e <print_graph+0x8e>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118b <print_graph+0x7b>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1178 <print_graph+0x68>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <print_graph+0x6d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <print_graph+0x29>
jmp    1190 <print_graph+0x80>
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    1185 <print_graph+0x75>
mov    %esi,%ebx
lea    0x0(,%rbx,4),%r13
xor    %r12d,%r12d
lea    0xecd(%rip),%r15
jmp    114d <print_graph+0x3d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp),%rdi
add    $0x4,%rdi
cmp    %rbx,%r12
je     1185 <print_graph+0x75>
add    $0x1,%r12
mov    %rdi,(%rsp)
mov    %rdi,%rbp
xor    %edx,%edx
jmp    116b <print_graph+0x5b>
nopl   0x0(%rax)
add    %r13,%rbp
mov    %r14,%rdx
cmp    %r14,%rbx
je     1140 <print_graph+0x30>
lea    0x1(%rdx),%r14
cmpl   $0x1,0x0(%rbp)
jne    1160 <print_graph+0x50>
add    $0x1,%edx
mov    %r15,%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
jmp    1160 <print_graph+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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