#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);
int /*<<< orphan*/ radialRecurrence(double, double *, int);
double sin(double);
void sphBessel(double x, double *y, int n) {
  if (y == 0)
    return;
  if (n >= 0)
    y[0] = (x < 1e-10) ? 1.0 : sin(x) / x;
  if (n >= 1)
    y[1] = -cos(x) / x + y[0] / x;
  radialRecurrence(x, y, n);
}


x86 assembly (clang, -O0):
<sphBessel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <sphBessel+0x24>
jmp    11ff <sphBessel+0xcf>
cmpl   $0x0,-0x14(%rbp)
jl     11a4 <sphBessel+0x74>
movsd  0xe9a(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1183 <sphBessel+0x53>
movsd  0xe8f(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1197 <sphBessel+0x67>
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cmpl   $0x1,-0x14(%rbp)
jl     11ee <sphBessel+0xbe>
movsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
divsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <radialRecurrence@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphBessel>:
test   %rdi,%rdi
je     1162 <sphBessel+0x32>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movapd %xmm0,%xmm2
test   %esi,%esi
js     11a0 <sphBessel+0x70>
movsd  0xebb(%rip),%xmm0
ucomisd %xmm2,%xmm0
movsd  %xmm2,(%rsp)
jbe    1163 <sphBessel+0x33>
movsd  0xea0(%rip),%xmm0
jmp    1175 <sphBessel+0x45>
ret
movapd %xmm2,%xmm0
call   1030 <sin@plt>
movsd  (%rsp),%xmm2
divsd  %xmm2,%xmm0
movsd  %xmm0,(%rbx)
test   %ebp,%ebp
je     11a0 <sphBessel+0x70>
movapd %xmm2,%xmm0
call   1050 <cos@plt>
movsd  (%rsp),%xmm2
movsd  (%rbx),%xmm1
divsd  %xmm2,%xmm1
divsd  %xmm2,%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rbx)
movapd %xmm2,%xmm0
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <radialRecurrence@plt>

LLVM IR (-O0):
define void @sphBessel(double %0, double* %1, i32 %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca i32
store double %0, double* %4
store double* %1, double** %5
store i32 %2, i32* %6
%7 = load double*, double** %5
%8 = icmp eq double* %7, null
br i1 %8, label %9, label %10
9: ; preds = %3
br label %48
10: ; preds = %3
%11 = load i32, i32* %6
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load double, double* %4
%15 = fcmp olt double %14, 1.000000e-10
br i1 %15, label %16, label %17
16: ; preds = %13
br label %22
17: ; preds = %13
%18 = load double, double* %4
%19 = call double @sin(double %18)
%20 = load double, double* %4
%21 = fdiv double %19, %20
br label %22
22: ; preds = %17, %16
%23 = phi double [ 1.000000e+00, %16 ], [ %21, %17 ]
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 0
store double %23, double* %25
br label %26
26: ; preds = %22, %10
%27 = load i32, i32* %6
%28 = icmp sge i32 %27, 1
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = load double, double* %4
%31 = call double @cos(double %30)
%32 = fneg double %31
%33 = load double, double* %4
%34 = fdiv double %32, %33
%35 = load double*, double** %5
%36 = getelementptr inbounds double, double* %35, i64 0
%37 = load double, double* %36
%38 = load double, double* %4
%39 = fdiv double %37, %38
%40 = fadd double %34, %39
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 1
store double %40, double* %42
br label %43
43: ; preds = %29, %26
%44 = load double, double* %4
%45 = load double*, double** %5
%46 = load i32, i32* %6
%47 = call i32 @radialRecurrence(double %44, double* %45, i32 %46)
br label %48
48: ; preds = %43, %9
ret void
}

LLVM IR (-O2):
define void @sphBessel(double %0, double* %1, i32 %2) {
%4 = icmp eq double* %1, null
br i1 %4, label %24, label %5
5: ; preds = %3
%6 = icmp sgt i32 %2, -1
br i1 %6, label %7, label %22
7: ; preds = %5
%8 = fcmp olt double %0, 1.000000e-10
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = tail call double @sin(double %0)
%11 = fdiv double %10, %0
br label %12
12: ; preds = %9, %7
%13 = phi double [ %11, %9 ], [ 1.000000e+00, %7 ]
store double %13, double* %1
%14 = icmp eq i32 %2, 0
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = tail call double @cos(double %0)
%17 = load double, double* %1
%18 = fdiv double %17, %0
%19 = fdiv double %16, %0
%20 = fsub double %18, %19
%21 = getelementptr inbounds double, double* %1, i64 1
store double %20, double* %21
br label %22
22: ; preds = %5, %15, %12
%23 = tail call i32 @radialRecurrence(double %0, double* %1, i32 %2)
br label %24
24: ; preds = %3, %22
ret void
}