#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 */
int tanh(double);
double brillouin(double x, double S) {
  return ((2 * S + 1) / tanh((2 * S + 1) * x / 2 / S) - 1 / tanh(x / 2 / S)) /
         2 / S;
}


x86 assembly (clang, -O0):
<brillouin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xed5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xebb(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
divsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <tanh@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe75(%rip),%xmm1
divsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <tanh@plt>
movsd  -0x18(%rbp),%xmm0
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
divsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brillouin>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm2
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  0xecc(%rip),%xmm0
movsd  %xmm0,(%rsp)
mulsd  %xmm2,%xmm0
mulsd  0xec3(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1030 <tanh@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe97(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
call   1030 <tanh@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovb  %eax,%edx
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
movsd  (%rsp),%xmm0
subsd  %xmm1,%xmm0
mulsd  0xe69(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @brillouin(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %5, double 1.000000e+00)
%7 = load double, double* %4
%8 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %7, double 1.000000e+00)
%9 = load double, double* %3
%10 = fmul double %8, %9
%11 = fdiv double %10, 2.000000e+00
%12 = load double, double* %4
%13 = fdiv double %11, %12
%14 = call i32 @tanh(double %13)
%15 = sitofp i32 %14 to double
%16 = fdiv double %6, %15
%17 = load double, double* %3
%18 = fdiv double %17, 2.000000e+00
%19 = load double, double* %4
%20 = fdiv double %18, %19
%21 = call i32 @tanh(double %20)
%22 = sdiv i32 1, %21
%23 = sitofp i32 %22 to double
%24 = fsub double %16, %23
%25 = fdiv double %24, 2.000000e+00
%26 = load double, double* %4
%27 = fdiv double %25, %26
ret double %27
}

LLVM IR (-O2):
define double @brillouin(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %1, double 2.000000e+00, double 1.000000e+00)
%4 = fmul double %3, %0
%5 = fmul double %4, 5.000000e-01
%6 = fdiv double %5, %1
%7 = tail call i32 @tanh(double %6)
%8 = sitofp i32 %7 to double
%9 = fdiv double %3, %8
%10 = fmul double %0, 5.000000e-01
%11 = fdiv double %10, %1
%12 = tail call i32 @tanh(double %11)
%13 = add i32 %12, 1
%14 = icmp ult i32 %13, 3
%15 = select i1 %14, i32 %12, i32 0
%16 = sitofp i32 %15 to double
%17 = fsub double %9, %16
%18 = fmul double %17, 5.000000e-01
%19 = fdiv double %18, %1
ret double %19
}