// File: /workspace/github_c_makefile_star2_O2/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 0x95e0
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 0x26736
cmpl %edx, %r15d
movl %edx, 0x4(%rsp)
movl %edx, %eax
cmovll %r15d, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x9450
divsd 0x7c1c(%rip), %xmm0     # 0x2e2f8
callq 0x98f0
cvtsi2sd %ebx, %xmm1
subsd %xmm1, %xmm0
addsd 0x7bff(%rip), %xmm0     # 0x2e2f0
ucomisd 0x6b3f(%rip), %xmm0     # 0x2d238
jbe 0x2672e
movsd 0x8(%rsp), %xmm0
movsd %xmm1, 0x8(%rsp)
callq 0x9450
divsd 0x7be4(%rip), %xmm0     # 0x2e2f8
callq 0x98f0
subsd 0x8(%rsp), %xmm0
addsd 0x7bc9(%rip), %xmm0     # 0x2e2f0
cvttsd2si %xmm0, %r13d
jmp 0x26732
pushq $0x1
popq %r13
movl 0x4(%rsp), %edx
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)
orl $-0x1, 0x34(%r14)
leal 0x1(%r13), %eax
movl %eax, 0x38(%r14)
movl %ebx, 0x3c(%r14)
movslq %r12d, %r15
leaq (,%r15,4), %r12
movq %r12, %rdi
callq 0x95e0
movq %rax, 0x40(%r14)
movl 0x38(%r14), %eax
subl 0x34(%r14), %eax
incl %eax
movslq %eax, %rdi
imulq %r12, %rdi
callq 0x95e0
movq %rax, 0x48(%r14)
movslq 0x38(%r14), %rdi
movslq 0x34(%r14), %rax
subq %rax, %rdi
imulq %r12, %rdi
callq 0x95e0
movq %rax, 0x50(%r14)
movslq 0x38(%r14), %rdi
movslq 0x34(%r14), %rax
subq %rax, %rdi
imulq %r15, %rdi
shlq $0x3, %rdi
callq 0x95e0
movq %rax, 0xb0(%r14)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
cvtsi2sd %r13d, %xmm1
movq %rax, (%r14)
movsd 0x6a52(%rip), %xmm0     # 0x2d238
divsd %xmm1, %xmm0
callq 0x9040
movsd %xmm0, 0x10(%r14)
movsd 0x7b03(%rip), %xmm2     # 0x2e300
mulsd %xmm0, %xmm2
movsd %xmm2, 0x8(%r14)
mulsd %xmm0, %xmm0
movsd 0x6a25(%rip), %xmm3     # 0x2d238
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
subsd %xmm1, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
movapd %xmm3, %xmm0
jb 0x26833
sqrtsd %xmm0, %xmm0
jmp 0x26844
movsd %xmm2, 0x10(%rsp)
callq 0x9a00
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)
andq $0x0, 0x88(%r14)
movsd 0x7a94(%rip), %xmm0     # 0x2e308
movups %xmm0, 0x90(%r14)
movapd 0x7acc(%rip), %xmm0     # 0x2e350
movupd %xmm0, 0xa0(%r14)
decl %ebx
movl %ebx, 0xb8(%r14)
leaq 0x10ec3(%rip), %rbx     # 0x37760
xorl %r15d, %r15d
cmpq $0x101, %r15            # imm = 0x101
je 0x268c8
cvtsi2sd %r15d, %xmm0
mulsd 0x7a5a(%rip), %xmm0     # 0x2e310
callq 0x9ae0
movsd %xmm0, (%rbx)
incq %r15
addq $0x8, %rbx
jmp 0x268a0
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq