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

```asm
<HTS_set_specified_duration>:
  endbr64
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x1,%edi
  sub    $0x8,%rsp
  movsd  D45(%rip),%xmm4
  movsd  D48(%rip),%xmm3
  addsd  %xmm4,%xmm0
  comisd %xmm0,%xmm3
  ja     L114
  movsd  D3(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L172
  subsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%rdi
  btc    $0x3f,%rdi
L114:
  cmp    %rbp,%rdi
  jbe    L122
L139:
  test   %rdi,%rdi
  js     L174
  pxor   %xmm7,%xmm7
  cvtsi2sd %rdi,%xmm7
L372:
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  movapd %xmm0,%xmm1
  test   %rbp,%rbp
  je     L173
  nopl   (%rax)
L40:
  addsd  (%rsi,%rax,8),%xmm1
  addsd  (%rdx,%rax,8),%xmm0
  mov    %rax,%r9
  lea    0x1(%rax),%rax
  cmp    %rax,%rbp
  jne    L40
  movapd %xmm7,%xmm6
  xor    %ecx,%ecx
  xor    %eax,%eax
  movabs $0x8000000000000000,%r10
  subsd  %xmm1,%xmm6
  divsd  %xmm0,%xmm6
  movsd  D3(%rip),%xmm0
  jmp    L13
  nopw   0x0(%rax,%rax,1)
L75:
  cvttsd2si %xmm2,%r8
L27:
  mov    %r8,(%rbx,%rax,8)
  add    %r8,%rcx
  lea    0x1(%rax),%r8
  cmp    %rax,%r9
  je     L288
L30:
  mov    %r8,%rax
L13:
  movsd  (%rdx,%rax,8),%xmm2
  mov    $0x1,%r8d
  mulsd  %xmm6,%xmm2
  addsd  (%rsi,%rax,8),%xmm2
  addsd  %xmm4,%xmm2
  comisd %xmm2,%xmm3
  ja     L27
  comisd %xmm0,%xmm2
  jb     L75
  movapd %xmm2,%xmm1
  subsd  %xmm0,%xmm1
  cvttsd2si %xmm1,%r8
  xor    %r10,%r8
  mov    %r8,(%rbx,%rax,8)
  add    %r8,%rcx
  lea    0x1(%rax),%r8
  cmp    %rax,%r9
  jne    L30
L288:
  cmp    %rcx,%rdi
  je     L329
  movq   D40(%rip),%xmm4
  movapd %xmm4,%xmm5
  nopl   0x0(%rax)
L310:
  cmp    %rcx,%rdi
  ja     L232
  mov    $0xffffffffffffffff,%r9
  xor    %eax,%eax
  test   %rbp,%rbp
  jne    L22
  jmp    L323
  nopl   0x0(%rax)
L4:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r8,%xmm0
L379:
  movapd %xmm6,%xmm1
  subsd  %xmm3,%xmm0
  subsd  (%rsi,%rax,8),%xmm0
  divsd  (%rdx,%rax,8),%xmm0
  subsd  %xmm0,%xmm1
  andpd  %xmm5,%xmm1
  movapd %xmm1,%xmm0
  test   %r9d,%r9d
  js     L125
  comisd %xmm1,%xmm2
  jbe    L215
L125:
  movslq %eax,%r9
  movapd %xmm0,%xmm2
L215:
  add    $0x1,%rax
  cmp    %rax,%rbp
  je     L357
L22:
  mov    (%rbx,%rax,8),%r8
  cmp    $0x1,%r8
  jbe    L215
  test   %r8,%r8
  jns    L4
  mov    %r8,%r10
  and    $0x1,%r8d
  pxor   %xmm0,%xmm0
  shr    %r10
  or     %r8,%r10
  cvtsi2sd %r10,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L379
  nopl   0x0(%rax)
L172:
  cvttsd2si %xmm0,%rdi
  cmp    %rbp,%rdi
  ja     L139
L122:
  jb     L368
L256:
  lea    (%rbx,%rbp,8),%rax
  test   %rbp,%rbp
  je     L223
  nopl   (%rax)
L316:
  movq   $0x1,(%rbx)
  add    $0x8,%rbx
  cmp    %rbx,%rax
  jne    L316
L223:
  pxor   %xmm7,%xmm7
  cvtsi2sd %rbp,%xmm7
L329:
  add    $0x8,%rsp
  movapd %xmm7,%xmm0
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L174:
  mov    %rdi,%rax
  mov    %rdi,%rcx
  pxor   %xmm7,%xmm7
  shr    %rax
  and    $0x1,%ecx
  or     %rcx,%rax
  cvtsi2sd %rax,%xmm7
  addsd  %xmm7,%xmm7
  jmp    L372
  nopl   0x0(%rax)
L232:
  test   %rbp,%rbp
  je     L77
  mov    $0xffffffffffffffff,%r9
  xor    %eax,%eax
  jmp    L309
  nopl   0x0(%rax)
L211:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r8,%xmm0
L88:
  movapd %xmm6,%xmm1
  addsd  %xmm3,%xmm0
  subsd  (%rsi,%rax,8),%xmm0
  divsd  (%rdx,%rax,8),%xmm0
  subsd  %xmm0,%xmm1
  andpd  %xmm4,%xmm1
  movapd %xmm1,%xmm0
  test   %r9d,%r9d
  js     L267
  comisd %xmm1,%xmm2
  jbe    L100
L267:
  movslq %eax,%r9
  movapd %xmm0,%xmm2
L100:
  add    $0x1,%rax
  cmp    %rax,%rbp
  je     L339
L309:
  mov    (%rbx,%rax,8),%r8
  test   %r8,%r8
  jns    L211
  mov    %r8,%r10
  and    $0x1,%r8d
  pxor   %xmm0,%xmm0
  shr    %r10
  or     %r8,%r10
  cvtsi2sd %r10,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L88
  nop
L339:
  shl    $0x3,%r9
L304:
  addq   $0x1,(%rbx,%r9,1)
  add    $0x1,%rcx
L188:
  cmp    %rdi,%rcx
  jne    L310
  add    $0x8,%rsp
  movapd %xmm7,%xmm0
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L357:
  shl    $0x3,%r9
L295:
  subq   $0x1,(%rbx,%r9,1)
  sub    $0x1,%rcx
  jmp    L188
  nopw   0x0(%rax,%rax,1)
L323:
  mov    $0xfffffffffffffff8,%r9
  jmp    L295
  nopl   0x0(%rax)
L77:
  mov    $0xfffffffffffffff8,%r9
  jmp    L304
L368:
  lea    D29(%rip),%rsi
  mov    $0xffffffff,%edi
  call   <HTS_error@plt>
  jmp    L256
L173:
  pxor   %xmm2,%xmm2
  movapd %xmm7,%xmm6
  xor    %ecx,%ecx
  divsd  %xmm2,%xmm6
  jmp    L288
```

tool_calls: name: disassemble_data
arguments: label: D45
type_guessed: f64
name: disassemble_data
arguments: label: D48
type_guessed: f64
name: disassemble_data
arguments: label: D3
type_guessed: f32[2]
name: disassemble_data
arguments: label: D40
type_guessed: qword
name: disassemble_data
arguments: label: D29
type_guessed: string

tool: D45: 0.5

tool: D48: 1

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

tool: D40: 9223372036854775807

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


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;
}
```