abc/src/bool/lucky/luckyFast16.c
// It considers all swap and flip possibilities of iVar and iVar+1 and switches InOut to a minimal of them  
It considers all swap and flip possibilities of iVar and iVar+1 and switches InOut to a minimal of them
It considers all swap and flip possibilities of iVar and iVar + 1 and switches InOut to a minimal of them
void minimalSwapAndFlipIVar_superFast_lessThen5(word* pInOut, int iVar, int nWords, char * pCanonPerm, unsigned* pCanonPhase)
{
    int min1, min2, DifStart0, DifStart1, DifStartMin, DifStart4=0;
    int M[2];   
    M[0] = minTemp0_fast(pInOut, iVar, nWords, &DifStart0); 
    M[1] = minTemp1_fast(pInOut, iVar, nWords, &DifStart1); 
    min1 = minTemp2_fast(pInOut, iVar, M[0], M[1], nWords, &DifStartMin);
    if(DifStart0 != DifStart1)
    {
        if( DifStartMin>=DifStart1 && DifStartMin>=DifStart0 )
            arrangeQuoters_superFast_lessThen5(pInOut, DifStartMin/100, M[min1], M[(min1+1)&1], 3 - M[(min1+1)&1], 3 - M[min1], iVar, nWords, pCanonPerm, pCanonPhase);
        else if( DifStart0 > DifStart1)
            arrangeQuoters_superFast_lessThen5(pInOut,luckyMax(DifStartMin/100, DifStart0/100), M[0], M[1], 3 - M[1], 3 - M[0], iVar, nWords, pCanonPerm, pCanonPhase);
        else
            arrangeQuoters_superFast_lessThen5(pInOut,luckyMax(DifStartMin/100, DifStart1/100), M[1], M[0], 3 - M[0], 3 - M[1], iVar, nWords, pCanonPerm, pCanonPhase);
    }
    else
    {
        if(DifStartMin>=DifStart0)
            arrangeQuoters_superFast_lessThen5(pInOut, DifStartMin/100, M[min1], M[(min1+1)&1], 3 - M[(min1+1)&1], 3 - M[min1], iVar, nWords, pCanonPerm, pCanonPhase);
        else
        {
            min2 = minTemp3_fast(pInOut, iVar, DifStart0/100, DifStartMin/100, 3-M[0], 3-M[1], &DifStart4);  
            if(DifStart4>DifStartMin)
                arrangeQuoters_superFast_lessThen5(pInOut, DifStart0/100, M[(min2+1)&1], M[min2], 3 - M[min2], 3 - M[(min2+1)&1], iVar, nWords, pCanonPerm, pCanonPhase);
            else
                arrangeQuoters_superFast_lessThen5(pInOut, DifStart0/100, M[min1], M[(min1+1)&1], 3 - M[(min1+1)&1], 3 - M[min1], iVar, nWords, pCanonPerm, pCanonPhase);
        }
    }
}
void minimalSwapAndFlipIVar_superFast_lessThen5 ( word * pInOut , int iVar , int nWords , char * pCanonPerm , unsigned * pCanonPhase ) { int min1 , min2 , DifStart0 , DifStart1 , DifStartMin , DifStart4 = 0 ; int M [ 2 ] ; M [ 0 ] = minTemp0_fast ( pInOut , iVar , nWords , & DifStart0 ) ; M [ 1 ] = minTemp1_fast ( pInOut , iVar , nWords , & DifStart1 ) ; min1 = minTemp2_fast ( pInOut , iVar , M [ 0 ] , M [ 1 ] , nWords , & DifStartMin ) ; if ( DifStart0 != DifStart1 ) { if ( DifStartMin >= DifStart1 && DifStartMin >= DifStart0 ) arrangeQuoters_superFast_lessThen5 ( pInOut , DifStartMin / 100 , M [ min1 ] , M [ ( min1 + 1 ) & 1 ] , 3 - M [ ( min1 + 1 ) & 1 ] , 3 - M [ min1 ] , iVar , nWords , pCanonPerm , pCanonPhase ) ; else if ( DifStart0 > DifStart1 ) arrangeQuoters_superFast_lessThen5 ( pInOut , luckyMax ( DifStartMin / 100 , DifStart0 / 100 ) , M [ 0 ] , M [ 1 ] , 3 - M [ 1 ] , 3 - M [ 0 ] , iVar , nWords , pCanonPerm , pCanonPhase ) ; else arrangeQuoters_superFast_lessThen5 ( pInOut , luckyMax ( DifStartMin / 100 , DifStart1 / 100 ) , M [ 1 ] , M [ 0 ] , 3 - M [ 0 ] , 3 - M [ 1 ] , iVar , nWords , pCanonPerm , pCanonPhase ) ; } else { if ( DifStartMin >= DifStart0 ) arrangeQuoters_superFast_lessThen5 ( pInOut , DifStartMin / 100 , M [ min1 ] , M [ ( min1 + 1 ) & 1 ] , 3 - M [ ( min1 + 1 ) & 1 ] , 3 - M [ min1 ] , iVar , nWords , pCanonPerm , pCanonPhase ) ; else { min2 = minTemp3_fast ( pInOut , iVar , DifStart0 / 100 , DifStartMin / 100 , 3 - M [ 0 ] , 3 - M [ 1 ] , & DifStart4 ) ; if ( DifStart4 > DifStartMin ) arrangeQuoters_superFast_lessThen5 ( pInOut , DifStart0 / 100 , M [ ( min2 + 1 ) & 1 ] , M [ min2 ] , 3 - M [ min2 ] , 3 - M [ ( min2 + 1 ) & 1 ] , iVar , nWords , pCanonPerm , pCanonPhase ) ; else arrangeQuoters_superFast_lessThen5 ( pInOut , DifStart0 / 100 , M [ min1 ] , M [ ( min1 + 1 ) & 1 ] , 3 - M [ ( min1 + 1 ) & 1 ] , 3 - M [ min1 ] , iVar , nWords , pCanonPerm , pCanonPhase ) ; } } }
It considers all swap and flip possibilities of iVar and iVar+1 and switches InOut to a minimal of them
It considers all swap and flip possibilities of iVar and iVar + 1 and switches InOut to a minimal of them
// 0, 3 // 1, 2 //     printf("\nDifStart0 = %d, DifStart1 = %d, DifStartMin = %d\n",DifStart0, DifStart1, DifStartMin); //     printf("M[0] = %d, M[1] = %d, min1 = %d\n", M[0], M[1], min1); //         printf("if\n"); //         printf("else\n"); // no reuse DifStart1 because DifStart1 = DifStart1=0 //             printf("after minTemp3_fast min2 = %d, DifStart4 = %d\n", min2, DifStart4);