#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 exp(int /*<<< orphan*/);
int /*<<< orphan*/ gammaLn(int);
void logLogisticFit(double beta[], double logLogisticParams[]) {
  double g1, g2;
  logLogisticParams[2] =
      (2 * beta[1] - beta[0]) / (6 * beta[1] - beta[0] - 6 * beta[2]);
  g1 = exp(gammaLn(1 + 1 / logLogisticParams[2]));
  g2 = exp(gammaLn(1 - 1 / logLogisticParams[2]));
  logLogisticParams[1] =
      (beta[0] - 2 * beta[1]) * logLogisticParams[2] / (g1 * g2);
  logLogisticParams[0] = beta[0] - logLogisticParams[1] * g1 * g2;
}


x86 assembly (clang, -O0):
<logLogisticFit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe80(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
movsd  0xe5f(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe36(%rip),%xmm1
divsd  0x10(%rax),%xmm1
movsd  0xe29(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <gammaLn@plt>
mov    %eax,%edi
call   1040 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xe04(%rip),%xmm1
divsd  0x10(%rax),%xmm1
movsd  0xdf7(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <gammaLn@plt>
mov    %eax,%edi
call   1040 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logLogisticFit>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
subsd  %xmm0,%xmm2
mulsd  0xeb9(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0xeb0(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsi)
movsd  0xea3(%rip),%xmm1
movapd %xmm1,%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <gammaLn@plt>
mov    %eax,%edi
call   1040 <exp@plt>
movsd  0xe7f(%rip),%xmm2
movapd %xmm2,%xmm1
divsd  0x10(%r14),%xmm1
movsd  %xmm0,(%rsp)
subsd  %xmm1,%xmm2
cvttsd2si %xmm2,%edi
call   1030 <gammaLn@plt>
mov    %eax,%edi
call   1040 <exp@plt>
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm2
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
mulsd  0x10(%r14),%xmm1
movsd  (%rsp),%xmm3
movapd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%r14)
movsd  (%rbx),%xmm2
mulsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm2
movsd  %xmm2,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @logLogisticFit(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%7 = load double*, double** %3
%8 = getelementptr inbounds double, double* %7, i64 1
%9 = load double, double* %8
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fneg double %12
%14 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %9, double %13)
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = fneg double %20
%22 = call double @llvm.fmuladd.f64(double 6.000000e+00, double %17, double %21)
%23 = load double*, double** %3
%24 = getelementptr inbounds double, double* %23, i64 2
%25 = load double, double* %24
%26 = call double @llvm.fmuladd.f64(double -6.000000e+00, double %25, double %22)
%27 = fdiv double %14, %26
%28 = load double*, double** %4
%29 = getelementptr inbounds double, double* %28, i64 2
store double %27, double* %29
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 2
%32 = load double, double* %31
%33 = fdiv double 1.000000e+00, %32
%34 = fadd double 1.000000e+00, %33
%35 = fptosi double %34 to i32
%36 = call i32 @gammaLn(i32 %35)
%37 = call double @exp(i32 %36)
store double %37, double* %5
%38 = load double*, double** %4
%39 = getelementptr inbounds double, double* %38, i64 2
%40 = load double, double* %39
%41 = fdiv double 1.000000e+00, %40
%42 = fsub double 1.000000e+00, %41
%43 = fptosi double %42 to i32
%44 = call i32 @gammaLn(i32 %43)
%45 = call double @exp(i32 %44)
store double %45, double* %6
%46 = load double*, double** %3
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
%49 = load double*, double** %3
%50 = getelementptr inbounds double, double* %49, i64 1
%51 = load double, double* %50
%52 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %51, double %48)
%53 = load double*, double** %4
%54 = getelementptr inbounds double, double* %53, i64 2
%55 = load double, double* %54
%56 = fmul double %52, %55
%57 = load double, double* %5
%58 = load double, double* %6
%59 = fmul double %57, %58
%60 = fdiv double %56, %59
%61 = load double*, double** %4
%62 = getelementptr inbounds double, double* %61, i64 1
store double %60, double* %62
%63 = load double*, double** %3
%64 = getelementptr inbounds double, double* %63, i64 0
%65 = load double, double* %64
%66 = load double*, double** %4
%67 = getelementptr inbounds double, double* %66, i64 1
%68 = load double, double* %67
%69 = load double, double* %5
%70 = fmul double %68, %69
%71 = load double, double* %6
%72 = fneg double %70
%73 = call double @llvm.fmuladd.f64(double %72, double %71, double %65)
%74 = load double*, double** %4
%75 = getelementptr inbounds double, double* %74, i64 0
store double %73, double* %75
ret void
}

LLVM IR (-O2):
define void @logLogisticFit(double* nocapture %0, double* nocapture %1) {
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = load double, double* %0
%6 = fneg double %5
%7 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double %6)
%8 = tail call double @llvm.fmuladd.f64(double %4, double 6.000000e+00, double %6)
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = tail call double @llvm.fmuladd.f64(double %10, double -6.000000e+00, double %8)
%12 = fdiv double %7, %11
%13 = getelementptr inbounds double, double* %1, i64 2
store double %12, double* %13
%14 = fdiv double 1.000000e+00, %12
%15 = fadd double %14, 1.000000e+00
%16 = fptosi double %15 to i32
%17 = tail call i32 @gammaLn(i32 %16)
%18 = tail call double @exp(i32 %17)
%19 = load double, double* %13
%20 = fdiv double 1.000000e+00, %19
%21 = fsub double 1.000000e+00, %20
%22 = fptosi double %21 to i32
%23 = tail call i32 @gammaLn(i32 %22)
%24 = tail call double @exp(i32 %23)
%25 = load double, double* %0
%26 = load double, double* %3
%27 = tail call double @llvm.fmuladd.f64(double %26, double -2.000000e+00, double %25)
%28 = load double, double* %13
%29 = fmul double %27, %28
%30 = fmul double %18, %24
%31 = fdiv double %29, %30
%32 = getelementptr inbounds double, double* %1, i64 1
store double %31, double* %32
%33 = load double, double* %0
%34 = fneg double %31
%35 = fmul double %18, %34
%36 = tail call double @llvm.fmuladd.f64(double %35, double %24, double %33)
store double %36, double* %1
ret void
}