// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::FillHoles()
void R2Grid::
FillHoles(void)
{
  // Build Gaussian filter
  RNScalar sigma = 1.5;
  double denom = -2.0 * sigma * sigma;
  RNScalar filter[5][5];
  for (int i = -2; i <= 2; i++) {
    for (int j = -2; j <= 2; j++) {
      filter[i+2][j+2] = exp((i*i+j*j)/denom);
    }
  }

  // Initialize image with heap state
  int width = XResolution();
  int height = YResolution();
  R2Grid heap_image(width, height);
  RNScalar *heap_values = (RNScalar *) heap_image.GridValues();

  // Seed heap with border unknown values
  RNHeap<RNScalar *> heap(0, -1, FALSE);
  for (int x = 0; x < width; x++) {
    for (int y = 0; y < height; y++) {
      if (GridValue(x, y) == R2_GRID_UNKNOWN_VALUE) continue;
     
      // Push neighbors with unknown values onto queue
      if ((x > 0) && (GridValue(x-1, y) == R2_GRID_UNKNOWN_VALUE)) {
        RNScalar *heap_value = &heap_values[y*width+(x-1)];
        *heap_value += 1;
        if (*heap_value < 1.5) heap.Push(heap_value);
        else heap.Update(heap_value);
      }
      if ((y > 0) && (GridValue(x, y-1) == R2_GRID_UNKNOWN_VALUE)) {
        RNScalar *heap_value = &heap_values[(y-1)*width+x];
        *heap_value += 1;
        if (*heap_value < 1.5) heap.Push(heap_value);
        else heap.Update(heap_value);
      }
      if ((x < width-1) && (GridValue(x+1, y) == R2_GRID_UNKNOWN_VALUE)) {
        RNScalar *heap_value = &heap_values[y*width+(x+1)];
        *heap_value += 1;
        if (*heap_value < 1.5) heap.Push(heap_value);
        else heap.Update(heap_value);
      }
      if ((y < height-1) && (GridValue(x, y+1) == R2_GRID_UNKNOWN_VALUE)) {
        RNScalar *heap_value = &heap_values[(y+1)*width+x];
        *heap_value += 1;
        if (*heap_value < 1.5) heap.Push(heap_value);
        else heap.Update(heap_value);
      }
    }
  }

  // Iteratively update border unknown values with blur of immediate neighbors
  while (!heap.IsEmpty()) {
    // Pop grid cell from heap
    RNScalar *heap_value = heap.Pop();
    assert(*heap_value > 0);
    int index = heap_value - heap_values;
    assert((index >= 0) && (index < heap_image.NEntries()));
    int x, y; heap_image.IndexToIndices(index, x, y);
    assert(GridValue(index) == R2_GRID_UNKNOWN_VALUE);

    // Update value
    RNScalar sum = 0;
    RNScalar weight = 0;
    for (int i = -2; i <= 2; i++) {
      for (int j = -2; j <= 2; j++) {
        int nx = x + i;
        int ny = y + j;
        if ((nx < 0) || (nx >= width)) continue;
        if ((ny < 0) || (ny >= height)) continue;
        RNScalar value = GridValue(nx, ny);
        if (value == R2_GRID_UNKNOWN_VALUE) continue;
        RNScalar w = filter[i+2][j+2];
        sum += w * value;
        weight += w;
      }
    }

    // Divide by total weight
    if (weight > 0) SetGridValue(x, y, sum / weight);
    else RNFail("Zero weight in fill holes\n");

    // Push neighbors with unknown values onto heap
    if ((x > 0) && (GridValue(x-1, y) == R2_GRID_UNKNOWN_VALUE)) {
      RNScalar *heap_value = &heap_values[y*width+(x-1)];
      *heap_value += 1;
      if (*heap_value < 1.5) heap.Push(heap_value);
      else heap.Update(heap_value);
    }
    if ((y > 0) && (GridValue(x, y-1) == R2_GRID_UNKNOWN_VALUE)) {
      RNScalar *heap_value = &heap_values[(y-1)*width+x];
      *heap_value += 1;
      if (*heap_value < 1.5) heap.Push(heap_value);
      else heap.Update(heap_value);
    }
    if ((x < width-1) && (GridValue(x+1, y) == R2_GRID_UNKNOWN_VALUE)) {
      RNScalar *heap_value = &heap_values[y*width+(x+1)];
      *heap_value += 1;
      if (*heap_value < 1.5) heap.Push(heap_value);
      else heap.Update(heap_value);
    }
    if ((y < height-1) && (GridValue(x, y+1) == R2_GRID_UNKNOWN_VALUE)) {
      RNScalar *heap_value = &heap_values[(y+1)*width+x];
      *heap_value += 1;
      if (*heap_value < 1.5) heap.Push(heap_value);
      else heap.Update(heap_value);
    }
  }
}

// Assembly:
subq $0x328, %rsp            # imm = 0x328
movq %rdi, 0x320(%rsp)
movq 0x320(%rsp), %rax
movq %rax, 0x78(%rsp)
movsd 0x8cfe4(%rip), %xmm0    # 0x135c68
movsd %xmm0, 0x318(%rsp)
movsd 0x8a573(%rip), %xmm0    # 0x133208
mulsd 0x318(%rsp), %xmm0
mulsd 0x318(%rsp), %xmm0
movsd %xmm0, 0x310(%rsp)
movl $0xfffffffe, 0x23c(%rsp) # imm = 0xFFFFFFFE
cmpl $0x2, 0x23c(%rsp)
jg 0xa8d69
movl $0xfffffffe, 0x238(%rsp) # imm = 0xFFFFFFFE
cmpl $0x2, 0x238(%rsp)
jg 0xa8d51
movl 0x23c(%rsp), %eax
imull 0x23c(%rsp), %eax
movl 0x238(%rsp), %ecx
imull 0x238(%rsp), %ecx
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
divsd 0x310(%rsp), %xmm0
callq 0xf8c0
movl 0x23c(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq 0x240(%rsp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x238(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x238(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x238(%rsp)
jmp 0xa8cd4
jmp 0xa8d53
movl 0x23c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x23c(%rsp)
jmp 0xa8cbb
movq 0x78(%rsp), %rdi
callq 0xb9260
movq 0x78(%rsp), %rdi
movl %eax, 0x234(%rsp)
callq 0xb9280
movl %eax, 0x230(%rsp)
movl 0x234(%rsp), %esi
movl 0x230(%rsp), %edx
leaq 0x160(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0xa61e0
movq 0x68(%rsp), %rdi
callq 0xb9420
movq %rax, 0x70(%rsp)
jmp 0xa8dbc
movq 0x70(%rsp), %rax
movq %rax, 0x158(%rsp)
leaq 0x110(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x382f0
jmp 0xa8de1
movl $0x0, 0x10c(%rsp)
movl 0x10c(%rsp), %eax
cmpl 0x234(%rsp), %eax
jge 0xa926f
movl $0x0, 0x108(%rsp)
movl 0x108(%rsp), %eax
cmpl 0x230(%rsp), %eax
jge 0xa9257
movq 0x78(%rsp), %rdi
movl 0x10c(%rsp), %esi
movl 0x108(%rsp), %edx
callq 0xb92a0
movsd %xmm0, 0x60(%rsp)
jmp 0xa8e3f
movsd 0x60(%rsp), %xmm0
movsd 0x8b063(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa8e99
jp 0xa8e99
jmp 0xa9241
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0xa98c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x38a60
jmp 0xa98c9
cmpl $0x0, 0x10c(%rsp)
jle 0xa8f7e
movq 0x78(%rsp), %rdi
movl 0x10c(%rsp), %esi
decl %esi
movl 0x108(%rsp), %edx
callq 0xb92a0
movsd %xmm0, 0x58(%rsp)
jmp 0xa8ec9
movsd 0x58(%rsp), %xmm0
movsd 0x8afd9(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa8f7e
jp 0xa8f7e
movq 0x158(%rsp), %rax
movl 0x108(%rsp), %ecx
imull 0x234(%rsp), %ecx
movl 0x10c(%rsp), %edx
subl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rax
movsd 0x8a0dc(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0x100(%rsp), %rax
movsd 0x8cd24(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa8f63
movq 0x100(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa8f61
jmp 0xa8f7c
movq 0x100(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa8f7a
jmp 0xa8f7c
jmp 0xa8f7e
cmpl $0x0, 0x108(%rsp)
jle 0xa9061
movq 0x78(%rsp), %rdi
movl 0x10c(%rsp), %esi
movl 0x108(%rsp), %edx
decl %edx
callq 0xb92a0
movsd %xmm0, 0x50(%rsp)
jmp 0xa8fae
movsd 0x50(%rsp), %xmm0
movsd 0x8aef4(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa9061
jp 0xa9061
movq 0x158(%rsp), %rax
movl 0x108(%rsp), %ecx
subl $0x1, %ecx
imull 0x234(%rsp), %ecx
addl 0x10c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rax
movsd 0x89ff9(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0xf8(%rsp), %rax
movsd 0x8cc41(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa9046
movq 0xf8(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa9044
jmp 0xa905f
movq 0xf8(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa905d
jmp 0xa905f
jmp 0xa9061
movl 0x10c(%rsp), %eax
movl 0x234(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xa9151
movq 0x78(%rsp), %rdi
movl 0x10c(%rsp), %esi
incl %esi
movl 0x108(%rsp), %edx
callq 0xb92a0
movsd %xmm0, 0x48(%rsp)
jmp 0xa909c
movsd 0x48(%rsp), %xmm0
movsd 0x8ae06(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa9151
jp 0xa9151
movq 0x158(%rsp), %rax
movl 0x108(%rsp), %ecx
imull 0x234(%rsp), %ecx
movl 0x10c(%rsp), %edx
addl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
movsd 0x89f09(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0xf0(%rsp), %rax
movsd 0x8cb51(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa9136
movq 0xf0(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa9134
jmp 0xa914f
movq 0xf0(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa914d
jmp 0xa914f
jmp 0xa9151
movl 0x108(%rsp), %eax
movl 0x230(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xa923f
movq 0x78(%rsp), %rdi
movl 0x10c(%rsp), %esi
movl 0x108(%rsp), %edx
incl %edx
callq 0xb92a0
movsd %xmm0, 0x40(%rsp)
jmp 0xa918c
movsd 0x40(%rsp), %xmm0
movsd 0x8ad16(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa923f
jp 0xa923f
movq 0x158(%rsp), %rax
movl 0x108(%rsp), %ecx
addl $0x1, %ecx
imull 0x234(%rsp), %ecx
addl 0x10c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rax
movsd 0x89e1b(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0xe8(%rsp), %rax
movsd 0x8ca63(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa9224
movq 0xe8(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa9222
jmp 0xa923d
movq 0xe8(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa923b
jmp 0xa923d
jmp 0xa923f
jmp 0xa9241
movl 0x108(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x108(%rsp)
jmp 0xa8e0b
jmp 0xa9259
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0xa8dec
jmp 0xa9271
leaq 0x110(%rsp), %rdi
callq 0x38570
movl %eax, 0x3c(%rsp)
jmp 0xa9284
movl 0x3c(%rsp), %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xa9299
jmp 0xa98a7
leaq 0x110(%rsp), %rdi
callq 0x38590
movq %rax, 0x30(%rsp)
jmp 0xa92ad
movq 0x30(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movq 0x158(%rsp), %rcx
subq %rcx, %rax
shrq $0x3, %rax
movl %eax, 0xdc(%rsp)
movl 0xdc(%rsp), %esi
leaq 0x160(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
leaq 0xd4(%rsp), %rcx
callq 0xb9440
jmp 0xa92fe
xorps %xmm0, %xmm0
movsd %xmm0, 0xc8(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xc0(%rsp)
movl $0xfffffffe, 0xbc(%rsp) # imm = 0xFFFFFFFE
cmpl $0x2, 0xbc(%rsp)
jg 0xa94a6
movl $0xfffffffe, 0xb8(%rsp) # imm = 0xFFFFFFFE
cmpl $0x2, 0xb8(%rsp)
jg 0xa948e
movl 0xd8(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0xb4(%rsp)
movl 0xd4(%rsp), %eax
addl 0xb8(%rsp), %eax
movl %eax, 0xb0(%rsp)
cmpl $0x0, 0xb4(%rsp)
jl 0xa938c
movl 0xb4(%rsp), %eax
cmpl 0x234(%rsp), %eax
jl 0xa9391
jmp 0xa9478
cmpl $0x0, 0xb0(%rsp)
jl 0xa93ab
movl 0xb0(%rsp), %eax
cmpl 0x230(%rsp), %eax
jl 0xa93b0
jmp 0xa9478
movq 0x78(%rsp), %rdi
movl 0xb4(%rsp), %esi
movl 0xb0(%rsp), %edx
callq 0xb92a0
movsd %xmm0, 0x28(%rsp)
jmp 0xa93d0
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd 0x8aac0(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa93fa
jp 0xa93fa
jmp 0xa9478
movl 0xbc(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq 0x240(%rsp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0xb8(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0xa0(%rsp)
movsd 0xa0(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm2
movsd 0xc8(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xc8(%rsp)
movsd 0xa0(%rsp), %xmm0
addsd 0xc0(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
movl 0xb8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb8(%rsp)
jmp 0xa933a
jmp 0xa9490
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0xa9321
movsd 0xc0(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xa94ea
movq 0x78(%rsp), %rdi
movl 0xd8(%rsp), %esi
movl 0xd4(%rsp), %edx
movsd 0xc8(%rsp), %xmm0
movsd 0xc0(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x6bc00
jmp 0xa94e8
jmp 0xa94fc
leaq 0x8c793(%rip), %rdi     # 0x135c84
xorl %eax, %eax
callq 0xd4f30
jmp 0xa94fa
jmp 0xa94fc
cmpl $0x0, 0xd8(%rsp)
jle 0xa95e1
movq 0x78(%rsp), %rdi
movl 0xd8(%rsp), %esi
decl %esi
movl 0xd4(%rsp), %edx
callq 0xb92a0
movsd %xmm0, 0x20(%rsp)
jmp 0xa952c
movsd 0x20(%rsp), %xmm0
movsd 0x8a976(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa95e1
jp 0xa95e1
movq 0x158(%rsp), %rax
movl 0xd4(%rsp), %ecx
imull 0x234(%rsp), %ecx
movl 0xd8(%rsp), %edx
subl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movsd 0x89a79(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0x98(%rsp), %rax
movsd 0x8c6c1(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa95c6
movq 0x98(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa95c4
jmp 0xa95df
movq 0x98(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa95dd
jmp 0xa95df
jmp 0xa95e1
cmpl $0x0, 0xd4(%rsp)
jle 0xa96c4
movq 0x78(%rsp), %rdi
movl 0xd8(%rsp), %esi
movl 0xd4(%rsp), %edx
decl %edx
callq 0xb92a0
movsd %xmm0, 0x18(%rsp)
jmp 0xa9611
movsd 0x18(%rsp), %xmm0
movsd 0x8a891(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa96c4
jp 0xa96c4
movq 0x158(%rsp), %rax
movl 0xd4(%rsp), %ecx
subl $0x1, %ecx
imull 0x234(%rsp), %ecx
addl 0xd8(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
movsd 0x89996(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0x90(%rsp), %rax
movsd 0x8c5de(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa96a9
movq 0x90(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa96a7
jmp 0xa96c2
movq 0x90(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa96c0
jmp 0xa96c2
jmp 0xa96c4
movl 0xd8(%rsp), %eax
movl 0x234(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xa97b4
movq 0x78(%rsp), %rdi
movl 0xd8(%rsp), %esi
incl %esi
movl 0xd4(%rsp), %edx
callq 0xb92a0
movsd %xmm0, 0x10(%rsp)
jmp 0xa96ff
movsd 0x10(%rsp), %xmm0
movsd 0x8a7a3(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa97b4
jp 0xa97b4
movq 0x158(%rsp), %rax
movl 0xd4(%rsp), %ecx
imull 0x234(%rsp), %ecx
movl 0xd8(%rsp), %edx
addl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movsd 0x898a6(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0x88(%rsp), %rax
movsd 0x8c4ee(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa9799
movq 0x88(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa9797
jmp 0xa97b2
movq 0x88(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa97b0
jmp 0xa97b2
jmp 0xa97b4
movl 0xd4(%rsp), %eax
movl 0x230(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xa98a2
movq 0x78(%rsp), %rdi
movl 0xd8(%rsp), %esi
movl 0xd4(%rsp), %edx
incl %edx
callq 0xb92a0
movsd %xmm0, 0x8(%rsp)
jmp 0xa97ef
movsd 0x8(%rsp), %xmm0
movsd 0x8a6b3(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa98a2
jp 0xa98a2
movq 0x158(%rsp), %rax
movl 0xd4(%rsp), %ecx
addl $0x1, %ecx
imull 0x234(%rsp), %ecx
addl 0xd8(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movsd 0x897b8(%rip), %xmm0    # 0x133008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq 0x80(%rsp), %rax
movsd 0x8c400(%rip), %xmm0    # 0x135c68
ucomisd (%rax), %xmm0
jbe 0xa9887
movq 0x80(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38350
jmp 0xa9885
jmp 0xa98a0
movq 0x80(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x38770
jmp 0xa989e
jmp 0xa98a0
jmp 0xa98a2
jmp 0xa9271
leaq 0x110(%rsp), %rdi
callq 0x38a60
leaq 0x160(%rsp), %rdi
callq 0xa7690
addq $0x328, %rsp            # imm = 0x328
retq
leaq 0x160(%rsp), %rdi
callq 0xa7690
movq 0x150(%rsp), %rdi
callq 0xf890
nopw %cs:(%rax,%rax)