void scalars_nonewald(int version, double r, double *scalar) {
  int i;
  for (i = 0; i < 11; i++)
    scalar[i] = 0.0;
  double r2;
  r2 = r * r;
  scalar[0] = (1.5 - 1.0 / r2) / r;
  scalar[1] = (0.75 + 0.5 / r2) / r;
  if (version == 0)
    return;
  scalar[2] = -0.75 / r2;
  scalar[3] = +0.75 / r2 / r;
  scalar[4] = -0.375 / r2 / r;
  if (version == 1)
    return;
  scalar[5] = (2.25 - 3.6 / r2) / r2;
  scalar[6] = 1.2 / r2 / r2;
  scalar[7] = -1.125 / r2 / r;
  scalar[8] = (-4.5 + 10.8 / r2) / r2 / r;
  scalar[9] = (+2.25 - 7.2 / r2) / r2 / r;
  scalar[10] = +1.8 / r2 / r2 / r;
}


x86 assembly (clang, -O0):
<scalars_nonewald>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xb,-0x1c(%rbp)
jge    113f <scalars_nonewald+0x3f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <scalars_nonewald+0x17>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xec2(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0xead(%rip),%xmm0
subsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe8c(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0xe77(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
cmpl   $0x0,-0x4(%rbp)
jne    11aa <scalars_nonewald+0xaa>
jmp    12da <scalars_nonewald+0x1da>
movsd  0xe76(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  0xe38(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  0xe3d(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x20(%rax)
cmpl   $0x1,-0x4(%rbp)
jne    1205 <scalars_nonewald+0x105>
jmp    12da <scalars_nonewald+0x1da>
movsd  0xe5b(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0xe1e(%rip),%xmm0
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  0xe2c(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  0xe09(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  0xde6(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0xdd1(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x40(%rax)
movsd  0xdaa(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0xd95(%rip),%xmm0
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x48(%rax)
movsd  0xd6e(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x50(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalars_nonewald>:
xorps  %xmm1,%xmm1
movups %xmm1,0x40(%rsi)
movups %xmm1,0x30(%rsi)
movups %xmm1,0x20(%rsi)
movups %xmm1,0x10(%rsi)
movq   $0x0,0x50(%rsi)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
unpcklpd %xmm1,%xmm2
movapd 0xecd(%rip),%xmm4
divpd  %xmm2,%xmm4
movsd  0xf21(%rip),%xmm3
subpd  %xmm4,%xmm3
addpd  0xec5(%rip),%xmm4
movsd  %xmm3,%xmm4
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
divpd  %xmm3,%xmm4
movupd %xmm4,(%rsi)
test   %edi,%edi
je     122e <scalars_nonewald+0x12e>
movsd  0xef9(%rip),%xmm4
divsd  %xmm1,%xmm4
movapd 0xea5(%rip),%xmm5
unpcklpd %xmm4,%xmm5
movapd %xmm1,%xmm4
unpcklpd %xmm0,%xmm4
divpd  %xmm4,%xmm5
movupd %xmm5,0x10(%rsi)
movsd  0xed8(%rip),%xmm5
divsd  %xmm1,%xmm5
divsd  %xmm0,%xmm5
movsd  %xmm5,0x20(%rsi)
cmp    $0x1,%edi
je     122e <scalars_nonewald+0x12e>
movsd  0xec2(%rip),%xmm5
divsd  %xmm1,%xmm5
addsd  0xebe(%rip),%xmm5
divsd  %xmm1,%xmm5
movsd  %xmm5,0x28(%rsi)
movapd 0xe5d(%rip),%xmm5
divpd  %xmm2,%xmm5
divpd  %xmm4,%xmm5
movupd %xmm5,0x30(%rsi)
movapd 0xe58(%rip),%xmm4
divpd  %xmm2,%xmm4
movsd  0xe94(%rip),%xmm5
addpd  %xmm4,%xmm5
movapd 0xe50(%rip),%xmm6
subpd  %xmm4,%xmm6
movsd  %xmm5,%xmm6
divpd  %xmm2,%xmm6
divpd  %xmm3,%xmm6
movupd %xmm6,0x40(%rsi)
movsd  0xe73(%rip),%xmm2
divsd  %xmm1,%xmm2
divsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x50(%rsi)
ret

LLVM IR (-O0):
define void @scalars_nonewald(i32 %0, double %1, double* %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
store double* %2, double** %6
store i32 0, i32* %7
br label %9
9: ; preds = %17, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 11
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load double*, double** %6
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
store double 0.000000e+00, double* %16
br label %17
17: ; preds = %12
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %9
20: ; preds = %9
%21 = load double, double* %5
%22 = load double, double* %5
%23 = fmul double %21, %22
store double %23, double* %8
%24 = load double, double* %8
%25 = fdiv double 1.000000e+00, %24
%26 = fsub double 1.500000e+00, %25
%27 = load double, double* %5
%28 = fdiv double %26, %27
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 0
store double %28, double* %30
%31 = load double, double* %8
%32 = fdiv double 5.000000e-01, %31
%33 = fadd double 7.500000e-01, %32
%34 = load double, double* %5
%35 = fdiv double %33, %34
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i64 1
store double %35, double* %37
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %20
br label %107
41: ; preds = %20
%42 = load double, double* %8
%43 = fdiv double -7.500000e-01, %42
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 2
store double %43, double* %45
%46 = load double, double* %8
%47 = fdiv double 7.500000e-01, %46
%48 = load double, double* %5
%49 = fdiv double %47, %48
%50 = load double*, double** %6
%51 = getelementptr inbounds double, double* %50, i64 3
store double %49, double* %51
%52 = load double, double* %8
%53 = fdiv double -3.750000e-01, %52
%54 = load double, double* %5
%55 = fdiv double %53, %54
%56 = load double*, double** %6
%57 = getelementptr inbounds double, double* %56, i64 4
store double %55, double* %57
%58 = load i32, i32* %4
%59 = icmp eq i32 %58, 1
br i1 %59, label %60, label %61
60: ; preds = %41
br label %107
61: ; preds = %41
%62 = load double, double* %8
%63 = fdiv double 3.600000e+00, %62
%64 = fsub double 2.250000e+00, %63
%65 = load double, double* %8
%66 = fdiv double %64, %65
%67 = load double*, double** %6
%68 = getelementptr inbounds double, double* %67, i64 5
store double %66, double* %68
%69 = load double, double* %8
%70 = fdiv double 1.200000e+00, %69
%71 = load double, double* %8
%72 = fdiv double %70, %71
%73 = load double*, double** %6
%74 = getelementptr inbounds double, double* %73, i64 6
store double %72, double* %74
%75 = load double, double* %8
%76 = fdiv double -1.125000e+00, %75
%77 = load double, double* %5
%78 = fdiv double %76, %77
%79 = load double*, double** %6
%80 = getelementptr inbounds double, double* %79, i64 7
store double %78, double* %80
%81 = load double, double* %8
%82 = fdiv double 1.080000e+01, %81
%83 = fadd double -4.500000e+00, %82
%84 = load double, double* %8
%85 = fdiv double %83, %84
%86 = load double, double* %5
%87 = fdiv double %85, %86
%88 = load double*, double** %6
%89 = getelementptr inbounds double, double* %88, i64 8
store double %87, double* %89
%90 = load double, double* %8
%91 = fdiv double 7.200000e+00, %90
%92 = fsub double 2.250000e+00, %91
%93 = load double, double* %8
%94 = fdiv double %92, %93
%95 = load double, double* %5
%96 = fdiv double %94, %95
%97 = load double*, double** %6
%98 = getelementptr inbounds double, double* %97, i64 9
store double %96, double* %98
%99 = load double, double* %8
%100 = fdiv double 1.800000e+00, %99
%101 = load double, double* %8
%102 = fdiv double %100, %101
%103 = load double, double* %5
%104 = fdiv double %102, %103
%105 = load double*, double** %6
%106 = getelementptr inbounds double, double* %105, i64 10
store double %104, double* %106
br label %107
107: ; preds = %61, %60, %40
ret void
}

LLVM IR (-O2):
define void @scalars_nonewald(i32 %0, double %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds double, double* %2, i64 2
%5 = bitcast double* %4 to i8*
%6 = fmul double %1, %1
%7 = insertelement <2 x double> poison, double %6, i64 0
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%9 = fdiv <2 x double> <double 1.000000e+00, double 5.000000e-01>, %8
%10 = fsub <2 x double> <double 1.500000e+00, double poison>, %9
%11 = fadd <2 x double> %9, <double poison, double 7.500000e-01>
%12 = shufflevector <2 x double> %10, <2 x double> %11, <2 x i32> <i32 0, i32 3>
%13 = insertelement <2 x double> poison, double %1, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = fdiv <2 x double> %12, %14
%16 = bitcast double* %2 to <2 x double>*
store <2 x double> %15, <2 x double>* %16
%17 = icmp eq i32 %0, 0
br i1 %17, label %51, label %18
18: ; preds = %3
%19 = getelementptr inbounds double, double* %2, i64 2
%20 = fdiv double 7.500000e-01, %6
%21 = insertelement <2 x double> <double -7.500000e-01, double poison>, double %20, i64 1
%22 = insertelement <2 x double> poison, double %1, i64 1
%23 = insertelement <2 x double> %22, double %6, i64 0
%24 = fdiv <2 x double> %21, %23
%25 = bitcast double* %19 to <2 x double>*
store <2 x double> %24, <2 x double>* %25
%26 = fdiv double -3.750000e-01, %6
%27 = fdiv double %26, %1
%28 = getelementptr inbounds double, double* %2, i64 4
store double %27, double* %28
%29 = icmp eq i32 %0, 1
br i1 %29, label %51, label %30
30: ; preds = %18
%31 = fdiv double 3.600000e+00, %6
%32 = fsub double 2.250000e+00, %31
%33 = fdiv double %32, %6
%34 = getelementptr inbounds double, double* %2, i64 5
store double %33, double* %34
%35 = getelementptr inbounds double, double* %2, i64 6
%36 = fdiv <2 x double> <double 1.200000e+00, double -1.125000e+00>, %8
%37 = fdiv <2 x double> %36, %23
%38 = bitcast double* %35 to <2 x double>*
store <2 x double> %37, <2 x double>* %38
%39 = getelementptr inbounds double, double* %2, i64 8
%40 = fdiv <2 x double> <double 1.080000e+01, double 7.200000e+00>, %8
%41 = fadd <2 x double> %40, <double -4.500000e+00, double poison>
%42 = fsub <2 x double> <double poison, double 2.250000e+00>, %40
%43 = shufflevector <2 x double> %41, <2 x double> %42, <2 x i32> <i32 0, i32 3>
%44 = fdiv <2 x double> %43, %8
%45 = fdiv <2 x double> %44, %14
%46 = bitcast double* %39 to <2 x double>*
store <2 x double> %45, <2 x double>* %46
%47 = fdiv double 1.800000e+00, %6
%48 = fdiv double %47, %6
%49 = fdiv double %48, %1
%50 = getelementptr inbounds double, double* %2, i64 10
store double %49, double* %50
br label %51
51: ; preds = %18, %3, %30
ret void
}