int rgbD_interpolate(double z, const double aD[3], const double bD[3],
                     double cD[3]) {
  int i, err = 0;
  for (i = 0; i < 3; i++)
    err |= double_interpolate(z, aD[i], bD[i], cD + i);
  return err;
}


x86 assembly (clang, -O0):
<rgbD_interpolate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    118a <rgbD_interpolate+0x7a>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    $0x3,%al
call   1030 <double_interpolate@plt>
or     -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1137 <rgbD_interpolate+0x27>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgbD_interpolate>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm0,0x8(%rsp)
movsd  (%rdi),%xmm1
movsd  (%rsi),%xmm2
mov    %rdx,%rdi
mov    $0x3,%al
call   1030 <double_interpolate@plt>
mov    %eax,%r12d
movsd  0x8(%r15),%xmm1
movsd  0x8(%r14),%xmm2
lea    0x8(%rbx),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x3,%al
call   1030 <double_interpolate@plt>
mov    %eax,%ebp
or     %r12d,%ebp
movsd  0x10(%r15),%xmm1
movsd  0x10(%r14),%xmm2
add    $0x10,%rbx
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x3,%al
call   1030 <double_interpolate@plt>
or     %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rgbD_interpolate(double %0, double* %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
store double %0, double* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
store i32 0, i32* %10
store i32 0, i32* %9
br label %11
11: ; preds = %33, %4
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %36
14: ; preds = %11
%15 = load double, double* %5
%16 = load double*, double** %6
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double*, double** %8
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @double_interpolate to i32 (double, double, double, double*, ...)*)(double %15, double %20, double %25, double* %29)
%31 = load i32, i32* %10
%32 = or i32 %31, %30
store i32 %32, i32* %10
br label %33
33: ; preds = %14
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %11
36: ; preds = %11
%37 = load i32, i32* %10
ret i32 %37
}

LLVM IR (-O2):
define i32 @rgbD_interpolate(double %0, double* nocapture %1, double* nocapture %2, double* %3) {
%5 = load double, double* %1
%6 = load double, double* %2
%7 = tail call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @double_interpolate to i32 (double, double, double, double*, ...)*)(double %0, double %5, double %6, double* %3)
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %2, i64 1
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %3, i64 1
%13 = tail call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @double_interpolate to i32 (double, double, double, double*, ...)*)(double %0, double %9, double %11, double* %12)
%14 = or i32 %13, %7
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %2, i64 2
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %3, i64 2
%20 = tail call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @double_interpolate to i32 (double, double, double, double*, ...)*)(double %0, double %16, double %18, double* %19)
%21 = or i32 %20, %14
ret i32 %21
}