#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ConvertFwriteFloat(int /*<<< orphan*/ *, float);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  float val[8] = {0.1, 0.2, 0.5, -0.5, 0.6, 1.2, 1.8, -0.8};
  FILE *fp;
  fp = fopen("test.dat", "w");
  for (i = 0; i < 8; i++)
    ConvertFwriteFloat(fp, val[i]);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xea7(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11bb <main+0x8b>
mov    -0x48(%rbp),%rdi
movslq -0x14(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
call   1040 <ConvertFwriteFloat@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <main+0x60>
mov    -0x48(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
lea    0xeea(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
movss  0xeb1(%rip),%xmm0
mov    %rax,%rdi
call   1040 <ConvertFwriteFloat@plt>
movss  0xea5(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <ConvertFwriteFloat@plt>
movss  0xe99(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <ConvertFwriteFloat@plt>
movss  0xe8d(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <ConvertFwriteFloat@plt>
movss  0xe81(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <ConvertFwriteFloat@plt>
movss  0xe75(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <ConvertFwriteFloat@plt>
movss  0xe69(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <ConvertFwriteFloat@plt>
movss  0xe5d(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <ConvertFwriteFloat@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.val = [8 x float] [float 0x3FB99999A0000000, float 0x3FC99999A0000000, float 5.000000e-01, float -5.000000e-01, float 0x3FE3333340000000, float 0x3FF3333340000000, float 0x3FFCCCCCC0000000, float 0xBFE99999A0000000]
@.str = [9 x i8] c"test.dat\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [8 x float]
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [8 x float]* %7 to i8*
%10 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %8
store i32 0, i32* %6
br label %11
11: ; preds = %21, %2
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32*, i32** %8
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [8 x float], [8 x float]* %7, i64 0, i64 %17
%19 = load float, float* %18
%20 = call i32 @ConvertFwriteFloat(i32* %15, float %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %11
24: ; preds = %11
%25 = load i32*, i32** %8
%26 = call i32 @fclose(i32* %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.dat\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @ConvertFwriteFloat(i32* %3, float 0x3FB99999A0000000)
%5 = tail call i32 @ConvertFwriteFloat(i32* %3, float 0x3FC99999A0000000)
%6 = tail call i32 @ConvertFwriteFloat(i32* %3, float 5.000000e-01)
%7 = tail call i32 @ConvertFwriteFloat(i32* %3, float -5.000000e-01)
%8 = tail call i32 @ConvertFwriteFloat(i32* %3, float 0x3FE3333340000000)
%9 = tail call i32 @ConvertFwriteFloat(i32* %3, float 0x3FF3333340000000)
%10 = tail call i32 @ConvertFwriteFloat(i32* %3, float 0x3FFCCCCCC0000000)
%11 = tail call i32 @ConvertFwriteFloat(i32* %3, float 0xBFE99999A0000000)
%12 = tail call i32 @fclose(i32* %3)
ret i32 0
}