#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*/ bbob2009_unif(double *, size_t, long);
int floor(int);
void bbob2009_compute_xopt(double *xopt, long seed, size_t DIM) {
  long i;
  bbob2009_unif(xopt, DIM, seed);
  for (i = 0; i < DIM; i++) {
    xopt[i] = 8 * floor(1e4 * xopt[i]) / 1e4 - 4;
    if (xopt[i] == 0.0)
      xopt[i] = -1e-5;
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <bbob2009_unif@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11f0 <bbob2009_compute_xopt+0xd0>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  0xe9d(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
shl    $0x3,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe6c(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11da <bbob2009_compute_xopt+0xba>
jp     11da <bbob2009_compute_xopt+0xba>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  0xe3b(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    11df <bbob2009_compute_xopt+0xbf>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114d <bbob2009_compute_xopt+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rdx
mov    %rdi,%r15
mov    %r14,%rsi
call   1040 <bbob2009_unif@plt>
test   %r14,%r14
je     11a9 <bbob2009_compute_xopt+0x89>
xor    %ebx,%ebx
nopl   (%rax)
movsd  (%r15,%rbx,8),%xmm0
movsd  0xeb2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
shl    $0x3,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xe93(%rip),%xmm0
addsd  0xe93(%rip),%xmm0
movapd %xmm0,%xmm1
cmpeqsd 0xe96(%rip),%xmm1
movapd %xmm1,%xmm2
andnpd %xmm0,%xmm2
movsd  0xe7e(%rip),%xmm0
andpd  %xmm0,%xmm1
orpd   %xmm2,%xmm1
movlpd %xmm1,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <bbob2009_compute_xopt+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @bbob2009_compute_xopt(double* %0, i64 %1, i64 %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store double* %0, double** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load double*, double** %4
%9 = load i64, i64* %6
%10 = load i64, i64* %5
%11 = call i32 @bbob2009_unif(double* %8, i64 %9, i64 %10)
store i64 0, i64* %7
br label %12
12: ; preds = %41, %3
%13 = load i64, i64* %7
%14 = load i64, i64* %6
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %44
16: ; preds = %12
%17 = load double*, double** %4
%18 = load i64, i64* %7
%19 = getelementptr inbounds double, double* %17, i64 %18
%20 = load double, double* %19
%21 = fmul double 1.000000e+04, %20
%22 = fptosi double %21 to i32
%23 = call i32 @floor(i32 %22)
%24 = mul nsw i32 8, %23
%25 = sitofp i32 %24 to double
%26 = fdiv double %25, 1.000000e+04
%27 = fsub double %26, 4.000000e+00
%28 = load double*, double** %4
%29 = load i64, i64* %7
%30 = getelementptr inbounds double, double* %28, i64 %29
store double %27, double* %30
%31 = load double*, double** %4
%32 = load i64, i64* %7
%33 = getelementptr inbounds double, double* %31, i64 %32
%34 = load double, double* %33
%35 = fcmp oeq double %34, 0.000000e+00
br i1 %35, label %36, label %40
36: ; preds = %16
%37 = load double*, double** %4
%38 = load i64, i64* %7
%39 = getelementptr inbounds double, double* %37, i64 %38
store double -1.000000e-05, double* %39
br label %40
40: ; preds = %36, %16
br label %41
41: ; preds = %40
%42 = load i64, i64* %7
%43 = add nsw i64 %42, 1
store i64 %43, i64* %7
br label %12
44: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @bbob2009_compute_xopt(double* %0, i64 %1, i64 %2) {
%4 = tail call i32 @bbob2009_unif(double* %0, i64 %2, i64 %1)
%5 = icmp eq i64 %2, 0
br i1 %5, label %21, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %19, %6 ], [ 0, %3 ]
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = fmul double %9, 1.000000e+04
%11 = fptosi double %10 to i32
%12 = tail call i32 @floor(i32 %11)
%13 = shl nsw i32 %12, 3
%14 = sitofp i32 %13 to double
%15 = fdiv double %14, 1.000000e+04
%16 = fadd double %15, -4.000000e+00
%17 = fcmp oeq double %16, 0.000000e+00
%18 = select i1 %17, double -1.000000e-05, double %16
store double %18, double* %8
%19 = add nuw i64 %7, 1
%20 = icmp eq i64 %19, %2
br i1 %20, label %21, label %6
21: ; preds = %6, %3
ret void
}