#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 ranf();
int sqrt(int);
double variablePopnSizeTraj(double dt, double currentFreq, double alpha,
                            double h, double f) {
  double mean, var, p;
  if (alpha > 0.0)
    mean = -1. * alpha * currentFreq * (1. - currentFreq) *
           (currentFreq + h * (1. - 2. * currentFreq));
  else
    mean = -1.0 * currentFreq;
  var = currentFreq * (1. - currentFreq) * 2. / f;
  p = (mean * dt) + ((2. * ranf() - 1.) * sqrt(3. * var) * dt);
  if ((currentFreq + p) > 1.0) {
    return (1.0);
  } else {
    return (currentFreq + p);
  }
}


x86 assembly (clang, -O0):
<variablePopnSizeTraj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ab <variablePopnSizeTraj+0x8b>
movsd  0xea5(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe9b(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm4
addsd  %xmm4,%xmm4
movsd  0xe77(%rip),%xmm3
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11bd <variablePopnSizeTraj+0x9d>
movsd  0xe4d(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe3e(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3d(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    $0x0,%al
call   1030 <ranf@plt>
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm0
movsd  0xdec(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xdeb(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
cvtsi2sd %eax,%xmm3
mulsd  %xmm3,%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  0xd9a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    128a <variablePopnSizeTraj+0x16a>
movsd  0xd88(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1299 <variablePopnSizeTraj+0x179>
movsd  -0x18(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<variablePopnSizeTraj>:
sub    $0x48,%rsp
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    1174 <variablePopnSizeTraj+0x54>
xorpd  0xec4(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  0xec8(%rip),%xmm0
movapd %xmm0,%xmm6
subsd  %xmm1,%xmm6
mulsd  %xmm6,%xmm2
movapd %xmm1,%xmm5
addsd  %xmm1,%xmm5
subsd  %xmm5,%xmm0
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm3
movapd %xmm3,0x20(%rsp)
jmp    1192 <variablePopnSizeTraj+0x72>
movapd 0xe84(%rip),%xmm0
xorpd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0xe82(%rip),%xmm6
subsd  %xmm1,%xmm6
mulsd  %xmm1,%xmm6
addsd  %xmm6,%xmm6
divsd  %xmm4,%xmm6
movsd  %xmm6,0x8(%rsp)
xor    %eax,%eax
movapd %xmm1,0x30(%rsp)
call   1030 <ranf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm0
addsd  0xe54(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe48(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movapd 0x20(%rsp),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
addsd  0x30(%rsp),%xmm1
movsd  0xdfc(%rip),%xmm0
minsd  %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @variablePopnSizeTraj(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
%15 = load double, double* %9
%16 = fcmp ogt double %15, 0.000000e+00
br i1 %16, label %17, label %31
17: ; preds = %5
%18 = load double, double* %9
%19 = fmul double -1.000000e+00, %18
%20 = load double, double* %8
%21 = fmul double %19, %20
%22 = load double, double* %8
%23 = fsub double 1.000000e+00, %22
%24 = fmul double %21, %23
%25 = load double, double* %8
%26 = load double, double* %10
%27 = load double, double* %8
%28 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %27, double 1.000000e+00)
%29 = call double @llvm.fmuladd.f64(double %26, double %28, double %25)
%30 = fmul double %24, %29
store double %30, double* %12
br label %34
31: ; preds = %5
%32 = load double, double* %8
%33 = fmul double -1.000000e+00, %32
store double %33, double* %12
br label %34
34: ; preds = %31, %17
%35 = load double, double* %8
%36 = load double, double* %8
%37 = fsub double 1.000000e+00, %36
%38 = fmul double %35, %37
%39 = fmul double %38, 2.000000e+00
%40 = load double, double* %11
%41 = fdiv double %39, %40
store double %41, double* %13
%42 = load double, double* %12
%43 = load double, double* %7
%44 = call i32 (...) @ranf()
%45 = sitofp i32 %44 to double
%46 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %45, double -1.000000e+00)
%47 = load double, double* %13
%48 = fmul double 3.000000e+00, %47
%49 = fptosi double %48 to i32
%50 = call i32 @sqrt(i32 %49)
%51 = sitofp i32 %50 to double
%52 = fmul double %46, %51
%53 = load double, double* %7
%54 = fmul double %52, %53
%55 = call double @llvm.fmuladd.f64(double %42, double %43, double %54)
store double %55, double* %14
%56 = load double, double* %8
%57 = load double, double* %14
%58 = fadd double %56, %57
%59 = fcmp ogt double %58, 1.000000e+00
br i1 %59, label %60, label %61
60: ; preds = %34
store double 1.000000e+00, double* %6
br label %65
61: ; preds = %34
%62 = load double, double* %8
%63 = load double, double* %14
%64 = fadd double %62, %63
store double %64, double* %6
br label %65
65: ; preds = %61, %60
%66 = load double, double* %6
ret double %66
}

LLVM IR (-O2):
define double @variablePopnSizeTraj(double %0, double %1, double %2, double %3, double %4) {
%6 = fcmp ogt double %2, 0.000000e+00
br i1 %6, label %7, label %15
7: ; preds = %5
%8 = fneg double %2
%9 = fmul double %8, %1
%10 = fsub double 1.000000e+00, %1
%11 = fmul double %10, %9
%12 = tail call double @llvm.fmuladd.f64(double %1, double -2.000000e+00, double 1.000000e+00)
%13 = tail call double @llvm.fmuladd.f64(double %3, double %12, double %1)
%14 = fmul double %11, %13
br label %18
15: ; preds = %5
%16 = fneg double %1
%17 = fsub double 1.000000e+00, %1
br label %18
18: ; preds = %15, %7
%19 = phi double [ %17, %15 ], [ %10, %7 ]
%20 = phi double [ %16, %15 ], [ %14, %7 ]
%21 = fmul double %19, %1
%22 = fmul double %21, 2.000000e+00
%23 = fdiv double %22, %4
%24 = tail call i32 (...) @ranf()
%25 = sitofp i32 %24 to double
%26 = tail call double @llvm.fmuladd.f64(double %25, double 2.000000e+00, double -1.000000e+00)
%27 = fmul double %23, 3.000000e+00
%28 = fptosi double %27 to i32
%29 = tail call i32 @sqrt(i32 %28)
%30 = sitofp i32 %29 to double
%31 = fmul double %26, %30
%32 = fmul double %31, %0
%33 = tail call double @llvm.fmuladd.f64(double %20, double %0, double %32)
%34 = fadd double %33, %1
%35 = fcmp ogt double %34, 1.000000e+00
%36 = select i1 %35, double 1.000000e+00, double %34
ret double %36
}