#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 const cdflib_psi(double const *);
double fabs(double);
double const log(double const);
double cdflib_apser(const double *a, const double *b, const double *x,
                    const double *eps) {
  static const double g = 0.577215664901533e0;
  double apser, aj, bx, c, j, s, t, tol;
  bx = *b * *x;
  t = *x - bx;
  if (*b * *eps > 2.e-2) {
    goto S10;
  }
  c = log(*x) + cdflib_psi(b) + g + t;
  goto S20;
S10:
  c = log(bx) + g + t;
S20:
  tol = 5.0e0 * *eps * fabs(c);
  j = 1.0e0;
  s = 0.0e0;
S30:
  j = j + 1.0e0;
  t = t * (*x - bx / j);
  aj = t / j;
  s = s + aj;
  if (fabs(aj) > tol) {
    goto S30;
  }
  apser = -(*a * (c + s));
  return apser;
}


x86 assembly (clang, -O0):
<cdflib_apser>:
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    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  0xe89(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1186 <cdflib_apser+0x66>
jmp    11c8 <cdflib_apser+0xa8>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <log@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <cdflib_psi@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe53(%rip),%xmm1
addsd  %xmm1,%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11e8 <cdflib_apser+0xc8>
movsd  -0x38(%rbp),%xmm0
call   1040 <log@plt>
movsd  0xe2e(%rip),%xmm1
addsd  %xmm1,%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  0xe24(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm1
movaps 0xe1c(%rip),%xmm2
pand   %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xdf7(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xde2(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x38(%rbp),%xmm2
divsd  -0x48(%rbp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movaps 0xd9a(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    129a <cdflib_apser+0x17a>
jmp    1226 <cdflib_apser+0x106>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm1
addsd  -0x50(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_apser>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r12
mov    %rdx,%r15
mov    %rdi,%r14
movsd  (%rsi),%xmm1
movsd  (%rdx),%xmm0
movapd %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm0,%xmm3
mulsd  (%rcx),%xmm1
subsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
ucomisd 0xea2(%rip),%xmm1
movsd  %xmm2,0x10(%rsp)
jbe    1171 <cdflib_apser+0x51>
movapd %xmm2,%xmm0
call   1040 <log@plt>
jmp    118b <cdflib_apser+0x6b>
mov    %rsi,%rbx
call   1040 <log@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <cdflib_psi@plt>
addsd  (%rsp),%xmm0
addsd  0xe75(%rip),%xmm0
movsd  (%r12),%xmm2
mulsd  0xe6f(%rip),%xmm2
movsd  0x8(%rsp),%xmm5
addsd  %xmm5,%xmm0
movapd 0xe6d(%rip),%xmm1
andpd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
movsd  (%r15),%xmm10
xorpd  %xmm2,%xmm2
movsd  0xe4b(%rip),%xmm9
movapd 0xe4a(%rip),%xmm8
movapd %xmm9,%xmm6
movsd  0x10(%rsp),%xmm4
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addsd  %xmm9,%xmm6
movapd %xmm4,%xmm7
divsd  %xmm6,%xmm7
movapd %xmm10,%xmm3
subsd  %xmm7,%xmm3
mulsd  %xmm3,%xmm5
movapd %xmm5,%xmm3
divsd  %xmm6,%xmm3
addsd  %xmm3,%xmm2
andpd  %xmm8,%xmm3
ucomisd %xmm1,%xmm3
ja     11f0 <cdflib_apser+0xd0>
addsd  %xmm2,%xmm0
movsd  (%r14),%xmm1
xorpd  0xdfe(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define double @cdflib_apser(double* nocapture %0, double* %1, double* nocapture %2, double* nocapture %3) {
%5 = load double, double* %1
%6 = load double, double* %2
%7 = fmul double %5, %6
%8 = fsub double %6, %7
%9 = load double, double* %3
%10 = fmul double %5, %9
%11 = fcmp ogt double %10, 2.000000e-02
br i1 %11, label %16, label %12
12: ; preds = %4
%13 = tail call double @log(double %6)
%14 = tail call double @cdflib_psi(double* %1)
%15 = fadd double %13, %14
br label %18
16: ; preds = %4
%17 = tail call double @log(double %7)
br label %18
18: ; preds = %16, %12
%19 = phi double [ %17, %16 ], [ %15, %12 ]
%20 = fadd double %19, 0x3FE2788CFC6FB61A
%21 = fadd double %8, %20
%22 = load double, double* %3
%23 = fmul double %22, 5.000000e+00
%24 = tail call double @llvm.fabs.f64(double %21)
%25 = fmul double %23, %24
%26 = load double, double* %2
br label %27
27: ; preds = %27, %18
%28 = phi double [ 1.000000e+00, %18 ], [ %31, %27 ]
%29 = phi double [ 0.000000e+00, %18 ], [ %36, %27 ]
%30 = phi double [ %8, %18 ], [ %34, %27 ]
%31 = fadd double %28, 1.000000e+00
%32 = fdiv double %7, %31
%33 = fsub double %26, %32
%34 = fmul double %30, %33
%35 = fdiv double %34, %31
%36 = fadd double %29, %35
%37 = tail call double @llvm.fabs.f64(double %35)
%38 = fcmp ogt double %37, %25
br i1 %38, label %27, label %39
39: ; preds = %27
%40 = load double, double* %0
%41 = fadd double %21, %36
%42 = fneg double %40
%43 = fmul double %41, %42
ret double %43
}