#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 printAdjMatrix(int *matrix, unsigned int vertices) {
  for (int i = 0; i < vertices; ++i) {
    for (int j = 0; j < vertices; ++j) {
      printf("%d ", *((matrix + i * vertices) + j));
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printAdjMatrix>:
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
jae    1198 <printAdjMatrix+0x88>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    117c <printAdjMatrix+0x6c>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    %ecx,%ecx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <printAdjMatrix+0x29>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printAdjMatrix+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAdjMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %esi,0xc(%rsp)
test   %esi,%esi
je     118f <printAdjMatrix+0x6f>
mov    0xc(%rsp),%ebp
lea    0xeba(%rip),%rbx
xor    %r12d,%r12d
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %r12d,%eax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,4),%r14
xor    %r15d,%r15d
nop
mov    (%r14,%r15,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    1160 <printAdjMatrix+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    0xc(%rsp),%r12d
cmp    %rbp,%r13
jne    1150 <printAdjMatrix+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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