#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_image(size_t N, unsigned matrix[N][N]) {
  size_t i, j;
  for (i = 0; i < N; i++) {
    printf("%u", matrix[i][0]);
    for (j = 1; j < N; j++) {
      printf(" | %u", matrix[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11cb <print_image+0xbb>
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11ac <print_image+0x9c>
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1164 <print_image+0x54>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1130 <print_image+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_image>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,(%rsp)
test   %rdi,%rdi
je     11aa <print_image+0x8a>
mov    %rdi,%rbx
lea    0x0(,%rdi,4),%r13
lea    0xeba(%rip),%r12
mov    (%rsp),%rbp
xor    %r15d,%r15d
jmp    1166 <print_image+0x46>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
add    %r13,%rbp
cmp    %rbx,%r15
je     11aa <print_image+0x8a>
mov    %r15,%rax
imul   %rbx,%rax
mov    (%rsp),%rcx
mov    (%rcx,%rax,4),%esi
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%rbx
je     1150 <print_image+0x30>
mov    $0x1,%r14d
xchg   %ax,%ax
mov    0x0(%rbp,%r14,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1190 <print_image+0x70>
jmp    1150 <print_image+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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