// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/sift.c
// Function: vl_sift_process_first_octave
VL_EXPORT
int
vl_sift_process_first_octave (VlSiftFilt *f, vl_sift_pix const *im)
{
  int o, s, h, w ;
  double sa, sb ;
  vl_sift_pix *octave ;

  /* shortcuts */
  vl_sift_pix *temp   = f-> temp ;
  int width           = f-> width ;
  int height          = f-> height ;
  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 sigman       = f-> sigman ;
  double dsigma0      = f-> dsigma0 ;

  /* restart from the first */
  f->o_cur = o_min ;
  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) ;

  /* is there at least one octave? */
  if (f->O == 0)
    return VL_ERR_EOF ;

  /* ------------------------------------------------------------------
   *                     Compute the first sublevel of the first octave
   * --------------------------------------------------------------- */

  /*
   * If the first octave has negative index, we upscale the image; if
   * the first octave has positive index, we downscale the image; if
   * the first octave has index zero, we just copy the image.
   */

  octave = vl_sift_get_octave (f, s_min) ;

  if (o_min < 0) {
    /* double once */
    copy_and_upsample_rows (temp,   im,   width,      height) ;
    copy_and_upsample_rows (octave, temp, height, 2 * width ) ;

    /* double more */
    for(o = -1 ; o > o_min ; --o) {
      copy_and_upsample_rows (temp, octave,
                              width << -o,      height << -o ) ;
      copy_and_upsample_rows (octave, temp,
                              width << -o, 2 * (height << -o)) ;
    }
  }
  else if (o_min > 0) {
    /* downsample */
    copy_and_downsample (octave, im, width, height, o_min) ;
  }
  else {
    /* direct copy */
    memcpy(octave, im, sizeof(vl_sift_pix) * width * height) ;
  }

  /*
   * Here we adjust the smoothing of the first level of the octave.
   * The input image is assumed to have nominal smoothing equal to
   * f->simgan.
   */

  sa = sigma0 * pow (sigmak,   s_min) ;
  sb = sigman * pow (2.0,    - o_min) ;

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

  /* -----------------------------------------------------------------
   *                                          Compute the first 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:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movq %rsi, 0xb0(%rsp)
movq 0xb8(%rsp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0xb8(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x7c(%rsp)
movq 0xb8(%rsp), %rax
movl 0x24(%rax), %eax
movl %eax, 0x78(%rsp)
movq 0xb8(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, 0x74(%rsp)
movq 0xb8(%rsp), %rax
movl 0x34(%rax), %eax
movl %eax, 0x70(%rsp)
movq 0xb8(%rsp), %rax
movl 0x38(%rax), %eax
movl %eax, 0x6c(%rsp)
movq 0xb8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0xb8(%rsp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0xb8(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0xb8(%rsp), %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movl 0x74(%rsp), %ecx
movq 0xb8(%rsp), %rax
movl %ecx, 0x3c(%rax)
movq 0xb8(%rsp), %rax
movl $0x0, 0x80(%rax)
movq 0xb8(%rsp), %rcx
xorl %eax, %eax
subl 0x3c(%rcx), %eax
cmpl $0x0, %eax
jl 0x4c444
movq 0xb8(%rsp), %rax
movl 0x20(%rax), %eax
movq 0xb8(%rsp), %rdx
xorl %ecx, %ecx
subl 0x3c(%rdx), %ecx
shll %cl, %eax
movl %eax, 0x34(%rsp)
jmp 0x4c466
movq 0xb8(%rsp), %rax
movl 0x20(%rax), %eax
movq 0xb8(%rsp), %rcx
xorl %edx, %edx
subl 0x3c(%rcx), %edx
xorl %ecx, %ecx
subl %edx, %ecx
sarl %cl, %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
movq 0xb8(%rsp), %rcx
movl %eax, 0x58(%rcx)
movl %eax, 0xa0(%rsp)
movq 0xb8(%rsp), %rcx
xorl %eax, %eax
subl 0x3c(%rcx), %eax
cmpl $0x0, %eax
jl 0x4c4ae
movq 0xb8(%rsp), %rax
movl 0x24(%rax), %eax
movq 0xb8(%rsp), %rdx
xorl %ecx, %ecx
subl 0x3c(%rdx), %ecx
shll %cl, %eax
movl %eax, 0x30(%rsp)
jmp 0x4c4d0
movq 0xb8(%rsp), %rax
movl 0x24(%rax), %eax
movq 0xb8(%rsp), %rcx
xorl %edx, %edx
subl 0x3c(%rcx), %edx
xorl %ecx, %ecx
subl %edx, %ecx
sarl %cl, %eax
movl %eax, 0x30(%rsp)
movl 0x30(%rsp), %eax
movq 0xb8(%rsp), %rcx
movl %eax, 0x5c(%rcx)
movl %eax, 0xa4(%rsp)
movq 0xb8(%rsp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x4c504
movl $0x5, 0xc4(%rsp)
jmp 0x4c84d
movq 0xb8(%rsp), %rdi
movl 0x70(%rsp), %esi
callq 0x4c860
movq %rax, 0x88(%rsp)
cmpl $0x0, 0x74(%rsp)
jge 0x4c604
movq 0x80(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movl 0x7c(%rsp), %edx
movl 0x78(%rsp), %ecx
callq 0x4c8c0
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
movl 0x78(%rsp), %edx
movl 0x7c(%rsp), %ecx
shll %ecx
callq 0x4c8c0
movl $0xffffffff, 0xac(%rsp) # imm = 0xFFFFFFFF
movl 0xac(%rsp), %eax
cmpl 0x74(%rsp), %eax
jle 0x4c602
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rsi
movl 0x7c(%rsp), %edx
xorl %ecx, %ecx
subl 0xac(%rsp), %ecx
shll %cl, %edx
movl 0x78(%rsp), %eax
xorl %ecx, %ecx
subl 0xac(%rsp), %ecx
shll %cl, %eax
movl %eax, %ecx
callq 0x4c8c0
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
movl 0x7c(%rsp), %edx
xorl %ecx, %ecx
subl 0xac(%rsp), %ecx
shll %cl, %edx
movl 0x78(%rsp), %eax
xorl %ecx, %ecx
subl 0xac(%rsp), %ecx
shll %cl, %eax
movl %eax, %ecx
shll %ecx
callq 0x4c8c0
movl 0xac(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0x4c56f
jmp 0x4c658
cmpl $0x0, 0x74(%rsp)
jle 0x4c62f
movq 0x88(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movl 0x7c(%rsp), %edx
movl 0x78(%rsp), %ecx
movl 0x74(%rsp), %r8d
callq 0x4ca50
jmp 0x4c656
movq 0x88(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movslq 0x7c(%rsp), %rdx
shlq $0x2, %rdx
movslq 0x78(%rsp), %rax
imulq %rax, %rdx
callq 0x9640
jmp 0x4c658
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x58(%rsp), %xmm0
cvtsi2sdl 0x70(%rsp), %xmm1
callq 0x92b0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x98(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %eax, %eax
subl 0x74(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0xca37(%rip), %xmm0     # 0x590e0
callq 0x92b0
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rsp)
movsd 0x98(%rsp), %xmm0
ucomisd 0x90(%rsp), %xmm0
jbe 0x4c765
movsd 0x98(%rsp), %xmm0
movsd 0x98(%rsp), %xmm2
movsd 0x90(%rsp), %xmm1
mulsd 0x90(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x9b20
movsd %xmm0, 0x40(%rsp)
movq 0xb8(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq 0x88(%rsp), %rcx
movslq 0xa0(%rsp), %r8
movslq 0xa4(%rsp), %r9
movsd 0x40(%rsp), %xmm0
callq 0x4cb20
movl 0x70(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa8(%rsp)
movl 0xa8(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jg 0x4c842
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x58(%rsp), %xmm0
cvtsi2sdl 0xa8(%rsp), %xmm1
callq 0x92b0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xb8(%rsp), %rdi
movl 0xa8(%rsp), %esi
callq 0x4c860
movq %rax, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xb8(%rsp), %rdi
movl 0xa8(%rsp), %esi
subl $0x1, %esi
callq 0x4c860
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rax, %rcx
movslq 0xa0(%rsp), %r8
movslq 0xa4(%rsp), %r9
movsd 0x38(%rsp), %xmm0
callq 0x4cb20
movl 0xa8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa8(%rsp)
jmp 0x4c773
movl $0x0, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
addq $0xc8, %rsp
retq
nopl (%rax)