void rotateCoefDegree_mem(int L, double *cfR, double *cfI, double *cfrR,
                          double *cfrI, double *expAR, double *expAI,
                          double *expGR, double *expGI, int expZero,
                          double *dmat) {
  int i, j, dim;
  double *expAPtrR, *expAPtrI;
  double *expGPtrR, *expGPtrI;
  double tmpAR, tmpAI, tmpR, tmpI;
  double tmp2R, tmp2I, tmp3R, tmp3I;
  expAPtrR = &expAR[expZero - L];
  expAPtrI = &expAI[expZero - L];
  expGPtrR = &expGR[expZero - L];
  expGPtrI = &expGI[expZero - L];
  dim = 2 * L + 1;
  for (i = 0; i < dim; i++) {
    tmpAR = expAPtrR[i];
    tmpAI = expAPtrI[i];
    tmpR = (double)0;
    tmpI = (double)0;
    for (j = 0; j < dim; j++) {
      tmp2R = dmat[i * dim + j] * expGPtrR[j];
      tmp2I = dmat[i * dim + j] * expGPtrI[j];
      tmp3R = tmp2R * tmpAR - tmp2I * tmpAI;
      tmp3I = tmp2R * tmpAI + tmp2I * tmpAR;
      tmp2R = tmp3R * cfR[j] - tmp3I * cfI[j];
      tmp2I = tmp3R * cfI[j] + tmp3I * cfR[j];
      tmpR += tmp2R;
      tmpI += tmp2I;
    }
    cfrR[i] = tmpR;
    cfrI[i] = tmpI;
  }
}


x86 assembly (clang, -O0):
<rotateCoefDegree_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    0x28(%rbp),%ecx
sub    -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    0x10(%rbp),%rax
mov    0x28(%rbp),%ecx
sub    -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    0x18(%rbp),%rax
mov    0x28(%rbp),%ecx
sub    -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    0x20(%rbp),%rax
mov    0x28(%rbp),%ecx
sub    -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    13a8 <rotateCoefDegree_mem+0x2a8>
mov    -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1376 <rotateCoefDegree_mem+0x276>
mov    0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0xa0(%rbp),%xmm1
ff
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0xa0(%rbp),%xmm1
ff
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11ec <rotateCoefDegree_mem+0xec>
movsd  -0x78(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a5 <rotateCoefDegree_mem+0xa5>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateCoefDegree_mem>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    (%rdi,%rdi,1),%ebp
add    $0x1,%ebp
test   %ebp,%ebp
jle    1213 <rotateCoefDegree_mem+0x113>
mov    0x50(%rsp),%rax
mov    0x48(%rsp),%ebx
sub    %edi,%ebx
movslq %ebx,%r11
lea    (%r9,%r11,8),%r9
shl    $0x3,%r11
mov    0x30(%rsp),%r10
add    %r11,%r10
mov    0x38(%rsp),%r12
add    %r11,%r12
add    0x40(%rsp),%r11
mov    %ebp,%r14d
lea    0x0(,%r14,8),%rbx
xor    %r15d,%r15d
movapd 0xea8(%rip),%xmm8
nopl   0x0(%rax,%rax,1)
movsd  (%r9,%r15,8),%xmm9
movsd  (%r10,%r15,8),%xmm3
xorpd  %xmm1,%xmm1
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rax,%rdi,1),%xmm4
movsd  (%r12,%rdi,1),%xmm5
mulsd  %xmm4,%xmm5
mulsd  (%r11,%rdi,1),%xmm4
movapd %xmm3,%xmm6
mulsd  %xmm4,%xmm6
movapd %xmm5,%xmm7
mulsd  %xmm9,%xmm7
subsd  %xmm6,%xmm7
mulsd  %xmm9,%xmm4
mulsd  %xmm3,%xmm5
addsd  %xmm4,%xmm5
movapd %xmm5,%xmm4
xorpd  %xmm8,%xmm4
movsd  (%rsi,%rdi,1),%xmm6
movsd  (%rdx,%rdi,1),%xmm2
movapd %xmm2,%xmm0
unpcklpd %xmm6,%xmm0
unpcklpd %xmm5,%xmm4
mulpd  %xmm0,%xmm4
unpcklpd %xmm7,%xmm7
unpcklpd %xmm2,%xmm6
mulpd  %xmm7,%xmm6
addpd  %xmm4,%xmm6
addpd  %xmm6,%xmm1
add    $0x8,%rdi
cmp    %rdi,%rbx
jne    1180 <rotateCoefDegree_mem+0x80>
movlpd %xmm1,(%rcx,%r15,8)
movhpd %xmm1,(%r8,%r15,8)
add    $0x1,%r15
add    %rbx,%rax
cmp    %r14,%r15
jne    1160 <rotateCoefDegree_mem+0x60>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rotateCoefDegree_mem(i32 %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8, i32 %9, double* %10) {
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca double*
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca double*
%27 = alloca double*
%28 = alloca double*
%29 = alloca double*
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
store i32 %0, i32* %12
store double* %1, double** %13
store double* %2, double** %14
store double* %3, double** %15
store double* %4, double** %16
store double* %5, double** %17
store double* %6, double** %18
store double* %7, double** %19
store double* %8, double** %20
store i32 %9, i32* %21
store double* %10, double** %22
%38 = load double*, double** %17
%39 = load i32, i32* %21
%40 = load i32, i32* %12
%41 = sub nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %38, i64 %42
store double* %43, double** %26
%44 = load double*, double** %18
%45 = load i32, i32* %21
%46 = load i32, i32* %12
%47 = sub nsw i32 %45, %46
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %44, i64 %48
store double* %49, double** %27
%50 = load double*, double** %19
%51 = load i32, i32* %21
%52 = load i32, i32* %12
%53 = sub nsw i32 %51, %52
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %50, i64 %54
store double* %55, double** %28
%56 = load double*, double** %20
%57 = load i32, i32* %21
%58 = load i32, i32* %12
%59 = sub nsw i32 %57, %58
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %56, i64 %60
store double* %61, double** %29
%62 = load i32, i32* %12
%63 = mul nsw i32 2, %62
%64 = add nsw i32 %63, 1
store i32 %64, i32* %25
store i32 0, i32* %23
br label %65
65: ; preds = %177, %11
%66 = load i32, i32* %23
%67 = load i32, i32* %25
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %180
69: ; preds = %65
%70 = load double*, double** %26
%71 = load i32, i32* %23
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
store double %74, double* %30
%75 = load double*, double** %27
%76 = load i32, i32* %23
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
%79 = load double, double* %78
store double %79, double* %31
store double 0.000000e+00, double* %32
store double 0.000000e+00, double* %33
store i32 0, i32* %24
br label %80
80: ; preds = %163, %69
%81 = load i32, i32* %24
%82 = load i32, i32* %25
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %166
84: ; preds = %80
%85 = load double*, double** %22
%86 = load i32, i32* %23
%87 = load i32, i32* %25
%88 = mul nsw i32 %86, %87
%89 = load i32, i32* %24
%90 = add nsw i32 %88, %89
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %85, i64 %91
%93 = load double, double* %92
%94 = load double*, double** %28
%95 = load i32, i32* %24
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
%98 = load double, double* %97
%99 = fmul double %93, %98
store double %99, double* %34
%100 = load double*, double** %22
%101 = load i32, i32* %23
%102 = load i32, i32* %25
%103 = mul nsw i32 %101, %102
%104 = load i32, i32* %24
%105 = add nsw i32 %103, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %100, i64 %106
%108 = load double, double* %107
%109 = load double*, double** %29
%110 = load i32, i32* %24
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
%113 = load double, double* %112
%114 = fmul double %108, %113
store double %114, double* %35
%115 = load double, double* %34
%116 = load double, double* %30
%117 = load double, double* %35
%118 = load double, double* %31
%119 = fmul double %117, %118
%120 = fneg double %119
%121 = call double @llvm.fmuladd.f64(double %115, double %116, double %120)
store double %121, double* %36
%122 = load double, double* %34
%123 = load double, double* %31
%124 = load double, double* %35
%125 = load double, double* %30
%126 = fmul double %124, %125
%127 = call double @llvm.fmuladd.f64(double %122, double %123, double %126)
store double %127, double* %37
%128 = load double, double* %36
%129 = load double*, double** %13
%130 = load i32, i32* %24
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
%133 = load double, double* %132
%134 = load double, double* %37
%135 = load double*, double** %14
%136 = load i32, i32* %24
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %135, i64 %137
%139 = load double, double* %138
%140 = fmul double %134, %139
%141 = fneg double %140
%142 = call double @llvm.fmuladd.f64(double %128, double %133, double %141)
store double %142, double* %34
%143 = load double, double* %36
%144 = load double*, double** %14
%145 = load i32, i32* %24
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds double, double* %144, i64 %146
%148 = load double, double* %147
%149 = load double, double* %37
%150 = load double*, double** %13
%151 = load i32, i32* %24
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %150, i64 %152
%154 = load double, double* %153
%155 = fmul double %149, %154
%156 = call double @llvm.fmuladd.f64(double %143, double %148, double %155)
store double %156, double* %35
%157 = load double, double* %34
%158 = load double, double* %32
%159 = fadd double %158, %157
store double %159, double* %32
%160 = load double, double* %35
%161 = load double, double* %33
%162 = fadd double %161, %160
store double %162, double* %33
br label %163
163: ; preds = %84
%164 = load i32, i32* %24
%165 = add nsw i32 %164, 1
store i32 %165, i32* %24
br label %80
166: ; preds = %80
%167 = load double, double* %32
%168 = load double*, double** %15
%169 = load i32, i32* %23
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds double, double* %168, i64 %170
store double %167, double* %171
%172 = load double, double* %33
%173 = load double*, double** %16
%174 = load i32, i32* %23
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double, double* %173, i64 %175
store double %172, double* %176
br label %177
177: ; preds = %166
%178 = load i32, i32* %23
%179 = add nsw i32 %178, 1
store i32 %179, i32* %23
br label %65
180: ; preds = %65
ret void
}

LLVM IR (-O2):
define void @rotateCoefDegree_mem(i32 %0, double* nocapture %1, double* nocapture %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture %8, i32 %9, double* nocapture %10) {
%12 = sub nsw i32 %9, %0
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %5, i64 %13
%15 = getelementptr inbounds double, double* %6, i64 %13
%16 = getelementptr inbounds double, double* %7, i64 %13
%17 = getelementptr inbounds double, double* %8, i64 %13
%18 = shl nsw i32 %0, 1
%19 = or i32 %18, 1
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %73
21: ; preds = %11
%22 = zext i32 %19 to i64
%23 = zext i32 %19 to i64
br label %24
24: ; preds = %66, %21
%25 = phi i64 [ 0, %21 ], [ %71, %66 ]
%26 = getelementptr inbounds double, double* %14, i64 %25
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %15, i64 %25
%29 = load double, double* %28
%30 = mul nsw i64 %25, %22
br label %31
31: ; preds = %24, %31
%32 = phi i64 [ 0, %24 ], [ %64, %31 ]
%33 = phi <2 x double> [ zeroinitializer, %24 ], [ %63, %31 ]
%34 = add nuw nsw i64 %32, %30
%35 = getelementptr inbounds double, double* %10, i64 %34
%36 = load double, double* %35
%37 = getelementptr inbounds double, double* %16, i64 %32
%38 = load double, double* %37
%39 = fmul double %36, %38
%40 = getelementptr inbounds double, double* %17, i64 %32
%41 = load double, double* %40
%42 = fmul double %36, %41
%43 = fneg double %42
%44 = fmul double %29, %43
%45 = tail call double @llvm.fmuladd.f64(double %39, double %27, double %44)
%46 = fmul double %27, %42
%47 = tail call double @llvm.fmuladd.f64(double %39, double %29, double %46)
%48 = getelementptr inbounds double, double* %1, i64 %32
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %2, i64 %32
%51 = load double, double* %50
%52 = fneg double %47
%53 = insertelement <2 x double> poison, double %51, i64 0
%54 = insertelement <2 x double> %53, double %49, i64 1
%55 = insertelement <2 x double> poison, double %52, i64 0
%56 = insertelement <2 x double> %55, double %47, i64 1
%57 = fmul <2 x double> %54, %56
%58 = insertelement <2 x double> poison, double %45, i64 0
%59 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> zeroinitializer
%60 = insertelement <2 x double> poison, double %49, i64 0
%61 = insertelement <2 x double> %60, double %51, i64 1
%62 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %59, <2 x double> %61, <2 x double> %57)
%63 = fadd <2 x double> %33, %62
%64 = add nuw nsw i64 %32, 1
%65 = icmp eq i64 %64, %23
br i1 %65, label %66, label %31
66: ; preds = %31
%67 = getelementptr inbounds double, double* %3, i64 %25
%68 = extractelement <2 x double> %63, i64 0
store double %68, double* %67
%69 = getelementptr inbounds double, double* %4, i64 %25
%70 = extractelement <2 x double> %63, i64 1
store double %70, double* %69
%71 = add nuw nsw i64 %25, 1
%72 = icmp eq i64 %71, %23
br i1 %72, label %73, label %24
73: ; preds = %66, %11
ret void
}