#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 printArray(const int a[]) {
  int j;
  for (j = 0; j <= 99 - 1; j++) {
    if (j % 20 == 0)
      printf("\n");
    printf("%2d", a[j]);
  }
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x62,-0xc(%rbp)
jg     1176 <printArray+0x66>
mov    -0xc(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <printArray+0x3f>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <printArray+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xece(%rip),%r14
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    115c <printArray+0x3c>
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
add    $0xff,%r12b
cmp    $0x63,%rbx
je     117f <printArray+0x5f>
movzbl %bl,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
and    $0xfffffffc,%eax
lea    (%rax,%rax,4),%eax
add    %r12b,%al
jne    1140 <printArray+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1140 <printArray+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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