float rhohalo(radius, drho)
float radius;
float *drho;
{
  float rcyl, z, rhocur, halodens_();
  float rho0, rho1, dr;
  rcyl = radius;
  z = 0.0;
  rhocur = halodens_(&rcyl, &z);
  dr = 0.001 * radius;
  rcyl = radius * 1.0005;
  rho1 = halodens_(&rcyl, &z);
  rcyl = radius * 0.9995;
  rho0 = halodens_(&rcyl, &z);
  *drho = (rho1 - rho0) / dr;
  return rhocur;
}


x86 assembly (clang, -O0):
<rhohalo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <halodens_@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb4(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <halodens_@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe54(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <halodens_@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x24(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
divss  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rhohalo>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r14
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
movl   $0x0,0x1c(%rsp)
lea    0xc(%rsp),%rbx
lea    0x1c(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <halodens_@plt>
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xe97(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movsd  0xe89(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <halodens_@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0xe68(%rip),%xmm1
movss  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <halodens_@plt>
movss  0x10(%rsp),%xmm1
subss  %xmm0,%xmm1
divss  0x8(%rsp),%xmm1
movss  %xmm1,(%r14)
movss  0x18(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @rhohalo(double %0, float* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = fptrunc double %0 to float
store float %11, float* %3
store float* %1, float** %4
%12 = load float, float* %3
store float %12, float* %5
store float 0.000000e+00, float* %6
%13 = call float (float*, float*, ...) bitcast (float (...)* @halodens_ to float (float*, float*, ...)*)(float* %5, float* %6)
store float %13, float* %7
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = fmul double 1.000000e-03, %15
%17 = fptrunc double %16 to float
store float %17, float* %10
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = fmul double %19, 1.000500e+00
%21 = fptrunc double %20 to float
store float %21, float* %5
%22 = call float (float*, float*, ...) bitcast (float (...)* @halodens_ to float (float*, float*, ...)*)(float* %5, float* %6)
store float %22, float* %9
%23 = load float, float* %3
%24 = fpext float %23 to double
%25 = fmul double %24, 9.995000e-01
%26 = fptrunc double %25 to float
store float %26, float* %5
%27 = call float (float*, float*, ...) bitcast (float (...)* @halodens_ to float (float*, float*, ...)*)(float* %5, float* %6)
store float %27, float* %8
%28 = load float, float* %9
%29 = load float, float* %8
%30 = fsub float %28, %29
%31 = load float, float* %10
%32 = fdiv float %30, %31
%33 = load float*, float** %4
store float %32, float* %33
%34 = load float, float* %7
ret float %34
}

LLVM IR (-O2):
define float @rhohalo(double %0, float* nocapture writeonly %1) {
%3 = alloca float
%4 = alloca float
%5 = fptrunc double %0 to float
%6 = bitcast float* %3 to i8*
%7 = bitcast float* %4 to i8*
store float %5, float* %3
store float 0.000000e+00, float* %4
%8 = call float (float*, float*, ...) bitcast (float (...)* @halodens_ to float (float*, float*, ...)*)(float* %3, float* %4)
%9 = fpext float %5 to double
%10 = fmul double %9, 1.000000e-03
%11 = fptrunc double %10 to float
%12 = fmul double %9, 1.000500e+00
%13 = fptrunc double %12 to float
store float %13, float* %3
%14 = call float (float*, float*, ...) bitcast (float (...)* @halodens_ to float (float*, float*, ...)*)(float* %3, float* %4)
%15 = fmul double %9, 9.995000e-01
%16 = fptrunc double %15 to float
store float %16, float* %3
%17 = call float (float*, float*, ...) bitcast (float (...)* @halodens_ to float (float*, float*, ...)*)(float* %3, float* %4)
%18 = fsub float %14, %17
%19 = fdiv float %18, %11
store float %19, float* %1
ret float %8
}