// File: /workspace/github_cpp_makefile_star2_O3/ddunbar[P]PDSample/./quasisampler_prototype.h
// Function: Quasisampler::buildAdaptiveSubdivision(unsigned int)
void buildAdaptiveSubdivision( unsigned minSubdivisionLevel = 6 )
  {
    root = new TileNode(width,height);
    
    // Since we are approximating the MAX within each tile by the values at
    // a few key points, we must provide a sufficiently dense initial
    // tiling. This would not be necessary with a more thorough scan of each
    // tile.
    subdivideAll(minSubdivisionLevel);

    TileLeafIterator it(root);
    TileNode *tmp;

    // Recursively subdivide all triangles until each triangle's
    // required level is reached.
    unsigned level;
    do {
      level = it->getLevel();
      
      if ( it->isSamplingType() ) // Sampling tiles are infinitesimal
      {
        if ( level < getReqSubdivisionLevel(getImportanceAt_bounded(it->getP1())) )
        {
          tmp = *it;
          tmp->refine();
        }
      }
      else
      {
        if ( 
          ( level < getReqSubdivisionLevel(getImportanceAt_bounded(it->getP1())) ) ||
          ( level < getReqSubdivisionLevel(getImportanceAt_bounded(it->getP2())) ) ||
          ( level < getReqSubdivisionLevel(getImportanceAt_bounded(it->getP3())) ) ||
          ( level < getReqSubdivisionLevel(getImportanceAt_bounded(it->getCenter())) )
          )
        {
          tmp = *it;
          tmp->refine();
        }
      }
    } while ( it.next() );
  }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl $0x78, %edi
callq 0x21a0
movq %rax, %r14
movsd 0x10(%rbx), %xmm0
movsd 0x18(%rbx), %xmm1
movq %rax, %rdi
callq 0x5afe
movq %r14, 0x8(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5c10
movq 0x8(%rbx), %r14
cmpb $0x0, 0x5c(%r14)
jne 0x57c3
movq 0x60(%r14), %rax
movq (%rax), %r14
cmpb $0x1, 0x5c(%r14)
jne 0x57b5
movl (%r14), %ebp
cmpl $0x1, 0x4(%r14)
movsd 0x18(%r14), %xmm0
movsd 0x20(%r14), %xmm1
ja 0x581e
xorl %edi, %edi
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jb 0x580c
movsd 0x10(%rbx), %xmm2
ucomisd %xmm0, %xmm2
jbe 0x580c
ucomisd %xmm3, %xmm1
jb 0x580c
movsd 0x18(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x580c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %edi
callq 0x5c86
cmpl %eax, %ebp
jae 0x58f6
jmp 0x58ee
xorl %edi, %edi
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jb 0x5851
movsd 0x10(%rbx), %xmm2
ucomisd %xmm0, %xmm2
jbe 0x5851
ucomisd %xmm3, %xmm1
jb 0x5851
movsd 0x18(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x5851
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %edi
callq 0x5c86
cmpl %eax, %ebp
jb 0x58ee
movsd 0x28(%r14), %xmm0
xorl %edi, %edi
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0x589d
movsd 0x10(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x589d
movsd 0x30(%r14), %xmm1
ucomisd %xmm2, %xmm1
jb 0x589d
movsd 0x18(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x589d
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %edi
callq 0x5c86
cmpl %eax, %ebp
jb 0x58ee
movsd 0x38(%r14), %xmm0
xorl %edi, %edi
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0x58e5
movsd 0x10(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x58e5
movsd 0x40(%r14), %xmm1
ucomisd %xmm2, %xmm1
jb 0x58e5
movsd 0x18(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x58e5
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %edi
callq 0x5c86
cmpl %eax, %ebp
jae 0x5911
movq %r14, %rdi
callq 0x5ce0
movq %r14, %rdi
callq 0x65ce
testq %rax, %rax
je 0x5977
movq %rax, %r14
cmpb $0x0, 0x5c(%rax)
je 0x58f6
jmp 0x57c3
movupd 0x18(%r14), %xmm0
movupd 0x28(%r14), %xmm1
addpd %xmm0, %xmm1
movupd 0x38(%r14), %xmm0
addpd %xmm1, %xmm0
divpd 0x4bbd(%rip), %xmm0     # 0xa4f0
xorl %edi, %edi
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0x580c
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
ucomisd %xmm2, %xmm1
setae %al
movupd 0x10(%rbx), %xmm2
movapd %xmm0, %xmm3
cmpltpd %xmm2, %xmm3
movmskpd %xmm3, %ecx
andb %cl, %al
shrb %cl
andb %cl, %al
cmpb $0x1, %al
je 0x5801
jmp 0x580c
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movl $0x78, %esi
movq %r14, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2310