user: What would the C source look like for the assembly code provided here:

```asm
<resample>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %esi,-0x6c(%rbp)
  mov    %edx,-0x70(%rbp)
  mov    %ecx,-0x74(%rbp)
  mov    %r8d,-0x78(%rbp)
  mov    %r9d,-0x7c(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x88(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D38(%rip),%rax
  mov    %rax,%rsi
  lea    D44(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L118
  lea    D45(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L159
L118:
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x74(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x78(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x38(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x48(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movl   $0x0,-0x5c(%rbp)
  movl   $0x0,-0x58(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  jmp    L72
L59:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x38(%rbp)
  movsd  -0x20(%rbp),%xmm0
  movsd  D3(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L129
  pxor   %xmm0,%xmm0
  comisd -0x48(%rbp),%xmm0
  jbe    L55
  movsd  -0x48(%rbp),%xmm0
  movq   D62(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  mulsd  -0x40(%rbp),%xmm0
  movsd  -0x38(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x38(%rbp)
L55:
  movsd  -0x48(%rbp),%xmm0
  addsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x48(%rbp)
  jmp    L102
L153:
  mov    -0x5c(%rbp),%edx
  mov    -0x6c(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    $0xffffff80,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x40(%rbp)
  addl   $0x1,-0x5c(%rbp)
  movsd  -0x48(%rbp),%xmm0
  movsd  D3(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L12
  movsd  -0x38(%rbp),%xmm0
  addsd  -0x40(%rbp),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  jmp    L41
L12:
  movsd  -0x40(%rbp),%xmm0
  mulsd  -0x48(%rbp),%xmm0
  movsd  -0x38(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x38(%rbp)
L41:
  movsd  -0x48(%rbp),%xmm0
  movsd  D3(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x48(%rbp)
L102:
  movsd  -0x48(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  ja     L153
  movsd  -0x38(%rbp),%xmm0
  divsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  jmp    L114
L129:
  movsd  -0x30(%rbp),%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x6c(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    $0xffffff80,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x38(%rbp)
L114:
  mov    -0x38(%rbp),%rax
  movq   %rax,%xmm0
  call   <round@plt>
  mov    %al,-0x5d(%rbp)
  mov    -0x28(%rbp),%rdx
  lea    -0x5d(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  addl   $0x1,-0x58(%rbp)
  movsd  -0x30(%rbp),%xmm0
  addsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x30(%rbp)
L72:
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x70(%rbp),%xmm0
  comisd -0x30(%rbp),%xmm0
  ja     L59
  cmpl   $0x1,-0x7c(%rbp)
  jle    L108
  mov    -0x7c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x50(%rbp)
  mov    -0x58(%rbp),%eax
  and    -0x50(%rbp),%eax
  mov    %eax,%edx
  mov    -0x7c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x4c(%rbp)
  mov    -0x4c(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  je     L108
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x4c(%rbp),%xmm1
  movsd  -0x38(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movl   $0x0,-0x54(%rbp)
  jmp    L143
L29:
  movsd  -0x38(%rbp),%xmm0
  subsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  movq   %rax,%xmm0
  call   <round@plt>
  mov    %al,-0x5d(%rbp)
  mov    -0x28(%rbp),%rdx
  lea    -0x5d(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  addl   $0x1,-0x58(%rbp)
  addl   $0x1,-0x54(%rbp)
L143:
  mov    -0x54(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L29
L108:
  mov    -0x88(%rbp),%rcx
  mov    -0x58(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <inEx@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x10(%rbp),%rax
L159:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L71
  call   <__stack_chk_fail@plt>
L71:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D38
type_guessed: string
name: disassemble_data
arguments: tag: D44
type_guessed: string
name: disassemble_data
arguments: tag: D45
type_guessed: string
name: disassemble_data
arguments: tag: D3
type_guessed: f32[2]
name: disassemble_data
arguments: tag: D62
type_guessed: f32[2]

tool: D38: wb+

tool: D44: tmp.bin

tool: D45: Error: cannot open file tmp.bin


tool: {"D3": [0.0,1.875]}

tool: {"D62": [0.0,-0.0]}

assistant: ```c
unsigned char *resample(unsigned char *data, int offset, int len, int inputRate, int outputRate, int align, int *outSize) {
  FILE *f = fopen("tmp.bin", "wb+");
  if (f == NULL) {
    printf("Error: cannot open file tmp.bin\n");
    return NULL;
  }
  const double step = (double)inputRate / (double)outputRate;
  double value;
  double lastSample;
  double sample = 0;
  unsigned char byte;
  double dOff;
  int off;
  int outOff;
  value = 0;
  lastSample = 0;
  off = 0;
  outOff = 0;
  for (dOff = 0; dOff < len; dOff += step) {
    sample = 0;
    if (step >= 1) {
      if (value < 0)
        sample += lastSample * -value;
      value += step;
      while (value > 0) {
        lastSample = (data[off + offset] & 0xFF) - 0x80;
        off++;
        if (value >= 1)
          sample += lastSample;
        else
          sample += lastSample * value;
        value--;
      }
      sample /= step;
    } else {
      sample = (data[(int)dOff + offset] & 0xFF) - 0x80;
    }
    byte = round(sample);
    fwrite(&byte, 1, 1, f);
    outOff++;
  }
  if (align > 1) {
    const int mask = align - 1;
    const int size = align - (outOff & mask);
    if (size != align) {
      double reduce = sample / size;
      int i;
      for (i = 0; i < size; i++) {
        sample -= reduce;
        byte = round(sample);
        fwrite(&byte, 1, 1, f);
        outOff++;
      }
    }
  }
  unsigned char *result = inEx(f, 0, outOff, outSize);
  fclose(f);
  return result;
}
```