#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 array_print(int array[]) {
  int i;
  for (i = 0; i < 50; i += 1)
    if ((i + 1) % 15)
      if ((i + 1) % 15)
        printf("%8d", array[i]);
      else
        printf("%8d\n", array[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<array_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jge    11aa <array_print+0x9a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1197 <array_print+0x87>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1179 <array_print+0x69>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1192 <array_print+0x82>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <array_print+0x87>
jmp    119c <array_print+0x8c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <array_print+0x13>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
mov    $0x1,%bl
lea    0xecc(%rip),%r14
xor    %eax,%eax
jmp    114c <array_print+0x2c>
nopl   0x0(%rax,%rax,1)
add    $0x1,%bl
mov    %r12,%rax
cmp    $0x32,%r12
je     1179 <array_print+0x59>
lea    0x1(%rax),%r12
movzbl %bl,%ecx
imul   $0x89,%ecx,%ecx
shr    $0xb,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,2),%ecx
add    $0xff,%cl
cmp    %al,%cl
je     1140 <array_print+0x20>
mov    (%r15,%rax,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1140 <array_print+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%8d\00"
@.str.1 = [5 x i8] c"%8d\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @array_print(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %33, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 50
br i1 %6, label %7, label %36
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = srem i32 %9, 15
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %32
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = srem i32 %14, 15
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %12
%18 = load i32*, i32** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %31
24: ; preds = %12
%25 = load i32*, i32** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %24, %17
br label %32
32: ; preds = %31, %7
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %4
36: ; preds = %4
%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):
@.str = [4 x i8] c"%8d\00"
define void @array_print(i32* nocapture %0) {
br label %2
2: ; preds = %1, %12
%3 = phi i64 [ 0, %1 ], [ %4, %12 ]
%4 = add nuw nsw i64 %3, 1
%5 = trunc i64 %4 to i8
%6 = urem i8 %5, 15
%7 = icmp eq i8 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = getelementptr inbounds i32, i32* %0, i64 %3
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %2, %8
%13 = icmp eq i64 %4, 50
br i1 %13, label %14, label %2
14: ; preds = %12
%15 = tail call i32 @putchar(i32 10)
ret void
}