int sample1(void) {
  int a1[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
  int a2[3][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  int a3[][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  int i = 0;
  int j = 0;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 4; j++) {
      printf("%d ", a3[i][j]);
    }
    printf("\n");
  }
  printf("\n");
  printf("a:%d, a+1:%d\n", a3, a3 + 1);
  printf("%d, %d\n", *(a3 + 0), *(a3 + 0) + 1);
  printf("%d, %d\n", a3[0], a3[0] + 1);
  int a[][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  printf("a:%d\n", a);
  printf("sizeof(a[0]):%d\n", sizeof(a[0]));
  printf("a[1]:%d, a[1]+1:%d\n", a[1], a[1] + 1);
  printf("*(a+1):%d\n", *(a + 1));
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<sample1>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    -0x30(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xeed(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x3,-0x94(%rbp)
jge    1222 <sample1+0xf2>
movl   $0x0,-0x98(%rbp)
cmpl   $0x4,-0x98(%rbp)
jge    1200 <sample1+0xd0>
movslq -0x94(%rbp),%rcx
lea    -0x90(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x98(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    11b2 <sample1+0x82>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    119b <sample1+0x6b>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    -0x90(%rbp),%rdx
add    $0x10,%rdx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    -0x90(%rbp),%rdx
add    $0x4,%rdx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    -0x90(%rbp),%rdx
add    $0x4,%rdx
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
lea    -0xd0(%rbp),%rsi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rsi
add    $0x10,%rsi
lea    -0xd0(%rbp),%rdx
add    $0x10,%rdx
add    $0x4,%rdx
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rsi
add    $0x10,%rsi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <system@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample1>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
movaps 0xf40(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf24(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xf08(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x40(%rsp),%r14
lea    0xe97(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x34(%rsp),%r15
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdb3(%rip),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda8(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
movaps 0xdef(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xdd3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xdb7(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rbx
lea    0xd61(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd56(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x14(%rsp),%rdx
lea    0xd4f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd52(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd42(%rip),%rdi
xor    %eax,%eax
call   1040 <system@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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