#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 pf(double, int, int);
int vpest(int n1, int n2, double uv1, double uv2, double g, double *xl,
          double *xu) {
  double f, w;
  if (n1 < 2 || n2 < 2 || g <= 0.0 || g >= 1.0)
    return 999;
  w = uv1 / uv2;
  f = (1.0 - g) * 0.5;
  *xl = w / pf(f, n1 - 1, n2 - 1);
  *xu = w * pf(f, n2 - 1, n1 - 1);
  return 0;
}


x86 assembly (clang, -O0):
<vpest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     116e <vpest+0x5e>
cmpl   $0x2,-0xc(%rbp)
jl     116e <vpest+0x5e>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jae    116e <vpest+0x5e>
movsd  -0x28(%rbp),%xmm0
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     117a <vpest+0x6a>
movl   $0x3e7,-0x4(%rbp)
jmp    1216 <vpest+0x106>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe6f(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xe6a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <pf@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1030 <pf@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpest>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
ucomisd 0xede(%rip),%xmm2
mov    $0x3e7,%eax
jae    11a5 <vpest+0x95>
mov    %edi,%ebp
cmp    $0x2,%edi
jl     11a5 <vpest+0x95>
mov    %esi,%ebx
cmp    $0x2,%esi
jl     11a5 <vpest+0x95>
xorpd  %xmm3,%xmm3
ucomisd %xmm2,%xmm3
jae    11a5 <vpest+0x95>
mov    %rcx,%r14
mov    %rdx,%r15
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xea7(%rip),%xmm0
subsd  %xmm2,%xmm0
mulsd  0xea3(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0xffffffff,%ebp
add    $0xffffffff,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <pf@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r15)
movsd  0x10(%rsp),%xmm0
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <pf@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @vpest(i32 %0, i32 %1, double %2, double %3, double %4, double* %5, double* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca double
%17 = alloca double
store i32 %0, i32* %9
store i32 %1, i32* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double* %5, double** %14
store double* %6, double** %15
%18 = load i32, i32* %9
%19 = icmp slt i32 %18, 2
br i1 %19, label %29, label %20
20: ; preds = %7
%21 = load i32, i32* %10
%22 = icmp slt i32 %21, 2
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = load double, double* %13
%25 = fcmp ole double %24, 0.000000e+00
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load double, double* %13
%28 = fcmp oge double %27, 1.000000e+00
br i1 %28, label %29, label %30
29: ; preds = %26, %23, %20, %7
store i32 999, i32* %8
br label %55
30: ; preds = %26
%31 = load double, double* %11
%32 = load double, double* %12
%33 = fdiv double %31, %32
store double %33, double* %17
%34 = load double, double* %13
%35 = fsub double 1.000000e+00, %34
%36 = fmul double %35, 5.000000e-01
store double %36, double* %16
%37 = load double, double* %17
%38 = load double, double* %16
%39 = load i32, i32* %9
%40 = sub nsw i32 %39, 1
%41 = load i32, i32* %10
%42 = sub nsw i32 %41, 1
%43 = call double @pf(double %38, i32 %40, i32 %42)
%44 = fdiv double %37, %43
%45 = load double*, double** %14
store double %44, double* %45
%46 = load double, double* %17
%47 = load double, double* %16
%48 = load i32, i32* %10
%49 = sub nsw i32 %48, 1
%50 = load i32, i32* %9
%51 = sub nsw i32 %50, 1
%52 = call double @pf(double %47, i32 %49, i32 %51)
%53 = fmul double %46, %52
%54 = load double*, double** %15
store double %53, double* %54
store i32 0, i32* %8
br label %55
55: ; preds = %30, %29
%56 = load i32, i32* %8
ret i32 %56
}

LLVM IR (-O2):
define i32 @vpest(i32 %0, i32 %1, double %2, double %3, double %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = icmp slt i32 %0, 2
%9 = icmp slt i32 %1, 2
%10 = or i1 %8, %9
%11 = fcmp ole double %4, 0.000000e+00
%12 = or i1 %10, %11
%13 = fcmp oge double %4, 1.000000e+00
%14 = or i1 %13, %12
br i1 %14, label %25, label %15
15: ; preds = %7
%16 = fdiv double %2, %3
%17 = fsub double 1.000000e+00, %4
%18 = fmul double %17, 5.000000e-01
%19 = add nsw i32 %0, -1
%20 = add nsw i32 %1, -1
%21 = tail call double @pf(double %18, i32 %19, i32 %20)
%22 = fdiv double %16, %21
store double %22, double* %5
%23 = tail call double @pf(double %18, i32 %20, i32 %19)
%24 = fmul double %16, %23
store double %24, double* %6
br label %25
25: ; preds = %7, %15
%26 = phi i32 [ 0, %15 ], [ 999, %7 ]
ret i32 %26
}