void computeResidualAtIdx_CFP64_INT64(long long *rowptr, double _Complex *valA,
                                      long long *colA, double _Complex *b,
                                      double _Complex *x, long long *Idxs,
                                      double _Complex *local_r,
                                      long long blockSize) {
  long long i, tt;
  for (i = 0; i < blockSize; ++i) {
    local_r[i] = b[Idxs[i] - 1];
  }
  for (i = 0; i < blockSize; ++i) {
    for (tt = rowptr[Idxs[i] - 1]; tt <= rowptr[Idxs[i]] - 1; ++tt) {
      local_r[i] -= conj(valA[tt - 1]) * x[colA[tt - 1] - 1];
    }
  }
}


x86 assembly (clang, -O0):
<computeResidualAtIdx_CFP64_INT64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    0x18(%rbp),%rax
jge    118e <computeResidualAtIdx_CFP64_INT64+0x8e>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
sub    $0x1,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
movsd  0x8(%rax),%xmm0
mov    0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm1,(%rax)
movsd  %xmm0,0x8(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1133 <computeResidualAtIdx_CFP64_INT64+0x33>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    0x18(%rbp),%rax
jge    132b <computeResidualAtIdx_CFP64_INT64+0x22b>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
mov    (%rcx,%rdx,8),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jg     1315 <computeResidualAtIdx_CFP64_INT64+0x215>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
movsd  %xmm1,-0x80(%rbp)
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
movsd  %xmm2,-0x78(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    -0x40(%rbp),%rdx
sub    $0x1,%rdx
mov    (%rcx,%rdx,8),%rcx
sub    $0x1,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm4
movsd  %xmm4,-0x70(%rbp)
movsd  0x8(%rax),%xmm5
movsd  %xmm5,-0x68(%rbp)
movaps %xmm1,%xmm0
mulsd  %xmm4,%xmm0
movaps %xmm2,%xmm3
mulsd  %xmm5,%xmm3
mulsd  %xmm5,%xmm1
mulsd  %xmm4,%xmm2
subsd  %xmm3,%xmm0
movsd  %xmm0,-0x60(%rbp)
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x58(%rbp)
ucomisd %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  %xmm1,-0x48(%rbp)
jnp    12d1 <computeResidualAtIdx_CFP64_INT64+0x1d1>
movsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm1
movsd  %xmm0,-0x50(%rbp)
movsd  %xmm1,-0x48(%rbp)
jnp    12d1 <computeResidualAtIdx_CFP64_INT64+0x1d1>
movsd  -0x68(%rbp),%xmm3
movsd  -0x70(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
call   1340 <__muldc3>
movsd  %xmm0,-0x50(%rbp)
movsd  %xmm1,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm2
mov    0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
movsd  0x8(%rax),%xmm0
subsd  %xmm3,%xmm1
subsd  %xmm2,%xmm0
movsd  %xmm1,(%rax)
movsd  %xmm0,0x8(%rax)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    11c0 <computeResidualAtIdx_CFP64_INT64+0xc0>
jmp    131a <computeResidualAtIdx_CFP64_INT64+0x21a>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1196 <computeResidualAtIdx_CFP64_INT64+0x96>
add    $0x80,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax

x86 assembly (clang, -O2):
<computeResidualAtIdx_CFP64_INT64>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x58(%rsp),%r10
test   %r10,%r10
jle    12c0 <computeResidualAtIdx_CFP64_INT64+0x1c0>
mov    %r9,%rbx
mov    %rdi,%r13
mov    0x50(%rsp),%r11
cmp    $0x1,%r10
jne    1131 <computeResidualAtIdx_CFP64_INT64+0x31>
xor    %eax,%eax
jmp    1172 <computeResidualAtIdx_CFP64_INT64+0x72>
mov    %r10,%r9
and    $0xfffffffffffffffe,%r9
lea    0x10(%r11),%rbp
xor    %eax,%eax
xchg   %ax,%ax
mov    (%rbx,%rax,8),%rdi
shl    $0x4,%rdi
movups -0x10(%rdi,%rcx,1),%xmm0
movups %xmm0,-0x10(%rbp)
mov    0x8(%rbx,%rax,8),%rdi
shl    $0x4,%rdi
movupd -0x10(%rdi,%rcx,1),%xmm0
movupd %xmm0,0x0(%rbp)
add    $0x2,%rax
add    $0x20,%rbp
cmp    %rax,%r9
jne    1140 <computeResidualAtIdx_CFP64_INT64+0x40>
test   $0x1,%r10b
je     1190 <computeResidualAtIdx_CFP64_INT64+0x90>
mov    (%rbx,%rax,8),%rdi
shl    $0x4,%rdi
movupd -0x10(%rdi,%rcx,1),%xmm0
shl    $0x4,%rax
movupd %xmm0,(%r11,%rax,1)
test   %r10,%r10
jle    12c0 <computeResidualAtIdx_CFP64_INT64+0x1c0>
add    $0xfffffffffffffff8,%rsi
xor    %r14d,%r14d
movapd 0xe58(%rip),%xmm7
jmp    11bd <computeResidualAtIdx_CFP64_INT64+0xbd>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    %r10,%r14
je     12c0 <computeResidualAtIdx_CFP64_INT64+0x1c0>
mov    (%rbx,%r14,8),%rax
mov    -0x8(%r13,%rax,8),%r15
cmp    0x0(%r13,%rax,8),%r15
jge    11b0 <computeResidualAtIdx_CFP64_INT64+0xb0>
mov    %r14,%r12
shl    $0x4,%r12
add    %r11,%r12
mov    %r15,%rbp
shl    $0x4,%rbp
add    %rsi,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rbp),%xmm0
movsd  0x0(%rbp),%xmm1
mov    -0x8(%rdx,%r15,8),%rax
shl    $0x4,%rax
movupd -0x10(%rax,%r8,1),%xmm2
movapd %xmm0,%xmm4
unpcklpd %xmm0,%xmm4
mulpd  %xmm2,%xmm4
movapd %xmm1,%xmm3
unpcklpd %xmm1,%xmm3
movapd %xmm2,%xmm5
shufpd $0x1,%xmm2,%xmm5
mulpd  %xmm3,%xmm5
movapd %xmm4,%xmm6
addpd  %xmm5,%xmm6
subpd  %xmm5,%xmm4
movapd %xmm4,%xmm3
movsd  %xmm6,%xmm3
ucomisd %xmm6,%xmm6
jp     126d <computeResidualAtIdx_CFP64_INT64+0x16d>
movupd (%r12),%xmm0
subpd  %xmm3,%xmm0
movupd %xmm0,(%r12)
add    $0x1,%r15
mov    (%rbx,%r14,8),%rax
add    $0x10,%rbp
cmp    0x0(%r13,%rax,8),%r15
jl     11f0 <computeResidualAtIdx_CFP64_INT64+0xf0>
jmp    11b0 <computeResidualAtIdx_CFP64_INT64+0xb0>
unpckhpd %xmm4,%xmm4
ucomisd %xmm4,%xmm4
jnp    1245 <computeResidualAtIdx_CFP64_INT64+0x145>
xorpd  %xmm7,%xmm1
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
mov    %r8,0x10(%rsp)
mov    %rdx,0x8(%rsp)
mov    %rsi,(%rsp)
call   12d0 <__muldc3>
movapd 0xd62(%rip),%xmm7
mov    0x50(%rsp),%r11
mov    0x58(%rsp),%r10
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%r8
movapd %xmm0,%xmm3
unpcklpd %xmm1,%xmm3
jmp    1245 <computeResidualAtIdx_CFP64_INT64+0x145>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
nop

LLVM IR (-O0):
define void @computeResidualAtIdx_CFP64_INT64(i64* %0, { double, double }* %1, i64* %2, { double, double }* %3, { double, double }* %4, i64* %5, { double, double }* %6, i64 %7) {
%9 = alloca i64*
%10 = alloca { double, double }*
%11 = alloca i64*
%12 = alloca { double, double }*
%13 = alloca { double, double }*
%14 = alloca i64*
%15 = alloca { double, double }*
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
store i64* %0, i64** %9
store { double, double }* %1, { double, double }** %10
store i64* %2, i64** %11
store { double, double }* %3, { double, double }** %12
store { double, double }* %4, { double, double }** %13
store i64* %5, i64** %14
store { double, double }* %6, { double, double }** %15
store i64 %7, i64* %16
store i64 0, i64* %17
br label %19
19: ; preds = %40, %8
%20 = load i64, i64* %17
%21 = load i64, i64* %16
%22 = icmp slt i64 %20, %21
br i1 %22, label %23, label %43
23: ; preds = %19
%24 = load { double, double }*, { double, double }** %12
%25 = load i64*, i64** %14
%26 = load i64, i64* %17
%27 = getelementptr inbounds i64, i64* %25, i64 %26
%28 = load i64, i64* %27
%29 = sub nsw i64 %28, 1
%30 = getelementptr inbounds { double, double }, { double, double }* %24, i64 %29
%31 = getelementptr inbounds { double, double }, { double, double }* %30, i32 0, i32 0
%32 = load double, double* %31
%33 = getelementptr inbounds { double, double }, { double, double }* %30, i32 0, i32 1
%34 = load double, double* %33
%35 = load { double, double }*, { double, double }** %15
%36 = load i64, i64* %17
%37 = getelementptr inbounds { double, double }, { double, double }* %35, i64 %36
%38 = getelementptr inbounds { double, double }, { double, double }* %37, i32 0, i32 0
%39 = getelementptr inbounds { double, double }, { double, double }* %37, i32 0, i32 1
store double %32, double* %38
store double %34, double* %39
br label %40
40: ; preds = %23
%41 = load i64, i64* %17
%42 = add nsw i64 %41, 1
store i64 %42, i64* %17
br label %19
43: ; preds = %19
store i64 0, i64* %17
br label %44
44: ; preds = %121, %43
%45 = load i64, i64* %17
%46 = load i64, i64* %16
%47 = icmp slt i64 %45, %46
br i1 %47, label %48, label %124
48: ; preds = %44
%49 = load i64*, i64** %9
%50 = load i64*, i64** %14
%51 = load i64, i64* %17
%52 = getelementptr inbounds i64, i64* %50, i64 %51
%53 = load i64, i64* %52
%54 = sub nsw i64 %53, 1
%55 = getelementptr inbounds i64, i64* %49, i64 %54
%56 = load i64, i64* %55
store i64 %56, i64* %18
br label %57
57: ; preds = %117, %48
%58 = load i64, i64* %18
%59 = load i64*, i64** %9
%60 = load i64*, i64** %14
%61 = load i64, i64* %17
%62 = getelementptr inbounds i64, i64* %60, i64 %61
%63 = load i64, i64* %62
%64 = getelementptr inbounds i64, i64* %59, i64 %63
%65 = load i64, i64* %64
%66 = sub nsw i64 %65, 1
%67 = icmp sle i64 %58, %66
br i1 %67, label %68, label %120
68: ; preds = %57
%69 = load { double, double }*, { double, double }** %10
%70 = load i64, i64* %18
%71 = sub nsw i64 %70, 1
%72 = getelementptr inbounds { double, double }, { double, double }* %69, i64 %71
%73 = getelementptr inbounds { double, double }, { double, double }* %72, i32 0, i32 0
%74 = load double, double* %73
%75 = getelementptr inbounds { double, double }, { double, double }* %72, i32 0, i32 1
%76 = load double, double* %75
%77 = fneg double %76
%78 = load { double, double }*, { double, double }** %13
%79 = load i64*, i64** %11
%80 = load i64, i64* %18
%81 = sub nsw i64 %80, 1
%82 = getelementptr inbounds i64, i64* %79, i64 %81
%83 = load i64, i64* %82
%84 = sub nsw i64 %83, 1
%85 = getelementptr inbounds { double, double }, { double, double }* %78, i64 %84
%86 = getelementptr inbounds { double, double }, { double, double }* %85, i32 0, i32 0
%87 = load double, double* %86
%88 = getelementptr inbounds { double, double }, { double, double }* %85, i32 0, i32 1
%89 = load double, double* %88
%90 = fmul double %74, %87
%91 = fmul double %77, %89
%92 = fmul double %74, %89
%93 = fmul double %77, %87
%94 = fsub double %90, %91
%95 = fadd double %92, %93
%96 = fcmp uno double %94, %94
br i1 %96, label %97, label %103
97: ; preds = %68
%98 = fcmp uno double %95, %95
br i1 %98, label %99, label %103
99: ; preds = %97
%100 = call { double, double } @__muldc3(double %74, double %77, double %87, double %89)
%101 = extractvalue { double, double } %100, 0
%102 = extractvalue { double, double } %100, 1
br label %103
103: ; preds = %99, %97, %68
%104 = phi double [ %94, %68 ], [ %94, %97 ], [ %101, %99 ]
%105 = phi double [ %95, %68 ], [ %95, %97 ], [ %102, %99 ]
%106 = load { double, double }*, { double, double }** %15
%107 = load i64, i64* %17
%108 = getelementptr inbounds { double, double }, { double, double }* %106, i64 %107
%109 = getelementptr inbounds { double, double }, { double, double }* %108, i32 0, i32 0
%110 = load double, double* %109
%111 = getelementptr inbounds { double, double }, { double, double }* %108, i32 0, i32 1
%112 = load double, double* %111
%113 = fsub double %110, %104
%114 = fsub double %112, %105
%115 = getelementptr inbounds { double, double }, { double, double }* %108, i32 0, i32 0
%116 = getelementptr inbounds { double, double }, { double, double }* %108, i32 0, i32 1
store double %113, double* %115
store double %114, double* %116
br label %117
117: ; preds = %103
%118 = load i64, i64* %18
%119 = add nsw i64 %118, 1
store i64 %119, i64* %18
br label %57
120: ; preds = %57
br label %121
121: ; preds = %120
%122 = load i64, i64* %17
%123 = add nsw i64 %122, 1
store i64 %123, i64* %17
br label %44
124: ; preds = %44
ret void
}

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