#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 *, float const);
int /*<<< orphan*/ putchar(char);
void printArray(const float array[], int n) {
  for (int i = 0; i < n; i++) {
    printf("%12.5f", array[i]);
    if (i % 5 == 4)
      putchar('\n');
  }
  if (n % 5 != 0)
    putchar('\n');
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118c <printArray+0x6c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x4,%edx
jne    1179 <printArray+0x59>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    117e <printArray+0x5e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <printArray+0x16>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11aa <printArray+0x8a>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,0x4(%rsp)
test   %esi,%esi
jle    118a <printArray+0x6a>
mov    %rdi,%r12
mov    0x4(%rsp),%ebp
xor    %ebx,%ebx
mov    $0xcccccccd,%r13d
lea    0xeb7(%rip),%r15
jmp    1159 <printArray+0x39>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     118a <printArray+0x6a>
mov    %ebx,%eax
imul   %r13,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%r14d
add    $0x4,%r14d
movss  (%r12,%rbx,4),%xmm0
mov    %r15,%rdi
call   1040 <printf@plt>
cmp    %ebx,%r14d
jne    1150 <printArray+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <printArray+0x30>
imul   $0xcccccccd,0x4(%rsp),%eax
cc
add    $0x19999999,%eax
cmp    $0x33333333,%eax
jb     11b6 <printArray+0x96>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%12.5f\00"
define void @printArray(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %23, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %26
10: ; preds = %6
%11 = load float*, float** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float, float* %11, i64 %13
%15 = load float, float* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %15)
%17 = load i32, i32* %5
%18 = srem i32 %17, 5
%19 = icmp eq i32 %18, 4
br i1 %19, label %20, label %22
20: ; preds = %10
%21 = call i32 @putchar(i8 signext 10)
br label %22
22: ; preds = %20, %10
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %6
26: ; preds = %6
%27 = load i32, i32* %4
%28 = srem i32 %27, 5
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @putchar(i8 signext 10)
br label %32
32: ; preds = %30, %26
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%12.5f\00"
define void @printArray(float* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %9
6: ; preds = %19, %2
%7 = srem i32 %1, 5
%8 = icmp eq i32 %7, 0
br i1 %8, label %24, label %22
9: ; preds = %4, %19
%10 = phi i64 [ 0, %4 ], [ %20, %19 ]
%11 = getelementptr inbounds float, float* %0, i64 %10
%12 = load float, float* %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %12)
%14 = trunc i64 %10 to i32
%15 = urem i32 %14, 5
%16 = icmp eq i32 %15, 4
br i1 %16, label %17, label %19
17: ; preds = %9
%18 = tail call i32 @putchar(i8 signext 10)
br label %19
19: ; preds = %9, %17
%20 = add nuw nsw i64 %10, 1
%21 = icmp eq i64 %20, %5
br i1 %21, label %6, label %9
22: ; preds = %6
%23 = tail call i32 @putchar(i8 signext 10)
br label %24
24: ; preds = %22, %6
ret void
}