/*

 Provide "int limits[MAXMARKS]" to the rest of the algorithm
 Uses: MAXMARKS, maxmarks, maxlength, depth, dist[][0]

 limits.h broken out of the main halfTweakedGARSP.c files
     Added OGRdist (32bit only for now, but could/should later be extended)
     Wrote optimized versions for KTEST=0, KTEST=1 and KTEST>1
     Use choose in the midpoint to improve the halflength limit

 limits_steps.h
     Include the calculated limit in the dists and see if the limit can be reduced even further (tempo)
     Also include the new DIST that would be added if we would set a mark at tempo (e.g. DIST@(depth+1))
     Add a while loop to reduce limit if there wouldnt be sapce for a mark at that place in COMP
 
 */

//#include "chooseV3_12_12.h"
#include "chooseV3_15_13_.h"
//#include "chooseV3_16_12.h"
#define MINIMUM(x,y) ((x<y) ? (x) : (y))
#define KTEST 1  /* NOTE: KTEST restricts your ability to find very short OGRs
                         e.g. using KTEST=0 you can find all OGRs (except OGR-0 though OGR-2 but these are trivial)
                              using KTEST=1 you cannot reliably find OGRs <= OGR-4
                              using KTEST=2 you cannot reliably find OGRs <= OGR-6 */

/* Use KTEST=0 for <= OGR-14
   Use KTEST=1 for >= OGR-15 (reduces the nodecount!!!)
   Use KTEST=2 ???
*/

#if (KTEST>0) && (CHOOSEMARKS<=(KTEST*2)+1)
/* calculation of halflength requires (CHOOSEMARKS>halfdepth2-halfdepth1) */
/* e.g.: COOSEMARKS > 3 for KTEST 1, > 5 for KTEST 2, > 7 for KTEST 3,... */
#error please use a choosefile with more CHOOSEMARKS or reduce KTEST
#endif

const unsigned char OGRdist_vert[16][192] = {
    /* OGR-01 */ {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-02 */ {
        1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-03 */ {
        1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-04 */ {
        1,2,3,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-05 */ {
        1,2,3,2,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-06 */ {
        1,2,3,2,2,2,2,0,1,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-07 */ {
        1,2,3,3,1,1,2,0,1,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-08 */ {
        1,2,3,4,5,3,4,1,2,2,1,2,2,1,1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1,
        1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-09 */ {
        1,2,3,4,5,4,3,4,4,2,3,3,3,2,2,3,3,0,1,1,0,1,1,2,2,1,2,0,1,2,0,1,
        0,1,1,1,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-10 */ {
        1,2,3,4,5,6,5,6,5,6,7,7,5,6,6,6,5,5,3,4,4,5,5,5,5,5,5,4,4,3,4,4,
        5,5,4,0,0,0,0,1,2,0,1,0,1,0,1,0,1,0,0,1,2,3,3,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-11 */ {
        1,2,3,4,3,4,5,4,4,3,0,1,2,2,2,2,3,3,2,2,3,0,1,2,2,0,1,2,0,0,1,2,
        2,2,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,1,2,0,1,0,0,0,1,0,0,1,0,0,1,0,
        0,0,0,1,2,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-12 */ {
        1,2,3,4,5,6,7,8,9,10,8,9,7,8,7,8,6,7,7,6,7,6,7,6,6,7,8,6,6,7,7,7,
        6,6,6,7,6,6,6,6,7, 6,6,6,6,6,6,0,1,0,1,2,3,0,1,2,0,0,0,0,1,2,0,0,
        0,1,0,1,2,3,0,0,1, 2,3,4,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-13 */ {
        1,2,3,4,5,6,7,7,8,6,5,4,5,6,6,3,4,5,5,3,4,5,6,0,1,2,3,4,5,6,0,1,
        2,3,4,5,3,4,5,4,4,5,4,0,1,2,3,4,0,0,0,1,0,1,2,3,3,0,1,2,3,3,3,3,
        3,0,0,1,2,3,0,0,1,2,0,0,0,0,0,1,2,0,1,2,3,0,1,0,1,0,0,0,1,2,0,1,
        2,3,3,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-14 */ {
        1,2,3,4,5,6,7,8,4,5,6,7,6,5,6,6,7,4,5,3,4,5,4,5,4,4,4,2,3,2,3,2,
        2,2,2,3,4,5,4,2,3,2,3,2,2,2,3,4,4,2,2,3,2,3,2,0,1,2,2,0,0,0,1,2,
        0,1,0,1,2,2,2,2,1,1,2,0,1,1,2,1,0,1,2,0,1,2,2,0,1,0,0,1,1,0,1,0,
        0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,2,1,0,0,0,1,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-15 */ {
        1,2,3,4,5,4,5,6,7,6,6,5,6,6,7,8,5,0,1,2,1,2,3,1,2,1,2,1,2,3,0,1,
        1,2,3,4,4,1,1,2,2,2,2,2,1,1,1,0,1,0,1,2,1,2,3,4,4,2,2,3,2,3,0,1,
        0,1,0,1,2,3,0,1,0,1,2,1,1,0,1,1,2,2,3,0,1,1,2,1,1,0,1,1,1,1,0,1,
        0,0,0,1,0,0,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,0,1,0,1,1,1,0,0,0,
        0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    },

    /* OGR-16 */ {
        1,2,3,4,5,6,7,8,7,5,6,7,5,6,5,6,7,8,5,4,3,4,0,1,2,3,4,4,1,2,3,4,
        1,2,3,2,0,0,1,0,1,2,2,1,2,2,3,4,4,3,1,2,2,0,1,2,3,2,2,3,2,3,0,1,
        1,2,3,2,0,0,0,1,0,1,2,3,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,2,0,1,1,0,
        0,0,0,1,2,1,0,1,0,1,1,2,3,0,1,2,2,1,2,1,1,1,0,0,1,0,1,1,0,0,0,0,
        0,1,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,2,0,0,1,2,1,2,0,0,0,0,1,0,1,0,
        0,1,1,2,0,1,2,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    }
    
    
};



const uint32_t OGRdist[32][19] = {

/* OGR-01 */ {
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-02 */ {
/* 10000000000000000000000000000000 */ 0x80000000,	//1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-03 */ {
/* 11100000000000000000000000000000 */ 0xe0000000,	//1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10100000000000000000000000000000 */ 0xa0000000,	//1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-04 */ {
/* 11111100000000000000000000000000 */ 0xfc000000,	//1,2,3,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 11010000000000000000000000000000 */ 0xd0000000,	//1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10000000000000000000000000000000 */ 0x80000000,	//1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-05 */ {
/* 11111011101000000000000000000000 */ 0xfba00000,	//1,2,3,2,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 11100000100000000000000000000000 */ 0xe0800000,	//1,2,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10000000000000000000000000000000 */ 0x80000000,	//1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-06 */ {
/* 11111110101010011000000000000000 */ 0xfea98000,	//1,2,3,2,2,2,2,0,1,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 11111110001000000000000000000000 */ 0xfe200000,	//1,2,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10000000000000000000000000000000 */ 0x80000000,	//1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-07 */ {
/* 11111110100001000110011010000000 */ 0xfe846680,	//1,2,3,3,1,1,2,0,1,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,0,0,0,0
/* 11100100100000000000000000000000 */ 0xe4800000,	//1,2,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 11100000000000000000000000000000 */ 0xe0000000,	//1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-08 */ {
/* 11111111111111101110111010010111 */ 0xfffeee97,	//1,2,3,4,5,3,4,1,2,2,1,2,2,1,1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1	
/* 11111101101100000010000000000000 */ 0xfdb02000,	//1,2,3,4,2,3,0,1,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0	
/* 11111100000000000000000000000000 */ 0xfc000000,	//1,2,3,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 11010000000000000000000000000000 */ 0xd0000000,	//1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10000000000000000000000000000000 */ 0x80000000,	//1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11000000000000000000000000000000 */ 0xc0000000	//1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-09 */ {
/* 11111111111111111011011111101101 */ 0xffffb7ed,	//1,2,3,4,5,4,3,4,4,2,3,3,3,2,2,3,3,0,1,1,0,1,1,2,2,1,2,0,1,2,0,1	
/* 11111111111111110000001101101000 */ 0xffff0368,	//1,2,3,4,3,2,3,3,1,2,2,2,1,1,2,2,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0	
/* 11111110111001110000000000100000 */ 0xfee70020,	//1,2,3,2,1,2,2,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0
/* 11101110000000010000000000000000 */ 0xee010000,	//1,2,1,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10100000000000000000000000000000 */ 0xa0000000,	//1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 01110011101100000000000000000000 */ 0x73b00000	//0,1,1,1,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-10 */ {
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,5,6,5,6,7,7,5,6,6,6,5,5,3,4,4,5,5,5,5,5,5,4,4,3,4,4	
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,4,5,4,5,6,6,4,5,5,5,4,4,2,3,3,4,4,4,4,4,4,3,3,2,3,3,4	
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,3,4,3,4,5,5,3,4,4,4,3,3,1,2,2,3,3,3,3,3,3,2,2,1,2,2,3,3	
/* 11111111111111101111111111011111 */ 0xfffeffdf,	//1,2,3,2,3,2,3,4,4,2,3,3,3,2,2,0,1,1,2,2,2,2,2,2,1,1,0,1,1,2,2,1	
/* 11111111111111100111111000001101 */ 0xfffe7e0d,	//1,2,1,2,1,2,3,3,1,2,2,2,1,1,1,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,0,1	
/* 10101110111000100000000000000000 */ 0xaee20000,	//1,0,1,0,1,2,2,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	
/* 00001100000000000000000000000000 */ 0x0c000000,	//0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11100001101010101001111000000000 */ 0xe1aa9e00	//5,5,4,0,0,0,0,1,2,0,1,0,1,0,1,0,1,0,0,1,2,3,3,0,0,0,0,0,0,0,0,0
//* 11100001101010101001111000000000 */ 0xe1aa9e00	//4,3,4,0,0,0,0,1,2,0,1,0,1,0,1,0,1,0,0,1,2,2,3,0,0,0,0,0,0,0,0,0
//* 11100001101010101001111000000000 */ 0xe1aa9e00	//2,3,3,0,0,0,0,1,2,0,1,0,1,0,1,0,1,0,0,1,1,2,1,0,0,0,0,0,0,0,0,0
//* 11100001001000000000101000000000 */ 0xe1200a00	//2,2,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0
//* 10000001001000000000000000000000 */ 0x81200000	//1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-11 */ {
/* 11111111110111111111101110110011 */ 0xffdffbb3,	//1,2,3,4,3,4,5,4,4,3,0,1,2,2,2,2,3,3,2,2,3,0,1,2,2,0,1,2,0,0,1,2		
/* 11111111110111111111101110110011 */ 0xffdffbb3,	//1,2,3,2,3,4,3,3,2,2,0,1,1,1,1,2,2,1,1,2,1,0,1,1,1,0,1,1,0,0,1,1		
/* 11111111100000110010100000000000 */ 0xff832800,	//1,2,1,2,3,2,2,1,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0		
/* 10111100100000000000000000000000 */ 0xbc800000,	//1,0,1,2,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00100000000000000000000000000000 */ 0x20000000,	//0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11001010101000100110100010010010 */ 0xcaa26892	//2,2,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,1,2,0,1,0,0,0,1,0,0,1,0,0,1,0
//* 11001010101000100110100010010010 */ 0xcaa26892	//1,1,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 00011011000000000000000000000000 */ 0x1b000000	//0,0,0,1,2,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00011011000000000000000000000000 */ 0x1b000000	//0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-12 */ {
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,8,9,7,8,7,8,6,7,7,6,7,6,7,6,6,7,8,6,6,7,7,7
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9, 7,8,6,7,6,7,5,6,6,5,6,5,6,5,5,6,7,5,5,6,6,6,5
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,6, 7,5,6,5,6,4,5,5,4,5,4,5,4,4,5,6,4,4,5,5,5,4,4
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,5,6, 4,5,4,5,3,4,4,3,4,3,4,3,3,4,5,3,3,4,4,4,3,3,3
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,4,5,3, 4,3,4,2,3,3,2,3,2,3,2,2,3,4,2,2,3,3,3,2,2,2,3
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,3,4,2,3, 2,3,1,2,2,1,2,1,2,1,1,2,3,1,1,2,2,2,1,1,1,2,1
/* 11111111110110101001100111000100 */ 0xffda99c4,	//1,2,3,4,2,3,1,2,1, 2,0,1,1,0,1,0,1,0,0,1,2,0,0,1,1,1,0,0,0,1,0,0
/* 11111010110010000001100000000000 */ 0xfac81800,	//1,2,3,1,2,0,1,0,1, 1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0
/* 11011000000010000000000000000000 */ 0xd8080000,	//1,2,0,1,1,0,0,0,0, 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 11000000000000000000000000000000 */ 0xc0000000,	//1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 01000000000000000000000000000000 */ 0x40000000,	//0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11111111111111101011101100001100 */ 0xfffebb0c	//6,6,6,7,6,6,6,6,7,6,6,6,6,6,6,0,1,0,1,2,3,0,1,2,0,0,0,0,1,2,0,0
//* 11111111111111101011101100001100 */ 0xfffebb0c	//5,5,6,5,5,5,5,6,5,5,5,5,5,5,4,0,1,0,1,2,3,0,1,2,0,0,0,0,1,2,0,0
//* 11111111111111101011101100001100 */ 0xfffebb0c	//4,5,4,4,4,4,5,4,4,4,4,4,4,3,4,0,1,0,1,2,3,0,1,2,0,0,0,0,1,2,0,0
//* 11111111111111101011101100001100 */ 0xfffebb0c	//4,3,3,3,3,4,3,3,3,3,3,3,2,3,3,0,1,0,1,2,3,0,1,2,0,0,0,0,1,2,0,0
//* 11111111111111101011101100001100 */ 0xfffebb0c	//2,2,2,2,3,2,2,2,2,2,2,1,2,2,2,0,1,0,1,2,2,0,1,2,0,0,0,0,1,1,0,0
//* 11111111110111001011101000000100 */ 0xffdcba04	//1,1,1,2,1,1,1,1,1,1,0,1,1,1,0,0,1,0,1,1,1,0,1,0,0,0,0,0,0,1,0,0
//* 00100000000000000000000000000000 */ 0x20000000	//0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 01011100111100100010100000000000 */ 0x5cf22800	//0,1,0,1,2,3,0,0,1,2,3,4,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0
//* 01011100111100100010100000000000 */ 0x5cf22800	//0,1,0,1,2,3,0,0,1,2,3,4,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0
//* 01011100111100100010100000000000 */ 0x5cf22800	//0,1,0,1,2,3,0,0,1,2,3,4,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0
//* 01011100111100100010100000000000 */ 0x5cf22800	//0,1,0,1,2,2,0,0,1,2,3,2,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0
//* 01011100111100100010100000000000 */ 0x5cf22800	//0,1,0,1,1,1,0,0,1,2,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0
//* 00000000100000100010000000000000 */ 0x00822000	//0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-13 */ {
/* 11111111111111111111111011111101 */ 0xfffffefd,	//1,2,3,4,5,6,7,7,8,6,5,4,5,6,6,3,4,5,5,3,4,5,6,0,1,2,3,4,5,6,0,1			
/* 11111111111111111111111011111101 */ 0xfffffefd,	//1,2,3,4,5,6,6,7,5,4,3,4,5,5,2,3,4,4,2,3,4,5,2,0,1,2,3,4,5,2,0,1			
/* 11111111111111111111111011111101 */ 0xfffffefd,	//1,2,3,4,5,5,6,4,3,2,3,4,4,1,2,3,3,1,2,3,4,1,1,0,1,2,3,4,1,1,0,1			
/* 11111111111101110111001011100101 */ 0xfff772e5,	//1,2,3,4,4,5,3,2,1,2,3,3,0,1,2,2,0,1,2,3,0,0,1,0,1,2,3,0,0,1,0,1			
/* 11111110111001110111001011100001 */ 0xfee772e1,	//1,2,3,3,4,2,1,0,1,2,2,0,0,1,1,1,0,1,2,1,0,0,1,0,1,2,2,0,0,0,0,1			
/* 11111000110000010101000011000000 */ 0xf8c150c0,	//1,2,2,3,1,0,0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,1,0,0,0,0,0,0	
/* 11100000000000000000000000000000 */ 0xe0000000,	//1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 01000000000000000000000000000000 */ 0x40000000,	//0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11111111111011110001011110111111 */ 0xffef17bf	//2,3,4,5,3,4,5,4,4,5,4,0,1,2,3,4,0,0,0,1,0,1,2,3,3,0,1,2,3,3,3,3
//* 11111111111011110001011110111111 */ 0xffef17bf	//2,3,4,2,3,4,3,3,4,3,2,0,1,2,3,2,0,0,0,1,0,1,2,2,3,0,1,2,2,2,2,2
//* 11111111111011110001011110111111 */ 0xffef17bf	//2,3,1,2,3,2,2,3,2,1,1,0,1,2,1,2,0,0,0,1,0,1,1,2,1,0,1,1,1,1,1,1
//* 10111111000010110000001000000000 */ 0xbf0b0200	//2,0,1,2,1,1,2,1,0,0,0,0,1,0,1,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
//* 00100101000010100000001000000000 */ 0x250a0200	//0,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 10011100110000011011101010001101 */ 0x9cc1ba8d	//3,0,0,1,2,3,0,0,1,2,0,0,0,0,0,1,2,0,1,2,3,0,1,0,1,0,0,0,1,2,0,1
//* 10011100110000011011101010001101 */ 0x9cc1ba8d	//2,0,0,1,2,2,0,0,1,2,0,0,0,0,0,1,2,0,1,2,2,0,1,0,1,0,0,0,1,2,0,1
//* 10011100110000011011101010001101 */ 0x9cc1ba8d	//1,0,0,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1
//* 00000100000000000000000000000100 */ 0x04000004	//0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11101001010000000000000000000000 */ 0xe9400000	//2,3,3,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 11101001010000000000000000000000 */ 0xe9400000	//2,2,2,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 11101001010000000000000000000000 */ 0xe9400000	//1,1,2,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 01001000000000000000000000000000 */ 0x48000000	//0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-14 */ {
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,4,5,6,7,6,5,6,6,7,4,5,3,4,5,4,5,4,4,4,2,3,2,3,2
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,3,4,5,6,5,4,5,5,6,3,4,2,3,4,3,4,3,3,3,1,2,1,2,1,1
/* 11111111111111111111111110101000 */ 0xffffffa8,	//1,2,3,4,5,6,2,3,4,5,4,3,4,4,5,2,3,1,2,3,2,3,2,2,2,0,1,0,1,0,0,0
/* 11111111111111110111111110000000 */ 0xffff7f80,	//1,2,3,4,5,1,2,3,4,3,2,3,3,4,1,2,0,1,2,1,2,1,1,1,2,0,0,0,0,0,0,0
/* 11110111111110100101000110000000 */ 0xf7fa5180,	//1,2,3,4,0,1,2,3,2,1,2,2,3,0,1,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0
/* 11110111011100100001000010000000 */ 0xf7721080,	//1,2,3,4,0,1,2,1,0,1,1,2,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0
/* 11110100001100000000000010000000 */ 0xf4300080,	//1,2,3,2,0,1,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
/* 11110100001000000000000000000000 */ 0xf4200000,	//1,2,1,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10000000000000000000000000000000 */ 0x80000000,	//1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11111111111111111111111011100011 */ 0xfffffee3	//2,2,2,3,4,5,4,2,3,2,3,2,2,2,3,4,4,2,2,3,2,3,2,0,1,2,2,0,0,0,1,2
//* 11111111111111111111110011100010 */ 0xfffffce2	//1,1,2,3,4,3,1,2,1,2,1,1,1,2,3,3,1,1,2,1,2,1,0,0,1,1,1,0,0,0,1,0
//* 01111010100011100101010000000000 */ 0x7a8e5400	//0,1,2,3,2,0,1,0,1,0,0,0,1,2,2,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0
//* 01111010100011000001010000000000 */ 0x7a8c1400	//0,1,2,1,2,0,1,0,1,0,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0
//* 01010000000000000000000000000000 */ 0x50000000	//0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 01010000000000000000000000000000 */ 0x50000000	//0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00010000000000000000000000000000 */ 0x10000000	//0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 01011111111011110110111010011010 */ 0x5fef6e9a	//0,1,0,1,2,2,2,2,1,1,2,0,1,1,2,1,0,1,2,0,1,2,2,0,1,0,0,1,1,0,1,0
//* 00011110010001100100110000000010 */ 0x1e464c02	//0,0,0,1,1,1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0
//* 00000000010000000000000000000000 */ 0x00400000	//0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000010000000000000000000000 */ 0x00400000	//0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 00100100001000000001010011100010 */ 0x242014e2	//0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,2,1,0,0,0,1,0
//* 00000000000000000000000010000000 */ 0x00000080	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
//* 00000000000000000000000010000000 */ 0x00000080	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
//* 00000000000000000000000010000000 */ 0x00000080	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-15 */ {
/* 11111111111111111011111111111101 */ 0xffffbffd,	//1,2,3,4,5,4,5,6,7,6,6,5,6,6,7,8,5,0,1,2,1,2,3,1,2,1,2,1,2,3,0,1
/* 11111111111111111010110101011100 */ 0xffffad5c,	//1,2,3,4,3,4,5,6,5,5,4,5,5,6,7,4,5,0,1,0,1,2,0,1,0,1,0,1,2,3,0,0
/* 11111111111111110010110100011000 */ 0xffff2d18,	//1,2,3,2,3,4,5,4,4,3,4,4,5,6,3,4,0,0,1,0,1,2,0,1,0,0,0,1,2,0,0,0
/* 11111111111111110010110100011000 */ 0xffff2d18,	//1,2,1,2,3,4,3,3,2,3,3,4,5,2,3,2,0,0,1,0,1,2,0,1,0,0,0,1,1,0,0,0
/* 10111111111111110010100100001000 */ 0xbfff2908,	//1,0,1,2,3,2,2,1,2,2,3,4,1,2,1,2,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0
/* 10111101111010100010100100001000 */ 0xbdea2908,	//1,0,1,2,1,1,0,1,1,2,3,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0
/* 10100000111010000000000000000000 */ 0xa0e80000,	//1,0,1,0,0,0,0,0,1,2,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10100000111010000000000000000000 */ 0xa0e80000,	//1,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10000000000000000000000000000000 */ 0x80000000,	//1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11111111111111101011111111111101 */ 0xfffebffd	//1,2,3,4,4,1,1,2,2,2,2,2,1,1,1,0,1,0,1,2,1,2,3,4,4,2,2,3,2,3,0,1
//* 11110011111000101010111111111001 */ 0xf3e2aff9	//1,2,3,3,0,0,1,1,1,1,1,0,0,0,1,0,1,0,1,0,1,2,3,3,1,1,2,1,2,0,0,1
//* 11100000000000101010111001010001 */ 0xe002ae51	//1,2,2,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,2,2,0,0,1,0,1,0,0,0,1
//* 11100000000000101010111001010001 */ 0xe002ae51	//1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,2,0,0,1,0,1,0,0,0,1
//* 00000000000000100000011000000001 */ 0x00020601	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,1
//* 00000000000000100000010000000000 */ 0x00020400	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 01011101011110111110111110111101 */ 0x5d7befbd	//0,1,0,1,2,3,0,1,0,1,2,1,1,0,1,1,2,2,3,0,1,1,2,1,1,0,1,1,1,1,0,1
//* 00011101010010011100010010000001 */ 0x1d49c481	//0,0,0,1,2,3,0,1,0,1,0,0,1,0,0,1,1,2,0,0,0,1,0,0,1,0,0,0,0,0,0,1
//* 00011101010010001000000010000000 */ 0x1d488080	//0,0,0,1,2,2,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
//* 00011101010010001000000010000000 */ 0x1d488080	//0,0,0,1,1,1,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 00010010011000100111001010111000 */ 0x126272b8	//0,0,0,1,0,0,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,0,1,0,1,1,1,0,0,0
//* 00000000000000000000000010000000 */ 0x00000080	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 00110001000110011010001000000000 */ 0x3119a200	//0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    
/* OGR-16 */ {
/* 11111111111111111111110111111111 */ 0xfffffdff,	//1,2,3,4,5,6,7,8,7,5,6,7,5,6,5,6,7,8,5,4,3,4,0,1,2,3,4,4,1,2,3,4
/* 11111111111111111111110111101110 */ 0xfffffdee,	//1,2,3,4,5,6,7,6,4,5,6,4,5,4,5,6,7,4,3,2,3,4,0,1,2,3,3,0,1,2,3,0
/* 11111111111111111111100111001110 */ 0xfffff9ce,	//1,2,3,4,5,6,5,3,4,5,3,4,3,4,5,6,3,2,1,2,3,0,0,1,2,2,0,0,1,2,2,0
/* 11111111111111111011000111001110 */ 0xffffb1ce,	//1,2,3,4,5,4,2,3,4,2,3,2,3,4,5,2,1,0,1,2,0,0,0,1,1,1,0,0,1,1,2,0
/* 11111111111111101011000001000110 */ 0xfffeb046,	//1,2,3,4,3,1,2,3,1,2,1,2,3,4,1,0,1,0,1,2,0,0,0,0,0,1,0,0,0,1,1,0
/* 11110110101110001010000000000000 */ 0xf6b8a000,	//1,2,3,2,0,1,2,0,1,0,1,2,3,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 11100110001110000010000000000000 */ 0xe6382000,	//1,2,1,0,0,1,1,0,0,0,1,2,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 10000010001000000000000000000000 */ 0x82200000,	//1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11110010111111111111101111111101 */ 0xf2fffbfd,	//1,2,3,2,0,0,1,0,1,2,2,1,2,2,3,4,4,3,1,2,2,0,1,2,3,2,2,3,2,3,0,1
//* 11110010110111111011101111111000 */ 0xf2dfbbf8,	//1,2,1,1,0,0,1,0,1,1,0,1,1,2,3,3,2,0,1,1,2,0,1,2,1,1,2,1,2,0,0,0
//* 10010010010011110001101001011000 */ 0x924f1a58,	//1,0,0,1,0,0,1,0,0,1,0,0,1,2,2,1,0,0,0,1,2,0,1,0,0,1,0,1,2,0,0,0
//* 00000010010011000001101000010000 */ 0x024c1a10,	//0,0,0,0,0,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,2,0,1,0,0,0,0,1,0,0,0,0
//* 00000010000000000001000000000000 */ 0x02001000,	//0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000010000000000000000000000000 */ 0x02000000,	//0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000010000000000000000000000000 */ 0x02000000,	//0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000,	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 11110001011101000110101010110110 */ 0xf1746ab6,	//1,2,3,2,0,0,0,1,0,1,2,3,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,2,0,1,1,0
//* 11110000011101000010101010110010 */ 0xf0742ab2,	//1,2,1,2,0,0,0,0,0,1,2,1,0,1,0,0,0,0,1,0,1,0,1,0,1,0,1,1,0,0,1,0
//* 10110000010000000000001000010000 */ 0xb0400210,	//1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000,	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000,	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 00011101011110111111110010110000 */ 0x1d7bfcb0,	//0,0,0,1,2,1,0,1,0,1,1,2,3,0,1,2,2,1,2,1,1,1,0,0,1,0,1,1,0,0,0,0
//* 00010101001100110100000010010000 */ 0x15334090,	//0,0,0,1,0,1,0,1,0,0,1,2,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0
//* 00000001001000010100000010000000 */ 0x01214080,	//0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0
//* 00000001000000000000000000000000 */ 0x01000000,	//0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000,	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 01101101101001001100111100001010 */ 0x6da4cf0a,	//0,1,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,2,0,0,1,2,1,2,0,0,0,0,1,0,1,0
//* 00000100000000001000101000000010 */ 0x04008a02,	//0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,
//* 00000000000000000000000000000010 */ 0x00000002,	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
//* 00000000000000000000000000000000 */ 0x00000000,	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

//* 01110111000010011000000000000000 */ 0x77098000,	//0,1,1,2,0,1,2,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00110100000010010000000000000000 */ 0x34090000,	//0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//* 00000000000000000000000000000000 */ 0x00000000,	//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

/* OGR-17 */ {
/* 11111111111111111011111111111111 */ 0xffffbfff,	//1,2,3,4,5,6,7,8,9,10,11,12,12,13,13,10,6,0,1,2,3,4,5,6,7,8,9,10,8,6,4,5
/* 11111111111111111011111111111111 */ 0xffffbfff,	//1,2,3,4,5,6,7,8,9,10,11,11,12,12, 9, 5,3,0,1,2,3,4,5,6,7,8,9, 7,5,3,4,5
/* 11111111111111111011111111111111 */ 0xffffbfff,	//1,2,3,4,5,6,7,8,9,10,10,11,11, 8, 4, 2,2,0,1,2,3,4,5,6,7,8,6, 4,2,3,4,4
/* 11111111111111111011111111111111 */ 0xffffbfff,	//1,2,3,4,5,6,7,8,9, 9,10,10, 7, 3, 1, 1,2,0,1,2,3,4,5,6,7,5,3, 1,2,3,3,4
/* 11111111111110011011111111011111 */ 0xfff9bfdf,	//1,2,3,4,5,6,7,8,8, 9, 9, 6, 2, 0, 0, 1,2,0,1,2,3,4,5,6,4,2,0, 1,2,2,3,4
/* 11111111111110011011111111011111 */ 0xfff9bfdf,	//1,2,3,4,5,6,7,7,8, 8, 5, 1, 2, 0, 0, 1,2,0,1,2,3,4,5,3,1,2,0, 1,1,2,3,4
/* 11111111110110011011111011001111 */ 0xffd9becf,	//1,2,3,4,5,6,6,7,7, 4, 0, 1, 2, 0, 0, 1,2,0,1,2,3,4,2,0,1,1,0, 0,1,2,3,4
/* 11111111110100011011111001001111 */ 0xffd1be4f,	//1,2,3,4,5,5,6,6,3, 3, 0, 1, 0, 0, 0, 1,2,0,1,2,3,1,2,0,0,1,0, 0,1,2,3,4
/* 11111111110100011011011001001111 */ 0xffd1b64f,	//1,2,3,4,4,5,5,2,2, 3, 0, 1, 0, 0, 0, 1,2,0,1,2,0,1,1,0,0,1,0, 0,1,2,3,4
/* 11111111110100011011001001001111 */ 0xffd1b24f,	//1,2,3,3,4,4,1,1,2, 2, 0, 1, 0, 0, 0, 1,2,0,1,2,0,0,1,0,0,1,0, 0,1,2,3,1
/* 11111001110100011010000000001101 */ 0xf9d1a00d,	//1,2,2,3,3,0,0,1,1, 2, 0, 1, 0, 0, 0, 1,1,0,1,0,0,0,0,0,0,0,0, 0,1,2,0,1
/* 11111000110000001010000000001101 */ 0xf8c0a00d,	//1,1,2,2,3,0,0,0,1, 2, 0, 0, 0, 0, 0, 0,1,0,1,0,0,0,0,0,0,0,0, 0,1,2,0,1
/* 01111000110000000010000000001001 */ 0x78c02009,	//0,1,1,2,2,0,0,0,1, 2, 0, 0, 0, 0, 0, 0,0,0,1,0,0,0,0,0,0,0,0, 0,1,0,0,1
/* 00110000110000000000000000000000 */ 0x30c00000,	//0,0,1,1,0,0,0,0,1, 1, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0
/* 00000000000000000000000000000000 */ 0x00000000},	//0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0
/* OGR-18 */ {
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,13,14,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,13,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,12,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,11,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,10,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,9,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,8,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,7,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,6,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,5,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,4,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,3,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,2,
/* 11111111111111111111111111111111 */ 0xffffffff,	//1,
               /* 00000000000000000000000000000000 */ 0x00000000},
/* OGR-19 */ { /* 11111111111111111111111111111111 */ 0xffffffff ,
               /* 00000000000000000000000000000000 */ 0x00000000},
/* OGR-20 */ { /* 11111111111111111111111111111111 */ 0xffffffff ,
               /* 00000000000000000000000000000000 */ 0x00000000},
/* OGR-21 */ { /* 11111111111111111111111111110111 */ 0xfffffff7 ,
               /* 00000000000000000000000000000000 */ 0x00000000},
/* OGR-22 */ { /* 11111111111111111111111011111110 */ 0xfffffefe ,
               /* 00000000000000000000000000000000 */ 0x00000000},
/* OGR-23 */ { /* 11111111111111111111111111111111 */ 0xffffffff ,
               /* 00000000000000000000000000000000 */ 0x00000000},
/* OGR-24 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-25 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-26 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-27 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-28 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-29 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-30 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-31 */ { /* 00000000000000000000000000000000 */ 0x00000000 },
/* OGR-32 */ { /* 00000000000000000000000000000000 */ 0x00000000 }
};


#if (KTEST>1)

/*#define SETUP_LIMITS(MAXMARKS)                                                        		*/
#define SETUP_LIMITS                                                                 			\
const int OGR[32] = { /*  1 */    0,   1,   3,   6,  11,  17,  25,  34,  44,  55,  72,			\
                      /* 12 */   85, 106, 127, 151, 177, 199, 216, 246, 283, 333, 356,			\
                      /* 23 */  372, 425, 480, 492, 553, 585, 623, 680, 747, 784 };			\
const int halfdepth1 = (maxmarks/2)-KTEST;								\
const int halfdepth2 = (maxmarks/2)+(maxmarks%2)+KTEST;							\
int limit[MAXMARKS];	/* current limit, populated by limits.h (based on CHOOSE, MIDPOINT, etc.) */


/*#define CALCULATE_LIMITS(depth)									*/
#define CALCULATE_LIMITS	                 							\
/* CHOOSE */												\
if (CHOOSEMARKS>maxmarks-depth) {									\
    limit[depth] = maxlength-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(maxmarks-depth)];		\
        if ((limit[depth]-count[depth])<=(32-CHOOSEBITS)) {						\
          while (limit[depth] > maxlength-chooseV3[((GET_DIST_32|(0x80000000>>((limit[depth]-count[depth])-1)))>>(32-CHOOSEBITS))][(maxmarks-depth)]) \
    {limit[depth] = limit[depth]-1;} }    								\
} else {												\
    int i=0;												\
    while ((GET_DIST_32 & OGRdist[maxmarks-depth][i]) != 0) {i++;}					\
    limit[depth] = (maxlength-OGR[maxmarks-depth])-i;							\
        /*if ((limit[depth]-count[depth])<=32) {							\
            while (limit[depth] > maxlength-chooseV3[((GET_DIST_32|(0x80000000>>((limit[depth]-count[depth])-1)))>>(32-CHOOSEBITS))][(maxmarks-depth)]) \
        {limit[depth] = limit[depth]-1;} }*/    							\
}													\
/* MIDPOINT */												\
if (depth <= halfdepth2) {										\
    if (depth <= halfdepth1) {										\
        int tempLimit;											\
        const int halflength = (maxlength-1-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(halfdepth2-halfdepth1)])/2;	\
        if (CHOOSEMARKS>halfdepth1-depth) {								\
            tempLimit = halflength-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(halfdepth1-depth)];	\
        } else {											\
            tempLimit = halflength-OGR[halfdepth1-depth];						\
        }												\
        limit[depth]=MINIMUM(limit[depth],tempLimit);							\
    } else {									\
        const int tempLimit = (maxlength-1-count[halfdepth1])-(chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(halfdepth2-depth)]);	\
        limit[depth]=MINIMUM(limit[depth],tempLimit);							\
    }													\
}


#elif (KTEST==1)

/*#define SETUP_LIMITS(MAXMARKS)                                                        		*/
#define SETUP_LIMITS                                                                 			\
const int OGR[32] = { /*  1 */    0,   1,   3,   6,  11,  17,  25,  34,  44,  55,  72,			\
                      /* 12 */   85, 106, 127, 151, 177, 199, 216, 246, 283, 333, 356,			\
                      /* 23 */  372, 425, 480, 492, 553, 585, 623, 680, 747, 784 };			\
const int halfdepth1 = (maxmarks/2)-KTEST;								\
const int halfdepth2 = (maxmarks/2)+(maxmarks%2)+KTEST;   						\
const int symmetry = (maxmarks%2 + maxlength%2 != 1) ? (maxlength-2) : (maxlength-1) ;			\
signed int limit[MAXMARKS]; /*current limit, populated by limits.h (based on CHOOSE, MIDPOINT, etc.) */


/*#define CALCULATE_LIMITS(depth)									*/
#define CALCULATE_LIMITS	                 							\
/* CHOOSE */												\
if ((CHOOSEMARKS>maxmarks-depth)/* && (GET_DIST_32>0x000FFFFF)*/) {					\
    limit[depth] = maxlength-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(maxmarks-depth)];		\
    /* frequently check if ((limit[depth]-count[depth])<=0)printf("KJHG\n"); */				\
    /* Maybe consider while(((GET_COMP_32 & tempo)!=0)) where (limit[depth]-count[depth])>32 		\
    if ((limit[depth]-count[depth])<=32) {								\
        uint32_t tempo=(0x80000000>>((limit[depth]-count[depth])-1));					\
        while ((GET_COMP_32&(tempo))!=0) { limit[depth]-=1;tempo<<=1; }					\
        if ((limit[depth]-count[depth])<=CHOOSEBITS) {							\
            while (((GET_COMP_32&(tempo))!=0)||(limit[depth]>maxlength-					\
                    chooseV3[((GET_DIST_32|(tempo|(GET_LIST_32>>(limit[depth]-count[depth]))))>>(32-CHOOSEBITS))][(maxmarks-depth)]))	\
            { limit[depth]-=1;tempo<<=1; }								\
        }												\
    }	*/												\
} else { /* We sometimes shift left by a value >32 here. It would be very good to extend OGRdist[] */	\
         /* Maybe precalculate this ala CHOOSE[][] and use full precision for that precalculation?? */	\
    int i; limit[depth] = maxlength-OGR[maxmarks-depth];						\
    for(i=0;((GET_DIST_32|(0x80000000>>((limit[depth]-count[depth])-1)))&OGRdist[maxmarks-depth][i])!=0;i++)	\
    {limit[depth]-=1;}											\
   	\
    \
   /* int i; limit[depth] = maxlength-OGR[maxmarks-depth]; \
      i=OGRdist_vert[maxmarks-depth][(limit[depth]-count[depth])-1];\
        for(limit[depth]-=i;((GET_DIST_32|(0x80000000>>((limit[depth]-count[depth])-1)))&OGRdist[maxmarks-depth][i])!=0;i++)	\
        {limit[depth]-=1;} \
   */ \
   /*  int i; uint32_t tempo; limit[depth] = maxlength-OGR[maxmarks-depth];				\
        tempo=(0x80000000>>((limit[depth]-count[depth])-1));						\
        for (i=0;(((GET_COMP_32&(tempo))!=0) || (((GET_DIST_32|(tempo|(GET_LIST_32>>(limit[depth]-count[depth])))) & OGRdist[maxmarks-depth][i])!=0));i++) \
        { tempo<<=1; } limit[depth]-=i; 									\
   */         \
   /*     int i; uint32_t tempo; limit[depth] = maxlength-OGR[maxmarks-depth];				\
        i=OGRdist_vert[maxmarks-depth][(limit[depth]-count[depth])-1];limit[depth]-=i;			\
        for (tempo=(0x80000000>>((limit[depth]-count[depth])-1));(((GET_COMP_32&(tempo))!=0)||		\
            (((GET_DIST_32|(tempo|(GET_LIST_32>>(limit[depth]-count[depth]))))&OGRdist[maxmarks-depth][i])!=0));i++)	\
        { limit[depth]-=1; tempo=(0x80000000>>((limit[depth]-count[depth])-1));}	*/		\
}													\
/*if((limit[depth]-count[depth])<=0) {break;}*/						\
/* MIDPOINT */												\
if (depth <= halfdepth2) {										\
    if (depth <= halfdepth1) {										\
        int tempLimit;											\
        /* halflength can be one less if certain symmetries apply */					\
        const int halflength = ((symmetry-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(halfdepth2-halfdepth1)])/2);	\
        if (CHOOSEMARKS>halfdepth1-depth) {								\
            tempLimit = halflength-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(halfdepth1-depth)];	\
                if ((tempLimit-count[depth])<=CHOOSEBITS) {						\
                    uint32_t tempo=(0x80000000>>((tempLimit-count[depth])-1));				\
                    while (((GET_COMP_32&(tempo))!=0)||(tempLimit>halflength-				\
                            chooseV3[((GET_DIST_32|(tempo|(GET_LIST_32>>(tempLimit-count[depth]))))>>(32-CHOOSEBITS))][(halfdepth1-depth)]))	\
                    { tempLimit-=1;tempo<<=1; }								\
                }											\
        } else {											\
            tempLimit = halflength-OGR[halfdepth1-depth];						\
        }												\
        limit[depth]=MINIMUM(limit[depth],tempLimit);							\
    } else {												\
        const int tempLimit = (maxlength-1-count[halfdepth1])-(chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(halfdepth2-depth)]);	\
        limit[depth]=MINIMUM(limit[depth],tempLimit);							\
    }													\
}

#else // (KTEST==0)

/*#define SETUP_LIMITS(MAXMARKS)                                                        		*/
#define SETUP_LIMITS                                                                 			\
const int OGR[32] = { /*  1 */    0,   1,   3,   6,  11,  17,  25,  34,  44,  55,  72,			\
                      /* 12 */   85, 106, 127, 151, 177, 199, 216, 246, 283, 333, 356,			\
                      /* 23 */  372, 425, 480, 492, 553, 585, 623, 680, 747, 784 };			\
const int halfdepth1 = (maxmarks/2);									\
const int halflength = (!(maxmarks%2) && (maxlength%2)) ? (maxlength/2) : (maxlength/2)-1;		\
int limit[MAXMARKS];	/* current limit, populated by limits.h (based on CHOOSE, MIDPOINT, etc.) */


/*#define CALCULATE_LIMITS(depth)									*/
#define CALCULATE_LIMITS	                 							\
/* CHOOSE */												\
if (CHOOSEMARKS>maxmarks-depth) {									\
    limit[depth] = maxlength-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(maxmarks-depth)];		\
} else {												\
    limit[depth] = maxlength-OGR[maxmarks-depth]; /* midpoint reduction may supercede this */		\
}													\
/* MIDPOINT */												\
if (depth<=halfdepth1) {										\
    int tempLimit;											\
    if (CHOOSEMARKS>halfdepth1-depth) {									\
        tempLimit = halflength-chooseV3[(GET_DIST_32>>(32-CHOOSEBITS))][(halfdepth1-depth)];		\
    } else {												\
        tempLimit = halflength-OGR[halfdepth1-depth];							\
    }													\
    limit[depth]=MINIMUM(limit[depth],tempLimit);							\
} else if ((depth==(halfdepth1+1)) && (maxmarks%2)) {							\
    const int tempLimit = maxlength-1-count[halfdepth1];						\
    limit[depth]=MINIMUM(limit[depth],tempLimit);							\
    /*printf("l%d r%d\n",count[halfdepth1],maxlength-1-count[halfdepth1]);*/				\
}



#endif
