#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 cdflib_gam1(double *);
double const cdflib_gamma_x(double *);
double cdflib_rlog(double *);
double const exp(double);
double log(double);
double pow(double, double);
double const sqrt(double);
double cdflib_rcomp(double *a, double *x) {
  static const double rt2pin = .398942280401433e0;
  double rcomp, t, t1, u;
  rcomp = 0.0e0;
  if (*a >= 20.0e0) {
    goto S20;
  }
  t = *a * log(*x) - *x;
  if (*a >= 1.0e0) {
    goto S10;
  }
  rcomp = *a * exp(t) * (1.0e0 + cdflib_gam1(a));
  return rcomp;
S10:
  rcomp = exp(t) / cdflib_gamma_x(a);
  return rcomp;
S20:
  u = *x / *a;
  if (u == 0.0e0) {
    return rcomp;
  }
  t = pow(1.0e0 / *a, 2.0);
  t1 = (((0.75e0 * t - 1.0e0) * t + 3.5e0) * t - 105.0e0) / (*a * 1260.0e0);
  t1 -= (*a * cdflib_rlog(&u));
  rcomp = rt2pin * sqrt(*a) * exp(t1);
  return rcomp;
}


x86 assembly (clang, -O0):
<cdflib_rcomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe68(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11a7 <cdflib_rcomp+0x37>
jmp    12a9 <cdflib_rcomp+0x139>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1070 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe03(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1214 <cdflib_rcomp+0xa4>
jmp    1271 <cdflib_rcomp+0x101>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <cdflib_gam1@plt>
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  0xdb3(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13f4 <cdflib_rcomp+0x284>
movsd  -0x28(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <cdflib_gamma_x@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13f4 <cdflib_rcomp+0x284>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12e5 <cdflib_rcomp+0x175>
jp     12e5 <cdflib_rcomp+0x175>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13f4 <cdflib_rcomp+0x284>
mov    -0x10(%rbp),%rax
movsd  0xd17(%rip),%xmm0
divsd  (%rax),%xmm0
movsd  0xd43(%rip),%xmm1
call   1080 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xd1c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd18(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcf3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcd6(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0xcbe(%rip),%xmm1
mulsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
lea    -0x38(%rbp),%rdi
call   1030 <cdflib_rlog@plt>
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xc4a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_rcomp>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movsd  (%rdi),%xmm1
ucomisd 0xe8a(%rip),%xmm1
movsd  (%rsi),%xmm0
jae    11da <cdflib_rcomp+0x7a>
mov    %rsi,%rbx
movsd  %xmm1,(%rsp)
call   1070 <log@plt>
mulsd  (%rsp),%xmm0
subsd  (%rbx),%xmm0
movsd  (%r14),%xmm1
movsd  %xmm1,(%rsp)
call   1050 <exp@plt>
movsd  (%rsp),%xmm2
ucomisd 0xe5a(%rip),%xmm2
jae    127f <cdflib_rcomp+0x11f>
movapd %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %r14,%rdi
call   1040 <cdflib_gam1@plt>
movapd %xmm0,%xmm2
addsd  0xe33(%rip),%xmm2
jmp    12b8 <cdflib_rcomp+0x158>
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jne    11f4 <cdflib_rcomp+0x94>
jnp    12bd <cdflib_rcomp+0x15d>
movsd  0xe0c(%rip),%xmm0
divsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
movsd  0xe04(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xe00(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xdfc(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xdf8(%rip),%xmm2
movsd  0xdf8(%rip),%xmm0
mulsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
lea    0x10(%rsp),%rdi
movsd  %xmm1,(%rsp)
call   1030 <cdflib_rlog@plt>
mulsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%r14),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1297 <cdflib_rcomp+0x137>
sqrtsd %xmm0,%xmm0
jmp    129c <cdflib_rcomp+0x13c>
mov    %r14,%rdi
movsd  %xmm0,(%rsp)
call   1060 <cdflib_gamma_x@plt>
movsd  (%rsp),%xmm2
divsd  %xmm0,%xmm2
jmp    12bd <cdflib_rcomp+0x15d>
call   1080 <sqrt@plt>
mulsd  0xd94(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <exp@plt>
movapd %xmm0,%xmm2
mulsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@cdflib_rcomp.rt2pin = internal constant double 0x3FD9884533D43656
define double @cdflib_rcomp(double* %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double 0.000000e+00, double* %6
%10 = load double*, double** %4
%11 = load double, double* %10
%12 = fcmp oge double %11, 2.000000e+01
br i1 %12, label %13, label %14
13: ; preds = %2
br label %46
14: ; preds = %2
%15 = load double*, double** %4
%16 = load double, double* %15
%17 = load double*, double** %5
%18 = load double, double* %17
%19 = call double @log(double %18)
%20 = load double*, double** %5
%21 = load double, double* %20
%22 = fneg double %21
%23 = call double @llvm.fmuladd.f64(double %16, double %19, double %22)
store double %23, double* %7
%24 = load double*, double** %4
%25 = load double, double* %24
%26 = fcmp oge double %25, 1.000000e+00
br i1 %26, label %27, label %28
27: ; preds = %14
br label %39
28: ; preds = %14
%29 = load double*, double** %4
%30 = load double, double* %29
%31 = load double, double* %7
%32 = call double @exp(double %31)
%33 = fmul double %30, %32
%34 = load double*, double** %4
%35 = call double @cdflib_gam1(double* %34)
%36 = fadd double 1.000000e+00, %35
%37 = fmul double %33, %36
store double %37, double* %6
%38 = load double, double* %6
store double %38, double* %3
br label %85
39: ; preds = %27
%40 = load double, double* %7
%41 = call double @exp(double %40)
%42 = load double*, double** %4
%43 = call double @cdflib_gamma_x(double* %42)
%44 = fdiv double %41, %43
store double %44, double* %6
%45 = load double, double* %6
store double %45, double* %3
br label %85
46: ; preds = %13
%47 = load double*, double** %5
%48 = load double, double* %47
%49 = load double*, double** %4
%50 = load double, double* %49
%51 = fdiv double %48, %50
store double %51, double* %9
%52 = load double, double* %9
%53 = fcmp oeq double %52, 0.000000e+00
br i1 %53, label %54, label %56
54: ; preds = %46
%55 = load double, double* %6
store double %55, double* %3
br label %85
56: ; preds = %46
%57 = load double*, double** %4
%58 = load double, double* %57
%59 = fdiv double 1.000000e+00, %58
%60 = call double @pow(double %59, double 2.000000e+00)
store double %60, double* %7
%61 = load double, double* %7
%62 = call double @llvm.fmuladd.f64(double 7.500000e-01, double %61, double -1.000000e+00)
%63 = load double, double* %7
%64 = call double @llvm.fmuladd.f64(double %62, double %63, double 3.500000e+00)
%65 = load double, double* %7
%66 = call double @llvm.fmuladd.f64(double %64, double %65, double -1.050000e+02)
%67 = load double*, double** %4
%68 = load double, double* %67
%69 = fmul double %68, 1.260000e+03
%70 = fdiv double %66, %69
store double %70, double* %8
%71 = load double*, double** %4
%72 = load double, double* %71
%73 = call double @cdflib_rlog(double* %9)
%74 = load double, double* %8
%75 = fneg double %72
%76 = call double @llvm.fmuladd.f64(double %75, double %73, double %74)
store double %76, double* %8
%77 = load double*, double** %4
%78 = load double, double* %77
%79 = call double @sqrt(double %78)
%80 = fmul double 0x3FD9884533D43656, %79
%81 = load double, double* %8
%82 = call double @exp(double %81)
%83 = fmul double %80, %82
store double %83, double* %6
%84 = load double, double* %6
store double %84, double* %3
br label %85
85: ; preds = %56, %54, %39, %28
%86 = load double, double* %3
ret double %86
}

LLVM IR (-O2):
define double @cdflib_rcomp(double* %0, double* nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = load double, double* %0
%6 = fcmp ult double %5, 2.000000e+01
%7 = load double, double* %1
br i1 %6, label %8, label %24
8: ; preds = %2
%9 = tail call double @log(double %7)
%10 = load double, double* %1
%11 = fneg double %10
%12 = tail call double @llvm.fmuladd.f64(double %5, double %9, double %11)
%13 = load double, double* %0
%14 = fcmp ult double %13, 1.000000e+00
%15 = tail call double @exp(double %12)
br i1 %14, label %16, label %21
16: ; preds = %8
%17 = fmul double %13, %15
%18 = tail call double @cdflib_gam1(double* %0)
%19 = fadd double %18, 1.000000e+00
%20 = fmul double %17, %19
br label %43
21: ; preds = %8
%22 = tail call double @cdflib_gamma_x(double* %0)
%23 = fdiv double %15, %22
br label %43
24: ; preds = %2
%25 = fdiv double %7, %5
store double %25, double* %3
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %43, label %27
27: ; preds = %24
%28 = fdiv double 1.000000e+00, %5
%29 = fmul double %28, %28
%30 = tail call double @llvm.fmuladd.f64(double %29, double 7.500000e-01, double -1.000000e+00)
%31 = tail call double @llvm.fmuladd.f64(double %30, double %29, double 3.500000e+00)
%32 = tail call double @llvm.fmuladd.f64(double %31, double %29, double -1.050000e+02)
%33 = fmul double %5, 1.260000e+03
%34 = fdiv double %32, %33
%35 = call double @cdflib_rlog(double* %3)
%36 = fneg double %5
%37 = call double @llvm.fmuladd.f64(double %36, double %35, double %34)
%38 = load double, double* %0
%39 = call double @sqrt(double %38)
%40 = fmul double %39, 0x3FD9884533D43656
%41 = call double @exp(double %37)
%42 = fmul double %40, %41
br label %43
43: ; preds = %24, %27, %21, %16
%44 = phi double [ %42, %27 ], [ %23, %21 ], [ %20, %16 ], [ 0.000000e+00, %24 ]
ret double %44
}