// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rsi
callq 0x402172
cmpb $0x1, 0xa9(%r14)
jne 0x4020a7
movq $0x0, 0x28(%rbx)
addq $0xc8, %rsp
popq %rbx
popq %r14
retq
cmpb $0x1, 0xa8(%rsp)
jne 0x4020e7
movq 0x18(%rbx), %rax
movaps 0xc3fb4(%rip), %xmm0    # 0x4c6070
movups %xmm0, (%rax)
movaps 0xc3fba(%rip), %xmm0    # 0x4c6080
movups %xmm0, 0x10(%rax)
movl $0x4, 0x28(%rbx)
movl 0x10(%rbx), %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
jb 0x402122
testl %eax, %eax
je 0x4020fe
cmpl $0x1, %eax
je 0x402110
jmp 0x40209c
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x40276c
movl 0x10(%rbx), %eax
cmpl $0x1, %eax
je 0x402110
testl %eax, %eax
jne 0x402162
movq %rbx, %rdi
addq $0xc8, %rsp
popq %rbx
popq %r14
jmp 0x4026c2
movq %rbx, %rdi
addq $0xc8, %rsp
popq %rbx
popq %r14
jmp 0x402704
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
movl $0x3, %ecx
xorl %r8d, %r8d
callq 0x40266a
movq %rbx, %rdi
movl $0x1, %esi
movl $0x2, %edx
movl $0x3, %ecx
movl $0x3, %r8d
callq 0x40266a
movl $0x6, 0x2c(%rbx)
jmp 0x40209c
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x402c24
jmp 0x40209c