user: Please show me the C implementation that matches the assembly code listed below:

```asm
<contract_ss_c>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %edi,%ebx
  mov    %edi,0x40(%rsp)
  mov    %esi,0x44(%rsp)
  mov    %edx,0x70(%rsp)
  mov    %rcx,%rbp
  mov    %rcx,0x38(%rsp)
  mov    %r8,0x48(%rsp)
  movslq %r9d,%r14
  lea    0x0(,%r9,4),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  lea    0x7e(%rbx),%eax
  add    $0x3f,%ebx
  cmovns %ebx,%eax
  sar    $0x6,%eax
  mov    %eax,%r12d
  mov    %eax,0x14(%rsp)
  movl   $0x0,(%r15)
  cltq
  mov    %rax,0x18(%rsp)
  shl    $0x2,%rax
  mov    %rax,0x8(%rsp)
  add    %rax,%rbp
  cmp    $0x1,%r14
  jbe    L145
  mov    %rbp,%r13
  lea    0x0(%rbp,%rax,1),%rdi
  mov    $0x1,%ebp
L148:
  mov    0x8(%rsp),%rax
  lea    (%rax,%rdi,1),%rbx
  mov    %r12d,%edx
  mov    0x38(%rsp),%rsi
  call   <n_excitations@plt>
  mov    %eax,(%rsp)
  mov    %r12d,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <n_excitations@plt>
  add    (%rsp),%eax
  mov    %eax,(%r15,%rbp,4)
  add    $0x1,%rbp
  mov    0x8(%rsp),%rax
  lea    (%rax,%rbx,1),%rdi
  cmp    %rbp,%r14
  jne    L148
L220:
  mov    0x18(%rsp),%rax
  shl    $0x3,%rax
  mov    %rax,(%rsp)
  movslq 0x44(%rsp),%rax
  mov    %rax,0x50(%rsp)
  shl    $0x2,%rax
  mov    %rax,0x60(%rsp)
  movslq 0x70(%rsp),%rax
  mov    %rax,0x58(%rsp)
  shl    $0x2,%rax
  mov    %rax,0x68(%rsp)
  mov    0x38(%rsp),%r13
  mov    $0x0,%r12d
  mov    %r15,%rax
  mov    %r14,%r15
  mov    %rax,%r14
  jmp    L207
L145:
  test   %r14,%r14
  je     L53
  jmp    L220
L222:
  mov    0x44(%rsp),%esi
  mov    %esi,%eax
  mov    0x70(%rsp),%r15d
  sub    %r15d,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    %esi,%eax
  add    %r15d,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  mulsd  D12(%rip),%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  D9(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,0x18(%rsp)
  mov    %esi,%ecx
  mov    0x40(%rsp),%edx
  mov    0x14(%rsp),%esi
  mov    0x28(%rsp),%rdi
  call   <compute_occ_list@plt>
  mov    %rax,0x30(%rsp)
  mov    %r15d,%ecx
  mov    0x40(%rsp),%edx
  mov    0x14(%rsp),%esi
  mov    0x20(%rsp),%rdi
  call   <compute_occ_list@plt>
  mov    %rax,%r15
  cmpq   $0x0,0x50(%rsp)
  je     L174
  mov    0x30(%rsp),%rdi
  mov    %rdi,%rsi
  add    0x60(%rsp),%rdi
  mov    0x68(%rsp),%rax
  lea    (%r15,%rax,1),%rcx
  mov    0x58(%rsp),%r8
  movsd  0x18(%rsp),%xmm0
  jmp    L224
L90:
  add    $0x4,%rax
  cmp    %rcx,%rax
  je     L119
L164:
  cmp    (%rax),%edx
  jne    L90
  subsd  D10(%rip),%xmm0
  jmp    L90
L119:
  add    $0x4,%rsi
  cmp    %rdi,%rsi
  je     L162
L224:
  mov    (%rsi),%edx
  test   %r8,%r8
  je     L119
  mov    %r15,%rax
  jmp    L164
L162:
  movsd  %xmm0,0x18(%rsp)
L174:
  mov    0x48(%rsp),%rax
  movsd  0x18(%rsp),%xmm0
  mulsd  (%rax,%r12,8),%xmm0
  mov    0xc0(%rsp),%rax
  addsd  (%rax,%r12,8),%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  jmp    L173
L154:
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
L173:
  add    $0x1,%rbx
  add    (%rsp),%rbp
  cmp    %rbx,%r13
  jbe    L239
L227:
  mov    (%r14,%r12,4),%eax
  sub    (%r14,%rbx,4),%eax
  add    $0x2,%eax
  cmp    $0x4,%eax
  ja     L173
  mov    %rbp,0x30(%rsp)
  mov    0x8(%rsp),%rax
  lea    (%rax,%rbp,1),%r15
  mov    0x14(%rsp),%edx
  mov    %rbp,%rsi
  mov    0x28(%rsp),%rdi
  call   <n_excitations@plt>
  mov    %eax,0x18(%rsp)
  mov    0x14(%rsp),%edx
  mov    %r15,%rsi
  mov    0x20(%rsp),%rdi
  call   <n_excitations@plt>
  cmp    %rbx,%r12
  je     L222
  mov    0x18(%rsp),%ecx
  lea    (%rcx,%rax,1),%edx
  cmp    $0x2,%edx
  jne    L173
  cmp    %eax,%ecx
  jne    L173
  mov    0x14(%rsp),%edx
  mov    0x30(%rsp),%rsi
  mov    0x28(%rsp),%rdi
  call   <get_single_excitation@plt>
  mov    %rax,0x18(%rsp)
  mov    0x14(%rsp),%edx
  mov    %r15,%rsi
  mov    0x20(%rsp),%rdi
  call   <get_single_excitation@plt>
  mov    %rax,%r15
  mov    0x18(%rsp),%rax
  mov    (%rax),%esi
  mov    0x4(%rax),%edi
  mov    (%r15),%ecx
  mov    0x4(%r15),%eax
  mov    %eax,0x30(%rsp)
  cmp    %eax,%esi
  jne    L154
  mov    %ecx,0x74(%rsp)
  cmp    %ecx,%edi
  jne    L154
  mov    0x14(%rsp),%ecx
  mov    0x28(%rsp),%rdx
  call   <compute_cre_des_sign@plt>
  movsd  %xmm0,0x78(%rsp)
  mov    0x14(%rsp),%ecx
  mov    0x20(%rsp),%rdx
  mov    0x74(%rsp),%esi
  mov    0x30(%rsp),%edi
  call   <compute_cre_des_sign@plt>
  mulsd  0x78(%rsp),%xmm0
  mov    0x48(%rsp),%rax
  mulsd  (%rax,%rbx,8),%xmm0
  mov    0xc0(%rsp),%rax
  movsd  (%rax,%r12,8),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax,%r12,8)
  jmp    L154
L239:
  mov    %r13,%r15
  add    $0x1,%r12
  mov    0x20(%rsp),%r13
  add    0x8(%rsp),%r13
  cmp    %r12,%r15
  jbe    L67
L207:
  mov    %r13,0x28(%rsp)
  add    0x8(%rsp),%r13
  mov    %r13,0x20(%rsp)
  mov    0x38(%rsp),%rbp
  mov    $0x0,%ebx
  mov    %r15,%r13
  jmp    L227
L67:
  mov    %r14,%r15
L53:
  mov    %r15,%rdi
  call   <free@plt>
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_label: D12
datatype: byte[8]
name: read_data
arguments: data_label: D9
datatype: byte[8]
name: read_data
arguments: data_label: D10
datatype: f64

tool: {"D12": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D9": [0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x3f]}

tool: D10: 1

assistant: ```c
void contract_ss_c(int norb, int neleca, int nelecb, uint64_t *strs, double *civec, uint64_t ndet, double *ci1) {
  int *ts = malloc(sizeof(int) * ndet);
#pragma omp parallel
  {
    size_t ip, jp, p, q;
    int nset = (norb + 63) / 64;
    ts[0] = 0;
    uint64_t *str1a = strs;
    uint64_t *str1b = strs + nset;
#pragma omp for schedule(static)
    for (ip = 1; ip < ndet; ++ip) {
      uint64_t *stria = strs + ip * 2 * nset;
      uint64_t *strib = strs + ip * 2 * nset + nset;
      ts[ip] = (n_excitations(stria, str1a, nset) + n_excitations(strib, str1b, nset));
    }
#pragma omp for schedule(static)
    for (ip = 0; ip < ndet; ++ip) {
      for (jp = 0; jp < ndet; ++jp) {
        if (abs(ts[ip] - ts[jp]) < 3) {
          uint64_t *stria = strs + ip * 2 * nset;
          uint64_t *strib = strs + ip * 2 * nset + nset;
          uint64_t *strja = strs + jp * 2 * nset;
          uint64_t *strjb = strs + jp * 2 * nset + nset;
          int n_excit_a = n_excitations(stria, strja, nset);
          int n_excit_b = n_excitations(strib, strjb, nset);
          if (ip == jp) {
            double apb = (double)(neleca + nelecb);
            double amb = (double)(neleca - nelecb);
            double prefactor = apb / 2.0 + amb * amb / 4.0;
            int *occsa = compute_occ_list(stria, nset, norb, neleca);
            int *occsb = compute_occ_list(strib, nset, norb, nelecb);
            for (p = 0; p < neleca; ++p) {
              int pa = occsa[p];
              for (q = 0; q < nelecb; ++q) {
                int qb = occsb[q];
                if (pa == qb)
                  prefactor -= 1.0;
              }
            }
            ci1[ip] += prefactor * civec[ip];
            free(occsa);
            free(occsb);
          } else if ((n_excit_a + n_excit_b) == 2) {
            int i, j, a, b;
            if (n_excit_a == n_excit_b) {
              int *ia = get_single_excitation(stria, strja, nset);
              int *jb = get_single_excitation(strib, strjb, nset);
              i = ia[0];
              a = ia[1];
              j = jb[0];
              b = jb[1];
              if (i == b && j == a) {
                double sign = compute_cre_des_sign(a, i, stria, nset);
                sign *= compute_cre_des_sign(b, j, strib, nset);
                ci1[ip] -= sign * civec[jp];
              }
              free(ia);
              free(jb);
            }
          }
        }
      }
    }
  }
  free(ts);
}
```