#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 cos(double);
double derivw(const double w, const double a, const double t) {
  double dw, x, y, a2, aa;
  x = w - t;
  y = w + t;
  a2 = a + a;
  aa = a * a;
  dw = 1.0 + (a * cos(x) - aa) / (1.0 - a2 * cos(x) + aa) +
       (a * cos(y) - aa) / (1.0 - a2 * cos(y) + aa);
  return (dw);
}


x86 assembly (clang, -O0):
<derivw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <cos@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xe11(%rip),%xmm2
addsd  %xmm2,%xmm0
addsd  -0x40(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdfc(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <cos@plt>
movsd  -0x58(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x48(%rbp),%xmm0
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xd65(%rip),%xmm3
addsd  %xmm3,%xmm2
addsd  -0x40(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<derivw>:
sub    $0x68,%rsp
movapd %xmm0,%xmm3
subsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%rsp)
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,0x40(%rsp)
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
movapd %xmm3,%xmm0
call   1030 <cos@plt>
movapd %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <cos@plt>
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm2,%xmm2
movapd 0x20(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm2,%xmm1
movapd 0x30(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
movapd %xmm0,0x30(%rsp)
subpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <cos@plt>
movapd 0x50(%rsp),%xmm1
unpcklpd %xmm1,%xmm1
movapd 0x10(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movapd 0xe2b(%rip),%xmm1
subpd  %xmm2,%xmm1
addpd  0x30(%rsp),%xmm1
movapd 0x20(%rsp),%xmm0
divpd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
addsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
add    $0x68,%rsp
ret

LLVM IR (-O0):
define double @derivw(double %0, double %1, double %2) {
%4 = alloca double
%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* %4
store double %1, double* %5
store double %2, double* %6
%12 = load double, double* %4
%13 = load double, double* %6
%14 = fsub double %12, %13
store double %14, double* %8
%15 = load double, double* %4
%16 = load double, double* %6
%17 = fadd double %15, %16
store double %17, double* %9
%18 = load double, double* %5
%19 = load double, double* %5
%20 = fadd double %18, %19
store double %20, double* %10
%21 = load double, double* %5
%22 = load double, double* %5
%23 = fmul double %21, %22
store double %23, double* %11
%24 = load double, double* %5
%25 = load double, double* %8
%26 = call double @cos(double %25)
%27 = load double, double* %11
%28 = fneg double %27
%29 = call double @llvm.fmuladd.f64(double %24, double %26, double %28)
%30 = load double, double* %10
%31 = load double, double* %8
%32 = call double @cos(double %31)
%33 = fneg double %30
%34 = call double @llvm.fmuladd.f64(double %33, double %32, double 1.000000e+00)
%35 = load double, double* %11
%36 = fadd double %34, %35
%37 = fdiv double %29, %36
%38 = fadd double 1.000000e+00, %37
%39 = load double, double* %5
%40 = load double, double* %9
%41 = call double @cos(double %40)
%42 = load double, double* %11
%43 = fneg double %42
%44 = call double @llvm.fmuladd.f64(double %39, double %41, double %43)
%45 = load double, double* %10
%46 = load double, double* %9
%47 = call double @cos(double %46)
%48 = fneg double %45
%49 = call double @llvm.fmuladd.f64(double %48, double %47, double 1.000000e+00)
%50 = load double, double* %11
%51 = fadd double %49, %50
%52 = fdiv double %44, %51
%53 = fadd double %38, %52
store double %53, double* %7
%54 = load double, double* %7
ret double %54
}

LLVM IR (-O2):
define double @derivw(double %0, double %1, double %2) {
%4 = fsub double %0, %2
%5 = fadd double %0, %2
%6 = fadd double %1, %1
%7 = fmul double %1, %1
%8 = tail call double @cos(double %4)
%9 = fneg double %7
%10 = tail call double @cos(double %4)
%11 = fneg double %6
%12 = tail call double @cos(double %5)
%13 = insertelement <2 x double> poison, double %1, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = insertelement <2 x double> poison, double %8, i64 0
%16 = insertelement <2 x double> %15, double %12, i64 1
%17 = insertelement <2 x double> poison, double %9, i64 0
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%19 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> %16, <2 x double> %18)
%20 = tail call double @cos(double %5)
%21 = insertelement <2 x double> poison, double %11, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = insertelement <2 x double> poison, double %10, i64 0
%24 = insertelement <2 x double> %23, double %20, i64 1
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %24, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%26 = insertelement <2 x double> poison, double %7, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = fadd <2 x double> %27, %25
%29 = fdiv <2 x double> %19, %28
%30 = extractelement <2 x double> %29, i64 0
%31 = fadd double %30, 1.000000e+00
%32 = extractelement <2 x double> %29, i64 1
%33 = fadd double %31, %32
ret double %33
}