// File: /workspace/github_c_makefile_star2_O1/zpole[P]IICV/vl/slic.c
// Function: vl_slic_segment
void
vl_slic_segment (vl_uint32 * segmentation,
                 float const * image,
                 vl_size width,
                 vl_size height,
                 vl_size numChannels,
                 vl_size regionSize,
                 float regularization,
                 vl_size minRegionSize)
{
  vl_index i, x, y, u, v, k, region ;
  vl_uindex iter ;
  vl_size const numRegionsX = (vl_size) ceil((double) width / regionSize) ;
  vl_size const numRegionsY = (vl_size) ceil((double) height / regionSize) ;
  vl_size const numRegions = numRegionsX * numRegionsY ;
  vl_size const numPixels = width * height ;
  float * centers ;
  float * edgeMap ;
  float previousEnergy = VL_INFINITY_F ;
  float startingEnergy ;
  vl_uint32 * masses ;
  vl_size const maxNumIterations = 100 ;

  assert(segmentation) ;
  assert(image) ;
  assert(width >= 1) ;
  assert(height >= 1) ;
  assert(numChannels >= 1) ;
  assert(regionSize >= 1) ;
  assert(regularization >= 0) ;

#define atimage(x,y,k) image[(x)+(y)*width+(k)*width*height]
#define atEdgeMap(x,y) edgeMap[(x)+(y)*width]

  edgeMap = vl_calloc(numPixels, sizeof(float)) ;
  masses = vl_malloc(sizeof(vl_uint32) * numPixels) ;
  centers = vl_malloc(sizeof(float) * (2 + numChannels) * numRegions) ;

  /* compute edge map (gradient strength) */
  for (k = 0 ; k < (signed)numChannels ; ++k) {
    for (y = 1 ; y < (signed)height-1 ; ++y) {
      for (x = 1 ; x < (signed)width-1 ; ++x) {
        float a = atimage(x-1,y,k) ;
        float b = atimage(x+1,y,k) ;
        float c = atimage(x,y+1,k) ;
        float d = atimage(x,y-1,k) ;
        atEdgeMap(x,y) += (a - b)  * (a - b) + (c - d) * (c - d) ;
      }
    }
  }

  /* initialize K-means centers */
  i = 0 ;
  for (v = 0 ; v < (signed)numRegionsY ; ++v) {
    for (u = 0 ; u < (signed)numRegionsX ; ++u) {
      vl_index xp ;
      vl_index yp ;
      vl_index centerx = 0 ;
      vl_index centery = 0 ;
      float minEdgeValue = VL_INFINITY_F ;

      x = (vl_index) vl_round_d(regionSize * (u + 0.5)) ;
      y = (vl_index) vl_round_d(regionSize * (v + 0.5)) ;

      x = VL_MAX(VL_MIN(x, (signed)width-1),0) ;
      y = VL_MAX(VL_MIN(y, (signed)height-1),0) ;

      /* search in a 3x3 neighbourhood the smallest edge response */
      for (yp = VL_MAX(0, y-1) ; yp <= VL_MIN((signed)height-1, y+1) ; ++ yp) {
        for (xp = VL_MAX(0, x-1) ; xp <= VL_MIN((signed)width-1, x+1) ; ++ xp) {
          float thisEdgeValue = atEdgeMap(xp,yp) ;
          if (thisEdgeValue < minEdgeValue) {
            minEdgeValue = thisEdgeValue ;
            centerx = xp ;
            centery = yp ;
          }
        }
      }

      /* initialize the new center at this location */
      centers[i++] = (float) centerx ;
      centers[i++] = (float) centery ;
      for (k  = 0 ; k < (signed)numChannels ; ++k) {
        centers[i++] = atimage(centerx,centery,k) ;
      }
    }
  }

  /* run k-means iterations */
  for (iter = 0 ; iter < maxNumIterations ; ++iter) {
    float factor = regularization / (regionSize * regionSize) ;
    float energy = 0 ;

    /* assign pixels to centers */
    for (y = 0 ; y < (signed)height ; ++y) {
      for (x = 0 ; x < (signed)width ; ++x) {
        vl_index u = floor((double)x / regionSize - 0.5) ;
        vl_index v = floor((double)y / regionSize - 0.5) ;
        vl_index up, vp ;
        float minDistance = VL_INFINITY_F ;

        for (vp = VL_MAX(0, v) ; vp <= VL_MIN((signed)numRegionsY-1, v+1) ; ++vp) {
          for (up = VL_MAX(0, u) ; up <= VL_MIN((signed)numRegionsX-1, u+1) ; ++up) {
            vl_index region = up  + vp * numRegionsX ;
            float centerx = centers[(2 + numChannels) * region + 0]  ;
            float centery = centers[(2 + numChannels) * region + 1] ;
            float spatial = (x - centerx) * (x - centerx) + (y - centery) * (y - centery) ;
            float appearance = 0 ;
            float distance ;
            for (k = 0 ; k < (signed)numChannels ; ++k) {
              float centerz = centers[(2 + numChannels) * region + k + 2]  ;
              float z = atimage(x,y,k) ;
              appearance += (z - centerz) * (z - centerz) ;
            }
            distance = appearance + factor * spatial ;
            if (minDistance > distance) {
              minDistance = distance ;
              segmentation[x + y * width] = (vl_uint32)region ;
            }
          }
        }
        energy += minDistance ;
      }
    }

    /*
     VL_PRINTF("vl:slic: iter %d: energy: %g\n", iter, energy) ;
    */

    /* check energy termination conditions */
    if (iter == 0) {
      startingEnergy = energy ;
    } else {
      if ((previousEnergy - energy) < 1e-5 * (startingEnergy - energy)) {
        break ;
      }
    }
    previousEnergy = energy ;

    /* recompute centers */
    memset(masses, 0, sizeof(vl_uint32) * width * height) ;
    memset(centers, 0, sizeof(float) * (2 + numChannels) * numRegions) ;

    for (y = 0 ; y < (signed)height ; ++y) {
      for (x = 0 ; x < (signed)width ; ++x) {
        vl_index pixel = x + y * width ;
        vl_index region = segmentation[pixel] ;
        masses[region] ++ ;
        centers[region * (2 + numChannels) + 0] += x ;
        centers[region * (2 + numChannels) + 1] += y ;
        for (k = 0 ; k < (signed)numChannels ; ++k) {
          centers[region * (2 + numChannels) + k + 2] += atimage(x,y,k) ;
        }
      }
    }

    for (region = 0 ; region < (signed)numRegions ; ++region) {
      float mass = VL_MAX(masses[region], 1e-8) ;
      for (i = (2 + numChannels) * region ;
           i < (signed)(2 + numChannels) * (region + 1) ;
           ++i) {
        centers[i] /= mass ;
      }
    }
  }

  vl_free(masses) ;
  vl_free(centers) ;
  vl_free(edgeMap) ;

  /* elimiate small regions */
  {
    vl_uint32 * cleaned = vl_calloc(numPixels, sizeof(vl_uint32)) ;
    vl_uindex * segment = vl_malloc(sizeof(vl_uindex) * numPixels) ;
    vl_size segmentSize ;
    vl_uint32 label ;
    vl_uint32 cleanedLabel ;
    vl_size numExpanded ;
    vl_index const dx [] = {+1, -1,  0,  0} ;
    vl_index const dy [] = { 0,  0, +1, -1} ;
    vl_index direction ;
    vl_index pixel ;

    for (pixel = 0 ; pixel < (signed)numPixels ; ++pixel) {
      if (cleaned[pixel]) continue ;
      label = segmentation[pixel] ;
      numExpanded = 0 ;
      segmentSize = 0 ;
      segment[segmentSize++] = pixel ;

      /*
       find cleanedLabel as the label of an already cleaned
       region neihbour of this pixel
       */
      cleanedLabel = label + 1 ;
      cleaned[pixel] = label + 1 ;
      x = pixel % width ;
      y = pixel / width ;
      for (direction = 0 ; direction < 4 ; ++direction) {
        vl_index xp = x + dx[direction] ;
        vl_index yp = y + dy[direction] ;
        vl_index neighbor = xp + yp * width ;
        if (0 <= xp && xp < (signed)width &&
            0 <= yp && yp < (signed)height &&
            cleaned[neighbor]) {
          cleanedLabel = cleaned[neighbor] ;
        }
      }

      /* expand the segment */
      while (numExpanded < segmentSize) {
        vl_index open = segment[numExpanded++] ;
        x = open % width ;
        y = open / width ;
        for (direction = 0 ; direction < 4 ; ++direction) {
          vl_index xp = x + dx[direction] ;
          vl_index yp = y + dy[direction] ;
          vl_index neighbor = xp + yp * width ;
          if (0 <= xp && xp < (signed)width &&
              0 <= yp && yp < (signed)height &&
              cleaned[neighbor] == 0 &&
              segmentation[neighbor] == label) {
            cleaned[neighbor] = label + 1 ;
            segment[segmentSize++] = neighbor ;
          }
        }
      }

      /* change label to cleanedLabel if the semgent is too small */
      if (segmentSize < minRegionSize) {
        while (segmentSize > 0) {
          cleaned[segment[--segmentSize]] = cleanedLabel ;
        }
      }
    }
    /* restore base 0 indexing of the regions */
    for (pixel = 0 ; pixel < (signed)numPixels ; ++pixel) cleaned[pixel] -- ;

    memcpy(segmentation, cleaned, numPixels * sizeof(vl_uint32)) ;
    vl_free(cleaned) ;
    vl_free(segment) ;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movss %xmm0, 0x14(%rsp)
movq %r8, %r13
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, 0x60(%rsp)
movq %rdi, 0x70(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq %rdx, %xmm1
movq 0x3c19(%rip), %xmm2     # 0x33180
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x3c1d(%rip), %xmm3     # 0x33190
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %r9, 0xa8(%rsp)
movq %r9, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movapd %xmm2, 0xc0(%rsp)
divsd %xmm2, %xmm0
callq 0x99c0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x4656(%rip), %xmm0     # 0x33c20
cvttsd2si %xmm0, %r15
andq %rcx, %r15
orq %rax, %r15
movq %r14, %xmm1
punpckldq 0x3b9e(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x3ba6(%rip), %xmm1     # 0x33190
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0xc0(%rsp), %xmm0
callq 0x99c0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x4608(%rip), %xmm0     # 0x33c20
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %r15, 0x80(%rsp)
movq %r15, %r12
movq %rdx, 0x40(%rsp)
imulq %rdx, %r12
movq %r14, 0x58(%rsp)
movq %rbx, (%rsp)
imulq %rbx, %r14
movl $0x4, %esi
movq %r14, %rdi
callq 0x98f0
movq %rax, 0x90(%rsp)
movq %r14, 0xd8(%rsp)
leaq (,%r14,4), %r15
movq %r15, %rdi
callq 0x95b0
movq %rax, 0x100(%rsp)
leaq 0x2(%r13), %rax
movq %rax, 0x38(%rsp)
movq %rax, %rdi
movq %r12, 0xa0(%rsp)
imulq %r12, %rdi
shlq $0x2, %rdi
movq %rdi, 0xf0(%rsp)
callq 0x95b0
movq %rax, %r12
movq %r13, 0x98(%rsp)
movslq %r13d, %rbp
testq %rbp, %rbp
jle 0x2f7b2
movq 0x58(%rsp), %rax
shlq $0x20, %rax
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %rdx, %rax
sarq $0x20, %rax
movq (%rsp), %rsi
movq %rsi, %rcx
shlq $0x20, %rcx
addq %rdx, %rcx
sarq $0x20, %rcx
leaq (,%rsi,4), %rdx
movq 0x90(%rsp), %rdi
leaq (%rdi,%rsi,4), %rdi
addq $0x4, %rdi
movq %rdi, 0x20(%rsp)
leaq -0x1(%rcx), %rdi
movq 0x60(%rsp), %r11
leaq 0x8(%r11,%rsi,4), %r8
movq %r8, 0x18(%rsp)
leaq (%r11,%rsi,8), %rsi
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
xorl %r10d, %r10d
cmpq $0x2, %rax
jl 0x2f799
movl $0x1, %ebx
movq 0x8(%rsp), %r14
movq %r11, %r13
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %rsi
cmpq $0x2, %rcx
jl 0x2f785
xorl %r9d, %r9d
movss -0x8(%r8,%r9,4), %xmm0
subss (%r8,%r9,4), %xmm0
movss (%r14,%r9,4), %xmm1
subss 0x4(%r13,%r9,4), %xmm1
mulss %xmm1, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
addss (%rsi,%r9,4), %xmm0
movss %xmm0, (%rsi,%r9,4)
incq %r9
cmpq %r9, %rdi
jne 0x2f74b
incq %rbx
addq %rdx, %rsi
addq %rdx, %r8
addq %rdx, %r13
addq %rdx, %r14
cmpq %rax, %rbx
jne 0x2f742
incq %r10
addq %r15, 0x18(%rsp)
addq %r15, %r11
addq %r15, 0x8(%rsp)
cmpq %rbp, %r10
jne 0x2f725
movslq 0x40(%rsp), %rax
movq %rax, 0xb0(%rsp)
testq %rax, %rax
movq 0x70(%rsp), %rbx
movss 0x14(%rsp), %xmm1
jle 0x2fa08
movslq 0x80(%rsp), %rax
movq %rax, 0x20(%rsp)
movq (%rsp), %rax
movq %rax, %rsi
shlq $0x20, %rsi
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %rdx, %rsi
sarq $0x20, %rsi
movq %rsi, 0x28(%rsp)
movq 0x58(%rsp), %rcx
shlq $0x20, %rcx
addq %rdx, %rcx
sarq $0x20, %rcx
movq %rcx, 0x78(%rsp)
leaq (,%rax,4), %r13
xorl %edx, %edx
xorl %ecx, %ecx
cmpq $0x0, 0x20(%rsp)
movq %rcx, 0xb8(%rsp)
jle 0x2f9e9
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
addsd 0x398a(%rip), %xmm0     # 0x331d0
mulsd 0xc0(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
xorl %ecx, %ecx
movq %rdx, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
addsd 0x395f(%rip), %xmm0     # 0x331d0
mulsd 0xc0(%rsp), %xmm0
callq 0x9230
movq %rax, %r14
movsd 0x48(%rsp), %xmm0
callq 0x9230
movq 0x78(%rsp), %rsi
cmpq %rsi, %rax
cmovgeq %rsi, %rax
testq %rax, %rax
movl $0x0, %edx
cmovgq %rax, %rdx
cmpq $0x2, %rax
movl $0x1, %ecx
cmovlq %rcx, %rax
decq %rax
leaq 0x1(%rdx), %rcx
cmpq %rdx, %rsi
cmovleq %rsi, %rcx
movl $0x0, %edx
movl $0x0, %esi
cmpq %rcx, %rax
jg 0x2f96e
movq 0x28(%rsp), %rsi
cmpq %rsi, %r14
cmovgeq %rsi, %r14
testq %r14, %r14
movl $0x0, %edx
cmovgq %r14, %rdx
cmpq $0x2, %r14
movl $0x1, %edi
cmovlq %rdi, %r14
decq %r14
leaq 0x1(%rdx), %rdi
cmpq %rdx, %rsi
cmovleq %rsi, %rdi
movq %rdi, %r8
negq %r8
movq %r13, %r9
imulq %rax, %r9
addq 0x90(%rsp), %r9
xorl %esi, %esi
xorl %edx, %edx
movss 0x3971(%rip), %xmm0     # 0x33298
cmpq %rdi, %r14
jle 0x2f931
movaps %xmm0, %xmm1
jmp 0x2f95c
movq %r14, %r10
movss (%r9,%r10,4), %xmm1
ucomiss %xmm1, %xmm0
cmovaq %rax, %rdx
minss %xmm0, %xmm1
cmovaq %r10, %rsi
leaq (%r8,%r10), %r11
incq %r11
incq %r10
movaps %xmm1, %xmm0
cmpq $0x1, %r11
jne 0x2f934
leaq 0x1(%rax), %r10
addq %r13, %r9
movaps %xmm1, %xmm0
cmpq %rcx, %rax
movq %r10, %rax
jne 0x2f927
xorps %xmm0, %xmm0
cvtsi2ss %rsi, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rdx, %xmm1
movq 0x8(%rsp), %rcx
leaq 0x2(%rcx), %rax
movss %xmm0, (%r12,%rcx,4)
movss %xmm1, 0x4(%r12,%rcx,4)
testq %rbp, %rbp
jle 0x2f9cb
imulq (%rsp), %rdx
movq 0x60(%rsp), %rcx
leaq (%rcx,%rsi,4), %rcx
leaq (%rcx,%rdx,4), %rcx
movq %rbp, %rdx
movss 0x14(%rsp), %xmm1
movss (%rcx), %xmm0
movss %xmm0, (%r12,%rax,4)
incq %rax
addq %r15, %rcx
decq %rdx
jne 0x2f9b4
jmp 0x2f9d1
movss 0x14(%rsp), %xmm1
movq 0x18(%rsp), %rcx
incq %rcx
movq %rax, %rdx
cmpq 0x20(%rsp), %rcx
jne 0x2f857
jmp 0x2f9ec
movq %rdx, %rax
movq 0xb8(%rsp), %rcx
incq %rcx
movq %rax, %rdx
cmpq 0xb0(%rsp), %rcx
jne 0x2f822
shlq $0x20, 0x40(%rsp)
movq 0xa8(%rsp), %rcx
imulq %rcx, %rcx
testq %rcx, %rcx
js 0x2fa29
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
jmp 0x2fa41
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
divss %xmm0, %xmm1
movss %xmm1, 0x14(%rsp)
movslq 0x58(%rsp), %rax
movq %rax, 0x68(%rsp)
movq (%rsp), %rax
movslq %eax, %rcx
movq %rcx, 0x48(%rsp)
movq 0x40(%rsp), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %rdx, %rcx
sarq $0x20, %rcx
movq %rcx, 0x40(%rsp)
movq 0x80(%rsp), %rcx
movq %rcx, %rsi
shlq $0x20, %rsi
addq %rdx, %rsi
sarq $0x20, %rsi
movq %rsi, 0xa8(%rsp)
movslq 0xa0(%rsp), %r13
movq 0x38(%rsp), %rdx
movslq %edx, %rsi
movq %rsi, 0xe8(%rsp)
leaq (,%rax,4), %rax
movq %rax, 0xd0(%rsp)
leaq 0x8(%r12), %rax
movq %rax, 0xa0(%rsp)
leaq (,%rdx,4), %rax
movq %rax, 0x110(%rsp)
imulq %rdx, %rcx
shlq $0x2, %rcx
movq %rcx, 0x20(%rsp)
movq 0x98(%rsp), %rax
leaq 0x8(,%rax,4), %rax
movq %rax, 0x18(%rsp)
movss 0x378f(%rip), %xmm0     # 0x33298
movq $0x0, 0x88(%rsp)
movss %xmm0, 0x34(%rsp)
movq %r13, 0xf8(%rsp)
cmpq $0x0, 0x68(%rsp)
jle 0x2fd85
xorps %xmm7, %xmm7
movq 0x60(%rsp), %r13
xorl %r14d, %r14d
cmpq $0x0, 0x48(%rsp)
movq %r13, 0x98(%rsp)
movq %r14, 0x108(%rsp)
jle 0x2fd58
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
divsd 0xc0(%rsp), %xmm0
addsd 0x36a9(%rip), %xmm0     # 0x33218
movss %xmm7, 0x28(%rsp)
callq 0x9880
movss 0x28(%rsp), %xmm7
movss 0x3710(%rip), %xmm6     # 0x33298
cvttsd2si %xmm0, %rax
testq %rax, %rax
movl $0x0, %edx
cmovgq %rax, %rdx
leaq 0x1(%rax), %rsi
movq 0x40(%rsp), %rcx
cmpq %rax, %rcx
cmovleq %rcx, %rsi
movq %rsi, 0x8(%rsp)
xorps %xmm8, %xmm8
cvtsi2ss %r14, %xmm8
movq %r14, %rax
imulq (%rsp), %rax
leaq (%rbx,%rax,4), %r14
movq 0x80(%rsp), %rax
movq %rdx, 0x78(%rsp)
imulq %rdx, %rax
movq %rax, 0xb0(%rsp)
movq %r13, %rbx
xorl %r13d, %r13d
movss %xmm8, 0xb8(%rsp)
movaps %xmm6, %xmm1
movq 0x8(%rsp), %rax
cmpq %rax, 0x78(%rsp)
jg 0x2fd42
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
divsd 0xc0(%rsp), %xmm0
addsd 0x3600(%rip), %xmm0     # 0x33218
movss %xmm7, 0x28(%rsp)
callq 0x9880
movss 0xb8(%rsp), %xmm8
movss 0x28(%rsp), %xmm7
movss 0x365d(%rip), %xmm6     # 0x33298
movss 0x14(%rsp), %xmm5
cvttsd2si %xmm0, %rdx
testq %rdx, %rdx
movl $0x0, %eax
cmovgq %rdx, %rax
leaq 0x1(%rdx), %rcx
movq 0xa8(%rsp), %rsi
cmpq %rdx, %rsi
cmovleq %rsi, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %r13, %xmm0
movq 0xb0(%rsp), %rdx
addq %rax, %rdx
imulq 0x110(%rsp), %rdx
addq 0xa0(%rsp), %rdx
movq 0x78(%rsp), %rsi
movaps %xmm6, %xmm1
cmpq %rcx, %rax
jg 0x2fd2b
movq %rsi, %rdi
imulq 0x80(%rsp), %rdi
movq %rdx, %r8
movq %rax, %r9
xorpd %xmm2, %xmm2
testq %rbp, %rbp
jle 0x2fcd9
movq %rbx, %r10
xorl %r11d, %r11d
movss (%r10), %xmm3
subss (%r8,%r11,4), %xmm3
mulss %xmm3, %xmm3
addss %xmm3, %xmm2
incq %r11
addq %r15, %r10
cmpq %r11, %rbp
jne 0x2fcbb
leaq (%r9,%rdi), %r10
movq %r10, %r11
imulq 0x38(%rsp), %r11
movaps %xmm0, %xmm3
subss (%r12,%r11,4), %xmm3
movaps %xmm8, %xmm4
subss 0x4(%r12,%r11,4), %xmm4
mulss %xmm4, %xmm4
mulss %xmm3, %xmm3
addss %xmm4, %xmm3
mulss %xmm5, %xmm3
addss %xmm2, %xmm3
ucomiss %xmm3, %xmm1
jbe 0x2fd1a
movl %r10d, (%r14,%r13,4)
movaps %xmm3, %xmm1
leaq 0x1(%r9), %r10
addq 0x18(%rsp), %r8
cmpq %rcx, %r9
movq %r10, %r9
jne 0x2fcac
leaq 0x1(%rsi), %rdi
addq 0x20(%rsp), %rdx
cmpq 0x8(%rsp), %rsi
movq %rdi, %rsi
jne 0x2fc91
addss %xmm1, %xmm7
incq %r13
addq $0x4, %rbx
cmpq 0x48(%rsp), %r13
jne 0x2fbec
movq 0x108(%rsp), %r14
incq %r14
movq 0x98(%rsp), %r13
addq 0xd0(%rsp), %r13
cmpq 0x68(%rsp), %r14
movq 0x70(%rsp), %rbx
jne 0x2fb3a
jmp 0x2fd88
xorps %xmm7, %xmm7
movaps %xmm7, %xmm2
cmpq $0x0, 0x88(%rsp)
movq 0x100(%rsp), %r14
movq 0xf8(%rsp), %r13
je 0x2fdd9
movss 0x34(%rsp), %xmm0
subss %xmm7, %xmm0
cvtss2sd %xmm0, %xmm0
movss 0x54(%rsp), %xmm2
movaps %xmm2, %xmm1
subss %xmm7, %xmm1
cvtss2sd %xmm1, %xmm1
mulsd 0x3723(%rip), %xmm1     # 0x334f0
movb $0x1, %al
ucomisd %xmm0, %xmm1
ja 0x2ff24
movss %xmm2, 0x8(%rsp)
movss %xmm7, 0x28(%rsp)
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x9400
movq %r12, %rdi
xorl %esi, %esi
movq 0xf0(%rsp), %rdx
callq 0x9400
cmpq $0x0, 0x68(%rsp)
jle 0x2feae
movq 0x60(%rsp), %rax
xorl %ecx, %ecx
cmpl $0x0, (%rsp)
jle 0x2fe98
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
movq %rcx, %rdx
imulq (%rsp), %rdx
movq %rax, %rsi
xorl %edi, %edi
leaq (%rdi,%rdx), %r8
movl (%rbx,%r8,4), %r8d
incl (%r14,%r8,4)
imulq 0x38(%rsp), %r8
xorps %xmm1, %xmm1
cvtsi2ss %rdi, %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movsd (%r12,%r8,4), %xmm2
addps %xmm1, %xmm2
movlps %xmm2, (%r12,%r8,4)
testq %rbp, %rbp
jle 0x2fe8a
leaq (%r12,%r8,4), %r8
movq %rsi, %r9
xorl %r10d, %r10d
movss (%r9), %xmm1
addss 0x8(%r8,%r10,4), %xmm1
movss %xmm1, 0x8(%r8,%r10,4)
incq %r10
addq %r15, %r9
cmpq %r10, %rbp
jne 0x2fe6c
incq %rdi
addq $0x4, %rsi
cmpq 0x48(%rsp), %rdi
jne 0x2fe32
incq %rcx
addq 0xd0(%rsp), %rax
cmpq 0x68(%rsp), %rcx
jne 0x2fe17
testq %r13, %r13
movss 0x45ab(%rip), %xmm2     # 0x34464
movss 0x28(%rsp), %xmm3
jle 0x2ff10
xorl %eax, %eax
movq 0xe8(%rsp), %rsi
movl (%r14,%rax,4), %ecx
movaps %xmm2, %xmm0
testl %ecx, %ecx
je 0x2fede
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
movq %rax, %rcx
imulq 0x38(%rsp), %rcx
incq %rax
movq %rax, %rdx
imulq %rsi, %rdx
cmpq %rdx, %rcx
jge 0x2ff0b
movss (%r12,%rcx,4), %xmm1
divss %xmm0, %xmm1
movss %xmm1, (%r12,%rcx,4)
incq %rcx
jmp 0x2fef1
cmpq %r13, %rax
jne 0x2fecb
xorl %eax, %eax
movss 0x8(%rsp), %xmm0
movss %xmm0, 0x54(%rsp)
movss %xmm3, 0x34(%rsp)
testb %al, %al
jne 0x2ff45
movq 0x88(%rsp), %rcx
incq %rcx
movq %rcx, 0x88(%rsp)
cmpq $0x64, %rcx
jne 0x2fb23
movq %r14, %rdi
callq 0x9580
movq %r12, %rdi
callq 0x9580
movq 0x90(%rsp), %rdi
callq 0x9580
movl $0x4, %esi
movq 0xd8(%rsp), %r14
movq %r14, %rdi
callq 0x98f0
movq %rax, %r12
leaq (,%r14,8), %rdi
callq 0x95b0
movq %rax, %r13
movslq %r14d, %rcx
testq %rcx, %rcx
jle 0x300d5
movslq (%rsp), %rdi
movslq 0x58(%rsp), %r8
xorl %eax, %eax
leaq 0x44c8(%rip), %r9       # 0x34470
leaq 0x44e1(%rip), %r10      # 0x34490
movq %rcx, 0x20(%rsp)
cmpl $0x0, (%r12,%rax,4)
jne 0x300c9
movl (%rbx,%rax,4), %ebx
movq %rax, (%r13)
leal 0x1(%rbx), %esi
movl %esi, (%r12,%rax,4)
movq %rax, 0x8(%rsp)
xorl %edx, %edx
divq (%rsp)
xorl %ecx, %ecx
movl %esi, 0x38(%rsp)
movl %esi, 0x18(%rsp)
movq (%rcx,%r9), %rsi
addq %rdx, %rsi
js 0x3001b
cmpq %rdi, %rsi
jge 0x3001b
movq (%rcx,%r10), %r11
addq %rax, %r11
js 0x3001b
cmpq %r8, %r11
jge 0x3001b
imulq (%rsp), %r11
leaq (%r12,%rsi,4), %rsi
movl (%rsi,%r11,4), %esi
testl %esi, %esi
movl 0x18(%rsp), %r11d
cmovnel %esi, %r11d
movl %r11d, 0x18(%rsp)
addq $0x8, %rcx
cmpq $0x20, %rcx
jne 0x2ffe2
movl $0x1, %r14d
xorl %esi, %esi
movq (%r13,%rsi,8), %rax
xorl %edx, %edx
divq (%rsp)
xorl %ecx, %ecx
movq (%rcx,%r9), %r11
addq %rdx, %r11
js 0x30081
cmpq %rdi, %r11
jge 0x30081
movq (%rcx,%r10), %rbp
addq %rax, %rbp
js 0x30081
cmpq %r8, %rbp
jge 0x30081
imulq (%rsp), %rbp
addq %r11, %rbp
cmpl $0x0, (%r12,%rbp,4)
jne 0x30081
movq 0x70(%rsp), %r11
cmpl %ebx, (%r11,%rbp,4)
jne 0x30081
movl 0x38(%rsp), %r11d
movl %r11d, (%r12,%rbp,4)
movq %rbp, (%r13,%r14,8)
incq %r14
addq $0x8, %rcx
cmpq $0x20, %rcx
jne 0x3003a
incq %rsi
cmpq %r14, %rsi
jb 0x3002d
cmpq 0xe0(%rsp), %r14
setae %al
testq %r14, %r14
sete %cl
orb %al, %cl
movq 0x70(%rsp), %rbx
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %rax
movl 0x18(%rsp), %esi
jne 0x300c9
movq -0x8(%r13,%r14,8), %rdx
movl %esi, (%r12,%rdx,4)
decq %r14
jne 0x300bb
incq %rax
cmpq %rcx, %rax
jne 0x2ffb4
testq %rcx, %rcx
jle 0x300e8
xorl %eax, %eax
decl (%r12,%rax,4)
incq %rax
cmpq %rax, %rcx
jne 0x300dc
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x95a0
movq %r12, %rdi
callq 0x9580
movq %r13, %rdi
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9580
nop