void scalars_mob_poly_scale_SD(int version, double a1, double *scalar) {
  scalar[0] *= a1;
  scalar[1] *= a1;
  if (version == 0)
    return;
  double a12 = a1 * a1;
  double a13 = a12 * a1;
  scalar[2] *= a12;
  scalar[3] *= a13;
  scalar[4] *= a13;
  if (version == 1)
    return;
  scalar[5] *= a12;
  scalar[6] *= a12;
  scalar[7] *= a13;
  scalar[8] *= a13;
  scalar[9] *= a13;
  scalar[10] *= a13;
}


x86 assembly (clang, -O0):
<scalars_mob_poly_scale_SD>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
cmpl   $0x0,-0x4(%rbp)
jne    1143 <scalars_mob_poly_scale_SD+0x43>
jmp    121b <scalars_mob_poly_scale_SD+0x11b>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x20(%rax),%xmm0
movsd  %xmm0,0x20(%rax)
cmpl   $0x1,-0x4(%rbp)
jne    11a9 <scalars_mob_poly_scale_SD+0xa9>
jmp    121b <scalars_mob_poly_scale_SD+0x11b>
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x28(%rax),%xmm0
movsd  %xmm0,0x28(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x30(%rax),%xmm0
movsd  %xmm0,0x30(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x38(%rax),%xmm0
movsd  %xmm0,0x38(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x40(%rax),%xmm0
movsd  %xmm0,0x40(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x48(%rax),%xmm0
movsd  %xmm0,0x48(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x50(%rax),%xmm0
movsd  %xmm0,0x50(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalars_mob_poly_scale_SD>:
movupd (%rsi),%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movupd %xmm2,(%rsi)
test   %edi,%edi
je     117f <scalars_mob_poly_scale_SD+0x7f>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
movupd 0x10(%rsi),%xmm2
movapd %xmm1,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm2,%xmm3
movupd %xmm3,0x10(%rsi)
movsd  0x20(%rsi),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x20(%rsi)
cmp    $0x1,%edi
je     117f <scalars_mob_poly_scale_SD+0x7f>
unpcklpd %xmm1,%xmm1
movupd 0x28(%rsi),%xmm2
mulpd  %xmm1,%xmm2
movupd 0x38(%rsi),%xmm1
movupd 0x48(%rsi),%xmm3
movupd %xmm2,0x28(%rsi)
unpcklpd %xmm0,%xmm0
mulpd  %xmm0,%xmm1
movupd %xmm1,0x38(%rsi)
mulpd  %xmm3,%xmm0
movupd %xmm0,0x48(%rsi)
ret

LLVM IR (-O0):
define void @scalars_mob_poly_scale_SD(i32 %0, double %1, double* %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double*
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
store double* %2, double** %6
%9 = load double, double* %5
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fmul double %12, %9
store double %13, double* %11
%14 = load double, double* %5
%15 = load double*, double** %6
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = fmul double %17, %14
store double %18, double* %16
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %3
br label %78
22: ; preds = %3
%23 = load double, double* %5
%24 = load double, double* %5
%25 = fmul double %23, %24
store double %25, double* %7
%26 = load double, double* %7
%27 = load double, double* %5
%28 = fmul double %26, %27
store double %28, double* %8
%29 = load double, double* %7
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 2
%32 = load double, double* %31
%33 = fmul double %32, %29
store double %33, double* %31
%34 = load double, double* %8
%35 = load double*, double** %6
%36 = getelementptr inbounds double, double* %35, i64 3
%37 = load double, double* %36
%38 = fmul double %37, %34
store double %38, double* %36
%39 = load double, double* %8
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i64 4
%42 = load double, double* %41
%43 = fmul double %42, %39
store double %43, double* %41
%44 = load i32, i32* %4
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %22
br label %78
47: ; preds = %22
%48 = load double, double* %7
%49 = load double*, double** %6
%50 = getelementptr inbounds double, double* %49, i64 5
%51 = load double, double* %50
%52 = fmul double %51, %48
store double %52, double* %50
%53 = load double, double* %7
%54 = load double*, double** %6
%55 = getelementptr inbounds double, double* %54, i64 6
%56 = load double, double* %55
%57 = fmul double %56, %53
store double %57, double* %55
%58 = load double, double* %8
%59 = load double*, double** %6
%60 = getelementptr inbounds double, double* %59, i64 7
%61 = load double, double* %60
%62 = fmul double %61, %58
store double %62, double* %60
%63 = load double, double* %8
%64 = load double*, double** %6
%65 = getelementptr inbounds double, double* %64, i64 8
%66 = load double, double* %65
%67 = fmul double %66, %63
store double %67, double* %65
%68 = load double, double* %8
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 9
%71 = load double, double* %70
%72 = fmul double %71, %68
store double %72, double* %70
%73 = load double, double* %8
%74 = load double*, double** %6
%75 = getelementptr inbounds double, double* %74, i64 10
%76 = load double, double* %75
%77 = fmul double %76, %73
store double %77, double* %75
br label %78
78: ; preds = %47, %46, %21
ret void
}

LLVM IR (-O2):
define void @scalars_mob_poly_scale_SD(i32 %0, double %1, double* nocapture %2) {
%4 = bitcast double* %2 to <2 x double>*
%5 = load <2 x double>, <2 x double>* %4
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = fmul <2 x double> %5, %7
%9 = bitcast double* %2 to <2 x double>*
store <2 x double> %8, <2 x double>* %9
%10 = icmp eq i32 %0, 0
br i1 %10, label %44, label %11
11: ; preds = %3
%12 = fmul double %1, %1
%13 = fmul double %12, %1
%14 = getelementptr inbounds double, double* %2, i64 2
%15 = bitcast double* %14 to <2 x double>*
%16 = load <2 x double>, <2 x double>* %15
%17 = insertelement <2 x double> poison, double %12, i64 0
%18 = insertelement <2 x double> %17, double %13, i64 1
%19 = fmul <2 x double> %18, %16
%20 = bitcast double* %14 to <2 x double>*
store <2 x double> %19, <2 x double>* %20
%21 = getelementptr inbounds double, double* %2, i64 4
%22 = load double, double* %21
%23 = fmul double %13, %22
store double %23, double* %21
%24 = icmp eq i32 %0, 1
br i1 %24, label %44, label %25
25: ; preds = %11
%26 = getelementptr inbounds double, double* %2, i64 5
%27 = bitcast double* %26 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%30 = fmul <2 x double> %29, %28
%31 = bitcast double* %26 to <2 x double>*
store <2 x double> %30, <2 x double>* %31
%32 = getelementptr inbounds double, double* %2, i64 7
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = insertelement <2 x double> poison, double %13, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = fmul <2 x double> %36, %34
%38 = bitcast double* %32 to <2 x double>*
store <2 x double> %37, <2 x double>* %38
%39 = getelementptr inbounds double, double* %2, i64 9
%40 = bitcast double* %39 to <2 x double>*
%41 = load <2 x double>, <2 x double>* %40
%42 = fmul <2 x double> %36, %41
%43 = bitcast double* %39 to <2 x double>*
store <2 x double> %42, <2 x double>* %43
br label %44
44: ; preds = %25, %11, %3
ret void
}