#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 */
double fabs(double);
double pow(double, double);
double sqrt(double const);
double f_linear_slope_raw(const double *x, const size_t number_of_variables,
                          const double *best_parameter) {
  static const double alpha = 100.0;
  size_t i;
  double result = 0.0;
  for (i = 0; i < number_of_variables; ++i) {
    double base, exponent, si;
    base = sqrt(alpha);
    exponent = (double)(long)i / ((double)(long)number_of_variables - 1);
    if (best_parameter[i] > 0.0) {
      si = pow(base, exponent);
    } else {
      si = -pow(base, exponent);
    }
    result += 5.0 * fabs(si) - si * x[i];
  }
  return result;
}


x86 assembly (clang, -O0):
<f_linear_slope_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1247 <f_linear_slope_raw+0x127>
movsd  0xeae(%rip),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdq -0x20(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xe88(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11b8 <f_linear_slope_raw+0x98>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
jmp    11e3 <f_linear_slope_raw+0xc3>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1030 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movaps 0xe31(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xdec(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1144 <f_linear_slope_raw+0x24>
movsd  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_linear_slope_raw>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %rsi,%rsi
je     11d2 <f_linear_slope_raw+0xc2>
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
cvtsi2sd %rsi,%xmm0
addsd  0xec6(%rip),%xmm0
movsd  %xmm0,(%rsp)
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,0x8(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %rbx,%xmm1
divsd  (%rsp),%xmm1
xorpd  %xmm0,%xmm0
cmpltsd (%r14,%rbx,8),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0xe8c(%rip),%xmm0
call   1030 <pow@plt>
movapd %xmm0,%xmm1
andpd  0xe93(%rip),%xmm1
movapd 0x10(%rsp),%xmm3
movapd %xmm3,%xmm2
andnpd %xmm0,%xmm2
xorpd  0xe8d(%rip),%xmm0
andpd  %xmm3,%xmm0
orpd   %xmm2,%xmm0
mulsd  (%r15,%rbx,8),%xmm0
mulsd  0xe57(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <f_linear_slope_raw+0x40>
jmp    11d6 <f_linear_slope_raw+0xc6>
xorpd  %xmm0,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@f_linear_slope_raw.alpha = internal constant double 1.000000e+02
define double @f_linear_slope_raw(double* %0, i64 %1, double* %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca double*
%7 = alloca i64
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double* %0, double** %4
store i64 %1, i64* %5
store double* %2, double** %6
store double 0.000000e+00, double* %8
store i64 0, i64* %7
br label %12
12: ; preds = %51, %3
%13 = load i64, i64* %7
%14 = load i64, i64* %5
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %54
16: ; preds = %12
%17 = call double @sqrt(double 1.000000e+02)
store double %17, double* %9
%18 = load i64, i64* %7
%19 = sitofp i64 %18 to double
%20 = load i64, i64* %5
%21 = sitofp i64 %20 to double
%22 = fsub double %21, 1.000000e+00
%23 = fdiv double %19, %22
store double %23, double* %10
%24 = load double*, double** %6
%25 = load i64, i64* %7
%26 = getelementptr inbounds double, double* %24, i64 %25
%27 = load double, double* %26
%28 = fcmp ogt double %27, 0.000000e+00
br i1 %28, label %29, label %33
29: ; preds = %16
%30 = load double, double* %9
%31 = load double, double* %10
%32 = call double @pow(double %30, double %31)
store double %32, double* %11
br label %38
33: ; preds = %16
%34 = load double, double* %9
%35 = load double, double* %10
%36 = call double @pow(double %34, double %35)
%37 = fneg double %36
store double %37, double* %11
br label %38
38: ; preds = %33, %29
%39 = load double, double* %11
%40 = call double @llvm.fabs.f64(double %39)
%41 = load double, double* %11
%42 = load double*, double** %4
%43 = load i64, i64* %7
%44 = getelementptr inbounds double, double* %42, i64 %43
%45 = load double, double* %44
%46 = fmul double %41, %45
%47 = fneg double %46
%48 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %40, double %47)
%49 = load double, double* %8
%50 = fadd double %49, %48
store double %50, double* %8
br label %51
51: ; preds = %38
%52 = load i64, i64* %7
%53 = add i64 %52, 1
store i64 %53, i64* %7
br label %12
54: ; preds = %12
%55 = load double, double* %8
ret double %55
}

LLVM IR (-O2):
define double @f_linear_slope_raw(double* nocapture %0, i64 %1, double* nocapture %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %27, label %5
5: ; preds = %3
%6 = sitofp i64 %1 to double
%7 = fadd double %6, -1.000000e+00
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %25, %8 ]
%10 = phi double [ 0.000000e+00, %5 ], [ %24, %8 ]
%11 = sitofp i64 %9 to double
%12 = fdiv double %11, %7
%13 = getelementptr inbounds double, double* %2, i64 %9
%14 = load double, double* %13
%15 = fcmp ogt double %14, 0.000000e+00
%16 = tail call double @pow(double 1.000000e+01, double %12)
%17 = tail call double @llvm.fabs.f64(double %16)
%18 = getelementptr inbounds double, double* %0, i64 %9
%19 = load double, double* %18
%20 = fneg double %16
%21 = select i1 %15, double %20, double %16
%22 = fmul double %19, %21
%23 = tail call double @llvm.fmuladd.f64(double %17, double 5.000000e+00, double %22)
%24 = fadd double %10, %23
%25 = add nuw i64 %9, 1
%26 = icmp eq i64 %25, %1
br i1 %26, label %27, label %8
27: ; preds = %8, %3
%28 = phi double [ 0.000000e+00, %3 ], [ %24, %8 ]
ret double %28
}