void twobody_scale_SD(int version, double *two, double l) {
  double l1 = 1.0 + l;
  double l2 = l1 * l1;
  double l3 = l2 * l1;
  l2 /= 6.0;
  l3 /= 6.0;
  l1 /= 2.0;
  two[1] *= l1;
  two[3] *= l1;
  if (version == 0)
    return;
  two[4] *= 2.0 / 3.0;
  two[5] *= l2;
  two[6] *= 4.0 / 3.0;
  two[7] *= l3;
  two[8] *= 4.0 / 3.0;
  two[9] *= l3;
  if (version == 1)
    return;
  two[10] *= 2.0 / 3.0;
  two[11] *= l2;
  two[12] *= 2.0 / 3.0;
  two[13] *= l2;
  two[14] *= 4.0 / 3.0;
  two[15] *= l3;
  double lm;
  lm = 5.0 / 6.0 * l3;
  two[16] *= 10.0 / 9.0;
  two[17] *= lm;
  two[18] *= 10.0 / 9.0;
  two[19] *= lm;
  two[20] *= 10.0 / 9.0;
  two[21] *= lm;
}


x86 assembly (clang, -O0):
<twobody_scale_SD>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  0xef8(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xebb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xea5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe87(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rax)
cmpl   $0x0,-0x4(%rbp)
jne    11b7 <twobody_scale_SD+0xb7>
jmp    136d <twobody_scale_SD+0x26d>
mov    -0x10(%rbp),%rax
movsd  0xe5d(%rip),%xmm0
mulsd  0x20(%rax),%xmm0
movsd  %xmm0,0x20(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x28(%rax),%xmm0
movsd  %xmm0,0x28(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe2c(%rip),%xmm0
mulsd  0x30(%rax),%xmm0
movsd  %xmm0,0x30(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x38(%rax),%xmm0
movsd  %xmm0,0x38(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe03(%rip),%xmm0
mulsd  0x40(%rax),%xmm0
movsd  %xmm0,0x40(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x48(%rax),%xmm0
movsd  %xmm0,0x48(%rax)
cmpl   $0x1,-0x4(%rbp)
jne    1241 <twobody_scale_SD+0x141>
jmp    136d <twobody_scale_SD+0x26d>
mov    -0x10(%rbp),%rax
movsd  0xdd3(%rip),%xmm0
mulsd  0x50(%rax),%xmm0
movsd  %xmm0,0x50(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x58(%rax),%xmm0
movsd  %xmm0,0x58(%rax)
mov    -0x10(%rbp),%rax
movsd  0xdaa(%rip),%xmm0
mulsd  0x60(%rax),%xmm0
movsd  %xmm0,0x60(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x68(%rax),%xmm0
movsd  %xmm0,0x68(%rax)
mov    -0x10(%rbp),%rax
movsd  0xd79(%rip),%xmm0
mulsd  0x70(%rax),%xmm0
movsd  %xmm0,0x70(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x78(%rax),%xmm0
movsd  %xmm0,0x78(%rax)
movsd  0xd6c(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xd4e(%rip),%xmm0
mulsd  0x80(%rax),%xmm0
movsd  %xmm0,0x80(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x88(%rax),%xmm0
movsd  %xmm0,0x88(%rax)
mov    -0x10(%rbp),%rax
movsd  0xd19(%rip),%xmm0
mulsd  0x90(%rax),%xmm0
movsd  %xmm0,0x90(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x98(%rax),%xmm0
movsd  %xmm0,0x98(%rax)
mov    -0x10(%rbp),%rax
movsd  0xce4(%rip),%xmm0
mulsd  0xa0(%rax),%xmm0
movsd  %xmm0,0xa0(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0xa8(%rax),%xmm0
movsd  %xmm0,0xa8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<twobody_scale_SD>:
addsd  0xef8(%rip),%xmm0
movsd  0xf00(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsi),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsi)
mulsd  0x18(%rsi),%xmm1
movsd  %xmm1,0x18(%rsi)
test   %edi,%edi
je     1211 <twobody_scale_SD+0x111>
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm0
divsd  0xec0(%rip),%xmm0
divsd  0xeb8(%rip),%xmm2
movapd 0xec8(%rip),%xmm1
unpcklpd %xmm2,%xmm1
movupd 0x20(%rsi),%xmm2
movupd 0x30(%rsi),%xmm3
movupd 0x40(%rsi),%xmm4
mulpd  %xmm1,%xmm2
movupd %xmm2,0x20(%rsi)
movapd 0xeb4(%rip),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm2,%xmm3
movupd %xmm3,0x30(%rsi)
mulpd  %xmm2,%xmm4
movupd %xmm4,0x40(%rsi)
cmp    $0x1,%edi
je     1211 <twobody_scale_SD+0x111>
movupd 0x50(%rsi),%xmm3
movupd 0x60(%rsi),%xmm4
movupd 0x70(%rsi),%xmm5
movupd 0x80(%rsi),%xmm6
mulpd  %xmm1,%xmm3
movupd %xmm3,0x50(%rsi)
mulpd  %xmm1,%xmm4
movupd %xmm4,0x60(%rsi)
mulpd  %xmm5,%xmm2
movupd %xmm2,0x70(%rsi)
mulsd  0xe47(%rip),%xmm0
movapd 0xe67(%rip),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm1,%xmm6
movupd %xmm6,0x80(%rsi)
movupd 0x90(%rsi),%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm0,0x90(%rsi)
movupd 0xa0(%rsi),%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm0,0xa0(%rsi)
ret

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

LLVM IR (-O2):
define void @twobody_scale_SD(i32 %0, double* nocapture %1, double %2) {
%4 = fadd double %2, 1.000000e+00
%5 = fmul double %4, %4
%6 = fmul double %4, %5
%7 = fdiv double %6, 6.000000e+00
%8 = fmul double %4, 5.000000e-01
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fmul double %8, %10
store double %11, double* %9
%12 = getelementptr inbounds double, double* %1, i64 3
%13 = load double, double* %12
%14 = fmul double %8, %13
store double %14, double* %12
%15 = icmp eq i32 %0, 0
br i1 %15, label %69, label %16
16: ; preds = %3
%17 = fdiv double %5, 6.000000e+00
%18 = getelementptr inbounds double, double* %1, i64 4
%19 = bitcast double* %18 to <2 x double>*
%20 = load <2 x double>, <2 x double>* %19
%21 = insertelement <2 x double> <double 0x3FE5555555555555, double poison>, double %17, i64 1
%22 = fmul <2 x double> %21, %20
%23 = bitcast double* %18 to <2 x double>*
store <2 x double> %22, <2 x double>* %23
%24 = getelementptr inbounds double, double* %1, i64 6
%25 = bitcast double* %24 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = insertelement <2 x double> <double 0x3FF5555555555555, double poison>, double %7, i64 1
%28 = fmul <2 x double> %27, %26
%29 = bitcast double* %24 to <2 x double>*
store <2 x double> %28, <2 x double>* %29
%30 = getelementptr inbounds double, double* %1, i64 8
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = fmul <2 x double> %27, %32
%34 = bitcast double* %30 to <2 x double>*
store <2 x double> %33, <2 x double>* %34
%35 = icmp eq i32 %0, 1
br i1 %35, label %69, label %36
36: ; preds = %16
%37 = getelementptr inbounds double, double* %1, i64 10
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = fmul <2 x double> %21, %39
%41 = bitcast double* %37 to <2 x double>*
store <2 x double> %40, <2 x double>* %41
%42 = getelementptr inbounds double, double* %1, i64 12
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = fmul <2 x double> %21, %44
%46 = bitcast double* %42 to <2 x double>*
store <2 x double> %45, <2 x double>* %46
%47 = getelementptr inbounds double, double* %1, i64 14
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = fmul <2 x double> %27, %49
%51 = bitcast double* %47 to <2 x double>*
store <2 x double> %50, <2 x double>* %51
%52 = fmul double %7, 0x3FEAAAAAAAAAAAAB
%53 = getelementptr inbounds double, double* %1, i64 16
%54 = bitcast double* %53 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = insertelement <2 x double> <double 0x3FF1C71C71C71C72, double poison>, double %52, i64 1
%57 = fmul <2 x double> %56, %55
%58 = bitcast double* %53 to <2 x double>*
store <2 x double> %57, <2 x double>* %58
%59 = getelementptr inbounds double, double* %1, i64 18
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = fmul <2 x double> %56, %61
%63 = bitcast double* %59 to <2 x double>*
store <2 x double> %62, <2 x double>* %63
%64 = getelementptr inbounds double, double* %1, i64 20
%65 = bitcast double* %64 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = fmul <2 x double> %56, %66
%68 = bitcast double* %64 to <2 x double>*
store <2 x double> %67, <2 x double>* %68
br label %69
69: ; preds = %16, %3, %36
ret void
}