#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, int);
void display(int x[3][3]) {
  int i;
  for (i = 0; i < 3; i++)
    printf("%d %d %d\n", x[i][0], x[i][1], x[i][2]);
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    117c <display+0x6c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <display+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%esi
mov    0x4(%rdi),%edx
mov    0x8(%rdi),%ecx
lea    0xeda(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0xc(%rbx),%esi
mov    0x10(%rbx),%edx
mov    0x14(%rbx),%ecx
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x18(%rbx),%esi
mov    0x1c(%rbx),%edx
mov    0x20(%rbx),%ecx
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
define void @display([3 x i32]* nocapture %0) {
%2 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 0
%3 = load i32, i32* %2
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 2
%7 = load i32, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5, i32 %7)
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 1, i64 0
%10 = load i32, i32* %9
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 1, i64 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 1, i64 2
%14 = load i32, i32* %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12, i32 %14)
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 0
%17 = load i32, i32* %16
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 1
%19 = load i32, i32* %18
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 2
%21 = load i32, i32* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %19, i32 %21)
ret void
}