// File: /workspace/github_cpp_makefile_star2_O2/YiweiMao[P]tessDX/src/tessellator.cpp
// Function: CHLSLTessellator::IsoLineHLSLProcessTessFactors(float, float)
void CHLSLTessellator::IsoLineHLSLProcessTessFactors( float TessFactor_V_LineDensity, float TessFactor_U_LineDetail )
{
    if( !(TessFactor_V_LineDensity > 0) || // NaN will pass
        !(TessFactor_U_LineDetail > 0) )
    {
        m_LastUnRoundedComputedTessFactors[0] = TessFactor_V_LineDensity;
        m_LastUnRoundedComputedTessFactors[1] = TessFactor_U_LineDetail;
        m_LastComputedTessFactors[0] = 
        m_LastComputedTessFactors[1] = 0;
        return;
    }

    CleanupFloatTessFactor(TessFactor_V_LineDensity); // clamp to [1.0f..INF], NaN->1.0f
    CleanupFloatTessFactor(TessFactor_U_LineDetail); // clamp to [1.0f..INF], NaN->1.0f

    ClampTessFactor(TessFactor_U_LineDetail); // clamp unbounded user input based on tessellation mode

    m_LastUnRoundedComputedTessFactors[1] = TessFactor_U_LineDetail;    // Save off TessFactors so they can be returned to app

    TESSELLATOR_PARITY parity;
    if(Pow2Partitioning()||IntegerPartitioning())
    {
        RoundUpTessFactor(TessFactor_U_LineDetail);
        parity = isEven(TessFactor_U_LineDetail) ? TESSELLATOR_PARITY_EVEN : TESSELLATOR_PARITY_ODD;
    }
    else
    {
        parity = m_originalParity;
    }

    FXP fxpTessFactor_U_LineDetail = floatToFixed(TessFactor_U_LineDetail);
    
    OverridePartitioning(D3D11_TESSELLATOR_PARTITIONING_INTEGER);

    ClampTessFactor(TessFactor_V_LineDensity); // Clamp unbounded user input to integer
    m_LastUnRoundedComputedTessFactors[0] = TessFactor_V_LineDensity;    // Save off TessFactors so they can be returned to app

    RoundUpTessFactor(TessFactor_V_LineDensity);

    RestorePartitioning();

    // Save off TessFactors so they can be returned to app
    m_LastComputedTessFactors[0] = TessFactor_V_LineDensity;
    m_LastComputedTessFactors[1] = TessFactor_U_LineDetail;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movss %xmm0, 0xc(%rsp)
movss %xmm1, 0x8(%rsp)
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jbe 0x404f2a
ucomiss %xmm2, %xmm1
jbe 0x404f2a
movd %xmm1, %eax
movd %xmm0, %edx
movl %edx, %ecx
notl %ecx
testl $0x7f800000, %ecx       # imm = 0x7F800000
sete %cl
testl $0x7fffff, %edx         # imm = 0x7FFFFF
setne %dl
movss 0xc01d9(%rip), %xmm2    # 0x4c5044
ucomiss %xmm0, %xmm2
ja 0x404e74
andb %dl, %cl
je 0x404e7c
movl $0x3f800000, 0xc(%rsp)  # imm = 0x3F800000
movl %eax, %ecx
notl %ecx
testl $0x7f800000, %ecx       # imm = 0x7F800000
sete %cl
testl $0x7fffff, %eax         # imm = 0x7FFFFF
setne %al
ucomiss %xmm1, %xmm2
ja 0x404e9a
andb %al, %cl
je 0x404ea2
movl $0x3f800000, 0x8(%rsp)  # imm = 0x3F800000
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x404a38
movss (%r14), %xmm0
movss %xmm0, 0x98(%rbx)
cmpl $0x1, 0x6c(%rbx)
ja 0x404ed2
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x404a02
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x404f49
andl $0x0, 0x6c(%rbx)
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x404a38
movss (%r15), %xmm0
movss %xmm0, 0x94(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x404a02
movl 0x68(%rbx), %eax
movl %eax, 0x6c(%rbx)
movss (%r15), %xmm0
movss %xmm0, 0x7c(%rbx)
movss (%r14), %xmm0
movss %xmm0, 0x80(%rbx)
jmp 0x404f3f
movss %xmm0, 0x94(%rbx)
movss %xmm1, 0x98(%rbx)
andq $0x0, 0x7c(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq