#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void logger_bbob_write_data(FILE *target_file, size_t number_of_evaluations,
                            double fvalue, double best_fvalue,
                            double best_value, const double *x,
                            size_t number_of_variables) {
  fprintf(target_file, "%ld %+10.9e %+10.9e %+10.9e %+10.9e",
          number_of_evaluations, fvalue - best_value, best_fvalue - best_value,
          fvalue, best_fvalue);
  if (number_of_variables < 22) {
    size_t i;
    for (i = 0; i < number_of_variables; i++) {
      fprintf(target_file, " %+5.4e", x[i]);
    }
  }
  fprintf(target_file, "\n");
}


x86 assembly (clang, -O0):
<logger_bbob_write_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
lea    0xe9c(%rip),%rsi
mov    $0x4,%al
call   1030 <fprintf@plt>
cmpq   $0x16,-0x38(%rbp)
jae    11c1 <logger_bbob_write_data+0xb1>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    11bc <logger_bbob_write_data+0xac>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe80(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    117e <logger_bbob_write_data+0x6e>
jmp    11c1 <logger_bbob_write_data+0xb1>
mov    -0x8(%rbp),%rdi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_bbob_write_data>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r15
mov    %rdx,%r14
movapd %xmm1,%xmm3
movapd %xmm0,%xmm4
mov    %rsi,%rdx
mov    %rdi,%r13
subsd  %xmm2,%xmm0
subsd  %xmm2,%xmm1
lea    0xeb4(%rip),%rsi
movapd %xmm4,%xmm2
mov    $0x4,%al
call   1040 <fprintf@plt>
lea    -0x1(%r15),%rax
cmp    $0x14,%rax
ja     118c <logger_bbob_write_data+0x6c>
xor    %ebx,%ebx
lea    0xeba(%rip),%r12
nopw   0x0(%rax,%rax,1)
movsd  (%r14,%rbx,8),%xmm0
mov    %r13,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <logger_bbob_write_data+0x50>
mov    $0xa,%edi
mov    %r13,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"%ld %+10.9e %+10.9e %+10.9e %+10.9e\00"
@.str.1 = [8 x i8] c" %+5.4e\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @logger_bbob_write_data(i32* %0, i64 %1, double %2, double %3, double %4, double* %5, i64 %6) {
%8 = alloca i32*
%9 = alloca i64
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double*
%14 = alloca i64
%15 = alloca i64
store i32* %0, i32** %8
store i64 %1, i64* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double* %5, double** %13
store i64 %6, i64* %14
%16 = load i32*, i32** %8
%17 = load i64, i64* %9
%18 = load double, double* %10
%19 = load double, double* %12
%20 = fsub double %18, %19
%21 = load double, double* %11
%22 = load double, double* %12
%23 = fsub double %21, %22
%24 = load double, double* %10
%25 = load double, double* %11
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 %17, double %20, double %23, double %24, double %25)
%27 = load i64, i64* %14
%28 = icmp ult i64 %27, 22
br i1 %28, label %29, label %45
29: ; preds = %7
store i64 0, i64* %15
br label %30
30: ; preds = %41, %29
%31 = load i64, i64* %15
%32 = load i64, i64* %14
%33 = icmp ult i64 %31, %32
br i1 %33, label %34, label %44
34: ; preds = %30
%35 = load i32*, i32** %8
%36 = load double*, double** %13
%37 = load i64, i64* %15
%38 = getelementptr inbounds double, double* %36, i64 %37
%39 = load double, double* %38
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %39)
br label %41
41: ; preds = %34
%42 = load i64, i64* %15
%43 = add i64 %42, 1
store i64 %43, i64* %15
br label %30
44: ; preds = %30
br label %45
45: ; preds = %44, %7
%46 = load i32*, i32** %8
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"%ld %+10.9e %+10.9e %+10.9e %+10.9e\00"
@.str.1 = [8 x i8] c" %+5.4e\00"
define void @logger_bbob_write_data(i32* nocapture %0, i64 %1, double %2, double %3, double %4, double* nocapture %5, i64 %6) {
%8 = fsub double %2, %4
%9 = fsub double %3, %4
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 %1, double %8, double %9, double %2, double %3)
%11 = add i64 %6, -1
%12 = icmp ult i64 %11, 21
br i1 %12, label %13, label %20
13: ; preds = %7, %13
%14 = phi i64 [ %18, %13 ], [ 0, %7 ]
%15 = getelementptr inbounds double, double* %5, i64 %14
%16 = load double, double* %15
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %16)
%18 = add nuw i64 %14, 1
%19 = icmp eq i64 %18, %6
br i1 %19, label %20, label %13
20: ; preds = %13, %7
%21 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}