user: Translate the below assembly code into C programming language:

```asm
<HTS_set_duration>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  movsd  %xmm0,-0x58(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  ucomisd -0x58(%rbp),%xmm0
  jp     L259
  pxor   %xmm0,%xmm0
  ucomisd -0x58(%rbp),%xmm0
  jne    L259
  movl   $0x0,-0x28(%rbp)
  jmp    L289
L258:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D57(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  cvttsd2si %xmm0,%eax
  mov    %eax,(%rdx)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jg     L165
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
L165:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,-0x20(%rbp)
  addl   $0x1,-0x28(%rbp)
L289:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L258
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x20(%rbp),%xmm0
  jmp    L228
L259:
  movsd  -0x58(%rbp),%xmm1
  movsd  D57(%rip),%xmm0
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jg     L74
  mov    -0x1c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jge    L278
  lea    D54(%rip),%rax
  mov    %rax,%rsi
  mov    $0xffffffff,%edi
  call   <HTS_error@plt>
L278:
  movl   $0x0,-0x28(%rbp)
  jmp    L9
L248:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
  addl   $0x1,-0x28(%rbp)
L9:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L248
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x4c(%rbp),%xmm0
  jmp    L228
L74:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L275
L53:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x18(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  addl   $0x1,-0x28(%rbp)
L275:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L53
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1c(%rbp),%xmm0
  subsd  -0x18(%rbp),%xmm0
  divsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L138
L251:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x8(%rbp),%xmm0
  addsd  %xmm0,%xmm1
  movsd  D57(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  cvttsd2si %xmm0,%eax
  mov    %eax,(%rdx)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jg     L141
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
L141:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,-0x20(%rbp)
  addl   $0x1,-0x28(%rbp)
L138:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L251
  jmp    L254
L241:
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jle    L272
  movl   $0xffffffff,-0x24(%rbp)
  movl   $0x1,-0x28(%rbp)
  jmp    L65
L70:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D39(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  -0x8(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <abs@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  js     L177
  movsd  -0x10(%rbp),%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L47
L177:
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  movsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
L47:
  addl   $0x1,-0x28(%rbp)
L65:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L70
  addl   $0x1,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  jmp    L254
L272:
  movl   $0xffffffff,-0x24(%rbp)
  movl   $0x1,-0x28(%rbp)
  jmp    L249
L267:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jle    L143
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  D39(%rip),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  -0x8(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <abs@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  js     L255
  movsd  -0x10(%rbp),%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L143
L255:
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  movsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
L143:
  addl   $0x1,-0x28(%rbp)
L249:
  mov    -0x28(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L267
  subl   $0x1,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  sub    $0x1,%edx
  mov    %edx,(%rax)
L254:
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jne    L241
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1c(%rbp),%xmm0
L228:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D57
datatype: f64
name: disassemble_data
arguments: label: D54
datatype: string
name: disassemble_data
arguments: label: D39
datatype: f32[2]

tool: D57: 0.5

tool: D54: HTS_set_duration: Specified frame length is too short.


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

assistant: ```c
double HTS_set_duration(int *duration, double *mean, double *vari, int size, double frame_length) {
  int i, j;
  double temp1, temp2;
  double rho = 0.0;
  int sum = 0;
  int target_length;
  if (frame_length == 0.0) {
    for (i = 0; i < size; i++) {
      duration[i] = (int)(mean[i] + 0.5);
      if (duration[i] < 1)
        duration[i] = 1;
      sum += duration[i];
    }
    return (double)sum;
  }
  target_length = (int)(frame_length + 0.5);
  if (target_length <= size) {
    if (target_length < size)
      HTS_error(-1, "HTS_set_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++) {
    duration[i] = (int)(mean[i] + rho * vari[i] + 0.5);
    if (duration[i] < 1)
      duration[i] = 1;
    sum += duration[i];
  }
  while (target_length != sum) {
    if (target_length > sum) {
      j = -1;
      for (i = 1; i < size; i++) {
        temp2 = abs(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 = 1; i < size; i++) {
        if (duration[i] > 1) {
          temp2 = abs(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;
}
```