user: Translate the below assembly code into C programming language:

```asm
<make_nucleon_2pt>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,0x48(%rsp)
  mov    %rsi,0x50(%rsp)
  mov    %rdx,%r13
  mov    %rcx,%rbp
  mov    %r8,0x70(%rsp)
  mov    %r9,0x78(%rsp)
  mov    0xe8(%rsp),%r14
  mov    0x118(%rsp),%r15d
  mov    0x138(%rsp),%r12d
  mov    0x120(%rsp),%eax
  imul   0x100(%rsp),%eax
  imul   0x108(%rsp),%eax
  imul   0x100(%rsp),%eax
  imul   0x108(%rsp),%eax
  imul   %r15d,%eax
  imul   0x100(%rsp),%eax
  imul   0x108(%rsp),%eax
  imul   %r12d,%eax
  lea    0x0(,%rax,8),%ebx
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,0x20(%rsp)
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,0x28(%rsp)
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,0x30(%rsp)
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    %rax,0x38(%rsp)
  sub    $0x8,%rsp
  push   %r12
  mov    0x140(%rsp),%ecx
  push   %rcx
  mov    0x140(%rsp),%ecx
  push   %rcx
  mov    0x140(%rsp),%ecx
  push   %rcx
  push   %r15
  mov    0x140(%rsp),%ecx
  push   %rcx
  mov    0x140(%rsp),%ecx
  push   %rcx
  mov    0x140(%rsp),%ecx
  push   %rcx
  push   %r14
  push   0x130(%rsp)
  push   0x118(%rsp)
  mov    0xd8(%rsp),%r9
  mov    0xd0(%rsp),%r8
  mov    %rbp,%rcx
  mov    %r13,%rdx
  mov    0x88(%rsp),%rsi
  mov    0x80(%rsp),%rdi
  call   <make_local_block@plt>
  add    $0x58,%rsp
  push   %r12
  mov    0x140(%rsp),%esi
  push   %rsi
  mov    0x140(%rsp),%esi
  push   %rsi
  mov    0x140(%rsp),%ecx
  push   %rcx
  push   %r15
  mov    0x140(%rsp),%esi
  push   %rsi
  mov    0x140(%rsp),%ecx
  push   %rcx
  mov    0x140(%rsp),%esi
  push   %rsi
  push   %r14
  push   0x130(%rsp)
  push   0x130(%rsp)
  mov    0x130(%rsp),%r9
  mov    0x128(%rsp),%r8
  mov    %rbp,%rcx
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    0x90(%rsp),%rdi
  call   <make_local_block@plt>
  add    $0x60,%rsp
  cmpl   $0x0,0x128(%rsp)
  jle    L237
  mov    0xc0(%rsp),%rax
  mov    %rax,0x40(%rsp)
  movl   $0x0,0x6c(%rsp)
  jmp    L47
L207:
  mov    0x40(%rsp),%rax
  movsd  (%rax),%xmm6
  movsd  %xmm6,0x58(%rsp)
  mov    0x140(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xf0(%rsp),%rcx
  mov    (%rcx,%rax,8),%rbp
  sub    $0x8,%rsp
  push   %r12
  push   %r15
  mov    0x120(%rsp),%ecx
  push   %rcx
  mov    0x120(%rsp),%ecx
  push   %rcx
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%ecx
  push   %rcx
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x60(%rsp),%r11
  movq   %rbp,%xmm2
  mulsd  (%r11,%rax,8),%xmm2
  movsd  %xmm2,0xa0(%rsp)
  add    $0x40,%rsp
  mov    0x140(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xf8(%rsp),%r9
  mov    (%r9,%rax,8),%rbp
  sub    $0x8,%rsp
  push   %r12
  push   %r15
  mov    0x120(%rsp),%r9d
  push   %r9
  mov    0x120(%rsp),%r9d
  push   %r9
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%edi
  push   %rdi
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x68(%rsp),%r9
  movq   %rbp,%xmm1
  mulsd  (%r9,%rax,8),%xmm1
  movsd  0xa0(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  0x98(%rsp),%xmm0
  movq   %xmm0,%rbp
  add    $0x38,%rsp
  mov    0x128(%rsp),%edx
  push   %rdx
  mov    0x150(%rsp),%r9d
  mov    %r12d,%r8d
  mov    %r14d,%ecx
  mov    0x18(%rsp),%edx
  mov    %r13d,%esi
  mov    $0x0,%edi
  call   <index_4d@plt>
  mov    0x58(%rsp),%rsi
  lea    (%rsi,%rax,8),%rax
  movq   %rbp,%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  mov    0x50(%rsp),%r10
  movsd  (%r10),%xmm7
  movsd  %xmm7,0x68(%rsp)
  mov    0x150(%rsp),%edx
  mov    0x18(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0x100(%rsp),%r10
  mov    (%r10,%rax,8),%rbp
  mov    %r12d,(%rsp)
  push   %r15
  mov    0x120(%rsp),%r10d
  push   %r10
  mov    0x120(%rsp),%r10d
  push   %r10
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%edi
  push   %rdi
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x68(%rsp),%r9
  movq   %rbp,%xmm3
  mulsd  (%r9,%rax,8),%xmm3
  movsd  %xmm3,0xa0(%rsp)
  add    $0x40,%rsp
  mov    0x140(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xf8(%rsp),%r10
  mov    (%r10,%rax,8),%rbp
  sub    $0x8,%rsp
  push   %r12
  push   %r15
  mov    0x120(%rsp),%r10d
  push   %r10
  mov    0x120(%rsp),%r10d
  push   %r10
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%edi
  push   %rdi
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x60(%rsp),%r11
  movq   %rbp,%xmm1
  mulsd  (%r11,%rax,8),%xmm1
  movsd  0xa0(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  0x98(%rsp),%xmm0
  movq   %xmm0,%rbp
  add    $0x38,%rsp
  mov    0x128(%rsp),%eax
  push   %rax
  mov    0x150(%rsp),%r9d
  mov    %r12d,%r8d
  mov    %r14d,%ecx
  mov    0x18(%rsp),%edx
  mov    %r13d,%esi
  mov    $0x0,%edi
  call   <index_4d@plt>
  mov    0x60(%rsp),%rcx
  lea    (%rcx,%rax,8),%rax
  movq   %rbp,%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x1,%ebx
  add    $0x10,%rsp
  cmp    %ebx,%r15d
  jne    L207
L138:
  add    $0x1,%r14d
  cmp    %r14d,0x120(%rsp)
  je     L97
L98:
  mov    $0x0,%ebx
  test   %r15d,%r15d
  jg     L207
  jmp    L138
L97:
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  cmp    %eax,0x140(%rsp)
  je     L220
L206:
  mov    $0x0,%r14d
  cmpl   $0x0,0x120(%rsp)
  jg     L98
  jmp    L97
L220:
  add    $0x1,%r13d
  cmp    %r13d,%r12d
  je     L146
L122:
  movl   $0x0,0x8(%rsp)
  cmpl   $0x0,0x140(%rsp)
  jg     L206
  jmp    L220
L146:
  mov    0x6c(%rsp),%eax
  add    $0x1,%eax
  addq   $0x8,0x40(%rsp)
  cmp    %eax,0x128(%rsp)
  je     L76
  mov    %eax,0x6c(%rsp)
L47:
  mov    0x130(%rsp),%edx
  mov    $0x0,%esi
  mov    0x6c(%rsp),%ebx
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0x70(%rsp),%r14
  mov    (%r14,%rax,4),%eax
  mov    %eax,0xc(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x0,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0x78(%rsp),%rbp
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,0x10(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    (%r14,%rax,4),%eax
  mov    %eax,0x14(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,0x18(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    (%r14,%rax,4),%eax
  mov    %eax,0x1c(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0x0(%rbp,%rax,4),%eax
  mov    %eax,0x68(%rsp)
  mov    $0x0,%r13d
  test   %r12d,%r12d
  jg     L122
  jmp    L146
L76:
  mov    0xd8(%rsp),%rax
  mov    %rax,0x40(%rsp)
  movl   $0x0,0x70(%rsp)
  jmp    L166
L10:
  mov    0x40(%rsp),%rax
  movsd  (%rax),%xmm2
  movsd  %xmm2,0x58(%rsp)
  mov    0x140(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xf0(%rsp),%rdx
  mov    (%rdx,%rax,8),%rbp
  sub    $0x8,%rsp
  push   %r12
  push   %r15
  mov    0x120(%rsp),%ecx
  push   %rcx
  mov    0x120(%rsp),%edx
  push   %rdx
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%ecx
  push   %rcx
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x70(%rsp),%r11
  movq   %rbp,%xmm4
  mulsd  (%r11,%rax,8),%xmm4
  movsd  %xmm4,0xa0(%rsp)
  add    $0x40,%rsp
  mov    0x140(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xf8(%rsp),%r9
  mov    (%r9,%rax,8),%rbp
  sub    $0x8,%rsp
  push   %r12
  push   %r15
  mov    0x120(%rsp),%r9d
  push   %r9
  mov    0x120(%rsp),%r9d
  push   %r9
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%edi
  push   %rdi
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x78(%rsp),%r9
  movq   %rbp,%xmm1
  mulsd  (%r9,%rax,8),%xmm1
  movsd  0xa0(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  0x98(%rsp),%xmm0
  movq   %xmm0,%rbp
  add    $0x38,%rsp
  mov    0x128(%rsp),%edx
  push   %rdx
  mov    0x150(%rsp),%r9d
  mov    %r12d,%r8d
  mov    %r14d,%ecx
  mov    0x18(%rsp),%edx
  mov    %r13d,%esi
  mov    $0x1,%edi
  call   <index_4d@plt>
  mov    0x58(%rsp),%rsi
  lea    (%rsi,%rax,8),%rax
  movq   %rbp,%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  mov    0x50(%rsp),%r10
  movsd  (%r10),%xmm3
  movsd  %xmm3,0x68(%rsp)
  mov    0x150(%rsp),%edx
  mov    0x18(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0x100(%rsp),%r10
  mov    (%r10,%rax,8),%rbp
  mov    %r12d,(%rsp)
  push   %r15
  mov    0x120(%rsp),%r10d
  push   %r10
  mov    0x120(%rsp),%r10d
  push   %r10
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%edi
  push   %rdi
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x78(%rsp),%r9
  movq   %rbp,%xmm5
  mulsd  (%r9,%rax,8),%xmm5
  movsd  %xmm5,0xa0(%rsp)
  add    $0x40,%rsp
  mov    0x140(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xf8(%rsp),%r10
  mov    (%r10,%rax,8),%rbp
  sub    $0x8,%rsp
  push   %r12
  push   %r15
  mov    0x120(%rsp),%r10d
  push   %r10
  mov    0x120(%rsp),%r10d
  push   %r10
  push   %r13
  mov    0x48(%rsp),%eax
  push   %rax
  mov    0x4c(%rsp),%edi
  push   %rdi
  mov    %ebx,%r9d
  mov    0xa8(%rsp),%r8d
  mov    0x5c(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x4c(%rsp),%esi
  mov    %r14d,%edi
  call   <Blocal_index@plt>
  mov    0x70(%rsp),%r11
  movq   %rbp,%xmm1
  mulsd  (%r11,%rax,8),%xmm1
  movsd  0xa0(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  0x98(%rsp),%xmm0
  movq   %xmm0,%rbp
  add    $0x38,%rsp
  mov    0x128(%rsp),%eax
  push   %rax
  mov    0x150(%rsp),%r9d
  mov    %r12d,%r8d
  mov    %r14d,%ecx
  mov    0x18(%rsp),%edx
  mov    %r13d,%esi
  mov    $0x1,%edi
  call   <index_4d@plt>
  mov    0x60(%rsp),%rsi
  lea    (%rsi,%rax,8),%rax
  movq   %rbp,%xmm0
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x1,%ebx
  add    $0x10,%rsp
  cmp    %ebx,%r15d
  jne    L10
L46:
  add    $0x1,%r14d
  cmp    %r14d,0x120(%rsp)
  je     L175
L244:
  mov    $0x0,%ebx
  test   %r15d,%r15d
  jg     L10
  jmp    L46
L175:
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  cmp    %eax,0x140(%rsp)
  je     L280
L67:
  mov    $0x0,%r14d
  cmpl   $0x0,0x120(%rsp)
  jg     L244
  jmp    L175
L280:
  add    $0x1,%r13d
  cmp    %r13d,%r12d
  je     L126
L32:
  movl   $0x0,0x8(%rsp)
  cmpl   $0x0,0x140(%rsp)
  jg     L67
  jmp    L280
L126:
  mov    0x70(%rsp),%ebx
  lea    0x1(%rbx),%eax
  addq   $0x8,0x40(%rsp)
  cmp    %ebx,0x6c(%rsp)
  je     L237
  mov    %eax,0x70(%rsp)
L166:
  mov    0x130(%rsp),%edx
  mov    $0x0,%esi
  mov    0x70(%rsp),%ebx
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xc8(%rsp),%rcx
  mov    (%rcx,%rax,4),%eax
  mov    %eax,0xc(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x0,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xd0(%rsp),%rsi
  mov    (%rsi,%rax,4),%eax
  mov    %eax,0x10(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xc8(%rsp),%rcx
  mov    (%rcx,%rax,4),%eax
  mov    %eax,0x14(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xd0(%rsp),%rsi
  mov    (%rsi,%rax,4),%eax
  mov    %eax,0x18(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xc8(%rsp),%rcx
  mov    (%rcx,%rax,4),%eax
  mov    %eax,0x1c(%rsp)
  mov    0x130(%rsp),%edx
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <index_2d@plt>
  mov    0xd0(%rsp),%rbx
  mov    (%rbx,%rax,4),%eax
  mov    %eax,0x68(%rsp)
  mov    $0x0,%r13d
  test   %r12d,%r12d
  jg     L32
  jmp    L126
L237:
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void make_nucleon_2pt(double *C_re, double *C_im, const double *prop_re, const double *prop_im, const int *src_color_weights_r1, const int *src_spin_weights_r1, const double *src_weights_r1, const int *src_color_weights_r2, const int *src_spin_weights_r2, const double *src_weights_r2, const double *src_psi_re, const double *src_psi_im, const double *snk_psi_re, const double *snk_psi_im, const int Nc, const int Ns, const int Vsrc, const int Vsnk, const int Nt, const int Nw, const int Nq, const int Nsrc, const int Nsnk) {
  int n, m, t, x, iC, iS, jC, jS, kC, kS, wnum;
  double *Blocal_r1_re = malloc(Nt * Nc * Ns * Nc * Ns * Vsnk * Nc * Ns * Nsrc * sizeof(double));
  double *Blocal_r1_im = malloc(Nt * Nc * Ns * Nc * Ns * Vsnk * Nc * Ns * Nsrc * sizeof(double));
  double *Blocal_r2_re = malloc(Nt * Nc * Ns * Nc * Ns * Vsnk * Nc * Ns * Nsrc * sizeof(double));
  double *Blocal_r2_im = malloc(Nt * Nc * Ns * Nc * Ns * Vsnk * Nc * Ns * Nsrc * sizeof(double));
  make_local_block(Blocal_r1_re, Blocal_r1_im, prop_re, prop_im, src_color_weights_r1, src_spin_weights_r1, src_weights_r1, src_psi_re, src_psi_im, Nc, Ns, Vsrc, Vsnk, Nt, Nw, Nq, Nsrc);
  make_local_block(Blocal_r2_re, Blocal_r2_im, prop_re, prop_im, src_color_weights_r2, src_spin_weights_r2, src_weights_r2, src_psi_re, src_psi_im, Nc, Ns, Vsrc, Vsnk, Nt, Nw, Nq, Nsrc);
  for (wnum = 0; wnum < Nw; wnum++) {
    iC = src_color_weights_r1[index_2d(wnum, 0, Nq)];
    iS = src_spin_weights_r1[index_2d(wnum, 0, Nq)];
    jC = src_color_weights_r1[index_2d(wnum, 1, Nq)];
    jS = src_spin_weights_r1[index_2d(wnum, 1, Nq)];
    kC = src_color_weights_r1[index_2d(wnum, 2, Nq)];
    kS = src_spin_weights_r1[index_2d(wnum, 2, Nq)];
    for (m = 0; m < Nsrc; m++) {
      for (n = 0; n < Nsnk; n++) {
        for (t = 0; t < Nt; t++) {
          for (x = 0; x < Vsnk; x++) {
            C_re[index_4d(0, m, n, t, Nsrc, Nsnk, Nt)] += src_weights_r1[wnum] * (snk_psi_re[index_2d(x, n, Nsnk)] * Blocal_r1_re[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)] - snk_psi_im[index_2d(x, n, Nsnk)] * Blocal_r1_im[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)]);
            C_im[index_4d(0, m, n, t, Nsrc, Nsnk, Nt)] += src_weights_r1[wnum] * (snk_psi_re[index_2d(x, n, Nsnk)] * Blocal_r1_im[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)] - snk_psi_im[index_2d(x, n, Nsnk)] * Blocal_r1_re[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)]);
          }
        }
      }
    }
  }
  for (wnum = 0; wnum < Nw; wnum++) {
    iC = src_color_weights_r2[index_2d(wnum, 0, Nq)];
    iS = src_spin_weights_r2[index_2d(wnum, 0, Nq)];
    jC = src_color_weights_r2[index_2d(wnum, 1, Nq)];
    jS = src_spin_weights_r2[index_2d(wnum, 1, Nq)];
    kC = src_color_weights_r2[index_2d(wnum, 2, Nq)];
    kS = src_spin_weights_r2[index_2d(wnum, 2, Nq)];
    for (m = 0; m < Nsrc; m++) {
      for (n = 0; n < Nsnk; n++) {
        for (t = 0; t < Nt; t++) {
          for (x = 0; x < Vsnk; x++) {
            C_re[index_4d(1, m, n, t, Nsrc, Nsnk, Nt)] += src_weights_r2[wnum] * (snk_psi_re[index_2d(x, n, Nsnk)] * Blocal_r2_re[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)] - snk_psi_im[index_2d(x, n, Nsnk)] * Blocal_r2_im[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)]);
            C_im[index_4d(1, m, n, t, Nsrc, Nsnk, Nt)] += src_weights_r2[wnum] * (snk_psi_re[index_2d(x, n, Nsnk)] * Blocal_r2_im[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)] - snk_psi_im[index_2d(x, n, Nsnk)] * Blocal_r2_re[Blocal_index(t, iC, iS, kC, kS, x, jC, jS, m, Nc, Ns, Vsnk, Nsrc)]);
          }
        }
      }
    }
  }
  free(Blocal_r1_re);
  free(Blocal_r1_im);
  free(Blocal_r2_re);
  free(Blocal_r2_im);
}
```