// File: /workspace/github_c_makefile_star2_O3/zpole[P]IICV/vl/sift.c
// Function: vl_sift_new
VL_EXPORT
VlSiftFilt *
vl_sift_new (int width, int height,
             int noctaves, int nlevels,
             int o_min)
{
  VlSiftFilt *f = vl_malloc (sizeof(VlSiftFilt)) ;

  int w   = VL_SHIFT_LEFT (width,  -o_min) ;
  int h   = VL_SHIFT_LEFT (height, -o_min) ;
  int nel = w * h ;

  /* negative value O => calculate max. value */
  if (noctaves < 0) {
    noctaves = VL_MAX (floor (log2 (VL_MIN(width, height))) - o_min - 3, 1) ;
  }

  f-> width   = width ;
  f-> height  = height ;
  f-> O       = noctaves ;
  f-> S       = nlevels ;
  f-> o_min   = o_min ;
  f-> s_min   = -1 ;
  f-> s_max   = nlevels + 1 ;
  f-> o_cur   = o_min ;

  f-> temp    = vl_malloc (sizeof(vl_sift_pix) * nel    ) ;
  f-> octave  = vl_malloc (sizeof(vl_sift_pix) * nel
                        * (f->s_max - f->s_min + 1)  ) ;
  f-> dog     = vl_malloc (sizeof(vl_sift_pix) * nel
                        * (f->s_max - f->s_min    )  ) ;
  f-> grad    = vl_malloc (sizeof(vl_sift_pix) * nel * 2
                        * (f->s_max - f->s_min    )  ) ;

  f-> sigman  = 0.5 ;
  f-> sigmak  = pow (2.0, 1.0 / nlevels) ;
  f-> sigma0  = 1.6 * f->sigmak ;
  f-> dsigma0 = f->sigma0 * sqrt (1.0 - 1.0 / (f->sigmak*f->sigmak)) ;

  f-> gaussFilter = NULL ;
  f-> gaussFilterSigma = 0 ;
  f-> gaussFilterWidth = 0 ;

  f-> octave_width  = 0 ;
  f-> octave_height = 0 ;

  f-> keys     = 0 ;
  f-> nkeys    = 0 ;
  f-> keys_res = 0 ;

  f-> peak_thresh = 0.0 ;
  f-> edge_thresh = 10.0 ;
  f-> norm_thresh = 0.0 ;
  f-> magnif      = 3.0 ;
  f-> windowSize  = NBP / 2 ;

  f-> grad_o  = o_min - 1 ;

  /* initialize fast_expn stuff */
  fast_expn_init () ;

  return f ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebx
movq %rcx, 0x10(%rsp)
movl %edx, %r13d
movl %esi, %ebp
movl %edi, %r15d
movl $0xc0, %edi
callq 0x95b0
movl %ebx, %edx
negb %dl
movl %r15d, %esi
movl %edx, %ecx
shll %cl, %esi
movl %r15d, %r12d
movl %ebx, %ecx
sarl %cl, %r12d
movl %ebp, %edi
movl %edx, %ecx
movl %ebp, %edx
shll %cl, %edi
movl %ebx, %ecx
sarl %cl, %ebp
testl %ebx, %ebx
cmovlel %esi, %r12d
movq %rax, %r14
cmovlel %edi, %ebp
testl %r13d, %r13d
jns 0x2b33a
cmpl %edx, %r15d
movl %edx, %eax
cmovll %r15d, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
movl %edx, 0x4(%rsp)
callq 0x9430
divsd 0x809c(%rip), %xmm0     # 0x33378
callq 0x9880
movl 0x4(%rsp), %edx
cvtsi2sd %ebx, %xmm1
subsd %xmm1, %xmm0
addsd 0x807b(%rip), %xmm0     # 0x33370
movl $0x1, %r13d
ucomisd 0x6f6d(%rip), %xmm0     # 0x32270
jbe 0x2b33a
movsd 0x8(%rsp), %xmm0
movsd %xmm1, 0x8(%rsp)
callq 0x9430
divsd 0x805a(%rip), %xmm0     # 0x33378
callq 0x9880
movl 0x4(%rsp), %edx
subsd 0x8(%rsp), %xmm0
addsd 0x803b(%rip), %xmm0     # 0x33370
cvttsd2si %xmm0, %r13d
imull %ebp, %r12d
movl %r15d, 0x20(%r14)
movl %edx, 0x24(%r14)
movl %r13d, 0x28(%r14)
movq 0x10(%rsp), %r13
movl %r13d, 0x2c(%r14)
movl %ebx, 0x30(%r14)
movl $0xffffffff, 0x34(%r14) # imm = 0xFFFFFFFF
leal 0x1(%r13), %eax
movl %eax, 0x38(%r14)
movl %ebx, 0x3c(%r14)
movslq %r12d, %r15
leaq (,%r15,4), %r12
movq %r12, %rdi
callq 0x95b0
movq %rax, 0x40(%r14)
movl 0x38(%r14), %eax
subl 0x34(%r14), %eax
incl %eax
movslq %eax, %rdi
imulq %r12, %rdi
callq 0x95b0
movq %rax, 0x48(%r14)
movslq 0x38(%r14), %rdi
movslq 0x34(%r14), %rax
subq %rax, %rdi
imulq %r12, %rdi
callq 0x95b0
movq %rax, 0x50(%r14)
movslq 0x38(%r14), %rdi
movslq 0x34(%r14), %rax
subq %rax, %rdi
imulq %r15, %rdi
shlq $0x3, %rdi
callq 0x95b0
movq %rax, 0xb0(%r14)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
movq %rax, (%r14)
movsd 0x6e80(%rip), %xmm0     # 0x32270
divsd %xmm1, %xmm0
callq 0x9040
movsd %xmm0, 0x10(%r14)
movsd 0x7f79(%rip), %xmm2     # 0x33380
mulsd %xmm0, %xmm2
movsd %xmm2, 0x8(%r14)
mulsd %xmm0, %xmm0
movsd 0x6e53(%rip), %xmm3     # 0x32270
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
subsd %xmm1, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
movapd %xmm3, %xmm0
jb 0x2b43d
sqrtsd %xmm0, %xmm0
jmp 0x2b44e
movsd %xmm2, 0x10(%rsp)
callq 0x9990
movsd 0x10(%rsp), %xmm2
mulsd %xmm0, %xmm2
movsd %xmm2, 0x18(%r14)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x58(%r14)
movupd %xmm0, 0x68(%r14)
movupd %xmm0, 0x78(%r14)
movq $0x0, 0x88(%r14)
movsd 0x7f07(%rip), %xmm0     # 0x33388
movups %xmm0, 0x90(%r14)
movapd 0x7f3f(%rip), %xmm0     # 0x333d0
movupd %xmm0, 0xa0(%r14)
decl %ebx
movl %ebx, 0xb8(%r14)
leaq 0x10276(%rip), %rbx     # 0x3b720
xorl %r15d, %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
mulsd 0x7ed3(%rip), %xmm0     # 0x33390
callq 0x9a60
movsd %xmm0, (%rbx)
incq %r15
addq $0x8, %rbx
cmpq $0x101, %r15            # imm = 0x101
jne 0x2b4ad
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq