#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*/ getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[4][4], *p;
  for (p = *a; p < *a + 16; p++)
    printf("%3d", *p = p - *a + 1);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
lea    -0x50(%rbp),%rcx
add    $0x40,%rcx
cmp    %rcx,%rax
jae    1184 <main+0x64>
mov    -0x58(%rbp),%rax
lea    -0x50(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
add    $0x1,%rax
mov    %eax,%esi
mov    -0x58(%rbp),%rax
mov    %esi,(%rax)
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
jmp    1137 <main+0x17>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsp,%r15
mov    $0x1,%ebx
lea    0x40(%rsp),%r12
lea    0xec1(%rip),%r14
nop
mov    %ebx,(%r15)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x4,%r15
add    $0x1,%ebx
cmp    %r12,%r15
jb     1140 <main+0x20>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [4 x i32]]
%3 = alloca i32*
store i32 0, i32* %1
%4 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %2, i64 0, i64 0
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
store i32* %5, i32** %3
br label %6
6: ; preds = %24, %0
%7 = load i32*, i32** %3
%8 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %2, 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 16
%11 = icmp ult i32* %7, %10
br i1 %11, label %12, label %27
12: ; preds = %6
%13 = load i32*, i32** %3
%14 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %2, 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 = add nsw i64 %19, 1
%21 = trunc i64 %20 to i32
%22 = load i32*, i32** %3
store i32 %21, i32* %22
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %24
24: ; preds = %12
%25 = load i32*, i32** %3
%26 = getelementptr inbounds i32, i32* %25, i32 1
store i32* %26, i32** %3
br label %6
27: ; preds = %6
%28 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca [4 x [4 x i32]]
%2 = bitcast [4 x [4 x i32]]* %1 to i8*
%3 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 0
%4 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 16
%5 = ptrtoint [4 x [4 x i32]]* %1 to i64
br label %6
6: ; preds = %0, %6
%7 = phi i32* [ %3, %0 ], [ %14, %6 ]
%8 = ptrtoint i32* %7 to i64
%9 = sub i64 %8, %5
%10 = lshr exact i64 %9, 2
%11 = trunc i64 %10 to i32
%12 = add i32 %11, 1
store i32 %12, i32* %7
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds i32, i32* %7, i64 1
%15 = icmp ult i32* %14, %4
br i1 %15, label %6, label %16
16: ; preds = %6
%17 = call i32 (...) @getchar()
ret i32 0
}