void main() {
  int a[3][4], *p[3], *p1;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 4; j++)
      a[i][j] = i * 4 + j;
  p1 = a[0];
  p[0] = a[1];
  printf("a[1][2]=%d\n", a[1][2]);
  printf("*(a[1]+2)=%d\n", *(a[1] + 2));
  printf("*(*a+1)+2)=%d\n", *(*(a + 1) + 2));
  printf("*(*a+6)=%d\n", *(*a + 6));
  printf("p[1][2]=%d\n", p[0][2]);
  printf("*(p[1]+2)=%d\n", *(p[0] + 2));
  printf("*(p1+6)=%d\n", *(p1 + 6));
  printf("p1[6]=%d\n", p1[6]);
  printf("*(p+6)=%d\n", *(p + 1));
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x5c(%rbp)
cmpl   $0x3,-0x5c(%rbp)
jge    118a <main+0x6a>
movl   $0x0,-0x60(%rbp)
cmpl   $0x4,-0x60(%rbp)
jge    1177 <main+0x57>
mov    -0x5c(%rbp),%edx
shl    $0x2,%edx
add    -0x60(%rbp),%edx
movslq -0x5c(%rbp),%rcx
lea    -0x30(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x60(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1140 <main+0x20>
jmp    117c <main+0x5c>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    112f <main+0xf>
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <getchar@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"a[1][2]=%d\0A\00"
@.str.1 = [14 x i8] c"*(a[1]+2)=%d\0A\00"
@.str.2 = [15 x i8] c"*(*a+1)+2)=%d\0A\00"
@.str.3 = [12 x i8] c"*(*a+6)=%d\0A\00"
@.str.4 = [12 x i8] c"p[1][2]=%d\0A\00"
@.str.5 = [14 x i8] c"*(p[1]+2)=%d\0A\00"
@.str.6 = [12 x i8] c"*(p1+6)=%d\0A\00"
@.str.7 = [10 x i8] c"p1[6]=%d\0A\00"
@.str.8 = [11 x i8] c"*(p+6)=%d\0A\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 6)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 6)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 6)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 6)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 6)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 6)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 6)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 6)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32* undef)
%10 = tail call i32 (...) @getchar()
ret void
}