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    D25(%rip),%rax
  mov    %rax,%rsi
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L35
  lea    D47(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L20
L35:
  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    L77
L79:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x38(%rbp)
  movsd  -0x20(%rbp),%xmm0
  movsd  D23(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L138
  pxor   %xmm0,%xmm0
  comisd -0x48(%rbp),%xmm0
  jbe    L84
  movsd  -0x48(%rbp),%xmm0
  movq   D54(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  mulsd  -0x40(%rbp),%xmm0
  movsd  -0x38(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x38(%rbp)
L84:
  movsd  -0x48(%rbp),%xmm0
  addsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x48(%rbp)
  jmp    L30
L24:
  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  D23(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L65
  movsd  -0x38(%rbp),%xmm0
  addsd  -0x40(%rbp),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  jmp    L6
L65:
  movsd  -0x40(%rbp),%xmm0
  mulsd  -0x48(%rbp),%xmm0
  movsd  -0x38(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x38(%rbp)
L6:
  movsd  -0x48(%rbp),%xmm0
  movsd  D23(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x48(%rbp)
L30:
  movsd  -0x48(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  ja     L24
  movsd  -0x38(%rbp),%xmm0
  divsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  jmp    L33
L138:
  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)
L33:
  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)
L77:
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x70(%rbp),%xmm0
  comisd -0x30(%rbp),%xmm0
  ja     L79
  cmpl   $0x1,-0x7c(%rbp)
  jle    L43
  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     L43
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x4c(%rbp),%xmm1
  movsd  -0x38(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movl   $0x0,-0x54(%rbp)
  jmp    L46
L102:
  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)
L46:
  mov    -0x54(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L102
L43:
  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
L20:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L125
  call   <__stack_chk_fail@plt>
L125:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D25
type_infered: string
name: disassemble_data
arguments: data_label: D28
type_infered: string
name: disassemble_data
arguments: data_label: D47
type_infered: string
name: disassemble_data
arguments: data_label: D23
type_infered: f32[2]
name: disassemble_data
arguments: data_label: D54
type_infered: f32[2]

tool: D25: wb+

tool: D28: tmp.bin

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


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

tool: {"D54": [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;
}
```