// File: /workspace/github_cpp_makefile_star2_O2/YiweiMao[P]tessDX/src/tessellator.cpp
// Function: CHWTessellator::TessellateQuadDomain(float, float, float, float, float, float)
void CHWTessellator::TessellateQuadDomain( float tessFactor_Ueq0, float tessFactor_Veq0, float tessFactor_Ueq1, float tessFactor_Veq1, 
                                         float insideTessFactor_U, float insideTessFactor_V )
{
    PROCESSED_TESS_FACTORS_QUAD processedTessFactors;
    QuadProcessTessFactors(tessFactor_Ueq0,tessFactor_Veq0,tessFactor_Ueq1,tessFactor_Veq1,insideTessFactor_U,insideTessFactor_V,processedTessFactors);

    if( processedTessFactors.bPatchCulled )
    {
        m_NumPoints = 0;
        m_NumIndices = 0;
        return;
    }
    else if( processedTessFactors.bJustDoMinimumTessFactor )
    {
        DefinePoint(/*U*/0,/*V*/0,/*pointStorageOffset*/0);
        DefinePoint(/*U*/FXP_ONE,/*V*/0,/*pointStorageOffset*/1);
        DefinePoint(/*U*/FXP_ONE,/*V*/FXP_ONE,/*pointStorageOffset*/2);
        DefinePoint(/*U*/0,/*V*/FXP_ONE,/*pointStorageOffset*/3);
        m_NumPoints = 4;

        switch(m_outputPrimitive)
        {
        case D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW:
        case D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW:
            // function orients them CCW if needed
            DefineClockwiseTriangle(0,1,3,/*indexStorageOffset*/0);
            DefineClockwiseTriangle(1,2,3,/*indexStorageOffset*/3);
            m_NumIndices = 6;
            break;
        case D3D11_TESSELLATOR_OUTPUT_POINT:
            DumpAllPoints();
            break;
        case D3D11_TESSELLATOR_OUTPUT_LINE:
            DumpAllPointsAsInOrderLineList();
            break;
        }
        return;
    }

    QuadGeneratePoints(processedTessFactors);

    if( m_outputPrimitive == D3D11_TESSELLATOR_OUTPUT_POINT )
    {
        DumpAllPoints();
        return;
    }
    if( m_outputPrimitive == D3D11_TESSELLATOR_OUTPUT_LINE )
    {
        DumpAllPointsAsInOrderLineList();
        return;
    }

    QuadGenerateConnectivity(processedTessFactors); // can be done in parallel to QuadGeneratePoints()
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x402164
cmpb $0x1, 0xa9(%r14)
jne 0x40209a
andq $0x0, 0x28(%rbx)
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
cmpb $0x1, 0xb0(%rsp)
jne 0x4020da
movq 0x18(%rbx), %rax
movaps 0xc2fc1(%rip), %xmm0    # 0x4c5070
movups %xmm0, (%rax)
movaps 0xc2fc7(%rip), %xmm0    # 0x4c5080
movups %xmm0, 0x10(%rax)
movl $0x4, 0x28(%rbx)
movl 0x10(%rbx), %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
jb 0x402119
testl %eax, %eax
je 0x4020f3
cmpl $0x1, %eax
je 0x402106
jmp 0x40208e
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x402654
movl 0x10(%rbx), %eax
cmpl $0x1, %eax
je 0x402106
testl %eax, %eax
jne 0x402151
movq %rbx, %rdi
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4025e0
movq %rbx, %rdi
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x40260c
pushq $0x1
popq %rbp
pushq $0x3
popq %r14
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl %r14d, %ecx
xorl %r8d, %r8d
callq 0x402592
pushq $0x2
popq %rdx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
movl %r14d, %r8d
callq 0x402592
movl $0x6, 0x2c(%rbx)
jmp 0x40208e
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x4029e4
jmp 0x40208e
nop