#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 main() {
  int a[5][7];
  int(*pa)[7] = a;
  for (int i = 0; i < 5 * 7; i++) {
    *((int *)a + i) = i;
  }
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 7; j++) {
      printf("%p %d\n", &a[i][j], a[i][j]);
      printf("%p %d\n", &pa[i][j], pa[i][j]);
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x9c(%rbp)
cmpl   $0x23,-0x9c(%rbp)
jge    116f <main+0x5f>
mov    -0x9c(%rbp),%ecx
movslq -0x9c(%rbp),%rax
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    113a <main+0x2a>
movl   $0x0,-0xa0(%rbp)
cmpl   $0x5,-0xa0(%rbp)
jge    1266 <main+0x156>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x7,-0xa4(%rbp)
jge    124d <main+0x13d>
movslq -0xa0(%rbp),%rax
lea    -0x90(%rbp),%rsi
imul   $0x1c,%rax,%rax
add    %rax,%rsi
movslq -0xa4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0xa0(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0x1c,%rcx,%rcx
add    %rcx,%rax
movslq -0xa4(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x98(%rbp),%rsi
movslq -0xa0(%rbp),%rax
imul   $0x1c,%rax,%rax
add    %rax,%rsi
movslq -0xa4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x98(%rbp),%rax
movslq -0xa0(%rbp),%rcx
imul   $0x1c,%rcx,%rcx
add    %rcx,%rax
movslq -0xa4(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xdcc(%rip),%rdi
call   1030 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1190 <main+0x80>
jmp    1252 <main+0x142>
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    1179 <main+0x69>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
movaps 0xedd(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeea(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xef6(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xefa(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movabs $0x2100000020,%rax
mov    %rax,0x80(%rsp)
movl   $0x22,0x88(%rsp)
xor    %ebx,%ebx
lea    0xedf(%rip),%r14
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rsp,%rbx,1),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    (%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    (%rsp,%rbx,1),%r15
add    $0x4,%r15
mov    0x4(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    0x4(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    (%rsp,%rbx,1),%r15
add    $0x8,%r15
mov    0x8(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    0x8(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    (%rsp,%rbx,1),%r15
add    $0xc,%r15
mov    0xc(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    0xc(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    (%rsp,%rbx,1),%r15
add    $0x10,%r15
mov    0x10(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    0x10(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    (%rsp,%rbx,1),%r15
add    $0x14,%r15
mov    0x14(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    0x14(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    (%rsp,%rbx,1),%r15
add    $0x18,%r15
mov    0x18(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    0x18(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
cmp    $0x70,%rbx
je     12c4 <main+0x1b4>
mov    0x1c(%rsp,%rbx,1),%edx
add    $0x1c,%rbx
jmp    11b0 <main+0xa0>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%p %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [7 x i32]]
%3 = alloca [7 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %2, i64 0, i64 0
store [7 x i32]* %7, [7 x i32]** %3
store i32 0, i32* %4
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 35
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %4
%13 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %2, i64 0, i64 0
%14 = bitcast [7 x i32]* %13 to i32*
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
store i32 %12, i32* %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %8
21: ; preds = %8
store i32 0, i32* %5
br label %22
22: ; preds = %64, %21
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 5
br i1 %24, label %25, label %67
25: ; preds = %22
store i32 0, i32* %6
br label %26
26: ; preds = %60, %25
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 7
br i1 %28, label %29, label %63
29: ; preds = %26
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %2, i64 0, i64 %31
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [7 x i32], [7 x i32]* %32, i64 0, i64 %34
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %2, i64 0, i64 %37
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [7 x i32], [7 x i32]* %38, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %35, i32 %42)
%44 = load [7 x i32]*, [7 x i32]** %3
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [7 x i32], [7 x i32]* %44, i64 %46
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [7 x i32], [7 x i32]* %47, i64 0, i64 %49
%51 = load [7 x i32]*, [7 x i32]** %3
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [7 x i32], [7 x i32]* %51, i64 %53
%55 = load i32, i32* %6
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [7 x i32], [7 x i32]* %54, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %50, i32 %58)
br label %60
60: ; preds = %29
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
store i32 %62, i32* %6
br label %26
63: ; preds = %26
br label %64
64: ; preds = %63
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
br label %22
67: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%p %d\0A\00"
define i32 @main() {
%1 = alloca [5 x [7 x i32]]
%2 = bitcast [5 x [7 x i32]]* %1 to i8*
%3 = bitcast [5 x [7 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %3
%4 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 4
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %5
%6 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 8
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %7
%8 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 12
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, <4 x i32>* %9
%10 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 16
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, <4 x i32>* %11
%12 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 20
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, <4 x i32>* %13
%14 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 24
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, <4 x i32>* %15
%16 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 28
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, <4 x i32>* %17
%18 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 32
store i32 32, i32* %18
%19 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 33
store i32 33, i32* %19
%20 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 0, i64 34
store i32 34, i32* %20
br label %21
21: ; preds = %60, %0
%22 = phi i32 [ 0, %0 ], [ %62, %60 ]
%23 = phi i64 [ 0, %0 ], [ %58, %60 ]
%24 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %23, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %24, i32 %22)
%26 = load i32, i32* %24
%27 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %24, i32 %26)
%28 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %23, i64 1
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %28, i32 %29)
%31 = load i32, i32* %28
%32 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %28, i32 %31)
%33 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %23, i64 2
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %33, i32 %34)
%36 = load i32, i32* %33
%37 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %33, i32 %36)
%38 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %23, i64 3
%39 = load i32, i32* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %38, i32 %39)
%41 = load i32, i32* %38
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %38, i32 %41)
%43 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %23, i64 4
%44 = load i32, i32* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %43, i32 %44)
%46 = load i32, i32* %43
%47 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %43, i32 %46)
%48 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %23, i64 5
%49 = load i32, i32* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %48, i32 %49)
%51 = load i32, i32* %48
%52 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %48, i32 %51)
%53 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %23, i64 6
%54 = load i32, i32* %53
%55 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %53, i32 %54)
%56 = load i32, i32* %53
%57 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %53, i32 %56)
%58 = add nuw nsw i64 %23, 1
%59 = icmp eq i64 %58, 5
br i1 %59, label %63, label %60
60: ; preds = %21
%61 = getelementptr inbounds [5 x [7 x i32]], [5 x [7 x i32]]* %1, i64 0, i64 %58, i64 0
%62 = load i32, i32* %61
br label %21
63: ; preds = %21
ret i32 0
}