// File: /workspace/github_c_makefile_star2_O3/zpole[P]IICV/vl/sift.c
// Function: vl_sift_process_next_octave
VL_EXPORT
int
vl_sift_process_next_octave (VlSiftFilt *f)
{

  int s, h, w, s_best ;
  double sa, sb ;
  vl_sift_pix *octave, *pt ;

  /* shortcuts */
  vl_sift_pix *temp   = f-> temp ;
  int O               = f-> O ;
  int S               = f-> S ;
  int o_min           = f-> o_min ;
  int s_min           = f-> s_min ;
  int s_max           = f-> s_max ;
  double sigma0       = f-> sigma0 ;
  double sigmak       = f-> sigmak ;
  double dsigma0      = f-> dsigma0 ;

  /* is there another octave ? */
  if (f->o_cur == o_min + O - 1)
    return VL_ERR_EOF ;

  /* retrieve base */
  s_best = VL_MIN(s_min + S, s_max) ;
  w      = vl_sift_get_octave_width  (f) ;
  h      = vl_sift_get_octave_height (f) ;
  pt     = vl_sift_get_octave        (f, s_best) ;
  octave = vl_sift_get_octave        (f, s_min) ;

  /* next octave */
  copy_and_downsample (octave, pt, w, h, 1) ;

  f-> o_cur            += 1 ;
  f-> nkeys             = 0 ;
  w = f-> octave_width  = VL_SHIFT_LEFT(f->width,  - f->o_cur) ;
  h = f-> octave_height = VL_SHIFT_LEFT(f->height, - f->o_cur) ;

  sa = sigma0 * powf (sigmak, s_min     ) ;
  sb = sigma0 * powf (sigmak, s_best - S) ;

  if (sa > sb) {
    double sd = sqrt (sa*sa - sb*sb) ;
    _vl_sift_smooth (f, octave, temp, octave, w, h, sd) ;
  }

  /* ------------------------------------------------------------------
   *                                                        Fill octave
   * --------------------------------------------------------------- */

  for(s = s_min + 1 ; s <= s_max ; ++s) {
    double sd = dsigma0 * pow (sigmak, s) ;
    _vl_sift_smooth (f, vl_sift_get_octave(f, s), temp,
                     vl_sift_get_octave(f, s - 1), w, h, sd) ;
  }

  return VL_ERR_OK ;
}

// Assembly:
movl 0x28(%rdi), %eax
movl 0x30(%rdi), %edx
movl 0x3c(%rdi), %ecx
addl %eax, %edx
decl %edx
movl $0x5, %eax
cmpl %edx, %ecx
je 0x2bcf4
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %r14
movl 0x2c(%rdi), %eax
movl 0x34(%rdi), %ebp
movl 0x38(%rdi), %r15d
movsd 0x8(%rdi), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rdi), %xmm1
movq %rax, 0x20(%rsp)
leal (%rax,%rbp), %r13d
cmpl %r15d, %r13d
cmovgel %r15d, %r13d
movsd 0x18(%rdi), %xmm2
movslq 0x5c(%rdi), %rax
movq 0x48(%rdi), %r12
testq %rax, %rax
jle 0x2bb84
movslq 0x58(%rbx), %rdx
movl %r13d, %esi
subl %ebp, %esi
movl %eax, %edi
imull %edx, %edi
imull %esi, %edi
movslq %edi, %rsi
leaq (%r12,%rsi,4), %rsi
leal -0x1(%rdx), %edi
xorl %r8d, %r8d
movq %r12, %r9
testl %edi, %edi
jle 0x2bb7b
movq %r8, %r10
imulq %rdx, %r10
leaq (%rsi,%r10,4), %r10
xorl %r11d, %r11d
movss (%r10), %xmm0
movss %xmm0, (%r9)
addq $0x4, %r9
addq $0x8, %r10
addl $0x2, %r11d
cmpl %edi, %r11d
jl 0x2bb60
addq $0x2, %r8
cmpq %rax, %r8
jb 0x2bb4e
movl %r13d, 0x4(%rsp)
movq %r12, 0x10(%rsp)
leal 0x1(%rcx), %eax
movl %eax, 0x3c(%rbx)
movl $0x0, 0x80(%rbx)
testl %ecx, %ecx
movsd %xmm2, 0x28(%rsp)
js 0x2bbba
movl 0x20(%rbx), %r12d
movl 0x24(%rbx), %r13d
movl %eax, %ecx
sarl %cl, %r12d
sarl %cl, %r13d
jmp 0x2bbca
notb %cl
movl 0x20(%rbx), %r12d
movl 0x24(%rbx), %r13d
shll %cl, %r12d
shll %cl, %r13d
movl %r12d, 0x58(%rbx)
movsd %xmm1, 0x30(%rsp)
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, (%rsp)
movl %r13d, 0x5c(%rbx)
xorps %xmm1, %xmm1
cvtsi2ss %ebp, %xmm1
callq 0x9720
cvtss2sd %xmm0, %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movl 0x4(%rsp), %eax
subl 0x20(%rsp), %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
movss (%rsp), %xmm0
callq 0x9720
movsd 0x18(%rsp), %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x8(%rsp), %xmm0
ucomisd %xmm0, %xmm1
movslq %r12d, %r12
movslq %r13d, %r13
jbe 0x2bc76
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
subsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x2bc54
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x2bc5d
movapd %xmm1, %xmm0
callq 0x9990
movq %rbx, %rdi
movq 0x10(%rsp), %rcx
movq %rcx, %rsi
movq %r14, %rdx
movq %r12, %r8
movq %r13, %r9
callq 0x2b8d8
xorl %eax, %eax
cmpl %r15d, %ebp
jge 0x2bce6
negl %r15d
incl %ebp
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
movsd 0x30(%rsp), %xmm0
callq 0x9270
mulsd 0x28(%rsp), %xmm0
movl 0x5c(%rbx), %eax
imull 0x58(%rbx), %eax
movq 0x48(%rbx), %rcx
movl %ebp, %edx
subl 0x34(%rbx), %edx
movl %edx, %esi
imull %eax, %esi
movslq %esi, %rsi
leaq (%rcx,%rsi,4), %rsi
decl %edx
imull %eax, %edx
movslq %edx, %rax
leaq (%rcx,%rax,4), %rcx
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %r8
movq %r13, %r9
callq 0x2b8d8
leal (%r15,%rbp), %eax
incl %eax
movl %ebp, %ecx
incl %ecx
movl %ecx, %ebp
cmpl $0x1, %eax
jne 0x2bc82
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq