Programming/reverse engineering challenge: Figure out what my obfuscated code does.
/*
k.c
-1 17 36 29 19 -1 13 13 04 14
-1 00 00 00 00 -1 00 00 00 00
-1 00 00 00 00 33 00 00 00 00
-1 07 00 00 00 00 00 00 35 08
-1 00 00 00 00 00 31 00 00 00
-1 00 00 10 00 00 00 27 00 00
-1 00 00 00 19 00 00 00 00 00
-1 03 11 00 00 00 00 00 00 14
-1 00 00 00 00 -1 00 00 00 00
-1 00 00 00 00 -1 00 00 00 00
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
19 00 00 00 00 27 00 00 00 00
30 00 00 00 00 13 00 00 00 00
-1 22 00 00 00 00 00 00 -1 -1
26 00 00 00 00 00 13 00 00 00
13 00 00 24 00 00 00 09 00 00
14 00 00 00 34 00 00 00 00 00
-1 -1 22 00 00 00 00 00 00 -1
22 00 00 00 00 11 00 00 00 00
14 00 00 00 00 30 00 00 00 00
*/
int vt [10] [10], ht[10][10],inv
[10] [10] ,inh [10][10],sl
[10][10];;int cp(int x,int
y){{int s[10] ={0},h=ht[y]
[x],hs=0,xx=x ;for(;;){int
c=sl[y][xx--] ;if(c==-1)
break;if(s[c] )return 0;
s[c]=1;hs+=c; ;;if(hs>h)
break;}if(x+1>=10||sl[y]
[x+1]==-1){if(hs!=h)
return 0;}else if(hs
>=h)return 0;};;int s
[10]={0},v=vt[y][x],vs
=0,yy=y;for(;;){int c=sl
[yy--][x];if(c==-1)break;
if(s[c])return 0;s[c]=1;vs
+=c;if(vs>v) break;}if(y+1
>=10||sl[y+1 ][x]==-1){;;;
return vs==v ;}return vs<v;
}int s(int x ,int y){if(y>=
10)return 1; if(sl[y][x]==
-1){if(x+1< 10)return s(x
+1,y);return s(0,y+1);}for
(int i =1;i< 10;++i){sl[y]
[x]=i;if(!cp (x,y)){;;;;;;
continue;;;} int cd=0;if(x
+1<10)cd=s(x +1,y);else cd
=s(0,y+1);;; if(cd)return 1
;}sl[y][x]=0 ;return 0;}int
main(){;;;;;; for(int i=0;i
<10;++i)for( int j=0;j<10;
++j)scanf("%d" ,&inv[i][j]);
for(int i=0;i< 10;++i) for(
int j=0;j<10;++j )scanf("%d",&inh
[i][j]);;for(int i=0;i < 10;++i) {int t0=-1,t1=-1
;;for(int j=0;j <10;++j){if(inh [i][j]>0)t0=inh[
i][j];ht[i][j]= t0;;if(inv[j][i ]>0)t1=inv[j][i]
;vt[j][i]=t1;;; int e=0;;if(inh [i][j]||inv[i][j
])e=-1;sl[i][j] =e;;}}if(s(0,0) ){for(int i=0;i<
10;++i){for(int j=0;j < 10;++j) printf("%2d ",sl
[i][j]);;printf ("\n");;;}}else printf("?\n");;}