// File: /workspace/github_cpp_makefile_star2_O3/Sleepwalking[P]world-octave/common.cpp
// Function: DCCorrection(double*, double, int, int, double*)
void DCCorrection(double *input, double current_f0, int fs, int fft_size,
    double *output) {
  int upper_limit = 1 +
    static_cast<int>(1.2 * current_f0 * fft_size / fs);
  double *low_frequency_replica = new double[upper_limit];
  double *low_frequency_axis = new double[upper_limit];

  for (int i = 0; i < upper_limit; ++i)
    low_frequency_axis[i] = static_cast<double>(i) * fs / fft_size;

  int upper_limit_replica = 1 + static_cast<int>(current_f0 * fft_size / fs);
  interp1Q(current_f0 - low_frequency_axis[0],
      -static_cast<double>(fs) / fft_size, input, upper_limit + 1,
      low_frequency_axis, upper_limit_replica, low_frequency_replica);

  for (int i = 0; i < upper_limit_replica; ++i)
    output[i] = input[i] + low_frequency_replica[i];

  delete[] low_frequency_replica;
  delete[] low_frequency_axis;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movsd 0xdd06(%rip), %xmm1     # 0xf018
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm1
cvtsi2sd %edx, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movsd %xmm2, (%rsp)
mulsd %xmm2, %xmm1
movapd %xmm0, 0x10(%rsp)
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r13d
movq %rdi, %r14
leal 0x1(%r13), %ebp
movslq %ebp, %rax
shlq $0x3, %rax
cmpl $-0x1, %r13d
movq $-0x1, %r12
cmovgeq %rax, %r12
movq %r12, %rdi
callq 0x1030
movq %rax, %r15
movq %r12, %rdi
callq 0x1030
movq %r13, %rsi
movq %rax, %r12
testl %esi, %esi
js 0x1449
movl %ebp, %ecx
leaq 0x1(%rcx), %rax
andq $-0x2, %rax
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0xdcc3(%rip), %xmm8     # 0xf060
xorl %ecx, %ecx
movdqa 0xdcc9(%rip), %xmm2     # 0xf070
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0xdcc9(%rip), %xmm4     # 0xf080
movapd 0x10(%rsp), %xmm1
movsd (%rsp), %xmm9
movdqa %xmm8, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edx
notl %edx
testb $0x1, %dl
je 0x140b
xorps %xmm6, %xmm6
cvtsi2sd %ecx, %xmm6
mulsd %xmm1, %xmm6
divsd %xmm9, %xmm6
movsd %xmm6, (%r12,%rcx,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x1433
leal 0x1(%rcx), %edx
xorps %xmm5, %xmm5
cvtsi2sd %edx, %xmm5
mulsd %xmm1, %xmm5
divsd %xmm9, %xmm5
movsd %xmm5, 0x8(%r12,%rcx,8)
addq $0x2, %rcx
paddq %xmm4, %xmm8
cmpq %rcx, %rax
jne 0x13c3
movsd (%r12), %xmm2
jmp 0x1455
movapd 0x10(%rsp), %xmm1
movsd (%rsp), %xmm9
movapd %xmm9, %xmm3
movsd 0x8(%rsp), %xmm0
mulsd %xmm0, %xmm3
divsd %xmm1, %xmm3
cvttsd2si %xmm3, %r13d
leal 0x1(%r13), %ebp
subsd %xmm2, %xmm0
xorpd 0xdc13(%rip), %xmm1     # 0xf090
divsd %xmm9, %xmm1
addl $0x2, %esi
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %ecx
movq %r15, %r8
callq 0x4bd0
testl %r13d, %r13d
js 0x14b7
movl %ebp, %eax
xorl %ecx, %ecx
movsd (%r14,%rcx,8), %xmm0
addsd (%r15,%rcx,8), %xmm0
movsd %xmm0, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x149e
movq %r15, %rdi
callq 0x1110
movq %r12, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1110