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

```asm
<sigproc_demux_fifodata>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x18,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %r8,-0x78(%rbp)
  mov    %r9,-0x80(%rbp)
  movsd  %xmm0,-0x88(%rbp)
  movsd  %xmm1,-0x90(%rbp)
  movq   $0x0,-0x40(%rbp)
  jmp    L9
L13:
  movq   $0x0,-0x38(%rbp)
  jmp    L19
L24:
  mov    -0x38(%rbp),%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x60(%rbp),%rax
  sub    %rdx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x40(%rbp),%rax
  imul   -0x60(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  lea    -0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x40(%rbp),%rax
  imul   -0x60(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %ecx,%eax
  mov    %eax,-0x44(%rbp)
  mov    -0x44(%rbp),%eax
  xor    $0x80,%ah
  sub    $0x8000,%eax
  mov    %eax,-0x44(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x44(%rbp),%xmm0
  mulsd  -0x90(%rbp),%xmm0
  addsd  -0x88(%rbp),%xmm0
  mov    -0x38(%rbp),%rax
  imul   -0x68(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  addq   $0x1,-0x38(%rbp)
L19:
  mov    -0x38(%rbp),%rax
  cmp    -0x80(%rbp),%rax
  jb     L24
  mov    -0x80(%rbp),%rax
  add    %rax,%rax
  mov    %rax,-0x30(%rbp)
  movq   $0x0,-0x38(%rbp)
  jmp    L0
L37:
  mov    -0x60(%rbp),%rax
  sub    -0x30(%rbp),%rax
  mov    -0x38(%rbp),%rdx
  shr    $0x3,%rdx
  sub    %rdx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  and    $0x7,%eax
  mov    %rax,-0x20(%rbp)
  mov    0x18(%rbp),%rax
  lea    (%rax,%rax,1),%rsi
  mov    -0x38(%rbp),%rax
  mov    $0x0,%edx
  div    %rsi
  mov    %rax,-0x18(%rbp)
  mov    0x18(%rbp),%rax
  lea    (%rax,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  mov    $0x0,%edx
  div    %rcx
  mov    %rdx,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  imul   -0x60(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    -0x20(%rbp),%rdx
  mov    %edx,%ecx
  sar    %cl,%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%rax
  imul   -0x68(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  imul   -0x70(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    0x10(%rbp),%rax
  add    %rdx,%rax
  and    $0x1,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addq   $0x1,-0x38(%rbp)
L0:
  mov    -0x70(%rbp),%rax
  imul   0x18(%rbp),%rax
  add    %rax,%rax
  cmp    %rax,-0x38(%rbp)
  jb     L37
  addq   $0x1,-0x40(%rbp)
L9:
  mov    -0x40(%rbp),%rax
  cmp    -0x68(%rbp),%rax
  jb     L13
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int sigproc_demux_fifodata(const char *fData, size_t bytesPerSample, size_t nSamples, size_t adcSdmCycRatio, float *adcData, size_t nAdcCh, char *sdmData, size_t nSdmCh, double adcVoffset, double adcLSB) {
  int v;
  ssize_t i, j, idx0, b0, bi, bs, ch, ss;
  for (i = 0; i < nSamples; i++) {
    for (j = 0; j < nAdcCh; j++) {
      idx0 = bytesPerSample - 1 - j * 2;
      v = ((unsigned char)(fData[i * bytesPerSample + idx0 - 1]) << 8 | (unsigned char)(fData[i * bytesPerSample + idx0]));
      v = (v ^ 0x8000) - 0x8000;
      adcData[j * nSamples + i] = v * adcLSB + adcVoffset;
    }
    b0 = nAdcCh * 2;
    for (j = 0; j < adcSdmCycRatio * nSdmCh * 2; j++) {
      bi = bytesPerSample - 1 - b0 - (ssize_t)(j / 8);
      bs = j % 8;
      ss = (ssize_t)(j / (nSdmCh * 2));
      ch = j % (nSdmCh * 2);
      sdmData[ch * nSamples * adcSdmCycRatio + i * adcSdmCycRatio + ss] = ((unsigned char)(fData[i * bytesPerSample + bi]) >> bs) & 0x1;
    }
  }
  return 0;
}
```