#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 jzero(double);
double pzero(double);
double qzero(double);
double sin(double);
double sqrt(double);
double rj0(double x) {
  if (x <= 0.0)
    x = -x;
  if (x < 8.0)
    return (jzero(x));
  else
    return (
        sqrt(0.63661977236758134307553505349005744 / x) *
        (pzero(x) * cos(x - 0.78539816339744830961566084581987572) -
         8.0 / x * qzero(x) * sin(x - 0.78539816339744830961566084581987572)));
}


x86 assembly (clang, -O0):
<rj0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     119c <rj0+0x3c>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe5c(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11c3 <rj0+0x63>
movsd  -0x10(%rbp),%xmm0
call   1030 <jzero@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    128a <rj0+0x12a>
movsd  0xe45(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1080 <pzero@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe12(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xdf4(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <qzero@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdca(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  -0x30(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm4,%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rj0>:
sub    $0x48,%rsp
movapd 0xe94(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm3
cmpnlesd %xmm1,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm3
orpd   %xmm0,%xmm3
movsd  0xe7f(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    11a4 <rj0+0x44>
movapd %xmm3,%xmm0
add    $0x48,%rsp
jmp    1030 <jzero@plt>
movsd  0xe6c(%rip),%xmm0
divsd  %xmm3,%xmm0
ucomisd %xmm1,%xmm0
movapd %xmm3,0x10(%rsp)
jb     11c2 <rj0+0x62>
sqrtsd %xmm0,%xmm0
jmp    11cd <rj0+0x6d>
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm3
movsd  %xmm0,0x8(%rsp)
movapd %xmm3,%xmm0
call   1080 <pzero@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0xe36(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
call   1060 <cos@plt>
movsd  %xmm0,0x38(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <qzero@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0xe04(%rip),%xmm1
divsd  0x10(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x38(%rsp),%xmm1
mulsd  0x40(%rsp),%xmm1
addsd  %xmm1,%xmm0
mulsd  0x8(%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @rj0(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ole double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = fneg double %7
store double %8, double* %3
br label %9
9: ; preds = %6, %1
%10 = load double, double* %3
%11 = fcmp olt double %10, 8.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load double, double* %3
%14 = call double @jzero(double %13)
store double %14, double* %2
br label %36
15: ; preds = %9
%16 = load double, double* %3
%17 = fdiv double 0x3FE45F306DC9C883, %16
%18 = call double @sqrt(double %17)
%19 = load double, double* %3
%20 = call double @pzero(double %19)
%21 = load double, double* %3
%22 = fsub double %21, 0x3FE921FB54442D18
%23 = call double @cos(double %22)
%24 = load double, double* %3
%25 = fdiv double 8.000000e+00, %24
%26 = load double, double* %3
%27 = call double @qzero(double %26)
%28 = fmul double %25, %27
%29 = load double, double* %3
%30 = fsub double %29, 0x3FE921FB54442D18
%31 = call double @sin(double %30)
%32 = fmul double %28, %31
%33 = fneg double %32
%34 = call double @llvm.fmuladd.f64(double %20, double %23, double %33)
%35 = fmul double %18, %34
store double %35, double* %2
br label %36
36: ; preds = %15, %12
%37 = load double, double* %2
ret double %37
}

LLVM IR (-O2):
define double @rj0(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %0, double %3
%5 = fcmp olt double %4, 8.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call double @jzero(double %4)
br label %21
8: ; preds = %1
%9 = fdiv double 0x3FE45F306DC9C883, %4
%10 = tail call double @sqrt(double %9)
%11 = tail call double @pzero(double %4)
%12 = fadd double %4, 0xBFE921FB54442D18
%13 = tail call double @cos(double %12)
%14 = tail call double @qzero(double %4)
%15 = tail call double @sin(double %12)
%16 = fdiv double -8.000000e+00, %4
%17 = fmul double %16, %14
%18 = fmul double %17, %15
%19 = tail call double @llvm.fmuladd.f64(double %11, double %13, double %18)
%20 = fmul double %10, %19
br label %21
21: ; preds = %8, %6
%22 = phi double [ %7, %6 ], [ %20, %8 ]
ret double %22
}