void ftest(float data1[], unsigned long n1, float data2[], unsigned long n2,
           float *f, float *prob) {
  void avevar(float data[], unsigned long n, float *ave, float *var);
  float betai(float a, float b, float x);
  float var1, var2, ave1, ave2, df1, df2;
  avevar(data1, n1, &ave1, &var1);
  avevar(data2, n2, &ave2, &var2);
  if (var1 > var2) {
    *f = var1 / var2;
    df1 = n1 - 1;
    df2 = n2 - 1;
  } else {
    *f = var2 / var1;
    df1 = n2 - 1;
    df2 = n1 - 1;
  }
  *prob = 2.0 * betai(0.5 * df2, 0.5 * df1, df2 / (df2 + df1 * (*f)));
  if (*prob > 1.0)
    *prob = 2.0 - *prob;
}


x86 assembly (clang, -O0):
<ftest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
lea    -0x34(%rbp),%rcx
call   1030 <avevar@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   1030 <avevar@plt>
movss  -0x34(%rbp),%xmm0
ucomiss -0x38(%rbp),%xmm0
jbe    122a <ftest+0x10a>
movss  -0x34(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x50(%rbp)
test   %rax,%rax
movss  %xmm0,-0x4c(%rbp)
js     11d0 <ftest+0xb0>
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x58(%rbp)
test   %rax,%rax
movss  %xmm0,-0x54(%rbp)
js     121b <ftest+0xfb>
movss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
jmp    12d6 <ftest+0x1b6>
movss  -0x38(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x60(%rbp)
test   %rax,%rax
movss  %xmm0,-0x5c(%rbp)
js     1281 <ftest+0x161>
movss  -0x60(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x68(%rbp)
test   %rax,%rax
movss  %xmm0,-0x64(%rbp)
js     12cc <ftest+0x1ac>
movss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd29(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x44(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xd10(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  -0x48(%rbp),%xmm2
movss  -0x48(%rbp),%xmm4
movss  -0x44(%rbp),%xmm3
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm5
mulss  %xmm5,%xmm3
addss  %xmm4,%xmm3
divss  %xmm3,%xmm2
call   1040 <betai@plt>
cvtss2sd %xmm0,%xmm1
movsd  0xccc(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x30(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xca0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    138e <ftest+0x26e>
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc8a(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x30(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftest>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%rbx
mov    %rdx,%r13
mov    %rsi,%r12
lea    0xc(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1030 <avevar@plt>
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <avevar@plt>
movss  0x4(%rsp),%xmm3
movss  (%rsp),%xmm0
ucomiss %xmm0,%xmm3
jbe    1177 <ftest+0x57>
divss  %xmm0,%xmm3
mov    %r12,%rax
jmp    1184 <ftest+0x64>
divss  %xmm3,%xmm0
movaps %xmm0,%xmm3
mov    %rbx,%rax
mov    %r12,%rbx
movss  %xmm3,(%r15)
add    $0xffffffffffffffff,%rbx
add    $0xffffffffffffffff,%rax
test   %rbx,%rbx
js     11b7 <ftest+0x97>
cvtsi2ss %rbx,%xmm2
test   %rax,%rax
jns    11d1 <ftest+0xb1>
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
or     %rcx,%rax
cvtsi2ss %rax,%xmm4
addss  %xmm4,%xmm4
jmp    11d6 <ftest+0xb6>
mov    %rbx,%rcx
shr    %rcx
and    $0x1,%ebx
or     %rcx,%rbx
cvtsi2ss %rbx,%xmm2
addss  %xmm2,%xmm2
test   %rax,%rax
js     11a0 <ftest+0x80>
cvtsi2ss %rax,%xmm4
movss  0xe22(%rip),%xmm1
movaps %xmm2,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm4,%xmm1
mulss  %xmm4,%xmm3
addss  %xmm2,%xmm3
divss  %xmm3,%xmm2
call   1040 <betai@plt>
addss  %xmm0,%xmm0
movss  0xdfe(%rip),%xmm1
subss  %xmm0,%xmm1
movss  0xdf6(%rip),%xmm2
cmpltss %xmm0,%xmm2
andps  %xmm2,%xmm1
andnps %xmm0,%xmm2
orps   %xmm1,%xmm2
movss  %xmm2,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ftest(float* %0, i64 %1, float* %2, i64 %3, float* %4, float* %5) {
%7 = alloca float*
%8 = alloca i64
%9 = alloca float*
%10 = alloca i64
%11 = alloca float*
%12 = alloca float*
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
store float* %0, float** %7
store i64 %1, i64* %8
store float* %2, float** %9
store i64 %3, i64* %10
store float* %4, float** %11
store float* %5, float** %12
%19 = load float*, float** %7
%20 = load i64, i64* %8
%21 = load float*, float** %9
%22 = load i64, i64* %10
%23 = load float, float* %13
%24 = load float, float* %14
%25 = fcmp ogt float %23, %24
br i1 %25, label %26, label %37
26: ; preds = %6
%27 = load float, float* %13
%28 = load float, float* %14
%29 = fdiv float %27, %28
%30 = load float*, float** %11
store float %29, float* %30
%31 = load i64, i64* %8
%32 = sub i64 %31, 1
%33 = uitofp i64 %32 to float
store float %33, float* %17
%34 = load i64, i64* %10
%35 = sub i64 %34, 1
%36 = uitofp i64 %35 to float
store float %36, float* %18
br label %48
37: ; preds = %6
%38 = load float, float* %14
%39 = load float, float* %13
%40 = fdiv float %38, %39
%41 = load float*, float** %11
store float %40, float* %41
%42 = load i64, i64* %10
%43 = sub i64 %42, 1
%44 = uitofp i64 %43 to float
store float %44, float* %17
%45 = load i64, i64* %8
%46 = sub i64 %45, 1
%47 = uitofp i64 %46 to float
store float %47, float* %18
br label %48
48: ; preds = %37, %26
%49 = load float, float* %18
%50 = fpext float %49 to double
%51 = fmul double 5.000000e-01, %50
%52 = fptrunc double %51 to float
%53 = load float, float* %17
%54 = fpext float %53 to double
%55 = fmul double 5.000000e-01, %54
%56 = fptrunc double %55 to float
%57 = load float, float* %18
%58 = load float, float* %18
%59 = load float, float* %17
%60 = load float*, float** %11
%61 = load float, float* %60
%62 = call float @llvm.fmuladd.f32(float %59, float %61, float %58)
%63 = fdiv float %57, %62
%64 = call float @betai(float %52, float %56, float %63)
%65 = fpext float %64 to double
%66 = fmul double 2.000000e+00, %65
%67 = fptrunc double %66 to float
%68 = load float*, float** %12
store float %67, float* %68
%69 = load float*, float** %12
%70 = load float, float* %69
%71 = fpext float %70 to double
%72 = fcmp ogt double %71, 1.000000e+00
br i1 %72, label %73, label %80
73: ; preds = %48
%74 = load float*, float** %12
%75 = load float, float* %74
%76 = fpext float %75 to double
%77 = fsub double 2.000000e+00, %76
%78 = fptrunc double %77 to float
%79 = load float*, float** %12
store float %78, float* %79
br label %80
80: ; preds = %73, %48
ret void
}

LLVM IR (-O2):
define void @ftest(float* %0, i64 %1, float* %2, i64 %3, float* nocapture %4, float* nocapture writeonly %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = bitcast float* %7 to i8*
%12 = bitcast float* %8 to i8*
%13 = bitcast float* %9 to i8*
%14 = bitcast float* %10 to i8*
%15 = load float, float* %7
%16 = load float, float* %8
%17 = fcmp ogt float %15, %16
br i1 %17, label %18, label %20
18: ; preds = %6
%19 = fdiv float %15, %16
br label %22
20: ; preds = %6
%21 = fdiv float %16, %15
br label %22
22: ; preds = %20, %18
%23 = phi float [ %19, %18 ], [ %21, %20 ]
%24 = phi i64 [ %1, %18 ], [ %3, %20 ]
%25 = phi i64 [ %3, %18 ], [ %1, %20 ]
store float %23, float* %4
%26 = add i64 %25, -1
%27 = add i64 %24, -1
%28 = uitofp i64 %26 to float
%29 = uitofp i64 %27 to float
%30 = fmul float %28, 5.000000e-01
%31 = fmul float %29, 5.000000e-01
%32 = call float @llvm.fmuladd.f32(float %29, float %23, float %28)
%33 = fdiv float %28, %32
%34 = call float @betai(float %30, float %31, float %33)
%35 = fmul float %34, 2.000000e+00
%36 = fcmp ogt float %35, 1.000000e+00
%37 = fsub float 2.000000e+00, %35
%38 = select i1 %36, float %37, float %35
store float %38, float* %5
ret void
}