#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 /*<<< orphan*/ SINCOS(double, double, double);
double fabs(double);
double sas_3j1x_x(double q) {
  if (fabs(q) < 0.7) {
    const double q2 = q * q;
    return (1.0 + q2 * (-3. / 30. + q2 * (3. / 840. + q2 * (-3. / 45360.))));
  } else {
    double sin_q, cos_q;
    SINCOS(q, sin_q, cos_q);
    return 3.0 * (sin_q / q - cos_q) / (q * q);
  }
}


x86 assembly (clang, -O0):
<sas_3j1x_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movaps 0xf07(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xecb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    119f <sas_3j1x_x+0x8f>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  0xebb(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xeb7(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe97(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe7f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e1 <sas_3j1x_x+0xd1>
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <SINCOS@plt>
movsd  -0x20(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0xe3e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sas_3j1x_x>:
push   %rax
movapd 0xee7(%rip),%xmm1
andpd  %xmm0,%xmm1
movsd  0xeeb(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    1161 <sas_3j1x_x+0x51>
mulsd  %xmm0,%xmm0
movsd  0xee9(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee5(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee1(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xedd(%rip),%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret
call   1030 <SINCOS@plt>
movsd  0xeaa(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sas_3j1x_x(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
%7 = load double, double* %3
%8 = call double @llvm.fabs.f64(double %7)
%9 = fcmp olt double %8, 0x3FE6666666666666
br i1 %9, label %10, label %20
10: ; preds = %1
%11 = load double, double* %3
%12 = load double, double* %3
%13 = fmul double %11, %12
store double %13, double* %4
%14 = load double, double* %4
%15 = load double, double* %4
%16 = load double, double* %4
%17 = call double @llvm.fmuladd.f64(double %16, double 0xBF11566ABC011567, double 0x3F6D41D41D41D41D)
%18 = call double @llvm.fmuladd.f64(double %15, double %17, double -1.000000e-01)
%19 = call double @llvm.fmuladd.f64(double %14, double %18, double 1.000000e+00)
store double %19, double* %2
br label %35
20: ; preds = %1
%21 = load double, double* %3
%22 = load double, double* %5
%23 = load double, double* %6
%24 = call i32 @SINCOS(double %21, double %22, double %23)
%25 = load double, double* %5
%26 = load double, double* %3
%27 = fdiv double %25, %26
%28 = load double, double* %6
%29 = fsub double %27, %28
%30 = fmul double 3.000000e+00, %29
%31 = load double, double* %3
%32 = load double, double* %3
%33 = fmul double %31, %32
%34 = fdiv double %30, %33
store double %34, double* %2
br label %35
35: ; preds = %20, %10
%36 = load double, double* %2
ret double %36
}

LLVM IR (-O2):
define double @sas_3j1x_x(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp olt double %2, 0x3FE6666666666666
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = fmul double %0, %0
%6 = tail call double @llvm.fmuladd.f64(double %5, double 0xBF11566ABC011567, double 0x3F6D41D41D41D41D)
%7 = tail call double @llvm.fmuladd.f64(double %5, double %6, double -1.000000e-01)
%8 = tail call double @llvm.fmuladd.f64(double %5, double %7, double 1.000000e+00)
br label %11
9: ; preds = %1
%10 = tail call i32 @SINCOS(double %0, double undef, double undef)
br label %11
11: ; preds = %9, %4
%12 = phi double [ %8, %4 ], [ 0x7FF8000000000000, %9 ]
ret double %12
}