// File: Sleepwalking[P]world-octave/dio.cpp
// Function: (anonymous namespace)::GetF0CandidatesSub(double**, int, double, double, double, double*, double*)
void GetF0CandidatesSub(double **interpolated_f0_set, int time_axis_length,
    double f0_floor, double f0_ceil, double boundary_f0,
    double *f0_candidates, double *f0_deviations) {
  for (int i = 0; i < time_axis_length; ++i) {
    f0_candidates[i] = (interpolated_f0_set[0][i] +
      interpolated_f0_set[1][i] + interpolated_f0_set[2][i] +
      interpolated_f0_set[3][i]) / 4.0;

    f0_deviations[i] = sqrt(((interpolated_f0_set[0][i] - f0_candidates[i]) *
      (interpolated_f0_set[0][i] - f0_candidates[i]) +
      (interpolated_f0_set[1][i] - f0_candidates[i]) *
      (interpolated_f0_set[1][i] - f0_candidates[i]) +
      (interpolated_f0_set[2][i] - f0_candidates[i]) *
      (interpolated_f0_set[2][i] - f0_candidates[i]) +
      (interpolated_f0_set[3][i] - f0_candidates[i]) *
      (interpolated_f0_set[3][i] - f0_candidates[i])) / 3.0);

    if (f0_candidates[i] > boundary_f0 ||
        f0_candidates[i] < boundary_f0 / 2.0 ||
        f0_candidates[i] > f0_ceil || f0_candidates[i] < f0_floor) {
      f0_candidates[i] = 0.0;
      f0_deviations[i] = world::kMaximumValue;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x20(%rbp)
movsd %xmm2, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x4806
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x3c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x3c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd 0x17a9c(%rip), %xmm1    # 0x1c0d0
divsd %xmm1, %xmm0
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm2
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm3
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x17971(%rip), %xmm1    # 0x1c0c8
divsd %xmm1, %xmm0
callq 0x1090
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x28(%rbp), %xmm0
ja 0x47d1
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0x28(%rbp), %xmm0
movsd 0x1786d(%rip), %xmm2    # 0x1c008
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
ja 0x47d1
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x20(%rbp), %xmm0
ja 0x47d1
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x47f6
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd 0x178cf(%rip), %xmm0    # 0x1c0c0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x47f8
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x45dd
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)