// File: /workspace/github_cpp_makefile_star2_O1/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 0x40573f
ucomiss %xmm2, %xmm1
jbe 0x40573f
movl 0xc(%rsp), %edx
movl %edx, %eax
notl %eax
testl $0x7f800000, %eax       # imm = 0x7F800000
sete %al
testl $0x7fffff, %edx         # imm = 0x7FFFFF
setne %cl
movd %edx, %xmm1
movss 0xc0988(%rip), %xmm0    # 0x4c6044
ucomiss %xmm1, %xmm0
ja 0x4056c5
andb %cl, %al
je 0x4056cd
movl $0x3f800000, 0xc(%rsp)  # imm = 0x3F800000
movl 0x8(%rsp), %edx
movl %edx, %eax
notl %eax
testl $0x7f800000, %eax       # imm = 0x7F800000
sete %al
testl $0x7fffff, %edx         # imm = 0x7FFFFF
setne %cl
movd %edx, %xmm1
ucomiss %xmm1, %xmm0
ja 0x4056f3
andb %cl, %al
je 0x4056fb
movl $0x3f800000, 0x8(%rsp)  # imm = 0x3F800000
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40518c
movss (%r14), %xmm0
movss %xmm0, 0x98(%rbx)
movl 0x6c(%rbx), %eax
testl %eax, %eax
je 0x405759
cmpl $0x1, %eax
jne 0x405764
movl 0x8(%rsp), %eax
testl $0x7fffff, %eax         # imm = 0x7FFFFF
je 0x405764
andl $0x7f800000, %eax       # imm = 0x7F800000
addl $0x800000, %eax         # imm = 0x800000
movl %eax, 0x8(%rsp)
jmp 0x405764
movss %xmm0, 0x94(%rbx)
movss %xmm1, 0x98(%rbx)
movq $0x0, 0x7c(%rbx)
jmp 0x4057b7
callq 0x4010c8
movss %xmm0, 0x8(%rsp)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x4057c1
movl $0x0, 0x6c(%rbx)
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x40518c
movss (%r15), %xmm0
movss %xmm0, 0x94(%rbx)
callq 0x4010c8
movss %xmm0, (%r15)
movl 0x68(%rbx), %eax
movl %eax, 0x6c(%rbx)
movss %xmm0, 0x7c(%rbx)
movss (%r14), %xmm0
movss %xmm0, 0x80(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq