#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 *, ...);
void printLongArray(const long *array, const int size) {
  const long *arrayPtr;
  const long *arrayEnd = array + size;
  int i;
  for (arrayPtr = array, i = 0; arrayPtr < arrayEnd; ++arrayPtr) {
    if (*arrayPtr != 0) {
      if (i == 0) {
        printf("[%12ld", *arrayPtr);
      } else {
        printf(" %12ld", *arrayPtr);
      }
      if ((i + 1) % 10 == 0) {
        printf("\n");
      }
      ++i;
    }
  }
  printf("]\n");
}


x86 assembly (clang, -O0):
<printLongArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11da <printLongArray+0xca>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     11c4 <printLongArray+0xb4>
cmpl   $0x0,-0x24(%rbp)
jne    1181 <printLongArray+0x71>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1196 <printLongArray+0x86>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11bb <printLongArray+0xab>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c9 <printLongArray+0xb9>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1141 <printLongArray+0x31>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printLongArray>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
jle    11b1 <printLongArray+0x81>
mov    %rdi,%rbx
movslq %esi,%rax
lea    (%rdi,%rax,8),%r12
lea    0xeb3(%rip),%r14
lea    0xeb3(%rip),%r15
xor    %ebp,%ebp
jmp    1178 <printLongArray+0x48>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebp
add    $0x8,%rbx
cmp    %r12,%rbx
jae    11b1 <printLongArray+0x81>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     116f <printLongArray+0x3f>
test   %ebp,%ebp
je     1160 <printLongArray+0x30>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
imul   $0xcccccccd,%ebp,%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999998,%eax
ja     116f <printLongArray+0x3f>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    116f <printLongArray+0x3f>
lea    0xe56(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"[%12ld\00"
@.str.1 = [7 x i8] c" %12ld\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c"]\0A\00"
define void @printLongArray(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%8 = load i64*, i64** %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i64, i64* %8, i64 %10
store i64* %11, i64** %6
%12 = load i64*, i64** %3
store i64* %12, i64** %5
store i32 0, i32* %7
br label %13
13: ; preds = %43, %2
%14 = load i64*, i64** %5
%15 = load i64*, i64** %6
%16 = icmp ult i64* %14, %15
br i1 %16, label %17, label %46
17: ; preds = %13
%18 = load i64*, i64** %5
%19 = load i64, i64* %18
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %42
21: ; preds = %17
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i64*, i64** %5
%26 = load i64, i64* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %26)
br label %32
28: ; preds = %21
%29 = load i64*, i64** %5
%30 = load i64, i64* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 %30)
br label %32
32: ; preds = %28, %24
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
%35 = srem i32 %34, 10
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37, %32
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %42
42: ; preds = %39, %17
br label %43
43: ; preds = %42
%44 = load i64*, i64** %5
%45 = getelementptr inbounds i64, i64* %44, i32 1
store i64* %45, i64** %5
br label %13
46: ; preds = %13
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

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