#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 jone(double);
double pone(double);
double qone(double);
double sin(double);
double sqrt(double);
double rj1(double x) {
  double v, w;
  v = x;
  if (x < 0.0)
    x = -x;
  if (x < 8.0)
    return (v * jone(x));
  else {
    w = sqrt(0.63661977236758134307553505349005744 / x) *
        (pone(x) * cos(x - 2.35619449019234492884698253745962716) -
         8.0 / x * qone(x) * sin(x - 2.35619449019234492884698253745962716));
    if (v < 0.0)
      w = -w;
    return (w);
  }
}


x86 assembly (clang, -O0):
<rj1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11a6 <rj1+0x46>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe52(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11e3 <rj1+0x83>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <jone@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e3 <rj1+0x183>
movsd  0xe25(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1080 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <pone@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdf2(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xdd4(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <qone@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdaa(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1050 <sin@plt>
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x30(%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,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    12d9 <rj1+0x179>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rj1>:
sub    $0x68,%rsp
movapd %xmm0,%xmm2
movapd 0xe90(%rip),%xmm0
xorpd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
movapd %xmm2,%xmm3
cmpltsd %xmm1,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm3
orpd   %xmm0,%xmm3
movsd  0xe7b(%rip),%xmm0
ucomisd %xmm3,%xmm0
movapd %xmm2,0x40(%rsp)
jbe    11b9 <rj1+0x59>
movapd %xmm3,%xmm0
call   1040 <jone@plt>
movapd 0x40(%rsp),%xmm2
mulsd  %xmm0,%xmm2
jmp    128e <rj1+0x12e>
movsd  0xe57(%rip),%xmm0
divsd  %xmm3,%xmm0
ucomisd %xmm1,%xmm0
movapd %xmm3,0x10(%rsp)
jb     11d7 <rj1+0x77>
sqrtsd %xmm0,%xmm0
jmp    11e2 <rj1+0x82>
call   1080 <sqrt@plt>
movapd 0x10(%rsp),%xmm3
movsd  %xmm0,0x8(%rsp)
movapd %xmm3,%xmm0
call   1030 <pone@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0xe21(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
call   1070 <cos@plt>
movapd %xmm0,0x50(%rsp)
movaps 0x10(%rsp),%xmm0
call   1060 <qone@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm0
call   1050 <sin@plt>
movsd  0xdef(%rip),%xmm1
divsd  0x10(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd 0x50(%rsp),%xmm2
mulsd  0x38(%rsp),%xmm2
addsd  %xmm1,%xmm2
mulsd  0x8(%rsp),%xmm2
movapd 0xd99(%rip),%xmm0
xorpd  %xmm2,%xmm0
movapd %xmm2,%xmm3
xorpd  %xmm1,%xmm1
movapd 0x40(%rsp),%xmm2
cmpltsd %xmm1,%xmm2
movapd %xmm2,%xmm1
andnpd %xmm3,%xmm1
andpd  %xmm0,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm2,%xmm0
add    $0x68,%rsp
ret

LLVM IR (-O0):
define double @rj1(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
store double %6, double* %4
%7 = load double, double* %3
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load double, double* %3
%11 = fneg double %10
store double %11, double* %3
br label %12
12: ; preds = %9, %1
%13 = load double, double* %3
%14 = fcmp olt double %13, 8.000000e+00
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load double, double* %4
%17 = load double, double* %3
%18 = call double @jone(double %17)
%19 = fmul double %16, %18
store double %19, double* %2
br label %48
20: ; preds = %12
%21 = load double, double* %3
%22 = fdiv double 0x3FE45F306DC9C883, %21
%23 = call double @sqrt(double %22)
%24 = load double, double* %3
%25 = call double @pone(double %24)
%26 = load double, double* %3
%27 = fsub double %26, 0x4002D97C7F3321D2
%28 = call double @cos(double %27)
%29 = load double, double* %3
%30 = fdiv double 8.000000e+00, %29
%31 = load double, double* %3
%32 = call double @qone(double %31)
%33 = fmul double %30, %32
%34 = load double, double* %3
%35 = fsub double %34, 0x4002D97C7F3321D2
%36 = call double @sin(double %35)
%37 = fmul double %33, %36
%38 = fneg double %37
%39 = call double @llvm.fmuladd.f64(double %25, double %28, double %38)
%40 = fmul double %23, %39
store double %40, double* %5
%41 = load double, double* %4
%42 = fcmp olt double %41, 0.000000e+00
br i1 %42, label %43, label %46
43: ; preds = %20
%44 = load double, double* %5
%45 = fneg double %44
store double %45, double* %5
br label %46
46: ; preds = %43, %20
%47 = load double, double* %5
store double %47, double* %2
br label %48
48: ; preds = %46, %15
%49 = load double, double* %2
ret double %49
}

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