#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 count;
int /*<<< orphan*/ printf(char *, ...);
void PrintArray(int a[], int n, int N) {
  int i;
  static count = 0;
  for (i = 0; i < N - count; i++)
    printf("   ");
  count++;
  for (i = 0; i < n; i++)
    printf("%6d", a[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<PrintArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    0x2ef7(%rip),%ecx
cmp    %ecx,%eax
jge    1159 <PrintArray+0x49>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <PrintArray+0x19>
mov    0x2ecd(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ec4(%rip)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a2 <PrintArray+0x92>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116f <PrintArray+0x5f>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintArray>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
mov    0x2f00(%rip),%eax
cmp    %edx,%eax
jge    116b <PrintArray+0x4b>
mov    %edx,%ebp
lea    0xebf(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
mov    0x2ed1(%rip),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
cmp    %ecx,%ebx
jl     1150 <PrintArray+0x30>
add    $0x1,%eax
mov    %eax,0x2ec0(%rip)
test   %r14d,%r14d
jle    11a7 <PrintArray+0x87>
mov    %r14d,%ebp
lea    0xe81(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <PrintArray+0x70>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@PrintArray.count = internal global i32 0
@.str = [4 x i8] c" \00"
@.str.1 = [4 x i8] c"%6d\00"
@.str.2 = [2 x i8] c"\0A\00"
@count = global i32 0
define void @PrintArray(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %16, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = load i32, i32* @PrintArray.count
%12 = sub nsw i32 %10, %11
%13 = icmp slt i32 %9, %12
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
br label %8
19: ; preds = %8
%20 = load i32, i32* @PrintArray.count
%21 = add nsw i32 %20, 1
store i32 %21, i32* @PrintArray.count
store i32 0, i32* %7
br label %22
22: ; preds = %33, %19
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i32*, i32** %4
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %26
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %22
36: ; preds = %22
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@PrintArray.count = internal unnamed_addr global i32 0
@.str = [4 x i8] c" \00"
@.str.1 = [4 x i8] c"%6d\00"
@count = global i32 0
define void @PrintArray(i32* nocapture %0, i32 %1, i32 %2) {
%4 = load i32, i32* @PrintArray.count
%5 = icmp slt i32 %4, %2
br i1 %5, label %6, label %13
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = add nuw nsw i32 %7, 1
%10 = load i32, i32* @PrintArray.count
%11 = sub nsw i32 %2, %10
%12 = icmp slt i32 %9, %11
br i1 %12, label %6, label %13
13: ; preds = %6, %3
%14 = phi i32 [ %4, %3 ], [ %10, %6 ]
%15 = add nsw i32 %14, 1
store i32 %15, i32* @PrintArray.count
%16 = icmp sgt i32 %1, 0
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = zext i32 %1 to i64
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ 0, %17 ], [ %24, %19 ]
%21 = getelementptr inbounds i32, i32* %0, i64 %20
%22 = load i32, i32* %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, %18
br i1 %25, label %26, label %19
26: ; preds = %19, %13
%27 = tail call i32 @putchar(i32 10)
ret void
}