#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 /*<<< orphan*/);
void printarray_2(int (*ptr)[4], int n) {
  int *p, count;
  p = (int *)ptr;
  for (count = 0; count < (4 * n); count++)
    printf("\n%d", *p++);
}


x86 assembly (clang, -O0):
<printarray_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jge    116a <printarray_2+0x5a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112e <printarray_2+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printarray_2>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1155 <printarray_2+0x45>
mov    %rdi,%r15
shl    $0x2,%esi
cmp    $0x2,%esi
mov    $0x1,%r12d
cmovge %esi,%r12d
xor    %ebx,%ebx
lea    0xec8(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1140 <printarray_2+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"\0A%d\00"
define void @printarray_2([4 x i32]* %0, i32 %1) {
%3 = alloca [4 x i32]*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store [4 x i32]* %0, [4 x i32]** %3
store i32 %1, i32* %4
%7 = load [4 x i32]*, [4 x i32]** %3
%8 = bitcast [4 x i32]* %7 to i32*
store i32* %8, i32** %5
store i32 0, i32* %6
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = mul nsw i32 4, %11
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i32 1
store i32* %16, i32** %5
%17 = load i32, i32* %15
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %9
22: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\0A%d\00"
define void @printarray_2([4 x i32]* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = shl i32 %1, 2
%6 = getelementptr [4 x i32], [4 x i32]* %0, i64 0, i64 0
%7 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %8
8: ; preds = %4, %8
%9 = phi i32 [ %14, %8 ], [ 0, %4 ]
%10 = phi i32* [ %11, %8 ], [ %6, %4 ]
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %10
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i32 %9, 1
%15 = icmp eq i32 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %2
ret void
}