// File: /workspace/github_cpp_makefile_star2_O3/ddunbar[P]PDSample/./quasisampler_prototype.h
// Function: Quasisampler::TileNode::refine()
void refine()
    {
      if (!terminal) return; // Can only subdivide leaf nodes.
      
      terminal=false; // The tile now has children.
      double newscale = scale / GOLDEN_RATIO; // The scale factor between levels is constant.
      
      switch(tileType)
      {

      // Each new tile is created using the following information:
      // A pointer to its parent, the type of the new tile (a through f),
      // the origin of the new tile, the change in orientation of the new tile with
      // respect to the parent's orientation, the two bits to be pre-pended to the F-Code,
      // the parent's slot (for traversal purposes), and the new linear scale of the tile,
      // which is always the parent's scale divided by the golden ratio.

      case TileTypeA:
        children.push_back(
          new TileNode(this, TileTypeB, p1, dir+0, B00, 0, newscale));
        break;

      case TileTypeB:
        children.push_back(
          new TileNode(this, TileTypeA, p1, dir+10, B00, 0, newscale) );
        break;
        
      case TileTypeC:
        children.push_back(
          new TileNode(this, TileTypeF, p3, dir+14, B00, 0, newscale) );
        children.push_back(
          new TileNode(this, TileTypeC, p2, dir+6, B10, 1, newscale) );      
        children.push_back(
          new TileNode(this, TileTypeA, children[0]->p3, dir+1, B10, 2, newscale) );
        break;

      case TileTypeD:
        children.push_back(
          new TileNode(this, TileTypeE, p2, dir+6, B00, 0, newscale) );
        children.push_back(
          new TileNode(this, TileTypeD, children[0]->p3, dir+14, B10, 1, newscale) );
        break;

      case TileTypeE:
        children.push_back(
          new TileNode(this, TileTypeC, p3, dir+12, B10, 0, newscale) );
        children.push_back(
          new TileNode(this, TileTypeE, p2, dir+8 , B01, 1, newscale) );
        children.push_back(
          new TileNode(this, TileTypeF, p1, dir+0 , B00, 2, newscale) );
        children.push_back(
          new TileNode(this, TileTypeA, children[0]->p2, dir+7, B10, 3, newscale) );
        break;

      case TileTypeF:
        children.push_back(
          new TileNode(this, TileTypeF, p3, dir+12, B01, 0, newscale) );
        children.push_back(
          new TileNode(this, TileTypeE, children[0]->p3, dir+0, B00, 1, newscale) );
        children.push_back(
          new TileNode(this, TileTypeD, children[1]->p3, dir+8, B10, 2, newscale) );
        children.push_back(
          new TileNode(this, TileTypeA, children[0]->p3, dir+15, B01, 3, newscale) );
        break;
      }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpb $0x1, 0x5c(%rdi)
jne 0x6194
movq %rdi, %rbx
movb $0x0, 0x5c(%rdi)
movl 0x4(%rdi), %eax
cmpq $0x5, %rax
ja 0x6194
movsd 0x10(%rbx), %xmm0
divsd 0x4724(%rip), %xmm0     # 0xa438
movsd %xmm0, (%rsp)
leaq 0x4800(%rip), %rcx      # 0xa520
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x78, %edi
callq 0x21a0
movq %rax, %r14
movsd 0x18(%rbx), %xmm0
movsd 0x20(%rbx), %xmm1
movl 0x8(%rbx), %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x1, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
movsd (%rsp), %xmm2
callq 0x61de
jmp 0x603a
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movsd 0x38(%rbx), %xmm0
movsd 0x40(%rbx), %xmm1
movl 0x8(%rbx), %ecx
addl $0xc, %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x2, %edx
movl $0x1, %r8d
xorl %r9d, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x60(%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm1
movl 0x8(%rbx), %ecx
addl $0x8, %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x4, %edx
movl $0x2, %r8d
movl $0x1, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movsd 0x18(%rbx), %xmm0
movsd 0x20(%rbx), %xmm1
movl 0x8(%rbx), %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x5, %edx
xorl %r8d, %r8d
movl $0x2, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movq 0x60(%rbx), %rax
movq (%rax), %rax
movsd 0x28(%rax), %xmm0
movsd 0x30(%rax), %xmm1
movl 0x8(%rbx), %ecx
addl $0x7, %ecx
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %r8d
movl $0x3, %r9d
movsd (%rsp), %xmm2
callq 0x61de
jmp 0x6184
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movsd 0x38(%rbx), %xmm0
movsd 0x40(%rbx), %xmm1
movl 0x8(%rbx), %ecx
addl $0xe, %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x5, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x60(%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm1
movl 0x8(%rbx), %ecx
addl $0x6, %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x2, %edx
movl $0x1, %r8d
movl $0x1, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movq 0x60(%rbx), %rax
movq (%rax), %rax
movsd 0x38(%rax), %xmm0
movsd 0x40(%rax), %xmm1
movl 0x8(%rbx), %ecx
incl %ecx
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %r8d
movl $0x2, %r9d
movsd (%rsp), %xmm2
callq 0x61de
jmp 0x6184
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm1
movl 0x8(%rbx), %ecx
addl $0x6, %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x4, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x60(%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movq 0x60(%rbx), %rax
movq (%rax), %rax
movsd 0x38(%rax), %xmm0
movsd 0x40(%rax), %xmm1
movl 0x8(%rbx), %ecx
addl $0xe, %ecx
movq %r15, %rdi
movq %rbx, %rsi
movl $0x3, %edx
movl $0x1, %r8d
movl $0x1, %r9d
movsd (%rsp), %xmm2
callq 0x61de
jmp 0x6184
movl $0x78, %edi
callq 0x21a0
movq %rax, %r14
movsd 0x18(%rbx), %xmm0
movsd 0x20(%rbx), %xmm1
movl 0x8(%rbx), %ecx
addl $0xa, %ecx
movq %rax, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
movsd (%rsp), %xmm2
callq 0x61de
addq $0x60, %rbx
leaq 0x8(%rsp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
jmp 0x618f
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movsd 0x38(%rbx), %xmm0
movsd 0x40(%rbx), %xmm1
movl 0x8(%rbx), %ecx
addl $0xc, %ecx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x5, %edx
movl $0x2, %r8d
xorl %r9d, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x60(%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movq 0x60(%rbx), %rax
movq (%rax), %rax
movsd 0x38(%rax), %xmm0
movsd 0x40(%rax), %xmm1
movl 0x8(%rbx), %ecx
movq %r15, %rdi
movq %rbx, %rsi
movl $0x4, %edx
xorl %r8d, %r8d
movl $0x1, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movq 0x60(%rbx), %rax
movq 0x8(%rax), %rax
movsd 0x38(%rax), %xmm0
movsd 0x40(%rax), %xmm1
movl 0x8(%rbx), %ecx
addl $0x8, %ecx
movq %r15, %rdi
movq %rbx, %rsi
movl $0x3, %edx
movl $0x1, %r8d
movl $0x2, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
movl $0x78, %edi
callq 0x21a0
movq %rax, %r15
movq 0x60(%rbx), %rax
movq (%rax), %rax
movsd 0x38(%rax), %xmm0
movsd 0x40(%rax), %xmm1
movl 0x8(%rbx), %ecx
addl $0xf, %ecx
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x2, %r8d
movl $0x3, %r9d
movsd (%rsp), %xmm2
callq 0x61de
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x6476
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61c5
jmp 0x61b4
movq %rax, %rbx
movl $0x78, %esi
movq %r14, %rdi
jmp 0x61d0
jmp 0x61c5
jmp 0x61c5
movq %rax, %rbx
movl $0x78, %esi
movq %r15, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2310
nop