// File: ddunbar[P]PDSample/./quasisampler_prototype.h
// Function: Quasisampler::TileNode::TileNode(Quasisampler::TileNode*, int, Point2D, int, unsigned int, int, double)
TileNode(  
      TileNode* parent = NULL, 
      int tileType = TileTypeF,
      Point2D refPt = Point2D(0,0),
      int dir = 15, // 15 = East.
      unsigned newbits = 0,
      int parent_slot = 0,
      double scale = 1.0)
    {
      this->parent = parent;
      this->tileType = tileType;
      this->p1 = refPt;
      this->dir = dir%20;
      this->parent_slot = parent_slot;
      this->scale = scale;
      this->level = parent ? parent->level + 1 : 0; // Increment the level.


      // Build triangle, according to type.
      switch(tileType)
      {
      case TileTypeC:
      case TileTypeD:
        // "Skinny" triangles
        p2 = p1 + vvect[dir%20]*scale;
        p3 = p1 + vvect[(dir+4)%20]*(PHI*scale);
        break;
      case TileTypeE:
      case TileTypeF:
        // "Fat" triangles
        p2 = p1 + vvect[dir%20]*(PHI2*scale);
        p3 = p1 + vvect[(dir+2)%20]*(PHI*scale);
        break;
      default:
        // Pentagonal tiles (triangle undefined)
        p2 = p1 + vvect[dir%20]*scale;
        p3 = p1 + vvect[(dir+5)%20]*scale;
      }
      
      // Append 2 new bits to the F-Code.
      if (parent)
        f_code = (parent->f_code<<2)^newbits;
      else 
        f_code = newbits;
      
      // Set as leaf node
      terminal = true;
      children.clear();
    }

// Assembly:
subq $0x218, %rsp            # imm = 0x218
movsd %xmm0, 0x208(%rsp)
movsd %xmm1, 0x210(%rsp)
movq %rdi, 0x200(%rsp)
movq %rsi, 0x1f8(%rsp)
movl %edx, 0x1f4(%rsp)
movl %ecx, 0x1f0(%rsp)
movl %r8d, 0x1ec(%rsp)
movl %r9d, 0x1e8(%rsp)
movsd %xmm2, 0x1e0(%rsp)
movq 0x200(%rsp), %rdi
movq %rdi, 0x108(%rsp)
addq $0x18, %rdi
callq 0xa030
movq 0x108(%rsp), %rdi
addq $0x28, %rdi
callq 0xa030
movq 0x108(%rsp), %rdi
addq $0x38, %rdi
callq 0xa030
movq 0x108(%rsp), %rdi
addq $0x60, %rdi
movq %rdi, 0x100(%rsp)
callq 0xa040
movq 0x108(%rsp), %rax
movq 0x1f8(%rsp), %rcx
movq %rcx, 0x50(%rax)
movl 0x1f4(%rsp), %ecx
movl %ecx, 0x4(%rax)
movq 0x208(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq 0x210(%rsp), %rcx
movq %rcx, 0x20(%rax)
movl 0x1f0(%rsp), %eax
movl $0x14, %ecx
cltd
idivl %ecx
movq 0x108(%rsp), %rax
movl %edx, 0x8(%rax)
movl 0x1e8(%rsp), %ecx
movl %ecx, 0x58(%rax)
movsd 0x1e0(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
cmpq $0x0, 0x1f8(%rsp)
je 0xa1cd
movq 0x1f8(%rsp), %rax
movl (%rax), %eax
addl $0x1, %eax
movl %eax, 0xfc(%rsp)
jmp 0xa1d8
xorl %eax, %eax
movl %eax, 0xfc(%rsp)
jmp 0xa1d8
movq 0x108(%rsp), %rax
movl 0xfc(%rsp), %ecx
movl %ecx, (%rax)
movl 0x1f4(%rsp), %eax
movl %eax, 0xf8(%rsp)
addl $-0x2, %eax
subl $0x2, %eax
jb 0xa219
jmp 0xa201
movl 0xf8(%rsp), %eax
addl $-0x4, %eax
subl $0x2, %eax
jb 0xa447
jmp 0xa63d
movq 0x108(%rsp), %rax
addq $0x18, %rax
movq %rax, 0xe0(%rsp)
movslq 0x1f0(%rsp), %rcx
movl %ecx, %eax
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rdx
addl %ecx, %edx
shll $0x2, %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
cltq
shlq $0x4, %rax
leaq 0x15f7e(%rip), %rdi     # 0x201e0
addq %rax, %rdi
movsd 0x1e0(%rsp), %xmm0
callq 0xa050
movsd %xmm1, 0xe8(%rsp)
movsd %xmm0, 0xf0(%rsp)
jmp 0xa287
movq 0xe0(%rsp), %rdi
movsd 0xe8(%rsp), %xmm0
movsd 0xf0(%rsp), %xmm1
movsd %xmm1, 0x1c0(%rsp)
movsd %xmm0, 0x1c8(%rsp)
leaq 0x1c0(%rsp), %rsi
callq 0xa950
movsd %xmm1, 0xd0(%rsp)
movsd %xmm0, 0xd8(%rsp)
jmp 0xa2d4
movq 0x108(%rsp), %rax
movsd 0xd0(%rsp), %xmm0
movsd 0xd8(%rsp), %xmm1
movsd %xmm1, 0x1d0(%rsp)
movsd %xmm0, 0x1d8(%rsp)
movups 0x1d0(%rsp), %xmm0
movups %xmm0, 0x28(%rax)
addq $0x18, %rax
movq %rax, 0xb8(%rsp)
movl 0x1f0(%rsp), %edx
movl %edx, %ecx
addl $0x4, %ecx
movl %edx, %eax
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rdx
addl %ecx, %edx
shll $0x2, %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %edx
negl %edx
movl %edx, %ecx
leal 0x4(%rax,%rcx), %eax
cltq
shlq $0x4, %rax
leaq 0x15e86(%rip), %rdi     # 0x201e0
addq %rax, %rdi
movsd 0x1e0(%rsp), %xmm0
movsd 0xc12a(%rip), %xmm1     # 0x16498
mulsd %xmm1, %xmm0
callq 0xa050
movsd %xmm1, 0xc0(%rsp)
movsd %xmm0, 0xc8(%rsp)
jmp 0xa38b
movq 0xb8(%rsp), %rdi
movsd 0xc0(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm1
movsd %xmm1, 0x190(%rsp)
movsd %xmm0, 0x198(%rsp)
leaq 0x190(%rsp), %rsi
callq 0xa950
movsd %xmm1, 0xa8(%rsp)
movsd %xmm0, 0xb0(%rsp)
jmp 0xa3d8
movq 0x108(%rsp), %rax
movsd 0xa8(%rsp), %xmm0
movsd 0xb0(%rsp), %xmm1
movsd %xmm1, 0x1a0(%rsp)
movsd %xmm0, 0x1a8(%rsp)
movq 0x1a0(%rsp), %rcx
movq %rcx, 0x38(%rax)
movq 0x1a8(%rsp), %rcx
movq %rcx, 0x40(%rax)
jmp 0xa7f8
movq 0x100(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
callq 0x85a0
jmp 0xa854
movq 0x108(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x90(%rsp)
movslq 0x1f0(%rsp), %rcx
movl %ecx, %eax
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rdx
addl %ecx, %edx
shll $0x2, %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
cltq
shlq $0x4, %rax
leaq 0x15d50(%rip), %rdi     # 0x201e0
addq %rax, %rdi
movsd 0x1e0(%rsp), %xmm0
movsd 0xc004(%rip), %xmm1     # 0x164a8
mulsd %xmm1, %xmm0
callq 0xa050
movsd %xmm1, 0x98(%rsp)
movsd %xmm0, 0xa0(%rsp)
jmp 0xa4c1
movq 0x90(%rsp), %rdi
movsd 0x98(%rsp), %xmm0
movsd 0xa0(%rsp), %xmm1
movsd %xmm1, 0x170(%rsp)
movsd %xmm0, 0x178(%rsp)
leaq 0x170(%rsp), %rsi
callq 0xa950
movsd %xmm1, 0x80(%rsp)
movsd %xmm0, 0x88(%rsp)
jmp 0xa50e
movq 0x108(%rsp), %rax
movsd 0x80(%rsp), %xmm0
movsd 0x88(%rsp), %xmm1
movsd %xmm1, 0x180(%rsp)
movsd %xmm0, 0x188(%rsp)
movups 0x180(%rsp), %xmm0
movups %xmm0, 0x28(%rax)
addq $0x18, %rax
movq %rax, 0x68(%rsp)
movl 0x1f0(%rsp), %edx
movl %edx, %ecx
addl $0x2, %ecx
movl %edx, %eax
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rdx
addl %ecx, %edx
shll $0x2, %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %edx
negl %edx
movl %edx, %ecx
leal 0x2(%rax,%rcx), %eax
cltq
shlq $0x4, %rax
leaq 0x15c4f(%rip), %rdi     # 0x201e0
addq %rax, %rdi
movsd 0x1e0(%rsp), %xmm0
movsd 0xbef3(%rip), %xmm1     # 0x16498
mulsd %xmm1, %xmm0
callq 0xa050
movsd %xmm1, 0x70(%rsp)
movsd %xmm0, 0x78(%rsp)
jmp 0xa5bc
movq 0x68(%rsp), %rdi
movsd 0x70(%rsp), %xmm0
movsd 0x78(%rsp), %xmm1
movsd %xmm1, 0x150(%rsp)
movsd %xmm0, 0x158(%rsp)
leaq 0x150(%rsp), %rsi
callq 0xa950
movsd %xmm1, 0x58(%rsp)
movsd %xmm0, 0x60(%rsp)
jmp 0xa5fa
movq 0x108(%rsp), %rax
movsd 0x58(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movsd %xmm1, 0x160(%rsp)
movsd %xmm0, 0x168(%rsp)
movq 0x160(%rsp), %rcx
movq %rcx, 0x38(%rax)
movq 0x168(%rsp), %rcx
movq %rcx, 0x40(%rax)
jmp 0xa7f8
movq 0x108(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x40(%rsp)
movslq 0x1f0(%rsp), %rcx
movl %ecx, %eax
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rdx
addl %ecx, %edx
shll $0x2, %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
cltq
shlq $0x4, %rax
leaq 0x15b5d(%rip), %rdi     # 0x201e0
addq %rax, %rdi
movsd 0x1e0(%rsp), %xmm0
callq 0xa050
movsd %xmm1, 0x48(%rsp)
movsd %xmm0, 0x50(%rsp)
jmp 0xa6a2
movq 0x40(%rsp), %rdi
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
movsd %xmm1, 0x130(%rsp)
movsd %xmm0, 0x138(%rsp)
leaq 0x130(%rsp), %rsi
callq 0xa950
movsd %xmm1, 0x30(%rsp)
movsd %xmm0, 0x38(%rsp)
jmp 0xa6e0
movq 0x108(%rsp), %rax
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd %xmm1, 0x140(%rsp)
movsd %xmm0, 0x148(%rsp)
movups 0x140(%rsp), %xmm0
movups %xmm0, 0x28(%rax)
addq $0x18, %rax
movq %rax, 0x18(%rsp)
movl 0x1f0(%rsp), %edx
movl %edx, %ecx
addl $0x5, %ecx
movl %edx, %eax
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rdx
addl %ecx, %edx
shll $0x2, %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %edx
negl %edx
movl %edx, %ecx
leal 0x5(%rax,%rcx), %eax
cltq
shlq $0x4, %rax
leaq 0x15a83(%rip), %rdi     # 0x201e0
addq %rax, %rdi
movsd 0x1e0(%rsp), %xmm0
callq 0xa050
movsd %xmm1, 0x20(%rsp)
movsd %xmm0, 0x28(%rsp)
jmp 0xa77c
movq 0x18(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd %xmm1, 0x110(%rsp)
movsd %xmm0, 0x118(%rsp)
leaq 0x110(%rsp), %rsi
callq 0xa950
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
jmp 0xa7ba
movq 0x108(%rsp), %rax
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x120(%rsp)
movsd %xmm0, 0x128(%rsp)
movq 0x120(%rsp), %rcx
movq %rcx, 0x38(%rax)
movq 0x128(%rsp), %rcx
movq %rcx, 0x40(%rax)
cmpq $0x0, 0x1f8(%rsp)
je 0xa825
movq 0x108(%rsp), %rax
movq 0x1f8(%rsp), %rcx
movl 0x48(%rcx), %ecx
shll $0x2, %ecx
xorl 0x1ec(%rsp), %ecx
movl %ecx, 0x48(%rax)
jmp 0xa837
movq 0x108(%rsp), %rax
movl 0x1ec(%rsp), %ecx
movl %ecx, 0x48(%rax)
movq 0x108(%rsp), %rdi
movb $0x1, 0x5c(%rdi)
addq $0x60, %rdi
callq 0x8640
addq $0x218, %rsp            # imm = 0x218
retq
movq 0x1b8(%rsp), %rdi
callq 0x22f0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)