void dspl_conv_mix_krn(double *aR, double *aI, int na, double *b, int nb,
                       double *cR, double *cI) {
  int k;
  int n;
  for (k = 0; k < na; k++) {
    for (n = 0; n < nb; n++) {
      cR[k + n] += aR[k] * b[n];
      cI[k + n] += aI[k] * b[n];
    }
  }
}


x86 assembly (clang, -O0):
<dspl_conv_mix_krn>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d8 <dspl_conv_mix_krn+0xd8>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11c5 <dspl_conv_mix_krn+0xc5>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1139 <dspl_conv_mix_krn+0x39>
jmp    11ca <dspl_conv_mix_krn+0xca>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1126 <dspl_conv_mix_krn+0x26>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dspl_conv_mix_krn>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,-0x10(%rsp)
test   %edx,%edx
jle    1338 <dspl_conv_mix_krn+0x238>
mov    0x38(%rsp),%rax
mov    %edx,%ebp
mov    %r8d,%r12d
lea    (%rcx,%r12,8),%rdx
mov    %rdx,-0x8(%rsp)
mov    %r12d,%r15d
and    $0xfffffffe,%r15d
xor    %r13d,%r13d
mov    -0x10(%rsp),%rbx
mov    %r8d,-0x24(%rsp)
mov    %rbp,-0x20(%rsp)
jmp    1165 <dspl_conv_mix_krn+0x65>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r13
add    $0x8,%rax
add    $0x8,%rbx
cmp    %rbp,%r13
je     1338 <dspl_conv_mix_krn+0x238>
test   %r8d,%r8d
jle    1150 <dspl_conv_mix_krn+0x50>
cmp    $0x1,%r8d
jne    1180 <dspl_conv_mix_krn+0x80>
xor    %edx,%edx
jmp    1300 <dspl_conv_mix_krn+0x200>
nopw   0x0(%rax,%rax,1)
lea    (%r12,%r13,1),%r10
mov    -0x10(%rsp),%rdx
lea    (%rdx,%r13,8),%rbp
lea    (%rdx,%r10,8),%r8
mov    0x38(%rsp),%rdx
lea    (%rdx,%r13,8),%r9
lea    (%rdx,%r10,8),%rdx
lea    (%rdi,%r13,8),%r10
mov    %r10,-0x18(%rsp)
lea    (%rdi,%r13,8),%r14
add    $0x8,%r14
cmp    %rdx,%rbp
setb   -0x25(%rsp)
cmp    %r8,%r9
setb   -0x26(%rsp)
cmp    %r14,%rbp
setb   -0x27(%rsp)
cmp    %r8,%r10
setb   -0x28(%rsp)
mov    -0x8(%rsp),%r10
cmp    %r10,%rbp
setb   -0x29(%rsp)
cmp    %rcx,%r8
seta   -0x2a(%rsp)
lea    (%rsi,%r13,8),%r11
add    $0x8,%r11
cmp    %r11,%rbp
lea    (%rsi,%r13,8),%rbp
setb   -0x2b(%rsp)
cmp    %r8,%rbp
setb   -0x2c(%rsp)
cmp    %r14,%r9
setb   %r8b
cmp    %rdx,-0x18(%rsp)
setb   -0x18(%rsp)
cmp    %r10,%r9
setb   %r14b
cmp    %rcx,%rdx
seta   -0x2d(%rsp)
cmp    %r11,%r9
setb   %r9b
cmp    %rdx,%rbp
setb   %r10b
mov    -0x26(%rsp),%dl
test   %dl,-0x25(%rsp)
jne    12e4 <dspl_conv_mix_krn+0x1e4>
mov    -0x28(%rsp),%dl
and    %dl,-0x27(%rsp)
jne    12e4 <dspl_conv_mix_krn+0x1e4>
mov    -0x2a(%rsp),%dl
and    %dl,-0x29(%rsp)
jne    12e4 <dspl_conv_mix_krn+0x1e4>
mov    -0x2c(%rsp),%dl
and    %dl,-0x2b(%rsp)
jne    12e4 <dspl_conv_mix_krn+0x1e4>
and    -0x18(%rsp),%r8b
jne    12e4 <dspl_conv_mix_krn+0x1e4>
and    -0x2d(%rsp),%r14b
mov    -0x24(%rsp),%r8d
jne    12f2 <dspl_conv_mix_krn+0x1f2>
mov    $0x0,%edx
and    %r10b,%r9b
mov    -0x20(%rsp),%rbp
jne    1300 <dspl_conv_mix_krn+0x200>
movsd  (%rdi,%r13,8),%xmm0
unpcklpd %xmm0,%xmm0
movsd  (%rsi,%r13,8),%xmm1
unpcklpd %xmm1,%xmm1
xor    %edx,%edx
xchg   %ax,%ax
movupd (%rcx,%rdx,8),%xmm2
mulpd  %xmm0,%xmm2
movupd (%rbx,%rdx,8),%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,(%rbx,%rdx,8)
movupd (%rcx,%rdx,8),%xmm2
mulpd  %xmm1,%xmm2
movupd (%rax,%rdx,8),%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,(%rax,%rdx,8)
add    $0x2,%rdx
cmp    %rdx,%r15
jne    12a0 <dspl_conv_mix_krn+0x1a0>
mov    %r15,%rdx
cmp    %r12,%r15
jne    1300 <dspl_conv_mix_krn+0x200>
jmp    1150 <dspl_conv_mix_krn+0x50>
xor    %edx,%edx
mov    -0x24(%rsp),%r8d
mov    -0x20(%rsp),%rbp
jmp    1300 <dspl_conv_mix_krn+0x200>
xor    %edx,%edx
mov    -0x20(%rsp),%rbp
nopl   0x0(%rax)
movsd  (%rdi,%r13,8),%xmm0
mulsd  (%rcx,%rdx,8),%xmm0
addsd  (%rbx,%rdx,8),%xmm0
movsd  %xmm0,(%rbx,%rdx,8)
movsd  (%rsi,%r13,8),%xmm0
mulsd  (%rcx,%rdx,8),%xmm0
addsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%r12
jne    1300 <dspl_conv_mix_krn+0x200>
jmp    1150 <dspl_conv_mix_krn+0x50>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @dspl_conv_mix_krn(double* nocapture %0, double* nocapture %1, i32 %2, double* nocapture %3, i32 %4, double* nocapture %5, double* nocapture %6) {
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %109
9: ; preds = %7
%10 = icmp sgt i32 %4, 0
%11 = zext i32 %2 to i64
%12 = zext i32 %4 to i64
%13 = getelementptr double, double* %3, i64 %12
%14 = icmp eq i32 %4, 1
%15 = and i64 %12, 4294967294
%16 = icmp eq i64 %15, %12
br label %17
17: ; preds = %9, %106
%18 = phi i64 [ 0, %9 ], [ %107, %106 ]
%19 = getelementptr double, double* %5, i64 %18
%20 = add nuw i64 %18, %12
%21 = getelementptr double, double* %5, i64 %20
%22 = getelementptr double, double* %6, i64 %18
%23 = getelementptr double, double* %6, i64 %20
%24 = getelementptr double, double* %0, i64 %18
%25 = add nuw i64 %18, 1
%26 = getelementptr double, double* %0, i64 %25
%27 = getelementptr double, double* %1, i64 %18
%28 = getelementptr double, double* %1, i64 %25
br i1 %10, label %29, label %106
29: ; preds = %17
%30 = getelementptr inbounds double, double* %0, i64 %18
%31 = getelementptr inbounds double, double* %1, i64 %18
br i1 %14, label %88, label %32
32: ; preds = %29
%33 = icmp ult double* %19, %23
%34 = icmp ult double* %22, %21
%35 = and i1 %33, %34
%36 = icmp ult double* %19, %26
%37 = icmp ult double* %24, %21
%38 = and i1 %36, %37
%39 = or i1 %35, %38
%40 = icmp ult double* %19, %13
%41 = icmp ugt double* %21, %3
%42 = and i1 %40, %41
%43 = or i1 %39, %42
%44 = icmp ult double* %19, %28
%45 = icmp ult double* %27, %21
%46 = and i1 %44, %45
%47 = or i1 %43, %46
%48 = icmp ult double* %22, %26
%49 = icmp ult double* %24, %23
%50 = and i1 %48, %49
%51 = or i1 %47, %50
%52 = icmp ult double* %22, %13
%53 = icmp ugt double* %23, %3
%54 = and i1 %52, %53
%55 = or i1 %51, %54
%56 = icmp ult double* %22, %28
%57 = icmp ult double* %27, %23
%58 = and i1 %56, %57
%59 = or i1 %55, %58
br i1 %59, label %88, label %60
60: ; preds = %32
%61 = load double, double* %30
%62 = insertelement <2 x double> poison, double %61, i64 0
%63 = shufflevector <2 x double> %62, <2 x double> poison, <2 x i32> zeroinitializer
%64 = load double, double* %31
%65 = insertelement <2 x double> poison, double %64, i64 0
%66 = shufflevector <2 x double> %65, <2 x double> poison, <2 x i32> zeroinitializer
br label %67
67: ; preds = %67, %60
%68 = phi i64 [ 0, %60 ], [ %85, %67 ]
%69 = getelementptr inbounds double, double* %3, i64 %68
%70 = bitcast double* %69 to <2 x double>*
%71 = load <2 x double>, <2 x double>* %70
%72 = add nuw nsw i64 %68, %18
%73 = getelementptr inbounds double, double* %5, i64 %72
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %63, <2 x double> %71, <2 x double> %75)
%77 = bitcast double* %73 to <2 x double>*
store <2 x double> %76, <2 x double>* %77
%78 = bitcast double* %69 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %6, i64 %72
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %66, <2 x double> %79, <2 x double> %82)
%84 = bitcast double* %80 to <2 x double>*
store <2 x double> %83, <2 x double>* %84
%85 = add nuw i64 %68, 2
%86 = icmp eq i64 %85, %15
br i1 %86, label %87, label %67
87: ; preds = %67
br i1 %16, label %106, label %88
88: ; preds = %32, %29, %87
%89 = phi i64 [ 0, %32 ], [ 0, %29 ], [ %15, %87 ]
br label %90
90: ; preds = %88, %90
%91 = phi i64 [ %104, %90 ], [ %89, %88 ]
%92 = load double, double* %30
%93 = getelementptr inbounds double, double* %3, i64 %91
%94 = load double, double* %93
%95 = add nuw nsw i64 %91, %18
%96 = getelementptr inbounds double, double* %5, i64 %95
%97 = load double, double* %96
%98 = tail call double @llvm.fmuladd.f64(double %92, double %94, double %97)
store double %98, double* %96
%99 = load double, double* %31
%100 = load double, double* %93
%101 = getelementptr inbounds double, double* %6, i64 %95
%102 = load double, double* %101
%103 = tail call double @llvm.fmuladd.f64(double %99, double %100, double %102)
store double %103, double* %101
%104 = add nuw nsw i64 %91, 1
%105 = icmp eq i64 %104, %12
br i1 %105, label %106, label %90
106: ; preds = %90, %87, %17
%107 = add nuw nsw i64 %18, 1
%108 = icmp eq i64 %107, %11
br i1 %108, label %109, label %17
109: ; preds = %106, %7
ret void
}