#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 asin(double);
double cos(double);
double cosh(int /*<<< orphan*/);
int /*<<< orphan*/ tan(double);
double spliceFunction2der(double x, double deltax, double dx, double ddeltax) {
  if (deltax < 0) {
    x = -x;
    deltax = -deltax;
    dx = -dx;
    ddeltax = -ddeltax;
  }
  if (x <= -deltax || x >= deltax) {
    return 0;
  } else {
    double piHalf = asin(1.0);
    double x1 = (x / deltax);
    double y = x1 * piHalf;
    double z = cosh(tan(y)) * cos(y);
    return ((dx - x1 * ddeltax) * (piHalf) / (2 * deltax)) / (z * z);
  }
}


x86 assembly (clang, -O0):
<spliceFunction2der>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11ee <spliceFunction2der+0xae>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jae    1229 <spliceFunction2der+0xe9>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1236 <spliceFunction2der+0xf6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12ee <spliceFunction2der+0x1ae>
movsd  0xdca(%rip),%xmm0
call   1040 <asin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <tan@plt>
mov    %eax,%edi
call   1030 <cosh@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xd2e(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spliceFunction2der>:
sub    $0x58,%rsp
movapd %xmm0,%xmm5
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    115a <spliceFunction2der+0x2a>
movapd 0xeb6(%rip),%xmm4
xorpd  %xmm4,%xmm5
xorpd  %xmm4,%xmm1
xorpd  %xmm4,%xmm2
xorpd  %xmm4,%xmm3
movapd 0xe9e(%rip),%xmm4
xorpd  %xmm1,%xmm4
ucomisd %xmm5,%xmm4
jae    1201 <spliceFunction2der+0xd1>
ucomisd %xmm1,%xmm5
jae    1201 <spliceFunction2der+0xd1>
divsd  %xmm1,%xmm5
movapd %xmm5,0x10(%rsp)
mulsd  0xe84(%rip),%xmm5
movsd  %xmm5,0x8(%rsp)
movapd %xmm5,%xmm0
movapd %xmm2,0x30(%rsp)
movapd %xmm1,0x40(%rsp)
movapd %xmm3,0x20(%rsp)
call   1040 <tan@plt>
mov    %eax,%edi
call   1030 <cosh@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  (%rsp),%xmm0
movapd 0x10(%rsp),%xmm2
mulsd  0x20(%rsp),%xmm2
movapd 0x30(%rsp),%xmm1
subsd  %xmm2,%xmm1
mulsd  0xe29(%rip),%xmm1
movapd 0x40(%rsp),%xmm2
addsd  %xmm2,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x58,%rsp
ret

LLVM IR (-O0):
define double @spliceFunction2der(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%14 = load double, double* %7
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %25
16: ; preds = %4
%17 = load double, double* %6
%18 = fneg double %17
store double %18, double* %6
%19 = load double, double* %7
%20 = fneg double %19
store double %20, double* %7
%21 = load double, double* %8
%22 = fneg double %21
store double %22, double* %8
%23 = load double, double* %9
%24 = fneg double %23
store double %24, double* %9
br label %25
25: ; preds = %16, %4
%26 = load double, double* %6
%27 = load double, double* %7
%28 = fneg double %27
%29 = fcmp ole double %26, %28
br i1 %29, label %34, label %30
30: ; preds = %25
%31 = load double, double* %6
%32 = load double, double* %7
%33 = fcmp oge double %31, %32
br i1 %33, label %34, label %35
34: ; preds = %30, %25
store double 0.000000e+00, double* %5
br label %63
35: ; preds = %30
%36 = call double @asin(double 1.000000e+00)
store double %36, double* %10
%37 = load double, double* %6
%38 = load double, double* %7
%39 = fdiv double %37, %38
store double %39, double* %11
%40 = load double, double* %11
%41 = load double, double* %10
%42 = fmul double %40, %41
store double %42, double* %12
%43 = load double, double* %12
%44 = call i32 @tan(double %43)
%45 = call double @cosh(i32 %44)
%46 = load double, double* %12
%47 = call double @cos(double %46)
%48 = fmul double %45, %47
store double %48, double* %13
%49 = load double, double* %8
%50 = load double, double* %11
%51 = load double, double* %9
%52 = fneg double %50
%53 = call double @llvm.fmuladd.f64(double %52, double %51, double %49)
%54 = load double, double* %10
%55 = fmul double %53, %54
%56 = load double, double* %7
%57 = fmul double 2.000000e+00, %56
%58 = fdiv double %55, %57
%59 = load double, double* %13
%60 = load double, double* %13
%61 = fmul double %59, %60
%62 = fdiv double %58, %61
store double %62, double* %5
br label %63
63: ; preds = %35, %34
%64 = load double, double* %5
ret double %64
}

LLVM IR (-O2):
define double @spliceFunction2der(double %0, double %1, double %2, double %3) {
%5 = fcmp olt double %1, 0.000000e+00
br i1 %5, label %6, label %11
6: ; preds = %4
%7 = fneg double %0
%8 = fneg double %1
%9 = fneg double %2
%10 = fneg double %3
br label %11
11: ; preds = %6, %4
%12 = phi double [ %10, %6 ], [ %3, %4 ]
%13 = phi double [ %9, %6 ], [ %2, %4 ]
%14 = phi double [ %8, %6 ], [ %1, %4 ]
%15 = phi double [ %7, %6 ], [ %0, %4 ]
%16 = fneg double %14
%17 = fcmp ugt double %15, %16
%18 = fcmp ult double %15, %14
%19 = and i1 %17, %18
br i1 %19, label %20, label %34
20: ; preds = %11
%21 = fdiv double %15, %14
%22 = fmul double %21, 0x3FF921FB54442D18
%23 = tail call i32 @tan(double %22)
%24 = tail call double @cosh(i32 %23)
%25 = tail call double @cos(double %22)
%26 = fmul double %24, %25
%27 = fneg double %21
%28 = tail call double @llvm.fmuladd.f64(double %27, double %12, double %13)
%29 = fmul double %28, 0x3FF921FB54442D18
%30 = fmul double %14, 2.000000e+00
%31 = fdiv double %29, %30
%32 = fmul double %26, %26
%33 = fdiv double %31, %32
br label %34
34: ; preds = %11, %20
%35 = phi double [ %33, %20 ], [ 0.000000e+00, %11 ]
ret double %35
}