double _orbita_models_homogeneous_sphere_psi(const void *par, const double *R) {
  double Rt = (sqrt((R)[0] * (R)[0] + (R)[1] * (R)[1] + (R)[2] * (R)[2])),
         a = ((double *)par)[1], rho_0 = ((double *)par)[0];
  if (Rt < a)
    return -2. * (3.14159265358979323846264338327950288419716939937510) *
           rho_0 *
           (((a) * (a)) -
            (1. / 3.) * ((R)[0] * (R)[0] + (R)[1] * (R)[1] + (R)[2] * (R)[2]));
  else
    return -4. * (3.14159265358979323846264338327950288419716939937510) *
           rho_0 * ((a) * (a) * (a)) / (3. * Rt);
}


x86 assembly (clang, -O0):
<_orbita_models_homogeneous_sphere_psi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1231 <_orbita_models_homogeneous_sphere_psi+0x121>
movsd  0xe73(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm3
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm5
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm4
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm4
mulsd  %xmm5,%xmm2
addsd  %xmm4,%xmm2
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm4
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm5
mulsd  %xmm5,%xmm4
addsd  %xmm2,%xmm4
movsd  0xe10(%rip),%xmm2
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)
jmp    1267 <_orbita_models_homogeneous_sphere_psi+0x157>
movsd  0xdcf(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda7(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_orbita_models_homogeneous_sphere_psi>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  (%rsi),%xmm1
movsd  0x8(%rsi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     114f <_orbita_models_homogeneous_sphere_psi+0x3f>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1158 <_orbita_models_homogeneous_sphere_psi+0x48>
call   1030 <sqrt@plt>
movapd %xmm0,%xmm1
movsd  (%r14),%xmm2
movsd  0x8(%r14),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a9 <_orbita_models_homogeneous_sphere_psi+0x99>
mulsd  0xe9f(%rip),%xmm2
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm3
mulsd  %xmm3,%xmm3
mulsd  %xmm1,%xmm1
addsd  %xmm3,%xmm1
movsd  0x10(%rbx),%xmm3
mulsd  %xmm3,%xmm3
addsd  %xmm1,%xmm3
mulsd  0xe7d(%rip),%xmm3
mulsd  %xmm0,%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
jmp    11d1 <_orbita_models_homogeneous_sphere_psi+0xc1>
mulsd  0xe4f(%rip),%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
mulsd  0xe3f(%rip),%xmm1
divsd  %xmm1,%xmm3
movapd %xmm3,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @_orbita_models_homogeneous_sphere_psi(i8* %0, double* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i8* %0, i8** %4
store double* %1, double** %5
%9 = load double*, double** %5
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = load double*, double** %5
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = fmul double %17, %20
%22 = call double @llvm.fmuladd.f64(double %11, double %14, double %21)
%23 = load double*, double** %5
%24 = getelementptr inbounds double, double* %23, i64 2
%25 = load double, double* %24
%26 = load double*, double** %5
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = call double @llvm.fmuladd.f64(double %25, double %28, double %22)
%30 = call double @sqrt(double %29)
store double %30, double* %6
%31 = load i8*, i8** %4
%32 = bitcast i8* %31 to double*
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
store double %34, double* %7
%35 = load i8*, i8** %4
%36 = bitcast i8* %35 to double*
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
store double %38, double* %8
%39 = load double, double* %6
%40 = load double, double* %7
%41 = fcmp olt double %39, %40
br i1 %41, label %42, label %72
42: ; preds = %2
%43 = load double, double* %8
%44 = fmul double 0xC01921FB54442D18, %43
%45 = load double, double* %7
%46 = load double, double* %7
%47 = load double*, double** %5
%48 = getelementptr inbounds double, double* %47, i64 0
%49 = load double, double* %48
%50 = load double*, double** %5
%51 = getelementptr inbounds double, double* %50, i64 0
%52 = load double, double* %51
%53 = load double*, double** %5
%54 = getelementptr inbounds double, double* %53, i64 1
%55 = load double, double* %54
%56 = load double*, double** %5
%57 = getelementptr inbounds double, double* %56, i64 1
%58 = load double, double* %57
%59 = fmul double %55, %58
%60 = call double @llvm.fmuladd.f64(double %49, double %52, double %59)
%61 = load double*, double** %5
%62 = getelementptr inbounds double, double* %61, i64 2
%63 = load double, double* %62
%64 = load double*, double** %5
%65 = getelementptr inbounds double, double* %64, i64 2
%66 = load double, double* %65
%67 = call double @llvm.fmuladd.f64(double %63, double %66, double %60)
%68 = fmul double 0x3FD5555555555555, %67
%69 = fneg double %68
%70 = call double @llvm.fmuladd.f64(double %45, double %46, double %69)
%71 = fmul double %44, %70
store double %71, double* %3
br label %84
72: ; preds = %2
%73 = load double, double* %8
%74 = fmul double 0xC02921FB54442D18, %73
%75 = load double, double* %7
%76 = load double, double* %7
%77 = fmul double %75, %76
%78 = load double, double* %7
%79 = fmul double %77, %78
%80 = fmul double %74, %79
%81 = load double, double* %6
%82 = fmul double 3.000000e+00, %81
%83 = fdiv double %80, %82
store double %83, double* %3
br label %84
84: ; preds = %72, %42
%85 = load double, double* %3
ret double %85
}

LLVM IR (-O2):
define double @_orbita_models_homogeneous_sphere_psi(i8* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = fmul double %5, %5
%7 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %6)
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %7)
%11 = tail call double @sqrt(double %10)
%12 = bitcast i8* %0 to double*
%13 = getelementptr inbounds i8, i8* %0, i64 8
%14 = bitcast i8* %13 to double*
%15 = load double, double* %14
%16 = load double, double* %12
%17 = fcmp olt double %11, %15
br i1 %17, label %18, label %29
18: ; preds = %2
%19 = fmul double %16, 0xC01921FB54442D18
%20 = load double, double* %1
%21 = load double, double* %4
%22 = fmul double %21, %21
%23 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %22)
%24 = load double, double* %8
%25 = tail call double @llvm.fmuladd.f64(double %24, double %24, double %23)
%26 = fmul double %25, 0xBFD5555555555555
%27 = tail call double @llvm.fmuladd.f64(double %15, double %15, double %26)
%28 = fmul double %19, %27
br label %36
29: ; preds = %2
%30 = fmul double %16, 0xC02921FB54442D18
%31 = fmul double %15, %15
%32 = fmul double %15, %31
%33 = fmul double %30, %32
%34 = fmul double %11, 3.000000e+00
%35 = fdiv double %33, %34
br label %36
36: ; preds = %29, %18
%37 = phi double [ %28, %18 ], [ %35, %29 ]
ret double %37
}