int _orbita_potential_miyamoto_disk_f(const void *par, const double *pos,
                                      double *F) {
  double M = ((double *)par)[0], A = ((double *)par)[1],
         B_sq = ((double *)par)[2], x_sq = pos[0] * pos[0],
         y_sq = pos[1] * pos[1], z_sq = pos[2] * pos[2];
  double W = sqrt(B_sq + z_sq),
         U = pow(((A) * (A)) + 2. * A * W + B_sq + x_sq + y_sq + z_sq, 1.5),
         V = pow(((A + W) * (A + W)) + x_sq + y_sq, 1.5);
  F[0] = -(M * pos[0]) / U, F[1] = -(M * pos[1]) / U,
  F[2] = -(M * pos[2]) / V - (A * M * pos[2]) / (W * V);
  return 0;
}


x86 assembly (clang, -O0):
<_orbita_potential_miyamoto_disk_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xe42(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  0xe0c(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
addsd  -0x50(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  0xdd4(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm1
movsd  -0x50(%rbp),%xmm2
mulsd  -0x60(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_orbita_potential_miyamoto_disk_f>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movsd  (%rdi),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rdi),%xmm3
movsd  (%rsi),%xmm1
movsd  0x8(%rsi),%xmm0
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsi),%xmm4
mulsd  %xmm4,%xmm4
movapd %xmm3,%xmm0
addsd  %xmm4,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1184 <_orbita_potential_miyamoto_disk_f+0x64>
sqrtsd %xmm0,%xmm0
jmp    11a1 <_orbita_potential_miyamoto_disk_f+0x81>
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x10(%rsp)
call   1040 <sqrt@plt>
movsd  0x10(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm3
addsd  0x20(%rsp),%xmm3
addsd  0x28(%rsp),%xmm3
addsd  %xmm3,%xmm4
movsd  0xe23(%rip),%xmm1
movapd %xmm4,%xmm0
call   1030 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  0x20(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
movsd  0xdf0(%rip),%xmm1
call   1030 <pow@plt>
movapd 0xdf3(%rip),%xmm1
movapd 0x30(%rsp),%xmm3
xorpd  %xmm3,%xmm1
movsd  (%rbx),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm4
divsd  %xmm4,%xmm2
movsd  %xmm2,(%r14)
movsd  0x8(%rbx),%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm4,%xmm2
movsd  %xmm2,0x8(%r14)
movsd  0x10(%rbx),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
mulsd  0x18(%rsp),%xmm3
mulsd  %xmm2,%xmm3
movsd  0x8(%rsp),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm3
subsd  %xmm3,%xmm1
movsd  %xmm1,0x10(%r14)
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @_orbita_potential_miyamoto_disk_f(i8* %0, double* %1, double* %2) {
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store i8* %0, i8** %4
store double* %1, double** %5
store double* %2, double** %6
%16 = load i8*, i8** %4
%17 = bitcast i8* %16 to double*
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
store double %19, double* %7
%20 = load i8*, i8** %4
%21 = bitcast i8* %20 to double*
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
store double %23, double* %8
%24 = load i8*, i8** %4
%25 = bitcast i8* %24 to double*
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
store double %27, double* %9
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
%31 = load double*, double** %5
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
%34 = fmul double %30, %33
store double %34, double* %10
%35 = load double*, double** %5
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = load double, double* %36
%38 = load double*, double** %5
%39 = getelementptr inbounds double, double* %38, i64 1
%40 = load double, double* %39
%41 = fmul double %37, %40
store double %41, double* %11
%42 = load double*, double** %5
%43 = getelementptr inbounds double, double* %42, i64 2
%44 = load double, double* %43
%45 = load double*, double** %5
%46 = getelementptr inbounds double, double* %45, i64 2
%47 = load double, double* %46
%48 = fmul double %44, %47
store double %48, double* %12
%49 = load double, double* %9
%50 = load double, double* %12
%51 = fadd double %49, %50
%52 = call double @sqrt(double %51)
store double %52, double* %13
%53 = load double, double* %8
%54 = load double, double* %8
%55 = load double, double* %8
%56 = fmul double 2.000000e+00, %55
%57 = load double, double* %13
%58 = fmul double %56, %57
%59 = call double @llvm.fmuladd.f64(double %53, double %54, double %58)
%60 = load double, double* %9
%61 = fadd double %59, %60
%62 = load double, double* %10
%63 = fadd double %61, %62
%64 = load double, double* %11
%65 = fadd double %63, %64
%66 = load double, double* %12
%67 = fadd double %65, %66
%68 = call double @pow(double %67, double 1.500000e+00)
store double %68, double* %14
%69 = load double, double* %8
%70 = load double, double* %13
%71 = fadd double %69, %70
%72 = load double, double* %8
%73 = load double, double* %13
%74 = fadd double %72, %73
%75 = load double, double* %10
%76 = call double @llvm.fmuladd.f64(double %71, double %74, double %75)
%77 = load double, double* %11
%78 = fadd double %76, %77
%79 = call double @pow(double %78, double 1.500000e+00)
store double %79, double* %15
%80 = load double, double* %7
%81 = load double*, double** %5
%82 = getelementptr inbounds double, double* %81, i64 0
%83 = load double, double* %82
%84 = fmul double %80, %83
%85 = fneg double %84
%86 = load double, double* %14
%87 = fdiv double %85, %86
%88 = load double*, double** %6
%89 = getelementptr inbounds double, double* %88, i64 0
store double %87, double* %89
%90 = load double, double* %7
%91 = load double*, double** %5
%92 = getelementptr inbounds double, double* %91, i64 1
%93 = load double, double* %92
%94 = fmul double %90, %93
%95 = fneg double %94
%96 = load double, double* %14
%97 = fdiv double %95, %96
%98 = load double*, double** %6
%99 = getelementptr inbounds double, double* %98, i64 1
store double %97, double* %99
%100 = load double, double* %7
%101 = load double*, double** %5
%102 = getelementptr inbounds double, double* %101, i64 2
%103 = load double, double* %102
%104 = fmul double %100, %103
%105 = fneg double %104
%106 = load double, double* %15
%107 = fdiv double %105, %106
%108 = load double, double* %8
%109 = load double, double* %7
%110 = fmul double %108, %109
%111 = load double*, double** %5
%112 = getelementptr inbounds double, double* %111, i64 2
%113 = load double, double* %112
%114 = fmul double %110, %113
%115 = load double, double* %13
%116 = load double, double* %15
%117 = fmul double %115, %116
%118 = fdiv double %114, %117
%119 = fsub double %107, %118
%120 = load double*, double** %6
%121 = getelementptr inbounds double, double* %120, i64 2
store double %119, double* %121
ret i32 0
}

LLVM IR (-O2):
define i32 @_orbita_potential_miyamoto_disk_f(i8* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = bitcast i8* %0 to double*
%5 = load double, double* %4
%6 = getelementptr inbounds i8, i8* %0, i64 8
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
%9 = getelementptr inbounds i8, i8* %0, i64 16
%10 = bitcast i8* %9 to double*
%11 = load double, double* %10
%12 = load double, double* %1
%13 = fmul double %12, %12
%14 = getelementptr inbounds double, double* %1, i64 1
%15 = load double, double* %14
%16 = fmul double %15, %15
%17 = getelementptr inbounds double, double* %1, i64 2
%18 = load double, double* %17
%19 = fmul double %18, %18
%20 = fadd double %11, %19
%21 = tail call double @sqrt(double %20)
%22 = fmul double %8, 2.000000e+00
%23 = fmul double %22, %21
%24 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %23)
%25 = fadd double %11, %24
%26 = fadd double %13, %25
%27 = fadd double %16, %26
%28 = fadd double %19, %27
%29 = tail call double @pow(double %28, double 1.500000e+00)
%30 = fadd double %8, %21
%31 = tail call double @llvm.fmuladd.f64(double %30, double %30, double %13)
%32 = fadd double %16, %31
%33 = tail call double @pow(double %32, double 1.500000e+00)
%34 = load double, double* %1
%35 = fneg double %5
%36 = fmul double %34, %35
%37 = fdiv double %36, %29
store double %37, double* %2
%38 = load double, double* %14
%39 = fmul double %38, %35
%40 = fdiv double %39, %29
%41 = getelementptr inbounds double, double* %2, i64 1
store double %40, double* %41
%42 = load double, double* %17
%43 = fmul double %42, %35
%44 = fdiv double %43, %33
%45 = fmul double %5, %8
%46 = fmul double %45, %42
%47 = fmul double %21, %33
%48 = fdiv double %46, %47
%49 = fsub double %44, %48
%50 = getelementptr inbounds double, double* %2, i64 2
store double %49, double* %50
ret i32 0
}