void main() {
  int a[3][4] = {{1, 3, 5, 7}, {9, 11, 13, 15}, {17, 19, 21, 23}};
  int *p;
  for (p = a[0]; p < a[0] + 12; p++) {
    if ((p - a[0]) % 4 == 0)
      printf("\n");
    printf("diff=%d,addr=%d,addr1=%o,value=%2d\n", p - a[0], p, p, *p);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
add    $0x30,%rcx
cmp    %rcx,%rax
jae    11c8 <main+0xa8>
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    118b <main+0x6b>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    -0x30(%rbp),%rax
sub    %rax,%rsi
sar    $0x2,%rsi
mov    -0x38(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x38(%rbp),%rax
mov    (%rax),%r8d
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    1145 <main+0x25>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x30(%rsp),%r15
lea    0xed6(%rip),%r14
xor    %ebx,%ebx
jmp    1189 <main+0x69>
xchg   %ax,%ax
lea    (%rsp,%rbx,1),%rcx
mov    (%rsp,%rbx,1),%r8d
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%rbx,1),%rax
add    $0x4,%rax
add    $0x4,%rbx
cmp    %r15,%rax
jae    11a1 <main+0x81>
mov    %rbx,%r12
sar    $0x2,%r12
test   $0xc,%bl
jne    1160 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x40>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.a = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 3, i32 5, i32 7], [4 x i32] [i32 9, i32 11, i32 13, i32 15], [4 x i32] [i32 17, i32 19, i32 21, i32 23]]
@.str = [2 x i8] c"\0A\00"
@.str.1 = [36 x i8] c"diff=%d,addr=%d,addr1=%o,value=%2d\0A\00"
define void @main() {
%1 = alloca [3 x [4 x i32]]
%2 = alloca 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
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
store i32* %5, i32** %2
br label %6
6: ; preds = %37, %0
%7 = load i32*, i32** %2
%8 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%10 = getelementptr inbounds i32, i32* %9, i64 12
%11 = icmp ult i32* %7, %10
br i1 %11, label %12, label %40
12: ; preds = %6
%13 = load i32*, i32** %2
%14 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 0, i64 0
%16 = ptrtoint i32* %13 to i64
%17 = ptrtoint i32* %15 to i64
%18 = sub i64 %16, %17
%19 = sdiv exact i64 %18, 4
%20 = srem i64 %19, 4
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %12
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %12
%25 = load i32*, i32** %2
%26 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 0
%28 = ptrtoint i32* %25 to i64
%29 = ptrtoint i32* %27 to i64
%30 = sub i64 %28, %29
%31 = sdiv exact i64 %30, 4
%32 = load i32*, i32** %2
%33 = load i32*, i32** %2
%34 = load i32*, i32** %2
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i64 %31, i32* %32, i32* %33, i32 %35)
br label %37
37: ; preds = %24
%38 = load i32*, i32** %2
%39 = getelementptr inbounds i32, i32* %38, i32 1
store i32* %39, i32** %2
br label %6
40: ; preds = %6
ret void
}

LLVM IR (-O2):
@__const.main.a = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 3, i32 5, i32 7], [4 x i32] [i32 9, i32 11, i32 13, i32 15], [4 x i32] [i32 17, i32 19, i32 21, i32 23]]
@.str.1 = [36 x i8] c"diff=%d,addr=%d,addr1=%o,value=%2d\0A\00"
define void @main() {
%1 = alloca [3 x [4 x i32]]
%2 = bitcast [3 x [4 x i32]]* %1 to i8*
%3 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0, i64 0
%4 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0, i64 12
%5 = ptrtoint [3 x [4 x i32]]* %1 to i64
br label %6
6: ; preds = %0, %15
%7 = phi i32* [ %3, %0 ], [ %18, %15 ]
%8 = ptrtoint i32* %7 to i64
%9 = sub i64 %8, %5
%10 = ashr exact i64 %9, 2
%11 = and i64 %9, 12
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %6
%14 = call i32 @putchar(i32 10)
br label %15
15: ; preds = %13, %6
%16 = load i32, i32* %7
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i64 %10, i32* %7, i32* %7, i32 %16)
%18 = getelementptr inbounds i32, i32* %7, i64 1
%19 = icmp ult i32* %18, %4
br i1 %19, label %6, label %20
20: ; preds = %15
ret void
}