#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 sqrt(float);
void sphbes(int n, float x, float *sj, float *sy, float *sjp, float *syp) {
  void bessjy(float x, float xnu, float *rj, float *ry, float *rjp, float *ryp);
  void nrerror(char error_text[]);
  float factor, order, rj, rjp, ry, ryp;
  if (n < 0 || x <= 0.0)
    nrerror("bad arguments in sphbes");
  order = n + 0.5;
  bessjy(x, order, &rj, &ry, &rjp, &ryp);
  factor = 1.2533141 / sqrt(x);
  *sj = factor * rj;
  *sy = factor * ry;
  *sjp = factor * rjp - (*sj) / (2.0 * x);
  *syp = factor * ryp - (*sy) / (2.0 * x);
}


x86 assembly (clang, -O0):
<sphbes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1170 <sphbes+0x40>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     117c <sphbes+0x4c>
lea    0xea1(%rip),%rdi
call   1030 <nrerror@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe87(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
lea    -0x34(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1040 <bessjy@plt>
movss  -0x8(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe3e(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
mulss  -0x34(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x2c(%rbp),%xmm0
mulss  -0x3c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x2c(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x8(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xdda(%rip),%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x2c(%rbp),%xmm0
mulss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x8(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xd97(%rip),%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphbes>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%ebp
test   %edi,%edi
movss  %xmm0,0xc(%rsp)
js     115c <sphbes+0x2c>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jb     116e <sphbes+0x3e>
lea    0xead(%rip),%rdi
call   1030 <nrerror@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
addsd  0xe83(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
lea    0x1c(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <bessjy@plt>
movss  0xc(%rsp),%xmm0
call   1050 <sqrt@plt>
movsd  0xe5b(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  0x1c(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
movss  0x14(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%r12)
movss  0x18(%rsp),%xmm1
mulss  %xmm0,%xmm1
cvtss2sd %xmm1,%xmm1
movss  (%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0xc(%rsp),%xmm3
cvtss2sd %xmm3,%xmm3
addsd  %xmm3,%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,(%r15)
mulss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%r12),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm3,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"bad arguments in sphbes\00"
define void @sphbes(i32 %0, float %1, float* %2, float* %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
store i32 %0, i32* %7
store float %1, float* %8
store float* %2, float** %9
store float* %3, float** %10
store float* %4, float** %11
store float* %5, float** %12
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %6
%22 = load float, float* %8
%23 = fpext float %22 to double
%24 = fcmp ole double %23, 0.000000e+00
br i1 %24, label %25, label %26
25: ; preds = %21, %6
br label %26
26: ; preds = %25, %21
%27 = load i32, i32* %7
%28 = sitofp i32 %27 to double
%29 = fadd double %28, 5.000000e-01
%30 = fptrunc double %29 to float
store float %30, float* %14
%31 = load float, float* %8
%32 = load float, float* %14
%33 = load float, float* %8
%34 = call double @sqrt(float %33)
%35 = fdiv double 0x3FF40D9315F1D9CD, %34
%36 = fptrunc double %35 to float
store float %36, float* %13
%37 = load float, float* %13
%38 = load float, float* %15
%39 = fmul float %37, %38
%40 = load float*, float** %9
store float %39, float* %40
%41 = load float, float* %13
%42 = load float, float* %17
%43 = fmul float %41, %42
%44 = load float*, float** %10
store float %43, float* %44
%45 = load float, float* %13
%46 = load float, float* %16
%47 = fmul float %45, %46
%48 = fpext float %47 to double
%49 = load float*, float** %9
%50 = load float, float* %49
%51 = fpext float %50 to double
%52 = load float, float* %8
%53 = fpext float %52 to double
%54 = fmul double 2.000000e+00, %53
%55 = fdiv double %51, %54
%56 = fsub double %48, %55
%57 = fptrunc double %56 to float
%58 = load float*, float** %11
store float %57, float* %58
%59 = load float, float* %13
%60 = load float, float* %18
%61 = fmul float %59, %60
%62 = fpext float %61 to double
%63 = load float*, float** %10
%64 = load float, float* %63
%65 = fpext float %64 to double
%66 = load float, float* %8
%67 = fpext float %66 to double
%68 = fmul double 2.000000e+00, %67
%69 = fdiv double %65, %68
%70 = fsub double %62, %69
%71 = fptrunc double %70 to float
%72 = load float*, float** %12
store float %71, float* %72
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"bad arguments in sphbes\00"
define void @sphbes(i32 %0, float %1, float* nocapture %2, float* nocapture %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = bitcast float* %7 to i8*
%12 = bitcast float* %8 to i8*
%13 = bitcast float* %9 to i8*
%14 = bitcast float* %10 to i8*
%15 = icmp sgt i32 %0, -1
%16 = fcmp ugt float %1, 0.000000e+00
%17 = and i1 %15, %16
br i1 %17, label %19, label %18
18: ; preds = %6
tail call void @nrerror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %6, %18
%20 = sitofp i32 %0 to double
%21 = fadd double %20, 5.000000e-01
%22 = fptrunc double %21 to float
%23 = call double @sqrt(float %1)
%24 = fdiv double 0x3FF40D9315F1D9CD, %23
%25 = fptrunc double %24 to float
%26 = load float, float* %7
%27 = fmul float %26, %25
store float %27, float* %2
%28 = load float, float* %9
%29 = fmul float %28, %25
store float %29, float* %3
%30 = load float, float* %8
%31 = fmul float %30, %25
%32 = fpext float %31 to double
%33 = load float, float* %2
%34 = fpext float %33 to double
%35 = fpext float %1 to double
%36 = fmul double %35, 2.000000e+00
%37 = fdiv double %34, %36
%38 = fsub double %32, %37
%39 = fptrunc double %38 to float
store float %39, float* %4
%40 = load float, float* %10
%41 = fmul float %40, %25
%42 = fpext float %41 to double
%43 = load float, float* %3
%44 = fpext float %43 to double
%45 = fdiv double %44, %36
%46 = fsub double %42, %45
%47 = fptrunc double %46 to float
store float %47, float* %5
ret void
}