user: 请将以下的汇编代码转换成C语言代码:

```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,%ebp
  lea    0x3e8(%rbp),%eax
  mov    %ebp,0x38(%rsp)
  add    $0x44c,%ebp
  mov    %eax,0x20(%rsp)
  call   <malloc@plt>
  lea    0x0(,%rbp,4),%edi
  mov    %rax,0x30(%rsp)
  mov    %rax,%r15
  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    D168(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  test   %r13d,%r13d
  jle    L24
  xor    %r12d,%r12d
  nopl   0x0(%rax)
L281:
  pxor   %xmm0,%xmm0
  add    $0x4,%r15
  cvtsi2sd %r12d,%xmm0
  divsd  0x18(%rsp),%xmm0
  add    $0x1,%r12d
  cvttsd2si %xmm0,%edi
  call   <sin@plt>
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%r15)
  cmp    %r12d,%r13d
  jne    L281
L24:
  mov    0x30(%rsp),%rcx
  movslq %r13d,%rax
  movaps D63(%rip),%xmm0
  lea    (%rcx,%rax,4),%rax
  lea    0x190(%rax),%rdx
  nopl   0x0(%rax)
L381:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L381
  mov    0x38(%rsp),%ecx
  add    $0x44b,%ecx
  js     L123
  cmp    $0x2,%ecx
  jbe    L8
  mov    %ebp,%edx
  mov    0x28(%rsp),%rsi
  shr    $0x2,%edx
  shl    $0x4,%rdx
  mov    %rsi,%rax
  add    %rsi,%rdx
  nopl   (%rax)
L265:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L265
  mov    %ebp,%eax
  and    $0xfffffffc,%eax
  and    $0x3,%ebp
  je     L123
L187:
  movss  D63(%rip),%xmm0
  mov    0x28(%rsp),%rdi
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rsi
  movss  %xmm0,(%rdi,%rdx,4)
  lea    0x1(%rax),%edx
  cmp    %ecx,%edx
  jg     L123
  add    $0x2,%eax
  movss  %xmm0,0x4(%rdi,%rsi,1)
  cmp    %eax,%ecx
  jl     L123
  movss  %xmm0,0x8(%rdi,%rsi,1)
L123:
  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)
L315:
  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     L45
  add    %esi,%ebp
  test   %esi,%esi
  mov    0x10(%rsp),%r8
  jne    L315
  cmp    %r12d,%r13d
  jne    L315
  mov    %r15,%rdi
  call   <resample_close@plt>
  test   %ebp,%ebp
  jne    L164
L251:
  xor    %esi,%esi
  lea    D97(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  jmp    L192
  nopw   0x0(%rax,%rax,1)
L45:
  mov    %r15,%rdi
  mov    %esi,0x10(%rsp)
  call   <resample_close@plt>
  mov    0x10(%rsp),%esi
  xor    %eax,%eax
  lea    D12(%rip),%rdi
  call   <printf@plt>
  test   %ebp,%ebp
  je     L251
L164:
  movsd  0x8(%rsp),%xmm6
  mov    %ebp,%edx
  sub    0x38(%rsp),%edx
  mov    %edx,%eax
  movapd %xmm6,%xmm0
  neg    %eax
  addsd  %xmm6,%xmm0
  addsd  D188(%rip),%xmm0
  cmovs  %edx,%eax
  cvttsd2si %xmm0,%ecx
  cmp    %eax,%ecx
  jl     L151
L79:
  mov    %ebp,%r13d
  sub    0x40(%rsp),%r13d
  test   %r13d,%r13d
  jle    L283
  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    L367
  nopl   0x0(%rax)
L13:
  add    $0x1,%r12d
L229:
  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     L320
L367:
  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  D37(%rip),%xmm3
  comisd D173(%rip),%xmm3
  jbe    L229
  test   %r12d,%r12d
  jne    L13
  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    D103(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  movsd  0x48(%rsp),%xmm2
  movsd  0x40(%rsp),%xmm3
  jmp    L13
L320:
  xor    %r8d,%r8d
  mov    %r12d,%r14d
  mov    0x5c(%rsp),%ebp
  xor    %r15d,%r15d
  movsd  D68(%rip),%xmm1
  lea    D34(%rip),%rdx
  mov    %r8d,%r12d
  jmp    L63
  nopw   0x0(%rax,%rax,1)
L223:
  add    $0x1,%r12d
L43:
  add    $0x1,%r15d
  add    $0x4,%rbx
  cmp    %r15d,%r13d
  je     L353
L63:
  pxor   %xmm0,%xmm0
  cvtss2sd (%rbx),%xmm0
  comisd %xmm0,%xmm1
  ja     L388
  comisd D142(%rip),%xmm0
  jbe    L43
L388:
  test   %r12d,%r12d
  jne    L223
  mov    %rdx,%rdi
  mov    %r15d,%esi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    D68(%rip),%rax
  lea    D34(%rip),%rdx
  movq   %rax,%xmm1
  jmp    L223
L353:
  cmp    $0x1,%r12d
  jg     L181
  test   %r14d,%r14d
  jne    L38
L280:
  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     L196
  sqrtsd %xmm1,%xmm1
L19:
  movapd %xmm2,%xmm0
  mov    %ebp,%esi
  mov    $0x2,%eax
  lea    D72(%rip),%rdi
  call   <printf@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
L192:
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L86
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L38:
  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    D43(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  mov    %r14d,%esi
  lea    D149(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L280
L181:
  xor    %eax,%eax
  mov    %r12d,%esi
  lea    D150(%rip),%rdi
  call   <printf@plt>
  test   %r14d,%r14d
  je     L280
  jmp    L38
L151:
  mov    0x38(%rsp),%esi
  mov    %ebp,%edx
  lea    D125(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L79
L283:
  pxor   %xmm4,%xmm4
  movsd  %xmm4,0x50(%rsp)
  movsd  %xmm4,0x10(%rsp)
  movsd  %xmm4,0x20(%rsp)
  jmp    L280
L8:
  xor    %eax,%eax
  jmp    L187
L196:
  movapd %xmm1,%xmm0
  movsd  %xmm2,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm2
  movapd %xmm0,%xmm1
  jmp    L19
L86:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D168
type: string
name: retrieve_data
arguments: data_label: D63
type: byte[16]
name: retrieve_data
arguments: data_label: D97
type: string
name: retrieve_data
arguments: data_label: D12
type: string
name: retrieve_data
arguments: data_label: D188
type: f64
name: retrieve_data
arguments: data_label: D37
type: qword[2]
name: retrieve_data
arguments: data_label: D173
type: f64[2]
name: retrieve_data
arguments: data_label: D103
type: string
name: retrieve_data
arguments: data_label: D68
type: byte[8]
name: retrieve_data
arguments: data_label: D34
type: string
name: retrieve_data
arguments: data_label: D142
type: f64
name: retrieve_data
arguments: data_label: D72
type: string
name: retrieve_data
arguments: data_label: D43
type: string
name: retrieve_data
arguments: data_label: D149
type: string
name: retrieve_data
arguments: data_label: D150
type: string
name: retrieve_data
arguments: data_label: D125
type: string

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


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

tool: D97: Error: resample_process returned %d samples


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


tool: D188: 1

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

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

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


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

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


tool: D142: 1.01

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


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


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


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


tool: D125:    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);
}
```