#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 fabs(double);
double log(double);
double psi(double *);
double apser(double *a, double *b, double *x, double *eps) {
  static double g = .577215664901533e0;
  static 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) + 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 += 1.0e0;
  t *= (*x - bx / j);
  aj = t / j;
  s += aj;
  if (fabs(aj) > tol)
    goto S30;
  apser = -(*a * (c + s));
  return apser;
}


x86 assembly (clang, -O0):
<apser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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,0x2f00(%rip)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
subsd  0x2ef0(%rip),%xmm0
movsd  %xmm0,0x2f08(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  0xe80(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118f <apser+0x6f>
jmp    11d3 <apser+0xb3>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <log@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <psi@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
addsd  0x2e72(%rip),%xmm0
addsd  0x2eaa(%rip),%xmm0
movsd  %xmm0,0x2e8a(%rip)
jmp    11f8 <apser+0xd8>
movsd  0x2e75(%rip),%xmm0
call   1040 <log@plt>
addsd  0x2e48(%rip),%xmm0
addsd  0x2e80(%rip),%xmm0
movsd  %xmm0,0x2e60(%rip)
mov    -0x20(%rbp),%rax
movsd  0xe0c(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  0x2e48(%rip),%xmm1
movaps 0xe09(%rip),%xmm2
pand   %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x2e51(%rip)
movsd  0xdd9(%rip),%xmm0
movsd  %xmm0,0x2e29(%rip)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x2e26(%rip)
movsd  0xdbe(%rip),%xmm0
addsd  0x2e0e(%rip),%xmm0
movsd  %xmm0,0x2e06(%rip)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x2de6(%rip),%xmm1
divsd  0x2dee(%rip),%xmm1
subsd  %xmm1,%xmm0
mulsd  0x2df2(%rip),%xmm0
movsd  %xmm0,0x2dea(%rip)
movsd  0x2de2(%rip),%xmm0
divsd  0x2dca(%rip),%xmm0
movsd  %xmm0,0x2daa(%rip)
movsd  0x2da2(%rip),%xmm0
addsd  0x2dba(%rip),%xmm0
movsd  %xmm0,0x2db2(%rip)
movsd  0x2d8a(%rip),%xmm0
movaps 0xd5b(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd 0x2da7(%rip),%xmm0
jbe    12dc <apser+0x1bc>
jmp    1242 <apser+0x122>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x2d6c(%rip),%xmm1
addsd  0x2d74(%rip),%xmm1
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,0x2d29(%rip)
movsd  0x2d21(%rip),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apser>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %rdx,%r15
movsd  (%rsi),%xmm2
movsd  (%rdx),%xmm0
movapd %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x2ef2(%rip)
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
movsd  %xmm3,0x2eea(%rip)
mulsd  (%rcx),%xmm2
mov    %rdi,%r14
ucomisd 0xe9b(%rip),%xmm2
jbe    1172 <apser+0x52>
movapd %xmm1,%xmm0
call   1040 <log@plt>
jmp    118c <apser+0x6c>
mov    %rsi,%rbx
call   1040 <log@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <psi@plt>
addsd  (%rsp),%xmm0
addsd  0xe74(%rip),%xmm0
movsd  0x2ea4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  (%r12),%xmm3
mulsd  0xe62(%rip),%xmm3
movapd 0xe6a(%rip),%xmm2
andpd  %xmm0,%xmm2
mulsd  %xmm3,%xmm2
movsd  (%r15),%xmm10
movsd  0xe4c(%rip),%xmm8
xorpd  %xmm3,%xmm3
movsd  0x2e60(%rip),%xmm7
movapd 0xe3f(%rip),%xmm9
movapd %xmm8,%xmm5
cs nopw 0x0(%rax,%rax,1)
addsd  %xmm8,%xmm5
movapd %xmm7,%xmm6
divsd  %xmm5,%xmm6
movapd %xmm10,%xmm4
subsd  %xmm6,%xmm4
mulsd  %xmm4,%xmm1
movapd %xmm1,%xmm4
divsd  %xmm5,%xmm4
addsd  %xmm4,%xmm3
andpd  %xmm9,%xmm4
ucomisd %xmm2,%xmm4
ja     11f0 <apser+0xd0>
movsd  %xmm1,0x2e17(%rip)
addsd  %xmm3,%xmm0
movsd  (%r14),%xmm1
xorpd  0xdf6(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@apser.bx = internal unnamed_addr global double 0.000000e+00
@apser.t = internal unnamed_addr global double 0.000000e+00
define double @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
store double %7, double* @apser.bx
%8 = fsub double %6, %7
store double %8, double* @apser.t
%9 = load double, double* %3
%10 = fmul double %5, %9
%11 = fcmp ogt double %10, 2.000000e-02
br i1 %11, label %19, label %12
12: ; preds = %4
%13 = tail call double @log(double %6)
%14 = tail call double @psi(double* %1)
%15 = fadd double %13, %14
%16 = fadd double %15, 0x3FE2788CFC6FB61A
%17 = load double, double* @apser.t
%18 = fadd double %17, %16
br label %24
19: ; preds = %4
%20 = tail call double @log(double %7)
%21 = fadd double %20, 0x3FE2788CFC6FB61A
%22 = load double, double* @apser.t
%23 = fadd double %21, %22
br label %24
24: ; preds = %19, %12
%25 = phi double [ %17, %12 ], [ %22, %19 ]
%26 = phi double [ %18, %12 ], [ %23, %19 ]
%27 = load double, double* %3
%28 = fmul double %27, 5.000000e+00
%29 = tail call double @llvm.fabs.f64(double %26)
%30 = fmul double %29, %28
%31 = load double, double* %2
%32 = load double, double* @apser.bx
br label %33
33: ; preds = %33, %24
%34 = phi double [ %42, %33 ], [ 0.000000e+00, %24 ]
%35 = phi double [ %40, %33 ], [ %25, %24 ]
%36 = phi double [ %37, %33 ], [ 1.000000e+00, %24 ]
%37 = fadd double %36, 1.000000e+00
%38 = fdiv double %32, %37
%39 = fsub double %31, %38
%40 = fmul double %35, %39
%41 = fdiv double %40, %37
%42 = fadd double %34, %41
%43 = tail call double @llvm.fabs.f64(double %41)
%44 = fcmp ogt double %43, %30
br i1 %44, label %33, label %45
45: ; preds = %33
store double %40, double* @apser.t
%46 = load double, double* %0
%47 = fadd double %26, %42
%48 = fneg double %46
%49 = fmul double %47, %48
ret double %49
}