user: Demonstrate the C code that generates the assembly output below:

```asm
<runtest>:
  endbr64
  push   %r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  mov    %edi,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x78,%rsp
  movsd  %xmm0,0x18(%rsp)
  pxor   %xmm0,%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  cvtsi2sd %edi,%xmm0
  lea    0x190(,%rdi,4),%edi
  movsd  %xmm1,0x8(%rsp)
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%r15d
  lea    0x3e8(%r15),%eax
  mov    %r15d,0x38(%rsp)
  mov    %eax,0x20(%rsp)
  call   <malloc@plt>
  lea    0x1130(,%r15,4),%edi
  mov    %rax,0x30(%rsp)
  mov    %rax,%r12
  call   <malloc@plt>
  movsd  0x8(%rsp),%xmm1
  mov    %r14d,%ecx
  mov    %ebx,%edx
  movsd  0x18(%rsp),%xmm0
  mov    %rax,0x28(%rsp)
  mov    %r13d,%esi
  lea    D70(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  test   %r13d,%r13d
  jle    L316
  xor    %ebp,%ebp
  nopl   0x0(%rax)
L330:
  pxor   %xmm0,%xmm0
  add    $0x4,%r12
  cvtsi2sd %ebp,%xmm0
  divsd  0x18(%rsp),%xmm0
  add    $0x1,%ebp
  cvttsd2si %xmm0,%edi
  call   <sin@plt>
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%r12)
  cmp    %ebp,%r13d
  jne    L330
L316:
  mov    0x30(%rsp),%rcx
  movslq %r13d,%rdx
  movss  D154(%rip),%xmm0
  shl    $0x2,%rdx
  lea    (%rcx,%rdx,1),%rax
  lea    0x190(%rcx,%rdx,1),%rdx
  xchg   %ax,%ax
L101:
  movss  %xmm0,(%rax)
  add    $0x4,%rax
  cmp    %rax,%rdx
  jne    L101
  mov    0x38(%rsp),%ecx
  cmp    $0xfffffbb5,%ecx
  jl     L45
  mov    0x28(%rsp),%rsi
  lea    0x44b(%rcx),%edx
  mov    %rsi,%rax
  lea    0x4(%rsi,%rdx,4),%rdx
  nopl   0x0(%rax)
L35:
  movss  %xmm0,(%rax)
  add    $0x4,%rax
  cmp    %rax,%rdx
  jne    L35
L45:
  movsd  0x8(%rsp),%xmm1
  mov    $0x1,%edi
  xor    %r12d,%r12d
  xor    %ebp,%ebp
  movapd %xmm1,%xmm0
  call   <resample_open@plt>
  mov    %rax,%rdi
  mov    %rax,%r15
  call   <resample_get_filter_width@plt>
  lea    0x64(%rsp),%r8
  mov    %eax,0x40(%rsp)
  nopw   0x0(%rax,%rax,1)
L307:
  mov    %r13d,%edx
  mov    0x30(%rsp),%rsi
  xor    %ecx,%ecx
  movslq %r12d,%rax
  sub    %r12d,%edx
  movslq %ebp,%rdi
  cmp    %ebx,%edx
  lea    (%rsi,%rax,4),%rsi
  cmovg  %ebx,%edx
  setle  %cl
  sub    $0x8,%rsp
  mov    0x28(%rsp),%eax
  sub    %ebp,%eax
  cmp    %r14d,%eax
  cmovg  %r14d,%eax
  push   %rax
  mov    %rdi,%rax
  mov    0x38(%rsp),%rdi
  movsd  0x18(%rsp),%xmm0
  lea    (%rdi,%rax,4),%r9
  mov    %r15,%rdi
  mov    %r8,0x20(%rsp)
  call   <resample_process@plt>
  add    0x74(%rsp),%r12d
  mov    %eax,%esi
  pop    %rax
  pop    %rdx
  test   %esi,%esi
  js     L336
  add    %esi,%ebp
  test   %esi,%esi
  mov    0x10(%rsp),%r8
  jne    L307
  cmp    %r12d,%r13d
  jne    L307
  mov    %r15,%rdi
  call   <resample_close@plt>
  test   %ebp,%ebp
  jne    L246
L50:
  xor    %esi,%esi
  lea    D125(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L336:
  mov    %r15,%rdi
  mov    %esi,0x10(%rsp)
  call   <resample_close@plt>
  mov    0x10(%rsp),%esi
  xor    %eax,%eax
  lea    D68(%rip),%rdi
  call   <printf@plt>
  test   %ebp,%ebp
  je     L50
L246:
  movsd  0x8(%rsp),%xmm6
  mov    %ebp,%edx
  sub    0x38(%rsp),%edx
  mov    %edx,%eax
  movapd %xmm6,%xmm0
  neg    %eax
  addsd  %xmm6,%xmm0
  addsd  D9(%rip),%xmm0
  cmovs  %edx,%eax
  cvttsd2si %xmm0,%ecx
  cmp    %eax,%ecx
  jl     L266
L236:
  mov    %ebp,%r13d
  sub    0x40(%rsp),%r13d
  test   %r13d,%r13d
  jle    L139
  mov    0x28(%rsp),%r14
  pxor   %xmm7,%xmm7
  mov    %ebp,0x5c(%rsp)
  xor    %r12d,%r12d
  xor    %r15d,%r15d
  movsd  %xmm7,0x50(%rsp)
  mov    %r14,%rbx
  movsd  %xmm7,0x20(%rsp)
  movsd  %xmm7,0x10(%rsp)
  jmp    L255
  nopl   0x0(%rax)
L90:
  add    $0x1,%r12d
L2:
  mulsd  %xmm2,%xmm2
  addsd  0x10(%rsp),%xmm3
  add    $0x1,%r15d
  add    $0x4,%r14
  addsd  0x20(%rsp),%xmm2
  movsd  %xmm3,0x10(%rsp)
  movsd  %xmm2,0x20(%rsp)
  cmp    %r15d,%r13d
  je     L285
L255:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r15d,%xmm0
  divsd  0x18(%rsp),%xmm0
  divsd  0x8(%rsp),%xmm0
  cvttsd2si %xmm0,%ebp
  mov    %ebp,%edi
  call   <sin@plt>
  pxor   %xmm1,%xmm1
  movapd %xmm0,%xmm2
  cvtss2sd (%r14),%xmm1
  subsd  %xmm1,%xmm2
  movapd %xmm2,%xmm3
  andpd  D134(%rip),%xmm3
  comisd D25(%rip),%xmm3
  jbe    L2
  test   %r12d,%r12d
  jne    L90
  mov    %ebp,%edi
  movsd  %xmm2,0x48(%rsp)
  movsd  %xmm3,0x40(%rsp)
  movsd  %xmm1,0x38(%rsp)
  call   <sin@plt>
  movsd  0x38(%rsp),%xmm1
  mov    %r15d,%esi
  lea    D63(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  movsd  0x48(%rsp),%xmm2
  movsd  0x40(%rsp),%xmm3
  jmp    L90
L285:
  xor    %r8d,%r8d
  mov    %r12d,%r14d
  mov    0x5c(%rsp),%ebp
  xor    %r15d,%r15d
  movsd  D10(%rip),%xmm1
  lea    D54(%rip),%rdx
  mov    %r8d,%r12d
  jmp    L178
  nopw   0x0(%rax,%rax,1)
L98:
  add    $0x1,%r12d
L34:
  add    $0x1,%r15d
  add    $0x4,%rbx
  cmp    %r15d,%r13d
  je     L165
L178:
  pxor   %xmm0,%xmm0
  cvtss2sd (%rbx),%xmm0
  comisd %xmm0,%xmm1
  ja     L159
  comisd D149(%rip),%xmm0
  jbe    L34
L159:
  test   %r12d,%r12d
  jne    L98
  mov    %rdx,%rdi
  mov    %r15d,%esi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    D10(%rip),%rax
  lea    D54(%rip),%rdx
  movq   %rax,%xmm1
  jmp    L98
L165:
  cmp    $0x1,%r12d
  jg     L198
  test   %r14d,%r14d
  jne    L288
L156:
  pxor   %xmm0,%xmm0
  movsd  0x20(%rsp),%xmm1
  movsd  0x50(%rsp),%xmm4
  cvtsi2sd %r13d,%xmm0
  movsd  0x10(%rsp),%xmm2
  divsd  %xmm0,%xmm1
  divsd  %xmm0,%xmm2
  ucomisd %xmm1,%xmm4
  ja     L53
  sqrtsd %xmm1,%xmm1
L30:
  movapd %xmm2,%xmm0
  mov    %ebp,%esi
  mov    $0x2,%eax
  lea    D133(%rip),%rdi
  call   <printf@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
L78:
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L160
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L288:
  lea    -0x1(%rbp),%r15d
  pxor   %xmm0,%xmm0
  mov    0x28(%rsp),%rcx
  pxor   %xmm1,%xmm1
  cvtsi2sd %r15d,%xmm0
  divsd  0x18(%rsp),%xmm0
  movslq %r15d,%rax
  divsd  0x8(%rsp),%xmm0
  cvttsd2si %xmm0,%edi
  cvtss2sd (%rcx,%rax,4),%xmm1
  movsd  %xmm1,0x38(%rsp)
  call   <sin@plt>
  movsd  0x38(%rsp),%xmm1
  mov    %r15d,%esi
  lea    D27(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  mov    %r14d,%esi
  lea    D147(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L156
L198:
  xor    %eax,%eax
  mov    %r12d,%esi
  lea    D108(%rip),%rdi
  call   <printf@plt>
  test   %r14d,%r14d
  je     L156
  jmp    L288
L266:
  mov    0x38(%rsp),%esi
  mov    %ebp,%edx
  lea    D144(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L236
L139:
  pxor   %xmm4,%xmm4
  movsd  %xmm4,0x50(%rsp)
  movsd  %xmm4,0x10(%rsp)
  movsd  %xmm4,0x20(%rsp)
  jmp    L156
L53:
  movapd %xmm1,%xmm0
  movsd  %xmm2,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm2
  movapd %xmm0,%xmm1
  jmp    L30
L160:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D70
type_infered: string
name: parse_data
arguments: tag: D154
type_infered: byte[4]
name: parse_data
arguments: tag: D125
type_infered: string
name: parse_data
arguments: tag: D68
type_infered: string
name: parse_data
arguments: tag: D9
type_infered: f64
name: parse_data
arguments: tag: D134
type_infered: qword[2]
name: parse_data
arguments: tag: D25
type_infered: f64[2]
name: parse_data
arguments: tag: D63
type_infered: string
name: parse_data
arguments: tag: D10
type_infered: byte[8]
name: parse_data
arguments: tag: D54
type_infered: string
name: parse_data
arguments: tag: D149
type_infered: f64[2]
name: parse_data
arguments: tag: D133
type_infered: string
name: parse_data
arguments: tag: D27
type_infered: string
name: parse_data
arguments: tag: D147
type_infered: string
name: parse_data
arguments: tag: D108
type_infered: string
name: parse_data
arguments: tag: D144
type_infered: string

tool: D70: -- srclen: %d sin freq: %.1f factor: %.3f srcblk: %d dstblk: %d


tool: {"D154": [0x00,0x00,0xc6,0xc2]}

tool: D125: Error: resample_process returned %d samples


tool: D68: Error: resample_process returned an error: %d


tool: D9: 1

tool: {"D134": [0x7fffffffffffffff,0x0000000000000000]}

tool: {"D25": [0.05,-1.01]}

tool: D63:    First error at i=%d: expected %.3f, got %.3f


tool: {"D10": [0x29,0x5c,0x8f,0xc2,0xf5,0x28,0xf0,0xbf]}

tool: D54:    Error at i=%d: value is %.3f


tool: {"D149": [1.01,null]}

tool: D133:    Out: %d samples  Avg err: %f RMS err: %f


tool: D27:    i=%d:  expected %.3f, got %.3f


tool: D147:    At least %d samples had significant error.


tool: D108:    At least %d samples were out of range


tool: D144:    Expected ~%d, got %d samples out


assistant: ```c
void runtest(int srclen, double freq, double factor, int srcblocksize, int dstblocksize) {
  int expectedlen = (int)(srclen * factor);
  int dstlen = expectedlen + 1000;
  float *src = (float *)malloc((srclen + 100) * sizeof(float));
  float *dst = (float *)malloc((dstlen + 100) * sizeof(float));
  void *handle;
  double sum, sumsq, err, rmserr;
  int i, out, o, srcused, errcount, rangecount;
  int statlen, srcpos, lendiff;
  int fwidth;
  printf("-- srclen: %d sin freq: %.1f factor: %.3f srcblk: %d dstblk: %d\n", srclen, freq, factor, srcblocksize, dstblocksize);
  for (i = 0; i < srclen; i++)
    src[i] = sin(i / freq);
  for (i = srclen; i < srclen + 100; i++)
    src[i] = -99.0;
  for (i = 0; i < dstlen + 100; i++)
    dst[i] = -99.0;
  handle = resample_open(1, factor, factor);
  fwidth = resample_get_filter_width(handle);
  out = 0;
  srcpos = 0;
  for (;;) {
    int srcBlock = (srclen - srcpos) < (srcblocksize) ? (srclen - srcpos) : (srcblocksize);
    int lastFlag = (srcBlock == srclen - srcpos);
    o = resample_process(handle, factor, &src[srcpos], srcBlock, lastFlag, &srcused, &dst[out], (dstlen - out) < (dstblocksize) ? (dstlen - out) : (dstblocksize));
    srcpos += srcused;
    if (o >= 0)
      out += o;
    if (o < 0 || (o == 0 && srcpos == srclen))
      break;
  }
  resample_close(handle);
  if (o < 0) {
    printf("Error: resample_process returned an error: %d\n", o);
  }
  if (out <= 0) {
    printf("Error: resample_process returned %d samples\n", out);
    free(src);
    free(dst);
    return;
  }
  lendiff = abs(out - expectedlen);
  if (lendiff > (int)(2 * factor + 1.0)) {
    printf("   Expected ~%d, got %d samples out\n", expectedlen, out);
  }
  sum = 0.0;
  sumsq = 0.0;
  errcount = 0.0;
  statlen = out - fwidth;
  for (i = 0; i < statlen; i++) {
    double diff = sin((i / freq) / factor) - dst[i];
    if (fabs(diff) > 0.05) {
      if (errcount == 0)
        printf("   First error at i=%d: expected %.3f, got %.3f\n", i, sin((i / freq) / factor), dst[i]);
      errcount++;
    }
    sum += fabs(diff);
    sumsq += diff * diff;
  }
  rangecount = 0;
  for (i = 0; i < statlen; i++) {
    if (dst[i] < -1.01 || dst[i] > 1.01) {
      if (rangecount == 0)
        printf("   Error at i=%d: value is %.3f\n", i, dst[i]);
      rangecount++;
    }
  }
  if (rangecount > 1)
    printf("   At least %d samples were out of range\n", rangecount);
  if (errcount > 0) {
    i = out - 1;
    printf("   i=%d:  expected %.3f, got %.3f\n", i, sin((i / freq) / factor), dst[i]);
    printf("   At least %d samples had significant error.\n", errcount);
  }
  err = sum / statlen;
  rmserr = sqrt(sumsq / statlen);
  printf("   Out: %d samples  Avg err: %f RMS err: %f\n", out, err, rmserr);
  free(src);
  free(dst);
}
```