void qd_mul_pwr2(const double *a, double b, double *c) {
  c[0] = a[0] * b;
  c[1] = a[1] * b;
  c[2] = a[2] * b;
  c[3] = a[3] * b;
}


x86 assembly (clang, -O0):
<qd_mul_pwr2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_mul_pwr2>:
movsd  (%rdi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
movsd  0x8(%rdi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsi)
movsd  0x10(%rdi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsi)
mulsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x18(%rsi)
ret

LLVM IR (-O0):
define void @qd_mul_pwr2(double* %0, double %1, double* %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double*
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
%7 = load double*, double** %4
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = load double*, double** %6
%13 = getelementptr inbounds double, double* %12, i64 0
store double %11, double* %13
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = load double, double* %5
%18 = fmul double %16, %17
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 1
store double %18, double* %20
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 2
%23 = load double, double* %22
%24 = load double, double* %5
%25 = fmul double %23, %24
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 2
store double %25, double* %27
%28 = load double*, double** %4
%29 = getelementptr inbounds double, double* %28, i64 3
%30 = load double, double* %29
%31 = load double, double* %5
%32 = fmul double %30, %31
%33 = load double*, double** %6
%34 = getelementptr inbounds double, double* %33, i64 3
store double %32, double* %34
ret void
}

LLVM IR (-O2):
define void @qd_mul_pwr2(double* nocapture %0, double %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = fmul double %4, %1
store double %5, double* %2
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = fmul double %7, %1
%9 = getelementptr inbounds double, double* %2, i64 1
store double %8, double* %9
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = fmul double %11, %1
%13 = getelementptr inbounds double, double* %2, i64 2
store double %12, double* %13
%14 = getelementptr inbounds double, double* %0, i64 3
%15 = load double, double* %14
%16 = fmul double %15, %1
%17 = getelementptr inbounds double, double* %2, i64 3
store double %16, double* %17
ret void
}