int sample3(void) {
  int a[][10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  int(*q)[10];
  q = a;
  printf("q:%d, q+1:%d\n", q, q + 1);
  typedef int(*P)[10];
  P p;
  p = a;
  int i = 0;
  int j = 0;
  int n = sizeof(a) / sizeof(a[0]);
  int nj = sizeof(a[0]) / sizeof(a[0][0]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < nj; j++) {
      printf("%d ", *(*(p + i) + j));
    }
    printf("\n");
  }
  int t[10];
  printf("sizeof(t)= %d, sizeof(&t) %d\n", sizeof(t), sizeof(&t));
  printf("sizeof(a):%d\n", sizeof(a));
  printf("sizeof(a[0]):%d, sizeof(&a[0]):%d\n", sizeof(a[0]), sizeof(&a[0]));
  printf("sizeof( *(a+0) ):%d, sizeof( a+0):%d\n", sizeof(*(a + 0)),
         sizeof(a + 0));
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<sample3>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    -0x50(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
mov    -0x58(%rbp),%rdx
add    $0x28,%rdx
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
movl   $0x2,-0x6c(%rbp)
movl   $0xa,-0x70(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    120a <sample3+0xda>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    11ee <sample3+0xbe>
mov    -0x60(%rbp),%rax
movslq -0x64(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11b0 <sample3+0x80>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    119d <sample3+0x6d>
lea    0xe51(%rip),%rdi
mov    $0x28,%esi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe57(%rip),%rdi
mov    $0x50,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x28,%esi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5d(%rip),%rdi
mov    $0x28,%esi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <system@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample3>:
push   %rbx
sub    $0x50,%rsp
movaps 0xf04(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x28(%rsp),%rdx
lea    0xed4(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xda3(%rip),%rdi
mov    $0x28,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda9(%rip),%rdi
mov    $0x50,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda4(%rip),%rdi
mov    $0x28,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdaf(%rip),%rdi
mov    $0x28,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdb3(%rip),%rdi
xor    %eax,%eax
call   1040 <system@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.sample3.a = <{ [10 x i32], <{ i32, i32, [8 x i32] }> }> <{ [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10], <{ i32, i32, [8 x i32] }> <{ i32 11, i32 12, [8 x i32] zeroinitializer }> }>
@.str = [14 x i8] c"q:%d, q+1:%d\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [30 x i8] c"sizeof(t)= %d, sizeof(&t) %d\0A\00"
@.str.4 = [14 x i8] c"sizeof(a):%d\0A\00"
@.str.5 = [35 x i8] c"sizeof(a[0]):%d, sizeof(&a[0]):%d\0A\00"
@.str.6 = [38 x i8] c"sizeof( *(a+0) ):%d, sizeof( a+0):%d\0A\00"
@.str.7 = [6 x i8] c"pause\00"
define i32 @sample3() {
%1 = alloca [2 x [10 x i32]]
%2 = alloca [10 x i32]*
%3 = alloca [10 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10 x i32]
%9 = bitcast [2 x [10 x i32]]* %1 to i8*
%10 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0
store [10 x i32]* %10, [10 x i32]** %2
%11 = load [10 x i32]*, [10 x i32]** %2
%12 = load [10 x i32]*, [10 x i32]** %2
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %12, i64 1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), [10 x i32]* %11, [10 x i32]* %13)
%15 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0
store [10 x i32]* %15, [10 x i32]** %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 2, i32* %6
store i32 10, i32* %7
store i32 0, i32* %4
br label %16
16: ; preds = %41, %0
%17 = load i32, i32* %4
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %44
20: ; preds = %16
store i32 0, i32* %5
br label %21
21: ; preds = %36, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %39
25: ; preds = %21
%26 = load [10 x i32]*, [10 x i32]** %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %26, i64 %28
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %29, i64 0, i64 0
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %25
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %21
39: ; preds = %21
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %16
44: ; preds = %16
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i64 40, i64 8)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 80)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i64 40, i64 8)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i64 40, i64 8)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%50 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.sample3.a = <{ [10 x i32], <{ i32, i32, [8 x i32] }> }> <{ [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10], <{ i32, i32, [8 x i32] }> <{ i32 11, i32 12, [8 x i32] zeroinitializer }> }>
@.str = [14 x i8] c"q:%d, q+1:%d\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.3 = [30 x i8] c"sizeof(t)= %d, sizeof(&t) %d\0A\00"
@.str.4 = [14 x i8] c"sizeof(a):%d\0A\00"
@.str.5 = [35 x i8] c"sizeof(a[0]):%d, sizeof(&a[0]):%d\0A\00"
@.str.6 = [38 x i8] c"sizeof( *(a+0) ):%d, sizeof( a+0):%d\0A\00"
@.str.7 = [6 x i8] c"pause\00"
define i32 @sample3() {
%1 = alloca [2 x [10 x i32]]
%2 = bitcast [2 x [10 x i32]]* %1 to i8*
%3 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0
%4 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), [10 x i32]* %3, [10 x i32]* %4)
%6 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 0
%7 = load i32, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 1
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 2
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 3
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 4
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 5
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 6
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 7
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 8
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 0, i64 9
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = call i32 @putchar(i32 10)
%37 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 0
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 1
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 2
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 3
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 4
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 5
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 6
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 7
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 8
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [2 x [10 x i32]], [2 x [10 x i32]]* %1, i64 0, i64 1, i64 9
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%67 = call i32 @putchar(i32 10)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i64 40, i64 8)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 80)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i64 40, i64 8)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i64 40, i64 8)
%72 = call i32 @putchar(i32 10)
%73 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}