#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 write_float_array(const void *arg, int len, int dummy) {
  const float *data = arg;
  int i;
  printf("   ");
  for (i = 0; i < len - 1; i++) {
    printf(" "
           "%.18e"
           ",",
           data[i]);
    if ((i & 3) == 3)
      printf("\n   ");
  }
  printf(" "
         "%.18e"
         "\n",
         data[i]);
}


x86 assembly (clang, -O0):
<write_float_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    119f <write_float_array+0x8f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
and    $0x3,%eax
cmp    $0x3,%eax
jne    118c <write_float_array+0x7c>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <write_float_array+0x81>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <write_float_array+0x2f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_float_array>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xee4(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x2,%r14d
jl     1181 <write_float_array+0x71>
add    $0xffffffff,%r14d
mov    %r14d,%ebp
lea    0xebe(%rip),%r14
lea    0xebf(%rip),%r15
xor    %ebx,%ebx
jmp    1159 <write_float_array+0x49>
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1181 <write_float_array+0x71>
movss  (%r12,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %ebx,%eax
not    %eax
test   $0x3,%al
jne    1150 <write_float_array+0x40>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1150 <write_float_array+0x40>
movss  (%r12,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7b(%rip),%rdi
mov    $0x1,%al
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

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