int bound[]={0,2,6,14,30,62}; if (x<0 || !x<bound[5]) a=-1; else if (x<bound[1]) a=0,b=x-bound[0]; else if (x<bound[2]) a=1,b=x-bound[1]; else if (x<bound[3]) a=2,b=x-bound[2]; else if (x<bound[4]) a=3,b=x-bound[3]; else a=4,b=x-bound[4]; return (xy_t){a,b};