#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(float *array, int length) {
  char i = 0;
  for (i = 0; i < length; i++) {
    printf("%.1f, ", array[i]);
    if (i == length - 1) {
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,-0xd(%rbp)
movb   $0x0,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1186 <printArray+0x76>
mov    -0x8(%rbp),%rax
movsbq -0xd(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1174 <printArray+0x64>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1179 <printArray+0x69>
mov    -0xd(%rbp),%al
add    $0x1,%al
mov    %al,-0xd(%rbp)
jmp    1127 <printArray+0x17>
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
test   %esi,%esi
jle    1183 <printArray+0x63>
mov    %esi,%r12d
mov    %rdi,%r14
lea    -0x1(%r12),%r13d
xor    %ebx,%ebx
lea    0xebd(%rip),%r15
jmp    115b <printArray+0x3b>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%bl
movsbl %bl,%ebx
cmp    %r12d,%ebx
jge    1183 <printArray+0x63>
movslq %ebx,%rbp
movss  (%r14,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmp    %ebp,%r13d
jne    1150 <printArray+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <printArray+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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