void Array2() {
  int a[2][2] = {{1, 2}, {3, 4}};
  int **p;
  int *q[2] = {a[0], a[1]};
  int *r;
  printf("%d, %d, %d, %d\n", a[0][0], **a, a[0][1], *(*a + 1));
  printf("%d, %d, %d, %d\n", a[1][0], **(a + 1), a[1][1], *(*(a + 1) + 1));
  printf("%d, %d\n", q[0][0], q[1][1]);
  printf("%d, %d, %d\n", a, a[0], &a[0][0]);
  printf("%d, %d, %d\n", q, q[0], &q[0][0]);
  r = &a[0][0];
  printf("%d, %d, %d, %d\n", r[0], r[1], r[2], r[3]);
  printf("%d, %d, %d, %d\n", r[0], r[1], r[2 * 1 + 0], r[2 * 1 + 1]);
}


x86 assembly (clang, -O0):
<Array2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%r8d
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%r8d
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%r8d
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Array2>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movaps 0xee0(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,0x10(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0xed3(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x2,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %r14,%rdi
mov    %edx,%esi
mov    %ecx,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe85(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.Array2.a = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]]
@.str = [16 x i8] c"%d, %d, %d, %d\0A\00"
@.str.1 = [8 x i8] c"%d, %d\0A\00"
@.str.2 = [12 x i8] c"%d, %d, %d\0A\00"
define void @Array2() {
%1 = alloca [2 x [2 x i32]]
%2 = alloca i32**
%3 = alloca [2 x i32*]
%4 = alloca i32*
%5 = bitcast [2 x [2 x i32]]* %1 to i8*
%6 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 0
%7 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32* %8, i32** %6
%9 = getelementptr inbounds i32*, i32** %6, i64 1
%10 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
store i32* %11, i32** %9
%12 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %15, i64 0, i64 0
%17 = load i32, i32* %16
%18 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 1
%20 = load i32, i32* %19
%21 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 0
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %17, i32 %20, i32 %24)
%26 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %26, i64 0, i64 0
%28 = load i32, i32* %27
%29 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 1
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 0
%32 = load i32, i32* %31
%33 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %33, i64 0, i64 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %36, i64 1
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %37, i64 0, i64 0
%39 = getelementptr inbounds i32, i32* %38, i64 1
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %32, i32 %35, i32 %40)
%42 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 0
%43 = load i32*, i32** %42
%44 = getelementptr inbounds i32, i32* %43, i64 0
%45 = load i32, i32* %44
%46 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 1
%47 = load i32*, i32** %46
%48 = getelementptr inbounds i32, i32* %47, i64 1
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %45, i32 %49)
%51 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%52 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %52, i64 0, i64 0
%54 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %54, i64 0, i64 0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), [2 x i32]* %51, i32* %53, i32* %55)
%57 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 0
%58 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 0
%59 = load i32*, i32** %58
%60 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 0
%61 = load i32*, i32** %60
%62 = getelementptr inbounds i32, i32* %61, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32** %57, i32* %59, i32* %62)
%64 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%65 = getelementptr inbounds [2 x i32], [2 x i32]* %64, i64 0, i64 0
store i32* %65, i32** %4
%66 = load i32*, i32** %4
%67 = getelementptr inbounds i32, i32* %66, i64 0
%68 = load i32, i32* %67
%69 = load i32*, i32** %4
%70 = getelementptr inbounds i32, i32* %69, i64 1
%71 = load i32, i32* %70
%72 = load i32*, i32** %4
%73 = getelementptr inbounds i32, i32* %72, i64 2
%74 = load i32, i32* %73
%75 = load i32*, i32** %4
%76 = getelementptr inbounds i32, i32* %75, i64 3
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %68, i32 %71, i32 %74, i32 %77)
%79 = load i32*, i32** %4
%80 = getelementptr inbounds i32, i32* %79, i64 0
%81 = load i32, i32* %80
%82 = load i32*, i32** %4
%83 = getelementptr inbounds i32, i32* %82, i64 1
%84 = load i32, i32* %83
%85 = load i32*, i32** %4
%86 = getelementptr inbounds i32, i32* %85, i64 2
%87 = load i32, i32* %86
%88 = load i32*, i32** %4
%89 = getelementptr inbounds i32, i32* %88, i64 3
%90 = load i32, i32* %89
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %81, i32 %84, i32 %87, i32 %90)
ret void
}

LLVM IR (-O2):
@__const.Array2.a = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]]
@.str = [16 x i8] c"%d, %d, %d, %d\0A\00"
@.str.1 = [8 x i8] c"%d, %d\0A\00"
@.str.2 = [12 x i8] c"%d, %d, %d\0A\00"
define void @Array2() {
%1 = alloca [2 x [2 x i32]]
%2 = alloca [2 x i32*]
%3 = bitcast [2 x [2 x i32]]* %1 to i8*
%4 = bitcast [2 x i32*]* %2 to i8*
%5 = getelementptr inbounds [2 x i32*], [2 x i32*]* %2, i64 0, i64 0
%6 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0
%7 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 0
store i32* %7, i32** %5
%8 = getelementptr inbounds [2 x i32*], [2 x i32*]* %2, i64 0, i64 1
%9 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1, i64 0
store i32* %9, i32** %8
%10 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, i32 1, i32 2, i32 2)
%12 = load i32, i32* %9
%13 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1, i64 1
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %12, i32 %14, i32 %14)
%16 = load i32, i32* %7
%17 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 1, i64 1
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), [2 x i32]* %6, i32* %7, i32* %7)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32** %5, i32* %7, i32* %7)
%22 = load i32, i32* %7
%23 = load i32, i32* %10
%24 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 2
%25 = load i32, i32* %24
%26 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %1, i64 0, i64 0, i64 3
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23, i32 %25, i32 %27)
%29 = load i32, i32* %7
%30 = load i32, i32* %10
%31 = load i32, i32* %24
%32 = load i32, i32* %26
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30, i32 %31, i32 %32)
ret void
}