34     0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
 
   35     1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
 
   36     1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
 
   37     2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
 
   38     1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
 
   39     2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
 
   40     2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
 
   41     3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
 
   61     {
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xAAAAAAAAAAAAAAAA)},
 
   62     {
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xCCCCCCCCCCCCCCCC)},
 
   63     {
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xF0F0F0F0F0F0F0F0)},
 
   64     {
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFF00FF00FF00FF00)},
 
   65     {
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFF0000FFFF0000)},
 
   66     {
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000),
ABC_CONST(0xFFFFFFFF00000000)},
 
   67     {
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF)},
 
   68     {
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF)},
 
   69     {
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF)},
 
   70     {
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0x0000000000000000),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF),
ABC_CONST(0xFFFFFFFFFFFFFFFF)}
 
   79     return nVars <= 6 ? 1 : 1 << (nVars-6);
 
   84     t = (z & 0xffff) | ((z & 0xffff) << 16);
 
   89     printf( 
" %d", (z >> 16) & 7 );
 
   90     printf( 
" %d", (z >> 20) & 7 );
 
   91     printf( 
" %d", (z >> 24) & 7 );
 
   92     printf( 
" %d", (z >> 28) & 7 );
 
  106     for ( w = 0; w < 
nWords; w++ )
 
  108     for ( m = 0; m < 16; m++ )
 
  110         if ( !((t >> m) & 1) )
 
  112         for ( w = 0; w < 
nWords; w++ )
 
  114         for ( v = 0; v < 4; v++ )
 
  115             for ( w = 0; w < 
nWords; w++ )
 
  116                 pC[w] &= ((m >> v) & 1) ? pF[v][w] : ~pF[v][w];
 
  117         for ( w = 0; w < 
nWords; w++ )
 
  123     word pN[16][16], * pG[4];
 
  127     for ( k = 0; k < nVars; k++ )
 
  128         for ( w = 0; w < 
nWords; w++ )
 
  130     for ( i = 0; (z = pZ[i]); i++, k++ )
 
  132         for ( v = 0; v < 4; v++ )
 
  133             pG[v] = pN[ (z >> (16+(v<<2))) & 7 ];
 
  137     for ( w = 0; w < 
nWords; w++ )
 
  138         if ( pN[k][w] != pF[w] )
 
  143             printf( 
"Verification failed!\n" );
 
  152     int nShift = (1 << (nVars - 4));
 
  153     word Mask  = (((
word)1) << nShift) - 1;
 
  154     word iCof0 = pF[0] & Mask;
 
  155     word iCof1 = iCof0, iCof;
 
  157     assert( nVars > 6 && nVars <= 10 );
 
  160     for ( i = 1; i < 16; i++ )
 
  162         iCof = (pF[(i * nShift) / 64] >> ((i * nShift) & 63)) & Mask;
 
  165         if ( iCof1 == iCof0 )
 
  167         else if ( iCof != iCof1 )
 
  174     int nShift = (1 << (nVars - 4));
 
  175     word Mask  = (((
word)1) << nShift) - 1;
 
  176     word iCofs[16], iCof;
 
  180     iCofs[0] = pF[0] & Mask;
 
  181     for ( i = 1; i < 16; i++ )
 
  183         iCof = (pF[(i * nShift) / 64] >> ((i * nShift) & 63)) & Mask;
 
  184         for ( c = 0; c < nCofs; c++ )
 
  185             if ( iCof == iCofs[c] )
 
  188             iCofs[nCofs++] = iCof;
 
  198     for ( w = 0; w < 
nWords; w++ )
 
  204     assert( iVar < nVars - 1 );
 
  207         int Shift = (1 << iVar);
 
  208         for ( i = 0; i < 
nWords; i++ )
 
  209             pOut[i] = (pIn[i] & 
PMasks[iVar][0]) | ((pIn[i] & 
PMasks[iVar][1]) << Shift) | ((pIn[i] & 
PMasks[iVar][2]) >> Shift);
 
  213         int Step = (1 << (iVar - 6));
 
  214         for ( k = 0; k < 
nWords; k += 4*Step )
 
  216             for ( i = 0; i < Step; i++ )
 
  218             for ( i = 0; i < Step; i++ )
 
  219                 pOut[Step+i] = pIn[2*Step+i];
 
  220             for ( i = 0; i < Step; i++ )
 
  221                 pOut[2*Step+i] = pIn[Step+i];
 
  222             for ( i = 0; i < Step; i++ )
 
  223                 pOut[3*Step+i] = pIn[3*Step+i];
 
  230         for ( i = 0; i < 
nWords; i += 2 )
 
  232             pOut[i]   = (pIn[i]   & 
ABC_CONST(0x00000000FFFFFFFF)) | ((pIn[i+1] & 
ABC_CONST(0x00000000FFFFFFFF)) << 32);
 
  233             pOut[i+1] = (pIn[i+1] & 
ABC_CONST(0xFFFFFFFF00000000)) | ((pIn[i]   & 
ABC_CONST(0xFFFFFFFF00000000)) >> 32);
 
  239     word pG[16], * pIn = pF, * pOut = pG, * pTemp;
 
  240     int iPlace0, iPlace1, Count = 0;
 
  241     assert( Var2Pla[v] <= p );
 
  242     while ( Var2Pla[v] != p )
 
  244         iPlace0 = Var2Pla[v];
 
  245         iPlace1 = Var2Pla[v]+1;
 
  247         pTemp = pIn; pIn = pOut, pOut = pTemp;
 
  248         Var2Pla[Pla2Var[iPlace0]]++;
 
  249         Var2Pla[Pla2Var[iPlace1]]--;
 
  250         Pla2Var[iPlace0] ^= Pla2Var[iPlace1];
 
  251         Pla2Var[iPlace1] ^= Pla2Var[iPlace0];
 
  252         Pla2Var[iPlace0] ^= Pla2Var[iPlace1];
 
  257     assert( Pla2Var[p] == v );
 
  303     return (Supp & (Supp+1)) == 0;
 
  311         int i, Shift = (1 << iVar);
 
  312         for ( i = 0; i < 
nWords; i++ )
 
  313             if ( (t[i] & ~
Truth6[iVar]) != ((t[i] & 
Truth6[iVar]) >> Shift) )
 
  319         int i, k, Step = (1 << (iVar - 6));
 
  320         for ( k = 0; k < 
nWords; k += 2*Step )
 
  322             for ( i = 0; i < Step; i++ )
 
  323                 if ( t[i] != t[Step+i] )
 
  333     for ( v = 0; v < nVars; v++ )
 
  346         int i, Shift = (1 << iVar);
 
  347         for ( i = 0; i < 
nWords; i++ )
 
  349             pCof0[i] = (pF[i] & ~
Truth6[iVar]) | ((pF[i] & ~
Truth6[iVar]) << Shift);
 
  350             pCof1[i] = (pF[i] &  
Truth6[iVar]) | ((pF[i] &  
Truth6[iVar]) >> Shift);
 
  356         int i, k, Step = (1 << (iVar - 6));
 
  357         for ( k = 0; k < 
nWords; k += 2*Step )
 
  359             for ( i = 0; i < Step; i++ )
 
  361                 pCof0[i] = pCof0[Step+i] = pF[i];
 
  362                 pCof1[i] = pCof1[Step+i] = pF[Step+i];
 
  373     assert( Num16 < (1<<16)-1 );
 
  379     for ( i = 0; i < nVars; i++ )
 
  380         assert( Pla2Var[Var2Pla[i]] == i );
 
  385     word pCof0[16], pCof1[16];
 
  386     int Pla2Var[10], Var2Pla[10], Count[210], Masks[210];
 
  387     int i, i0,i1,i2,i3, v, x;
 
  388     assert( nVars >= 6 && nVars <= 10 );
 
  390     for ( i = 0; i < nVars; i++ )
 
  393         Pla2Var[i] = Var2Pla[i] = i;
 
  409     for ( i0 = 0;    i0 < nVars; i0++ )
 
  410     for ( i1 = i0+1; i1 < nVars; i1++ )
 
  411     for ( i2 = i1+1; i2 < nVars; i2++ )
 
  412     for ( i3 = i2+1; i3 < nVars; i3++, v++ )
 
  420         Masks[v] = (1 << i0) | (1 << i1) | (1 << i2) | (1 << i3);
 
  423         if ( Count[v] == 2 || Count[v] > 5 )
 
  425         for ( x = 0; x < 4; x++ )
 
  430                 Count[v] = -Count[v];
 
  438     for ( i0 = 0; i0 < v; i0++ )
 
  439     for ( i1 = i0+1; i1 < v; i1++ )
 
  445             if ( Count[i0] == 2 && Count[i1] == 2 )
 
  448         else if ( nVars == 9 )
 
  450             if ( (Count[i0] == 2 && Count[i1] == 2) || 
 
  451                  (Count[i0] == 2 && Count[i1] <  0) || 
 
  452                  (Count[i0] <  0 && Count[i1] == 2) )
 
  457             if ( (Count[i0] == 2 && Count[i1] == 2) || 
 
  458                  (Count[i0] == 2 && Count[i1] <  0) || 
 
  459                  (Count[i0] <  0 && Count[i1] == 2) || 
 
  460                  (Count[i0] <  0 && Count[i1] <  0) )
 
  482     int nSupp, fDerive = 0;
 
static int If_Dec10CofCount(word *pF, int nVars)
static void If_DecVerifyPerm(int Pla2Var[10], int Var2Pla[10], int nVars)
static void If_Dec10SwapAdjacent(word *pOut, word *pIn, int iVar, int nVars)
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
static int If_Dec10WordNum(int nVars)
FUNCTION DEFINITIONS ///. 
static int If_Dec10Count16(int Num16)
static int If_Dec10Support(word *t, int nVars)
void If_Dec10Cofactors(word *pF, int nVars, int iVar, word *pCof0, word *pCof1)
static void If_Dec10ComposeLut4(int t, word **pF, word *pR, int nVars)
unsigned __int64 word
DECLARATIONS ///. 
static int If_DecSuppIsMinBase(int Supp)
#define ABC_NAMESPACE_IMPL_END
static ABC_NAMESPACE_IMPL_START int BitCount8[256]
DECLARATIONS ///. 
int If_Dec10Perform(word *pF, int nVars, int fDerive)
void If_Dec10PrintConfig(unsigned *pZ)
#define ABC_NAMESPACE_IMPL_START
static int If_Dec10HasVar(word *t, int nVars, int iVar)
static int If_Dec10CofCount2(word *pF, int nVars)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static word Truth10[10][16]
#define ABC_CONST(number)
PARAMETERS ///. 
void If_Dec10Verify(word *pF, int nVars, unsigned *pZ)
int If_CutPerformCheck10(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
static void If_Dec10Copy(word *pOut, word *pIn, int nVars)
static void If_Dec10MoveTo(word *pF, int nVars, int v, int p, int Pla2Var[], int Var2Pla[])
static void If_Dec10PrintConfigOne(unsigned z)