#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 exp(double);
int fabs(double);
double pow(double, double);
double B(double x) {
  double ret;
  if (fabs(x) < 1e-16) {
    ret = 1 - x / 2.0 + pow(x, 2.0) / 12.0 - pow(x, 4.0) / 720.0 +
          pow(x, 6.0) / 30240.0;
  } else {
    ret = x / (exp(x) - 1.0);
  }
  return ret;
}


x86 assembly (clang, -O0):
<B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xead(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1211 <B+0xe1>
movsd  -0x8(%rbp),%xmm1
movsd  0xece(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe92(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeac(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xe50(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe2e(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe11(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1242 <B+0x112>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xdd3(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<B>:
sub    $0x28,%rsp
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    115f <B+0x2f>
movsd  (%rsp),%xmm0
call   1040 <exp@plt>
addsd  0xeac(%rip),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
jmp    11db <B+0xab>
movsd  0xea1(%rip),%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
addsd  0xe98(%rip),%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
divsd  0xe90(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xe86(%rip),%xmm1
call   1050 <pow@plt>
movapd %xmm0,0x10(%rsp)
movsd  0xe7b(%rip),%xmm1
movsd  (%rsp),%xmm0
call   1050 <pow@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
divpd  0xe67(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @B(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 @fabs(double %4)
%6 = sitofp i32 %5 to double
%7 = fcmp olt double %6, 0x3C9CD2B297D889BC
br i1 %7, label %8, label %24
8: ; preds = %1
%9 = load double, double* %2
%10 = fdiv double %9, 2.000000e+00
%11 = fsub double 1.000000e+00, %10
%12 = load double, double* %2
%13 = call double @pow(double %12, double 2.000000e+00)
%14 = fdiv double %13, 1.200000e+01
%15 = fadd double %11, %14
%16 = load double, double* %2
%17 = call double @pow(double %16, double 4.000000e+00)
%18 = fdiv double %17, 7.200000e+02
%19 = fsub double %15, %18
%20 = load double, double* %2
%21 = call double @pow(double %20, double 6.000000e+00)
%22 = fdiv double %21, 3.024000e+04
%23 = fadd double %19, %22
store double %23, double* %3
br label %30
24: ; preds = %1
%25 = load double, double* %2
%26 = load double, double* %2
%27 = call double @exp(double %26)
%28 = fsub double %27, 1.000000e+00
%29 = fdiv double %25, %28
store double %29, double* %3
br label %30
30: ; preds = %24, %8
%31 = load double, double* %3
ret double %31
}

LLVM IR (-O2):
define double @B(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %4, label %19
4: ; preds = %1
%5 = fmul double %0, 5.000000e-01
%6 = fsub double 1.000000e+00, %5
%7 = fmul double %0, %0
%8 = fdiv double %7, 1.200000e+01
%9 = fadd double %6, %8
%10 = tail call double @pow(double %0, double 4.000000e+00)
%11 = tail call double @pow(double %0, double 6.000000e+00)
%12 = insertelement <2 x double> poison, double %10, i64 0
%13 = insertelement <2 x double> %12, double %11, i64 1
%14 = fdiv <2 x double> %13, <double 7.200000e+02, double 3.024000e+04>
%15 = extractelement <2 x double> %14, i64 0
%16 = fsub double %9, %15
%17 = extractelement <2 x double> %14, i64 1
%18 = fadd double %16, %17
br label %23
19: ; preds = %1
%20 = tail call double @exp(double %0)
%21 = fadd double %20, -1.000000e+00
%22 = fdiv double %0, %21
br label %23
23: ; preds = %19, %4
%24 = phi double [ %18, %4 ], [ %22, %19 ]
ret double %24
}