// File: Sleepwalking[P]world-octave/dio.cpp
// Function: (anonymous namespace)::GetF0Candidates(ZeroCrossings const*, double, double, double, double*, int, double*, double*)
void GetF0Candidates(const ZeroCrossings *zero_crossings, double boundary_f0,
  double f0_floor, double f0_ceil, double *time_axis, int time_axis_length,
  double *f0_candidates, double *f0_deviations) {
  if (0 == CheckEvent(zero_crossings->number_of_negatives - 2) *
      CheckEvent(zero_crossings->number_of_positives - 2) *
      CheckEvent(zero_crossings->number_of_peaks - 2) *
      CheckEvent(zero_crossings->number_of_dips - 2)) {
    for (int i = 0; i < time_axis_length; ++i) {
      f0_deviations[i] = world::kMaximumValue;
      f0_candidates[i] = 0.0;
    }
    return;
  }

  double *interpolated_f0_set[4];
  for (int i = 0; i < 4; ++i)
    interpolated_f0_set[i] = new double[time_axis_length];

  interp1(zero_crossings->negative_interval_locations,
      zero_crossings->negative_intervals,
      zero_crossings->number_of_negatives,
      time_axis, time_axis_length, interpolated_f0_set[0]);
  interp1(zero_crossings->positive_interval_locations,
      zero_crossings->positive_intervals,
      zero_crossings->number_of_positives,
      time_axis, time_axis_length, interpolated_f0_set[1]);
  interp1(zero_crossings->peak_interval_locations,
      zero_crossings->peak_intervals, zero_crossings->number_of_peaks,
      time_axis, time_axis_length, interpolated_f0_set[2]);
  interp1(zero_crossings->dip_interval_locations,
      zero_crossings->dip_intervals, zero_crossings->number_of_dips,
      time_axis, time_axis_length, interpolated_f0_set[3]);

  GetF0CandidatesSub(interpolated_f0_set, time_axis_length, f0_floor,
      f0_ceil, boundary_f0, f0_candidates, f0_deviations);
  for (int i = 0; i < 4; ++i) delete[] interpolated_f0_set[i];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm2, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movl %edx, -0x2c(%rbp)
movq %rcx, -0x38(%rbp)
movq %r8, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edi
subl $0x2, %edi
callq 0x4590
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rax
movl 0x28(%rax), %edi
subl $0x2, %edi
callq 0x4590
movl %eax, %ecx
movl -0x84(%rbp), %eax
imull %ecx, %eax
movl %eax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %edi
subl $0x2, %edi
callq 0x4590
movl %eax, %ecx
movl -0x80(%rbp), %eax
imull %ecx, %eax
movl %eax, -0x7c(%rbp)
movq -0x8(%rbp), %rax
movl 0x58(%rax), %edi
subl $0x2, %edi
callq 0x4590
movl -0x7c(%rbp), %ecx
imull %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x4018
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x4013
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd 0x180cd(%rip), %xmm0    # 0x1c0c0
movsd %xmm0, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movslq -0x44(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3fdb
jmp 0x415f
movl $0x0, -0x74(%rbp)
cmpl $0x4, -0x74(%rbp)
jge 0x4061
movslq -0x2c(%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, %rcx
movslq -0x74(%rbp), %rax
movq %rcx, -0x70(%rbp,%rax,8)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x401f
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x70(%rbp), %r9
callq 0x68d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x28(%rax), %edx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x68(%rbp), %r9
callq 0x68d0
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x40(%rax), %edx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x60(%rbp), %r9
callq 0x68d0
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x58(%rax), %edx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x58(%rbp), %r9
callq 0x68d0
leaq -0x70(%rbp), %rdi
movl -0x2c(%rbp), %esi
movsd -0x18(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
movsd -0x10(%rbp), %xmm2
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x45b0
movl $0x0, -0x78(%rbp)
cmpl $0x4, -0x78(%rbp)
jge 0x415f
movslq -0x78(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
je 0x4152
movq -0x90(%rbp), %rdi
callq 0x1110
jmp 0x4154
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x412a
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)