#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int 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("%4d", *p);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
lea    -0x40(%rbp),%rcx
add    $0x30,%rcx
cmp    %rcx,%rax
jae    11b7 <main+0x97>
mov    -0x48(%rbp),%rax
lea    -0x40(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    1192 <main+0x72>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
mov    (%rax),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x48(%rbp)
jmp    114c <main+0x2c>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsp,%r12
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x30(%rsp),%r15
lea    0xed3(%rip),%r14
mov    %r12,%rbx
jmp    1189 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x4,%rbx
add    $0x4,%r12
cmp    %r15,%rbx
jae    119b <main+0x7b>
test   $0xc,%r12b
jne    1170 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
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 = [4 x i8] c"%4d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [4 x i32]]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [3 x [4 x i32]]* %2 to i8*
%5 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
store i32* %6, i32** %3
br label %7
7: ; preds = %29, %0
%8 = load i32*, i32** %3
%9 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%11 = getelementptr inbounds i32, i32* %10, i64 12
%12 = icmp ult i32* %8, %11
br i1 %12, label %13, label %32
13: ; preds = %7
%14 = load i32*, i32** %3
%15 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %15, i64 0, i64 0
%17 = ptrtoint i32* %14 to i64
%18 = ptrtoint i32* %16 to i64
%19 = sub i64 %17, %18
%20 = sdiv exact i64 %19, 4
%21 = srem i64 %20, 4
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %13
%26 = load i32*, i32** %3
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25
%30 = load i32*, i32** %3
%31 = getelementptr inbounds i32, i32* %30, i32 1
store i32* %31, i32** %3
br label %7
32: ; preds = %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%34 = load i32, i32* %1
ret i32 %34
}

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 = [4 x i8] c"%4d\00"
define i32 @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
br label %5
5: ; preds = %0, %12
%6 = phi i32* [ %3, %0 ], [ %15, %12 ]
%7 = ptrtoint i32* %6 to i64
%8 = and i64 %7, 12
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = call i32 @putchar(i32 10)
br label %12
12: ; preds = %10, %5
%13 = load i32, i32* %6
%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 i32, i32* %6, i64 1
%16 = icmp ult i32* %15, %4
br i1 %16, label %5, label %17
17: ; preds = %12
%18 = call i32 @putchar(i32 10)
ret i32 0
}