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

```asm
<HTS_set_specified_duration>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  movsd  %xmm0,-0x68(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movq   $0x0,-0x18(%rbp)
  movsd  -0x68(%rbp),%xmm1
  movsd  D20(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movsd  D3(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L376
  movq   $0x1,-0x10(%rbp)
  jmp    L112
L376:
  movsd  -0x68(%rbp),%xmm1
  movsd  D20(%rip),%xmm0
  addsd  %xmm1,%xmm0
  comisd D131(%rip),%xmm0
  jae    L307
  cvttsd2si %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L159
L307:
  movsd  D131(%rip),%xmm1
  subsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  movabs $0x8000000000000000,%rax
  xor    %rax,-0x10(%rbp)
L159:
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L112:
  mov    -0x10(%rbp),%rax
  cmp    -0x60(%rbp),%rax
  ja     L169
  mov    -0x10(%rbp),%rax
  cmp    -0x60(%rbp),%rax
  jae    L257
  lea    D105(%rip),%rax
  mov    %rax,%rsi
  mov    $0xffffffff,%edi
  call   <HTS_error@plt>
L257:
  movq   $0x0,-0x30(%rbp)
  jmp    L96
L220:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movq   $0x1,(%rax)
  addq   $0x1,-0x30(%rbp)
L96:
  mov    -0x30(%rbp),%rax
  cmp    -0x60(%rbp),%rax
  jb     L220
  mov    -0x60(%rbp),%rax
  test   %rax,%rax
  js     L124
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L163
L124:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L163
L169:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L225
L271:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x28(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x20(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  addq   $0x1,-0x30(%rbp)
L225:
  mov    -0x30(%rbp),%rax
  cmp    -0x60(%rbp),%rax
  jb     L271
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  js     L211
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L212
L211:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L212:
  subsd  -0x28(%rbp),%xmm0
  divsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L18
L311:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x8(%rbp),%xmm0
  addsd  %xmm0,%xmm1
  movsd  D20(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  D3(%rip),%xmm0
  comisd -0x28(%rbp),%xmm0
  jbe    L177
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movq   $0x1,(%rax)
  jmp    L40
L177:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  movsd  -0x28(%rbp),%xmm0
  comisd D131(%rip),%xmm0
  jae    L44
  movsd  -0x28(%rbp),%xmm0
  cvttsd2si %xmm0,%rax
  jmp    L49
L44:
  movsd  -0x28(%rbp),%xmm0
  movsd  D131(%rip),%xmm1
  subsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%rax
  movabs $0x8000000000000000,%rcx
  xor    %rcx,%rax
L49:
  mov    %rax,(%rdx)
L40:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    %rax,-0x18(%rbp)
  addq   $0x1,-0x30(%rbp)
L18:
  mov    -0x30(%rbp),%rax
  cmp    -0x60(%rbp),%rax
  jb     L311
  jmp    L318
L16:
  mov    -0x10(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jbe    L213
  movl   $0xffffffff,-0x34(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L91
L316:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  js     L198
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L108
L198:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L108:
  movsd  D3(%rip),%xmm1
  addsd  %xmm1,%xmm0
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  -0x8(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movq   D135(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  js     L193
  movsd  -0x28(%rbp),%xmm0
  comisd -0x20(%rbp),%xmm0
  jbe    L180
L193:
  mov    -0x30(%rbp),%rax
  mov    %eax,-0x34(%rbp)
  movsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x28(%rbp)
L180:
  addq   $0x1,-0x30(%rbp)
L91:
  mov    -0x30(%rbp),%rax
  cmp    -0x60(%rbp),%rax
  jb     L316
  addq   $0x1,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  add    $0x1,%rdx
  mov    %rdx,(%rax)
  jmp    L318
L213:
  movl   $0xffffffff,-0x34(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L368
L38:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  cmp    $0x1,%rax
  jbe    L9
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  js     L347
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L28
L347:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L28:
  movsd  D3(%rip),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  -0x8(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movq   D135(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  js     L337
  movsd  -0x28(%rbp),%xmm0
  comisd -0x20(%rbp),%xmm0
  jbe    L9
L337:
  mov    -0x30(%rbp),%rax
  mov    %eax,-0x34(%rbp)
  movsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x28(%rbp)
L9:
  addq   $0x1,-0x30(%rbp)
L368:
  mov    -0x30(%rbp),%rax
  cmp    -0x60(%rbp),%rax
  jb     L38
  subq   $0x1,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  sub    $0x1,%rdx
  mov    %rdx,(%rax)
L318:
  mov    -0x10(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jne    L16
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  js     L372
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L163
L372:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L163:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D20
datatype: f64
name: unpack_data
arguments: data_label: D3
datatype: f64
name: unpack_data
arguments: data_label: D131
datatype: f32[4]
name: unpack_data
arguments: data_label: D105
datatype: string
name: unpack_data
arguments: data_label: D135
datatype: qword

tool: D20: 0.5

tool: D3: 1

tool: {"D131": [0.0,448.0,null,null]}

tool: D105: HTS_set_specified_duration: Specified frame length is too short.


tool: D135: 9223372036854775807

assistant: ```c
double HTS_set_specified_duration(size_t *duration, double *mean, double *vari, size_t size, double frame_length) {
  size_t i;
  int j;
  double temp1, temp2;
  double rho = 0.0;
  size_t sum = 0;
  size_t target_length;
  if (frame_length + 0.5 < 1.0)
    target_length = 1;
  else
    target_length = (size_t)(frame_length + 0.5);
  if (target_length <= size) {
    if (target_length < size)
      HTS_error(-1, "HTS_set_specified_duration: Specified frame length is too short.\n");
    for (i = 0; i < size; i++)
      duration[i] = 1;
    return (double)size;
  }
  temp1 = 0.0;
  temp2 = 0.0;
  for (i = 0; i < size; i++) {
    temp1 += mean[i];
    temp2 += vari[i];
  }
  rho = ((double)target_length - temp1) / temp2;
  for (i = 0; i < size; i++) {
    temp1 = mean[i] + rho * vari[i] + 0.5;
    if (temp1 < 1.0)
      duration[i] = 1;
    else
      duration[i] = (size_t)temp1;
    sum += duration[i];
  }
  while (target_length != sum) {
    if (target_length > sum) {
      j = -1;
      for (i = 0; i < size; i++) {
        temp2 = fabs(rho - ((double)duration[i] + 1 - mean[i]) / vari[i]);
        if (j < 0 || temp1 > temp2) {
          j = i;
          temp1 = temp2;
        }
      }
      sum++;
      duration[j]++;
    } else {
      j = -1;
      for (i = 0; i < size; i++) {
        if (duration[i] > 1) {
          temp2 = fabs(rho - ((double)duration[i] - 1 - mean[i]) / vari[i]);
          if (j < 0 || temp1 > temp2) {
            j = i;
            temp1 = temp2;
          }
        }
      }
      sum--;
      duration[j]--;
    }
  }
  return (double)target_length;
}
```