#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 dsnaf(double const);
double snaf(double const);
double dstrans(double const x) {
  double const y = 1 - x;
  double const snafx = snaf(x), snafy = snaf(y);
  double const dsnafx = dsnaf(x), dsnafy = dsnaf(y);
  double const snafxy = snafx + snafy;
  return (snafy * dsnafx - snafx * dsnafy) / (snafxy * snafxy);
}


x86 assembly (clang, -O0):
<dstrans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xecb(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <snaf@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <snaf@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <dsnaf@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <dsnaf@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dstrans>:
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  0xece(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
call   1040 <snaf@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <snaf@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <dsnaf@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <dsnaf@plt>
movsd  0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm3
addsd  %xmm3,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm3,%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm1
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @dstrans(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %2
%9 = load double, double* %2
%10 = fsub double 1.000000e+00, %9
store double %10, double* %3
%11 = load double, double* %2
%12 = call double @snaf(double %11)
store double %12, double* %4
%13 = load double, double* %3
%14 = call double @snaf(double %13)
store double %14, double* %5
%15 = load double, double* %2
%16 = call double @dsnaf(double %15)
store double %16, double* %6
%17 = load double, double* %3
%18 = call double @dsnaf(double %17)
store double %18, double* %7
%19 = load double, double* %4
%20 = load double, double* %5
%21 = fadd double %19, %20
store double %21, double* %8
%22 = load double, double* %5
%23 = load double, double* %6
%24 = load double, double* %4
%25 = load double, double* %7
%26 = fmul double %24, %25
%27 = fneg double %26
%28 = call double @llvm.fmuladd.f64(double %22, double %23, double %27)
%29 = load double, double* %8
%30 = load double, double* %8
%31 = fmul double %29, %30
%32 = fdiv double %28, %31
ret double %32
}

LLVM IR (-O2):
define double @dstrans(double %0) {
%2 = fsub double 1.000000e+00, %0
%3 = tail call double @snaf(double %0)
%4 = tail call double @snaf(double %2)
%5 = tail call double @dsnaf(double %0)
%6 = tail call double @dsnaf(double %2)
%7 = fadd double %3, %4
%8 = fneg double %3
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %9)
%11 = fmul double %7, %7
%12 = fdiv double %10, %11
ret double %12
}