// File: Sleepwalking[P]world-octave/dio.cpp
// Function: (anonymous namespace)::FixF0Contour(double, int, int, double**, double*, int, double, double, double*)
void FixF0Contour(double frame_period, int number_of_candidates,
    int fs, double **f0_candidates, double *best_f0_contour, int f0_length,
    double f0_floor, double allowed_range, double *fixed_f0_contour) {
  // memo:
  // These are the tentative values. Optimization should be required.
  int voice_range_minimum =
    static_cast<int>(0.5 + 1000.0 / frame_period / f0_floor) * 2 + 1;

  double *f0_tmp1 = new double[f0_length];
  double *f0_tmp2 = new double[f0_length];

  FixStep1(best_f0_contour, f0_length, voice_range_minimum,
      allowed_range, f0_tmp1);
  FixStep2(f0_tmp1, f0_length, voice_range_minimum, f0_tmp2);

  int positive_count, negative_count;
  int *positive_index = new int[f0_length];
  int *negative_index = new int[f0_length];
  CountNumberOfVoicedSections(f0_tmp2, f0_length, positive_index,
      negative_index, &positive_count, &negative_count);
  FixStep3(f0_tmp2, f0_length, f0_candidates, number_of_candidates,
      allowed_range, negative_index, negative_count, f0_tmp1);
  FixStep4(f0_tmp1, f0_length, f0_candidates, number_of_candidates,
      allowed_range, positive_index, positive_count, fixed_f0_contour);

  delete[] f0_tmp1;
  delete[] f0_tmp2;
  delete[] positive_index;
  delete[] negative_index;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movsd %xmm0, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movsd %xmm1, -0x30(%rbp)
movsd %xmm2, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movsd 0x18eb0(%rip), %xmm1    # 0x1c078
divsd -0x8(%rbp), %xmm1
divsd -0x30(%rbp), %xmm1
movsd 0x18e4e(%rip), %xmm0    # 0x1c028
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
shll %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movslq -0x24(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, -0x50(%rbp)
movslq -0x24(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x44(%rbp), %edx
movsd -0x38(%rbp), %xmm0
movq -0x50(%rbp), %rcx
callq 0x4810
movq -0x50(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x44(%rbp), %edx
movq -0x58(%rbp), %rcx
callq 0x49d0
movslq -0x24(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, -0x68(%rbp)
movslq -0x24(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, -0x70(%rbp)
movq -0x58(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
leaq -0x5c(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x4aa0
movq -0x58(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x18(%rbp), %rdx
movl -0xc(%rbp), %ecx
movsd -0x38(%rbp), %xmm0
movq -0x70(%rbp), %r8
movl -0x60(%rbp), %r9d
movq -0x50(%rbp), %rax
movq %rax, (%rsp)
callq 0x4ba0
movq -0x50(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x18(%rbp), %rdx
movl -0xc(%rbp), %ecx
movsd -0x38(%rbp), %xmm0
movq -0x68(%rbp), %r8
movl -0x5c(%rbp), %r9d
movq -0x40(%rbp), %rax
movq %rax, (%rsp)
callq 0x4ce0
movq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0x333c
movq -0x78(%rbp), %rdi
callq 0x1110
movq -0x58(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
je 0x3353
movq -0x80(%rbp), %rdi
callq 0x1110
movq -0x68(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x3370
movq -0x88(%rbp), %rdi
callq 0x1110
movq -0x70(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
je 0x338d
movq -0x90(%rbp), %rdi
callq 0x1110
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)