// File: /workspace/github_cpp_makefile_star2_O1/matteotiziano[P]simple-wavelet/wavelet.cpp
// Function: Wavelet<double>::Convdown(Matrix<double> const&, std::vector<double, std::allocator<double>> const&, Matrix<double>&, Matrix<double>&) const
void Wavelet<T>::Convdown(const Matrix<T>& x, const std::vector<T>& f, Matrix<T>& xL, Matrix<T>& xH) const {
  // Compute size of subbands
  const size_t num_rows_subband = static_cast<size_t>(std::ceil(static_cast<double>(x.GetNumRows()) / 2.0));
  const size_t num_cols_subband = static_cast<size_t>(std::ceil(static_cast<double>(x.GetNumColumns()) / 2.0));
  // Convolve and decimate each row with the chosen filter
  Matrix<T> tmp(x.GetNumRows(), num_cols_subband);
  for (size_t i = 0; i < x.GetNumRows(); i++) {
    const std::vector<T> row = Convdown(x.GetRow(i), f);
    tmp.SetRow(row, i);
  }
  // Compute high-pass subband of pre-filtered tmp matrix
  xH = Matrix<T>(num_rows_subband, num_cols_subband);
  for (size_t j = 0; j < tmp.GetNumColumns(); j++) {
    const std::vector<T> column = Convdown(tmp.GetColumn(j), Hi_D_);
    xH.SetColumn(column, j);
  }
  // Compute low-pass subband of pre-filtered tmp matrix
  xL = Matrix<T>(num_rows_subband, num_cols_subband);
  for (size_t j = 0; j < tmp.GetNumColumns(); j++) {
    const std::vector<T> column = Convdown(tmp.GetColumn(j), Lo_D_);
    xL.SetColumn(column, j);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r8, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x62ac
movq %rax, %xmm1
punpckldq 0x4a6f(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x4a77(%rip), %xmm1     # 0x9120
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x4a73(%rip), %xmm0     # 0x9130
callq 0x2060
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x4a62(%rip), %xmm0     # 0x9138
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x48(%rsp)
movq %r12, %rdi
callq 0x62b0
movq %rax, %xmm1
punpckldq 0x4a15(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x4a1d(%rip), %xmm1     # 0x9120
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x4a19(%rip), %xmm0     # 0x9130
callq 0x2060
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x4a08(%rip), %xmm0     # 0x9138
cvttsd2si %xmm0, %rbx
andq %rcx, %rbx
orq %rax, %rbx
movq %r12, %rdi
callq 0x62ac
leaq 0x60(%rsp), %rdi
xorpd %xmm0, %xmm0
movq %rax, %rsi
movq %rbx, 0x40(%rsp)
movq %rbx, %rdx
callq 0x6134
xorl %ebx, %ebx
movq %rsp, %r15
leaq 0x18(%rsp), %r13
movq %r12, %rdi
callq 0x62ac
cmpq %rax, %rbx
jae 0x47d4
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x6780
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x3dfc
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x47a8
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x60(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x658c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x47cf
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
incq %rbx
jmp 0x4766
leaq 0x18(%rsp), %rdi
xorpd %xmm0, %xmm0
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdx
callq 0x6134
leaq 0x28(%rsp), %rsi
movupd -0x10(%rsi), %xmm0
movq 0x58(%rsp), %rax
movupd %xmm0, (%rax)
leaq 0x10(%rax), %rdi
callq 0x357c
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x6292
leaq 0x18(%r14), %r13
xorl %ebx, %ebx
leaq 0x60(%rsp), %rbp
movq %rsp, %r15
movq %rbp, %rdi
callq 0x62b0
cmpq %rax, %rbx
jae 0x4891
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x682c
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x3dfc
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4865
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x58(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x666c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x488c
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
incq %rbx
jmp 0x4823
leaq 0x18(%rsp), %rdi
xorpd %xmm0, %xmm0
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdx
callq 0x6134
leaq 0x28(%rsp), %rsi
movupd -0x10(%rsi), %xmm0
movq 0x50(%rsp), %rax
movupd %xmm0, (%rax)
leaq 0x10(%rax), %rdi
callq 0x357c
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x6292
xorl %ebx, %ebx
leaq 0x60(%rsp), %r12
movq %rsp, %r13
movq %r12, %rdi
callq 0x62b0
cmpq %rax, %rbx
jae 0x494a
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x682c
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x3dfc
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x491e
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x50(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x666c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x4945
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
incq %rbx
jmp 0x48dc
leaq 0x60(%rsp), %rdi
callq 0x6292
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x496a
jmp 0x49bc
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6292
jmp 0x49bf
jmp 0x49bc
jmp 0x4987
jmp 0x499b
jmp 0x49bc
jmp 0x4987
jmp 0x499b
jmp 0x49bc
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x49bf
movq 0x28(%rsp), %rsi
jmp 0x49ac
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x49bf
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x49bf
jmp 0x49bc
jmp 0x49bc
jmp 0x49bc
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x6292
movq %rbx, %rdi
callq 0x22d0
nop