#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, int);
int main() {
  int A[3][3][3];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 3; k++)
        printf("p[%d][%d][%d] address : %d\n", i, j, k, (int)&A[i][j][k]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    11c6 <main+0xb6>
movl   $0x0,-0x78(%rbp)
cmpl   $0x3,-0x78(%rbp)
jge    11b3 <main+0xa3>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x3,-0x7c(%rbp)
jge    11a0 <main+0x90>
mov    -0x74(%rbp),%esi
mov    -0x78(%rbp),%edx
mov    -0x7c(%rbp),%ecx
movslq -0x74(%rbp),%rdi
lea    -0x70(%rbp),%rax
imul   $0x24,%rdi,%rdi
add    %rdi,%rax
movslq -0x78(%rbp),%rdi
imul   $0xc,%rdi,%rdi
add    %rdi,%rax
movslq -0x7c(%rbp),%rdi
shl    $0x2,%rdi
add    %rdi,%rax
mov    %eax,%r8d
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    114b <main+0x3b>
jmp    11a5 <main+0x95>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    113a <main+0x2a>
jmp    11b8 <main+0xa8>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1129 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
xor    %ebx,%ebx
mov    $0xffffffffffffff94,%r15
mov    %rsp,%r12
lea    0xed2(%rip),%r14
xchg   %ax,%ax
lea    (%r12,%r15,1),%r8d
add    $0x6c,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x70,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x74,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x78,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x7c,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x80,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x84,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x88,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    (%r12,%r15,1),%r8d
add    $0x8c,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1030 <printf@plt>
add    $0x1,%ebx
add    $0x24,%r15
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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