#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 M_PI_2;
int /*<<< orphan*/ M_PI_4;
int exp(double);
double log1p(int);
int pow(double, int /*<<< orphan*/);
double sinh(double);
double ftrans(double y) {
  double x = M_PI_2 * sinh(y);
  double t;
  if (x >= 0) {
    t = x + log1p(exp(-x));
  } else {
    t = log1p(exp(x));
  }
  return pow(t, M_PI_4) / (1 + exp(x));
}


x86 assembly (clang, -O0):
<ftrans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    0x2e8c(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sinh@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11d2 <ftrans+0x92>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
mov    %eax,%edi
call   1060 <log1p@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11e8 <ftrans+0xa8>
movsd  -0x10(%rbp),%xmm0
call   1040 <exp@plt>
mov    %eax,%edi
call   1060 <log1p@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1050 <pow@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <exp@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftrans>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e94(%rip),%rax
movsd  (%rax),%xmm1
movsd  %xmm1,(%rsp)
call   1030 <sinh@plt>
mulsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
movapd %xmm0,(%rsp)
ucomisd %xmm1,%xmm0
jae    1181 <ftrans+0x41>
movapd (%rsp),%xmm0
call   1040 <exp@plt>
mov    %eax,%edi
call   1060 <log1p@plt>
jmp    119f <ftrans+0x5f>
movapd 0xe77(%rip),%xmm0
xorpd  (%rsp),%xmm0
call   1040 <exp@plt>
mov    %eax,%edi
call   1060 <log1p@plt>
addsd  (%rsp),%xmm0
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1050 <pow@plt>
mov    %eax,%ebx
movaps (%rsp),%xmm0
call   1040 <exp@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI_2 = global double 0.000000e+00
@M_PI_4 = global i32 0
define double @ftrans(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* @M_PI_2
%6 = load double, double* %2
%7 = call double @sinh(double %6)
%8 = fmul double %5, %7
store double %8, double* %3
%9 = load double, double* %3
%10 = fcmp oge double %9, 0.000000e+00
br i1 %10, label %11, label %18
11: ; preds = %1
%12 = load double, double* %3
%13 = load double, double* %3
%14 = fneg double %13
%15 = call i32 @exp(double %14)
%16 = call double @log1p(i32 %15)
%17 = fadd double %12, %16
store double %17, double* %4
br label %22
18: ; preds = %1
%19 = load double, double* %3
%20 = call i32 @exp(double %19)
%21 = call double @log1p(i32 %20)
store double %21, double* %4
br label %22
22: ; preds = %18, %11
%23 = load double, double* %4
%24 = load i32, i32* @M_PI_4
%25 = call i32 @pow(double %23, i32 %24)
%26 = load double, double* %3
%27 = call i32 @exp(double %26)
%28 = add nsw i32 1, %27
%29 = sdiv i32 %25, %28
%30 = sitofp i32 %29 to double
ret double %30
}

LLVM IR (-O2):
@M_PI_2 = global double 0.000000e+00
@M_PI_4 = global i32 0
define double @ftrans(double %0) {
%2 = load double, double* @M_PI_2
%3 = tail call double @sinh(double %0)
%4 = fmul double %2, %3
%5 = fcmp ult double %4, 0.000000e+00
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = fneg double %4
%8 = tail call i32 @exp(double %7)
%9 = tail call double @log1p(i32 %8)
%10 = fadd double %4, %9
br label %14
11: ; preds = %1
%12 = tail call i32 @exp(double %4)
%13 = tail call double @log1p(i32 %12)
br label %14
14: ; preds = %11, %6
%15 = phi double [ %10, %6 ], [ %13, %11 ]
%16 = load i32, i32* @M_PI_4
%17 = tail call i32 @pow(double %15, i32 %16)
%18 = tail call i32 @exp(double %4)
%19 = add nsw i32 %18, 1
%20 = sdiv i32 %17, %19
%21 = sitofp i32 %20 to double
ret double %21
}