void dddsp_adjust_iir_gain_double(double a[], int poles, double gain) {
  int i;
  for (i = 0; i <= poles; i++)
    *a++ *= gain;
}


x86 assembly (clang, -O0):
<dddsp_adjust_iir_gain_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     114d <dddsp_adjust_iir_gain_double+0x4d>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <dddsp_adjust_iir_gain_double+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dddsp_adjust_iir_gain_double>:
test   %esi,%esi
js     11e6 <dddsp_adjust_iir_gain_double+0xe6>
xor    %r9d,%r9d
cmp    $0x3,%esi
jb     11c3 <dddsp_adjust_iir_gain_double+0xc3>
mov    %esi,%r8d
add    $0x1,%r8
mov    %r8,%r9
and    $0xfffffffffffffffc,%r9
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%r9),%rcx
mov    %rcx,%rax
shr    $0x2,%rax
add    $0x1,%rax
test   %rcx,%rcx
je     11e7 <dddsp_adjust_iir_gain_double+0xe7>
mov    %rax,%rcx
and    $0xfffffffffffffffe,%rcx
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movupd (%rdi,%rdx,8),%xmm2
movupd 0x10(%rdi,%rdx,8),%xmm3
movupd 0x20(%rdi,%rdx,8),%xmm4
movupd 0x30(%rdi,%rdx,8),%xmm5
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rdi,%rdx,8)
movupd %xmm3,0x10(%rdi,%rdx,8)
mulpd  %xmm1,%xmm4
mulpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rdi,%rdx,8)
movupd %xmm5,0x30(%rdi,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rcx
jne    1150 <dddsp_adjust_iir_gain_double+0x50>
test   $0x1,%al
je     11ba <dddsp_adjust_iir_gain_double+0xba>
movupd (%rdi,%rdx,8),%xmm2
movupd 0x10(%rdi,%rdx,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rdi,%rdx,8)
movupd %xmm3,0x10(%rdi,%rdx,8)
cmp    %r9,%r8
je     11e6 <dddsp_adjust_iir_gain_double+0xe6>
lea    (%rdi,%r9,8),%rdi
sub    %r9d,%esi
add    $0x1,%esi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movsd  (%rdi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
add    $0x1,%rax
cmp    %eax,%esi
jne    11d0 <dddsp_adjust_iir_gain_double+0xd0>
ret
xor    %edx,%edx
test   $0x1,%al
jne    119c <dddsp_adjust_iir_gain_double+0x9c>
jmp    11ba <dddsp_adjust_iir_gain_double+0xba>

LLVM IR (-O0):
define void @dddsp_adjust_iir_gain_double(double* %0, i32 %1, double %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store double %2, double* %6
store i32 0, i32* %7
br label %8
8: ; preds = %18, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load double, double* %6
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i32 1
store double* %15, double** %4
%16 = load double, double* %14
%17 = fmul double %16, %13
store double %17, double* %14
br label %18
18: ; preds = %12
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %8
21: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @dddsp_adjust_iir_gain_double(double* nocapture %0, i32 %1, double %2) {
%4 = icmp slt i32 %1, 0
br i1 %4, label %78, label %5
5: ; preds = %3
%6 = zext i32 %1 to i64
%7 = add nuw nsw i64 %6, 1
%8 = icmp ult i32 %1, 3
br i1 %8, label %67, label %9
9: ; preds = %5
%10 = and i64 %7, 8589934588
%11 = trunc i64 %10 to i32
%12 = getelementptr double, double* %0, i64 %10
%13 = insertelement <2 x double> poison, double %2, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = insertelement <2 x double> poison, double %2, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = add nsw i64 %10, -4
%18 = lshr exact i64 %17, 2
%19 = add nuw nsw i64 %18, 1
%20 = and i64 %19, 1
%21 = icmp eq i64 %17, 0
br i1 %21, label %51, label %22
22: ; preds = %9
%23 = and i64 %19, 9223372036854775806
br label %24
24: ; preds = %24, %22
%25 = phi i64 [ 0, %22 ], [ %48, %24 ]
%26 = phi i64 [ 0, %22 ], [ %49, %24 ]
%27 = getelementptr double, double* %0, i64 %25
%28 = bitcast double* %27 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = getelementptr double, double* %27, i64 2
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = fmul <2 x double> %29, %14
%34 = fmul <2 x double> %32, %16
%35 = bitcast double* %27 to <2 x double>*
store <2 x double> %33, <2 x double>* %35
%36 = bitcast double* %30 to <2 x double>*
store <2 x double> %34, <2 x double>* %36
%37 = or i64 %25, 4
%38 = getelementptr double, double* %0, i64 %37
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = getelementptr double, double* %38, i64 2
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = fmul <2 x double> %40, %14
%45 = fmul <2 x double> %43, %16
%46 = bitcast double* %38 to <2 x double>*
store <2 x double> %44, <2 x double>* %46
%47 = bitcast double* %41 to <2 x double>*
store <2 x double> %45, <2 x double>* %47
%48 = add nuw i64 %25, 8
%49 = add i64 %26, 2
%50 = icmp eq i64 %49, %23
br i1 %50, label %51, label %24
51: ; preds = %24, %9
%52 = phi i64 [ 0, %9 ], [ %48, %24 ]
%53 = icmp eq i64 %20, 0
br i1 %53, label %65, label %54
54: ; preds = %51
%55 = getelementptr double, double* %0, i64 %52
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = getelementptr double, double* %55, i64 2
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = fmul <2 x double> %57, %14
%62 = fmul <2 x double> %60, %16
%63 = bitcast double* %55 to <2 x double>*
store <2 x double> %61, <2 x double>* %63
%64 = bitcast double* %58 to <2 x double>*
store <2 x double> %62, <2 x double>* %64
br label %65
65: ; preds = %51, %54
%66 = icmp eq i64 %7, %10
br i1 %66, label %78, label %67
67: ; preds = %5, %65
%68 = phi i32 [ 0, %5 ], [ %11, %65 ]
%69 = phi double* [ %0, %5 ], [ %12, %65 ]
br label %70
70: ; preds = %67, %70
%71 = phi i32 [ %76, %70 ], [ %68, %67 ]
%72 = phi double* [ %73, %70 ], [ %69, %67 ]
%73 = getelementptr inbounds double, double* %72, i64 1
%74 = load double, double* %72
%75 = fmul double %74, %2
store double %75, double* %72
%76 = add nuw i32 %71, 1
%77 = icmp eq i32 %71, %1
br i1 %77, label %78, label %70
78: ; preds = %70, %65, %3
ret void
}