#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 aloga(double);
int betatilde(double, double, double);
double dlog_btil1(int, double, double);
double log(int);
double log_btiln(double, double, double);
double dlog_btilde(double s, double a, double b, double n) {
  double Hu = aloga(a) + aloga(b) - aloga(a + b);
  if (0)
    return (log(betatilde(a + s, b + 1., n)) - log(betatilde(a, b, n)));
  else {
    if ((int)n == 1)
      return dlog_btil1((int)s, a, b);
    else {
      double fprim1 = 2 * (a - 1.) - (b - 1.) * n;
      if (fprim1 > 0)
        return (-log(n + 1) - log(1. + 2 * s / fprim1));
      else
        return (log_btiln(a + s, b + 1, n) - log_btiln(a, b, n));
    }
  }
}


x86 assembly (clang, -O0):
<dlog_btilde>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <aloga@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <aloga@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
call   1040 <aloga@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvttsd2si -0x28(%rbp),%eax
cmp    $0x1,%eax
jne    11d2 <dlog_btilde+0x92>
cvttsd2si -0x10(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <dlog_btil1@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    12e9 <dlog_btilde+0x1a9>
movsd  -0x18(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe10(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    129e <dlog_btilde+0x15e>
movsd  0xdc9(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd9f(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  -0x38(%rbp),%xmm1
movsd  0xd85(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e9 <dlog_btilde+0x1a9>
movsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xd50(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1060 <log_btiln@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1060 <log_btiln@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlog_btilde>:
sub    $0x38,%rsp
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
movaps %xmm1,%xmm0
call   1040 <aloga@plt>
movsd  (%rsp),%xmm0
call   1040 <aloga@plt>
movsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1040 <aloga@plt>
movsd  0x18(%rsp),%xmm2
cvttsd2si %xmm2,%eax
cmp    $0x1,%eax
jne    11a6 <dlog_btilde+0x66>
cvttsd2si 0x10(%rsp),%edi
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
add    $0x38,%rsp
jmp    1030 <dlog_btil1@plt>
movsd  0xe52(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
addsd  (%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    1219 <dlog_btilde+0xd9>
addsd  0xe2d(%rip),%xmm2
cvttsd2si %xmm2,%edi
movsd  %xmm1,(%rsp)
call   1050 <log@plt>
xorpd  0xe1f(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  (%rsp),%xmm0
addsd  0xdfa(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log@plt>
jmp    1253 <dlog_btilde+0x113>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  0xddb(%rip),%xmm1
addsd  (%rsp),%xmm1
call   1060 <log_btiln@plt>
movapd %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1060 <log_btiln@plt>
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @dlog_btilde(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
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%12 = load double, double* %7
%13 = call double @aloga(double %12)
%14 = load double, double* %8
%15 = call double @aloga(double %14)
%16 = fadd double %13, %15
%17 = load double, double* %7
%18 = load double, double* %8
%19 = fadd double %17, %18
%20 = call double @aloga(double %19)
%21 = fsub double %16, %20
store double %21, double* %10
%22 = load double, double* %9
%23 = fptosi double %22 to i32
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %31
25: ; preds = %4
%26 = load double, double* %6
%27 = fptosi double %26 to i32
%28 = load double, double* %7
%29 = load double, double* %8
%30 = call double @dlog_btil1(i32 %27, double %28, double %29)
store double %30, double* %5
br label %69
31: ; preds = %4
%32 = load double, double* %7
%33 = fsub double %32, 1.000000e+00
%34 = load double, double* %8
%35 = fsub double %34, 1.000000e+00
%36 = load double, double* %9
%37 = fmul double %35, %36
%38 = fneg double %37
%39 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %33, double %38)
store double %39, double* %11
%40 = load double, double* %11
%41 = fcmp ogt double %40, 0.000000e+00
br i1 %41, label %42, label %56
42: ; preds = %31
%43 = load double, double* %9
%44 = fadd double %43, 1.000000e+00
%45 = fptosi double %44 to i32
%46 = call double @log(i32 %45)
%47 = fneg double %46
%48 = load double, double* %6
%49 = fmul double 2.000000e+00, %48
%50 = load double, double* %11
%51 = fdiv double %49, %50
%52 = fadd double 1.000000e+00, %51
%53 = fptosi double %52 to i32
%54 = call double @log(i32 %53)
%55 = fsub double %47, %54
store double %55, double* %5
br label %69
56: ; preds = %31
%57 = load double, double* %7
%58 = load double, double* %6
%59 = fadd double %57, %58
%60 = load double, double* %8
%61 = fadd double %60, 1.000000e+00
%62 = load double, double* %9
%63 = call double @log_btiln(double %59, double %61, double %62)
%64 = load double, double* %7
%65 = load double, double* %8
%66 = load double, double* %9
%67 = call double @log_btiln(double %64, double %65, double %66)
%68 = fsub double %63, %67
store double %68, double* %5
br label %69
69: ; preds = %56, %42, %25
%70 = load double, double* %5
ret double %70
}

LLVM IR (-O2):
define double @dlog_btilde(double %0, double %1, double %2, double %3) {
%5 = tail call double @aloga(double %1)
%6 = tail call double @aloga(double %2)
%7 = fadd double %1, %2
%8 = tail call double @aloga(double %7)
%9 = fptosi double %3 to i32
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = fptosi double %0 to i32
%13 = tail call double @dlog_btil1(i32 %12, double %1, double %2)
br label %38
14: ; preds = %4
%15 = fadd double %1, -1.000000e+00
%16 = fadd double %2, -1.000000e+00
%17 = fneg double %16
%18 = fmul double %17, %3
%19 = tail call double @llvm.fmuladd.f64(double %15, double 2.000000e+00, double %18)
%20 = fcmp ogt double %19, 0.000000e+00
br i1 %20, label %21, label %32
21: ; preds = %14
%22 = fadd double %3, 1.000000e+00
%23 = fptosi double %22 to i32
%24 = tail call double @log(i32 %23)
%25 = fneg double %24
%26 = fmul double %0, 2.000000e+00
%27 = fdiv double %26, %19
%28 = fadd double %27, 1.000000e+00
%29 = fptosi double %28 to i32
%30 = tail call double @log(i32 %29)
%31 = fsub double %25, %30
br label %38
32: ; preds = %14
%33 = fadd double %0, %1
%34 = fadd double %2, 1.000000e+00
%35 = tail call double @log_btiln(double %33, double %34, double %3)
%36 = tail call double @log_btiln(double %1, double %2, double %3)
%37 = fsub double %35, %36
br label %38
38: ; preds = %21, %32, %11
%39 = phi double [ %13, %11 ], [ %31, %21 ], [ %37, %32 ]
ret double %39
}