#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 dump_floats(float *vect, int len, char *name) {
  int i;
  printf("static const float %s[] = {\n\t", name);
  for (i = 0; i < len; i++) {
    char *end;
    if (i == len - 1)
      end = "\n";
    else if ((i & 3) == 3)
      end = ",\n\t";
    else
      end = ", ";
    printf("%14.7ef%s", vect[i], end);
  }
  printf("};\n");
}


x86 assembly (clang, -O0):
<dump_floats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c9 <dump_floats+0xb9>
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1169 <dump_floats+0x59>
lea    0xed1(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1198 <dump_floats+0x88>
mov    -0x1c(%rbp),%eax
and    $0x3,%eax
cmp    $0x3,%eax
jne    1188 <dump_floats+0x78>
lea    0xe9f(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1193 <dump_floats+0x83>
lea    0xe93(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1198 <dump_floats+0x88>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x28(%rbp),%rsi
lea    0xe71(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <dump_floats+0x2c>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_floats>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xec8(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    119c <dump_floats+0x7c>
lea    -0x1(%r14),%r12d
mov    %r14d,%r13d
xor    %ebx,%ebx
lea    0xec7(%rip),%rbp
lea    0xec9(%rip),%r14
xchg   %ax,%ax
mov    %ebx,%eax
not    %eax
test   $0x3,%al
lea    0xeb7(%rip),%rsi
lea    0xeac(%rip),%rax
cmove  %rax,%rsi
cmp    %rbx,%r12
cmove  %rbp,%rsi
movss  (%r15,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1160 <dump_floats+0x40>
lea    0xe8e(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str = [30 x i8] c"static const float %s[] = {\0A\09\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [4 x i8] c",\0A\09\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [10 x i8] c"%14.7ef%s\00"
@str = [3 x i8] c"};\00"
define void @dump_floats(float* nocapture %0, i32 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %23
6: ; preds = %3
%7 = add nsw i32 %1, -1
%8 = zext i32 %7 to i64
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %6, %10
%11 = phi i64 [ 0, %6 ], [ %21, %10 ]
%12 = icmp eq i64 %11, %8
%13 = and i64 %11, 3
%14 = icmp eq i64 %13, 3
%15 = select i1 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%16 = select i1 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %15
%17 = getelementptr inbounds float, float* %0, i64 %11
%18 = load float, float* %17
%19 = fpext float %18 to double
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %19, i8* %16)
%21 = add nuw nsw i64 %11, 1
%22 = icmp eq i64 %21, %9
br i1 %22, label %23, label %10
23: ; preds = %10, %3
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}