:- use_module(library(clpfd)).
:- discontiguous(ispointer/2).
:- discontiguous(unknownpointer/2).
:- discontiguous(isint/2).
:- discontiguous(isstring/2).
:- discontiguous(islong/2).
pagebase(333512704).
pointer([
		[0x13e10020,0],
		[0x13e10028,0],
		[0x13e10030,0],
		[0x13e10038,0],
		[0x13e10040,333512768],
		[0x13e10048,333512768],
		[0x13e10058,0],
		[0x13e10060,331883435],
		[0x13e10068,331883442],
		[0x13e10070,536029056],
		[0x13e10078,0],
		[0x13e10080,0],
		[0x13e10088,0],
		[0x13e10090,0],
		[0x13e10098,0],
		[0x13e100a0,0],
		[0x13e100a8,0],
		[0x13e100b0,0],
		[0x13e100b8,0],
		[0x13e100c0,0],
		[0x13e100c8,0],
		[0x13e100d0,0],
		[0x13e100d8,0],
		[0x13e100e0,0],
		[0x13e100e8,0],
		[0x13e100f0,0],
		[0x13e100f8,0],
		[0x13e10100,0],
		[0x13e10108,0],
		[0x13e10110,0],
		[0x13e10118,0],
		[0x13e10120,0],
		[0x13e10128,0],
		[0x13e10130,0],
		[0x13e10138,0],
		[0x13e10140,0],
		[0x13e10148,0],
		[0x13e10150,0],
		[0x13e10158,0],
		[0x13e10160,0],
		[0x13e10168,0],
		[0x13e10170,0],
		[0x13e10178,0],
		[0x13e10180,331883395],
		[0x13e10188,536029159],
		[0x13e10190,0],
		[0x13e10198,0],
		[0x13e101a0,0],
		[0x13e101a8,0],
		[0x13e101b0,0],
		[0x13e101b8,0],
		[0x13e101c0,0],
		[0x13e101c8,0],
		[0x13e101d0,0],
		[0x13e101d8,0],
		[0x13e101e0,0],
		[0x13e101e8,0],
		[0x13e101f0,0],
		[0x13e101f8,0],
		[0x13e10200,0],
		[0x13e10208,0],
		[0x13e10210,0],
		[0x13e10218,0],
		[0x13e10220,0],
		[0x13e10228,0],
		[0x13e10230,0],
		[0x13e10238,0],
		[0x13e10240,0],
		[0x13e10248,0],
		[0x13e10250,0],
		[0x13e10258,0],
		[0x13e10260,0],
		[0x13e10268,0],
		[0x13e10270,0],
		[0x13e10278,0],
		[0x13e10280,0],
		[0x13e10288,0],
		[0x13e10290,0],
		[0x13e10298,0],
		[0x13e102b0,0],
		[0x13e102b8,0],
		[0x13e102c0,0],
		[0x13e102c8,0],
		[0x13e102d0,0],
		[0x13e102d8,0],
		[0x13e10308,0],
		[0x13e10310,0],
		[0x13e10318,0],
		[0x13e10340,0],
		[0x13e10348,0],
		[0x13e10350,0],
		[0x13e10358,0],
		[0x13e10398,0],
		[0x13e103a0,0],
		[0x13e103b0,0],
		[0x13e103b8,0],
		[0x13e103c0,0],
		[0x13e103c8,0],
		[0x13e103d0,0],
		[0x13e103d8,0],
		[0x13e103e0,0],
		[0x13e103f0,0],
		[0x13e103f8,0],
		[0x13e10400,0],
		[0x13e10408,0],
		[0x13e10410,0],
		[0x13e10418,0],
		[0x13e10420,0],
		[0x13e10428,0],
		[0x13e10430,333777024],
		[0x13e10438,0],
		[0x13e10440,0],
		[0x13e10448,329429824],
		[0x13e10458,0],
		[0x13e10460,332187873],
		[0x13e10468,0],
		[0x13e10470,318777216],
		[0x13e10478,321189824],
		[0x13e10480,0],
		[0x13e10488,334277696],
		[0x13e10490,465606888],
		[0x13e104a0,0],
		[0x13e104a8,0],
		[0x13e104b0,0],
		[0x13e104b8,0],
		[0x13e104c0,0],
		[0x13e104c8,0],
		[0x13e104d0,333447168],
		[0x13e104e0,0],
		[0x13e104e8,0],
		[0x13e104f8,0],
		[0x13e10500,0],
		[0x13e10508,0],
		[0x13e10528,329417056],
		[0x13e10530,0],
		[0x13e10538,0],
		[0x13e10550,0],
		[0x13e10558,0],
		[0x13e10560,0],
		[0x13e10568,333514088],
		[0x13e10570,333514088],
		[0x13e10578,0],
		[0x13e10588,0],
		[0x13e10590,0],
		[0x13e10598,0],
		[0x13e105a0,0],
		[0x13e105a8,0],
		[0x13e105b0,0],
		[0x13e105b8,0],
		[0x13e105c0,0],
		[0x13e105c8,0],
		[0x13e105d0,0],
		[0x13e105d8,0],
		[0x13e105e0,0],
		[0x13e105e8,0],
		[0x13e105f0,0],
		[0x13e105f8,0],
		[0x13e10600,0],
		[0x13e10608,0],
		[0x13e10610,0],
		[0x13e10618,0],
		[0x13e10620,0],
		[0x13e10628,0],
		[0x13e10630,0],
		[0x13e10638,0],
		[0x13e10640,0],
		[0x13e10648,0],
		[0x13e10650,0],
		[0x13e10658,0],
		[0x13e10660,0],
		[0x13e10668,0],
		[0x13e10670,0],
		[0x13e10678,0],
		[0x13e10680,0],
		[0x13e10688,0],
		[0x13e10690,532787752],
		[0x13e10698,0],
		[0x13e106a0,0],
		[0x13e106a8,0],
		[0x13e106b0,0],
		[0x13e106b8,0],
		[0x13e106c0,0],
		[0x13e106c8,0],
		[0x13e106d0,0],
		[0x13e106d8,0],
		[0x13e106e0,0],
		[0x13e106e8,0],
		[0x13e106f0,0],
		[0x13e106f8,0],
		[0x13e10700,333514496],
		[0x13e10708,333514496],
		[0x13e10710,0],
		[0x13e10718,0],
		[0x13e10728,0],
		[0x13e10730,337937984],
		[0x13e10738,333514552],
		[0x13e10740,0],
		[0x13e10748,0],
		[0x13e10750,0],
		[0x13e10758,0],
		[0x13e10760,0],
		[0x13e10768,0],
		[0x13e10770,0],
		[0x13e10778,0],
		[0x13e10780,0],
		[0x13e10788,0],
		[0x13e10790,333514640],
		[0x13e10798,0],
		[0x13e107a0,0],
		[0x13e107a8,0],
		[0x13e107b0,0],
		[0x13e107b8,319593344],
		[0x13e107c0,532759040],
		[0x13e107c8,0],
		[0x13e107d0,0],
		[0x13e107d8,0],
		[0x13e10be8,0],
		[0x13e10bf0,0],
		[0x13e10bf8,333515768],
		[0x13e10c00,333515768],
		[0x13e10c10,0],
		[0x13e10c18,0],
		[0x13e10c20,0],
		[0x13e10c28,0],
		[0x13e10c30,467273584],
		[0x13e10c38,310516912],
		[0x13e10c48,333515848],
		[0x13e10c50,333515848],
		[0x13e10c58,333515864],
		[0x13e10c60,333515864],
		[0x13e10c68,0],
		[0x13e10c70,0],
		[0x13e10c78,0],
		[0x13e10c80,0],
		[0x13e10c88,390268864],
		[0x13e10c90,0],
		[0x13e10c98,0],
		[0x13e10ca0,0],
		[0x13e10ca8,0],
		[0x13e10cb0,0],
		[0x13e10cb8,0],
		[0x13e10cc0,0],
		[0x13e10cc8,0],
		[0x13e10cd0,0],
		[0x13e10cd8,0],
		[0x13e10ce0,0],
		[0x13e10ce8,0],
		[0x13e10cf0,0],
		[0x13e10cf8,0],
		[0x13e10d00,319386352],
		[0x13e10d08,0],
		[0x13e10d10,0],
		[0x13e10d18,0],
		[0x13e10d20,0],
		[0x13e10d28,0],
		[0x13e10d30,0],
		[0x13e10d40,333513920],
		[0x13e10d48,333513920],
		[0x13e10d50,467273888],
		[0x13e10d58,467301088],
		[0x13e10d60,333516128],
		[0x13e10d68,333516128],
		[0x13e10d70,333513920],
		[0x13e10d78,333516152],
		[0x13e10d80,333516152],
		[0x13e10d88,333516168],
		[0x13e10d90,333516168],
		[0x13e10d98,0],
		[0x13e10da0,0],
		[0x13e10da8,333807552],
		[0x13e10db0,0],
		[0x13e10db8,0],
		[0x13e10dc0,333807552],
		[0x13e10dc8,0],
		[0x13e10dd0,0],
		[0x13e10dd8,333807552],
		[0x13e10de0,333516256],
		[0x13e10de8,333516256],
		[0x13e10df0,333525072],
		[0x13e10df8,333525072],
		[0x13e10e00,0],
		[0x13e10e08,0],
		[0x13e10e10,0],
		[0x13e10e18,0],
		[0x13e10e28,0],
		[0x13e10e30,0],
		[0x13e10e38,0],
		[0x13e10e40,0],
		[0x13e10e48,0],
		[0x13e10e58,0],
		[0x13e10e60,0],
		[0x13e10e68,0],
		[0x13e10e70,0],
		[0x13e10e78,0],
		[0x13e10e80,0],
		[0x13e10e88,0],
		[0x13e10e90,333516432],
		[0x13e10e98,333516432],
		[0x13e10ea0,333516448],
		[0x13e10ea8,333516448],
		[0x13e10eb0,333516464],
		[0x13e10eb8,333516464],
		[0x13e10ec0,0],
		[0x13e10ec8,333808832],
		[0x13e10ed0,333808832],
		[0x13e10ee8,0],
		[0x13e10ef0,0],
		[0x13e10ef8,0],
		[0x13e10f00,0],
		[0x13e10f08,0],
		[0x13e10f10,334202432],
		[0x13e10f18,334177472],
		[0x13e10f20,333808224],
		[0x13e10f28,333525056],
		[0x13e10f30,333522944],
		[0x13e10f38,0],
		[0x13e10f40,0],
		[0x13e10f48,0],
		[0x13e10f50,333516624],
		[0x13e10f58,333516624],
		[0x13e10f60,0],
		[0x13e10f68,0],
		[0x13e10f70,0],
		[0x13e10f78,0],
		[0x13e10f80,0],
		[0x13e10f88,0],
		[0x13e10f98,0],
		[0x13e10fa0,0],
		[0x13e10fa8,0],
		[0x13e10fb0,0],
		[0x13e10fb8,0],
		[0x13e10fc0,0],
		[0x13e10fc8,0],
		[0x13e10fd0,0],
		[0x13e10fd8,0],
		[0x13e10fe0,0],
		[0x13e10fe8,0],
		[0x13e10ff0,0],
		[0x13e10ff8,0],
		[0, 0]
]).
unknown([
		[0x13e10000,18446636575778406527],
		[0x13e10008,10416984888683069439],
		[0x13e10010,18446744073537585152],
		[0x13e10018,9223372036854776035],
		[0x13e102a0,8461816525014171653],
		[0x13e102e8,7017855484192566642],
		[0x13e102f0,3776599529658082418],
		[0x13e102f8,5280840193753362484],
		[0x13e10320,3329286024533639168],
		[0x13e10328,3545511777287418161],
		[0x13e10330,7308890739083063345],
		[0x13e10360,2522015791327477760],
		[0x13e10370,5786372494020785457],
		[0x13e10378,8746356753134277664],
		[0x13e10380,3905529319172092960],
		[0x13e10388,2324794557242617914],
		[0x13e103e8,11651999035435008],
		[0x13e104d8,9008307356303362],
		[0x13e10d38,14593495508423839559],
		[0, 0]
]).
long([
		[0x13e10050,14784000],
		[0x13e102a8,120],
		[0x13e10300,59619400559960],
		[0x13e10338,6515058],
		[0x13e10390,925970482],
		[0x13e103a8,57408130267256],
		[0x13e10450,4026531838],
		[0x13e10498,32769],
		[0x13e104f0,1],
		[0x13e10510,4294967296],
		[0x13e10518,515396075640],
		[0x13e10520,120],
		[0x13e10540,1048576],
		[0x13e10548,4194304],
		[0x13e10580,5038873],
		[0x13e10720,25],
		[0x13e107e0,1],
		[0x13e107e8,1],
		[0x13e10c08,4294967295],
		[0x13e10c40,140],
		[0x13e10e20,939610791],
		[0x13e10e50,19398],
		[0x13e10ee0,48],
		[0, 0]
]).
int([
		[0x13e10018,227],
		[0x13e10020,0],
		[0x13e10024,0],
		[0x13e10028,0],
		[0x13e1002c,0],
		[0x13e10030,0],
		[0x13e10034,0],
		[0x13e10038,0],
		[0x13e1003c,0],
		[0x13e10054,0],
		[0x13e10058,0],
		[0x13e1005c,0],
		[0x13e10078,0],
		[0x13e1007c,0],
		[0x13e10080,0],
		[0x13e10084,0],
		[0x13e10088,0],
		[0x13e1008c,0],
		[0x13e10090,0],
		[0x13e10094,0],
		[0x13e10098,0],
		[0x13e1009c,0],
		[0x13e100a0,0],
		[0x13e100a4,0],
		[0x13e100a8,0],
		[0x13e100ac,0],
		[0x13e100b0,0],
		[0x13e100b4,0],
		[0x13e100b8,0],
		[0x13e100bc,0],
		[0x13e100c0,0],
		[0x13e100c4,0],
		[0x13e100c8,0],
		[0x13e100cc,0],
		[0x13e100d0,0],
		[0x13e100d4,0],
		[0x13e100d8,0],
		[0x13e100dc,0],
		[0x13e100e0,0],
		[0x13e100e4,0],
		[0x13e100e8,0],
		[0x13e100ec,0],
		[0x13e100f0,0],
		[0x13e100f4,0],
		[0x13e100f8,0],
		[0x13e100fc,0],
		[0x13e10100,0],
		[0x13e10104,0],
		[0x13e10108,0],
		[0x13e1010c,0],
		[0x13e10110,0],
		[0x13e10114,0],
		[0x13e10118,0],
		[0x13e1011c,0],
		[0x13e10120,0],
		[0x13e10124,0],
		[0x13e10128,0],
		[0x13e1012c,0],
		[0x13e10130,0],
		[0x13e10134,0],
		[0x13e10138,0],
		[0x13e1013c,0],
		[0x13e10140,0],
		[0x13e10144,0],
		[0x13e10148,0],
		[0x13e1014c,0],
		[0x13e10150,0],
		[0x13e10154,0],
		[0x13e10158,0],
		[0x13e1015c,0],
		[0x13e10160,0],
		[0x13e10164,0],
		[0x13e10168,0],
		[0x13e1016c,0],
		[0x13e10170,0],
		[0x13e10174,0],
		[0x13e10178,0],
		[0x13e1017c,0],
		[0x13e10190,0],
		[0x13e10194,0],
		[0x13e10198,0],
		[0x13e1019c,0],
		[0x13e101a0,0],
		[0x13e101a4,0],
		[0x13e101a8,0],
		[0x13e101ac,0],
		[0x13e101b0,0],
		[0x13e101b4,0],
		[0x13e101b8,0],
		[0x13e101bc,0],
		[0x13e101c0,0],
		[0x13e101c4,0],
		[0x13e101c8,0],
		[0x13e101cc,0],
		[0x13e101d0,0],
		[0x13e101d4,0],
		[0x13e101d8,0],
		[0x13e101dc,0],
		[0x13e101e0,0],
		[0x13e101e4,0],
		[0x13e101e8,0],
		[0x13e101ec,0],
		[0x13e101f0,0],
		[0x13e101f4,0],
		[0x13e101f8,0],
		[0x13e101fc,0],
		[0x13e10200,0],
		[0x13e10204,0],
		[0x13e10208,0],
		[0x13e1020c,0],
		[0x13e10210,0],
		[0x13e10214,0],
		[0x13e10218,0],
		[0x13e1021c,0],
		[0x13e10220,0],
		[0x13e10224,0],
		[0x13e10228,0],
		[0x13e1022c,0],
		[0x13e10230,0],
		[0x13e10234,0],
		[0x13e10238,0],
		[0x13e1023c,0],
		[0x13e10240,0],
		[0x13e10244,0],
		[0x13e10248,0],
		[0x13e1024c,0],
		[0x13e10250,0],
		[0x13e10254,0],
		[0x13e10258,0],
		[0x13e1025c,0],
		[0x13e10260,0],
		[0x13e10264,0],
		[0x13e10268,0],
		[0x13e1026c,0],
		[0x13e10270,0],
		[0x13e10274,0],
		[0x13e10278,0],
		[0x13e1027c,0],
		[0x13e10280,0],
		[0x13e10284,0],
		[0x13e10288,0],
		[0x13e1028c,0],
		[0x13e10290,0],
		[0x13e10294,0],
		[0x13e10298,0],
		[0x13e1029c,0],
		[0x13e102a0,5],
		[0x13e102a8,120],
		[0x13e102ac,0],
		[0x13e102b0,0],
		[0x13e102b4,0],
		[0x13e102b8,0],
		[0x13e102bc,0],
		[0x13e102c0,0],
		[0x13e102c4,0],
		[0x13e102c8,0],
		[0x13e102cc,0],
		[0x13e102d0,0],
		[0x13e102d4,0],
		[0x13e102d8,0],
		[0x13e102dc,0],
		[0x13e102e0,0],
		[0x13e10304,13881],
		[0x13e10308,0],
		[0x13e1030c,0],
		[0x13e10310,0],
		[0x13e10314,0],
		[0x13e10318,0],
		[0x13e1031c,0],
		[0x13e10320,0],
		[0x13e1033c,0],
		[0x13e10340,0],
		[0x13e10344,0],
		[0x13e10348,0],
		[0x13e1034c,0],
		[0x13e10350,0],
		[0x13e10354,0],
		[0x13e10358,0],
		[0x13e1035c,0],
		[0x13e10360,0],
		[0x13e10394,0],
		[0x13e10398,0],
		[0x13e1039c,0],
		[0x13e103a0,0],
		[0x13e103a4,0],
		[0x13e103ac,13366],
		[0x13e103b0,0],
		[0x13e103b4,0],
		[0x13e103b8,0],
		[0x13e103bc,0],
		[0x13e103c0,0],
		[0x13e103c4,0],
		[0x13e103c8,0],
		[0x13e103cc,0],
		[0x13e103d0,0],
		[0x13e103d4,0],
		[0x13e103d8,0],
		[0x13e103dc,0],
		[0x13e103e0,0],
		[0x13e103e4,0],
		[0x13e103f0,0],
		[0x13e103f4,0],
		[0x13e103f8,0],
		[0x13e103fc,0],
		[0x13e10400,0],
		[0x13e10404,0],
		[0x13e10408,0],
		[0x13e1040c,0],
		[0x13e10410,0],
		[0x13e10414,0],
		[0x13e10418,0],
		[0x13e1041c,0],
		[0x13e10420,0],
		[0x13e10424,0],
		[0x13e10428,0],
		[0x13e1042c,0],
		[0x13e10438,0],
		[0x13e1043c,0],
		[0x13e10440,0],
		[0x13e10444,0],
		[0x13e10454,0],
		[0x13e10458,0],
		[0x13e1045c,0],
		[0x13e10468,0],
		[0x13e1046c,0],
		[0x13e10480,0],
		[0x13e10484,0],
		[0x13e1049c,0],
		[0x13e104a0,0],
		[0x13e104a4,0],
		[0x13e104a8,0],
		[0x13e104ac,0],
		[0x13e104b0,0],
		[0x13e104b4,0],
		[0x13e104b8,0],
		[0x13e104bc,0],
		[0x13e104c0,0],
		[0x13e104c4,0],
		[0x13e104c8,0],
		[0x13e104cc,0],
		[0x13e104d8,2],
		[0x13e104e0,0],
		[0x13e104e4,0],
		[0x13e104e8,0],
		[0x13e104ec,0],
		[0x13e104f0,1],
		[0x13e104f4,0],
		[0x13e104f8,0],
		[0x13e104fc,0],
		[0x13e10500,0],
		[0x13e10504,0],
		[0x13e10508,0],
		[0x13e1050c,0],
		[0x13e10510,0],
		[0x13e10514,1],
		[0x13e10518,120],
		[0x13e1051c,120],
		[0x13e10520,120],
		[0x13e10524,0],
		[0x13e10530,0],
		[0x13e10534,0],
		[0x13e10538,0],
		[0x13e1053c,0],
		[0x13e10544,0],
		[0x13e1054c,0],
		[0x13e10550,0],
		[0x13e10554,0],
		[0x13e10558,0],
		[0x13e1055c,0],
		[0x13e10560,0],
		[0x13e10564,0],
		[0x13e10578,0],
		[0x13e1057c,0],
		[0x13e10584,0],
		[0x13e10588,0],
		[0x13e1058c,0],
		[0x13e10590,0],
		[0x13e10594,0],
		[0x13e10598,0],
		[0x13e1059c,0],
		[0x13e105a0,0],
		[0x13e105a4,0],
		[0x13e105a8,0],
		[0x13e105ac,0],
		[0x13e105b0,0],
		[0x13e105b4,0],
		[0x13e105b8,0],
		[0x13e105bc,0],
		[0x13e105c0,0],
		[0x13e105c4,0],
		[0x13e105c8,0],
		[0x13e105cc,0],
		[0x13e105d0,0],
		[0x13e105d4,0],
		[0x13e105d8,0],
		[0x13e105dc,0],
		[0x13e105e0,0],
		[0x13e105e4,0],
		[0x13e105e8,0],
		[0x13e105ec,0],
		[0x13e105f0,0],
		[0x13e105f4,0],
		[0x13e105f8,0],
		[0x13e105fc,0],
		[0x13e10600,0],
		[0x13e10604,0],
		[0x13e10608,0],
		[0x13e1060c,0],
		[0x13e10610,0],
		[0x13e10614,0],
		[0x13e10618,0],
		[0x13e1061c,0],
		[0x13e10620,0],
		[0x13e10624,0],
		[0x13e10628,0],
		[0x13e1062c,0],
		[0x13e10630,0],
		[0x13e10634,0],
		[0x13e10638,0],
		[0x13e1063c,0],
		[0x13e10640,0],
		[0x13e10644,0],
		[0x13e10648,0],
		[0x13e1064c,0],
		[0x13e10650,0],
		[0x13e10654,0],
		[0x13e10658,0],
		[0x13e1065c,0],
		[0x13e10660,0],
		[0x13e10664,0],
		[0x13e10668,0],
		[0x13e1066c,0],
		[0x13e10670,0],
		[0x13e10674,0],
		[0x13e10678,0],
		[0x13e1067c,0],
		[0x13e10680,0],
		[0x13e10684,0],
		[0x13e10688,0],
		[0x13e1068c,0],
		[0x13e10698,0],
		[0x13e1069c,0],
		[0x13e106a0,0],
		[0x13e106a4,0],
		[0x13e106a8,0],
		[0x13e106ac,0],
		[0x13e106b0,0],
		[0x13e106b4,0],
		[0x13e106b8,0],
		[0x13e106bc,0],
		[0x13e106c0,0],
		[0x13e106c4,0],
		[0x13e106c8,0],
		[0x13e106cc,0],
		[0x13e106d0,0],
		[0x13e106d4,0],
		[0x13e106d8,0],
		[0x13e106dc,0],
		[0x13e106e0,0],
		[0x13e106e4,0],
		[0x13e106e8,0],
		[0x13e106ec,0],
		[0x13e106f0,0],
		[0x13e106f4,0],
		[0x13e106f8,0],
		[0x13e106fc,0],
		[0x13e10710,0],
		[0x13e10714,0],
		[0x13e10718,0],
		[0x13e1071c,0],
		[0x13e10720,25],
		[0x13e10724,0],
		[0x13e10728,0],
		[0x13e1072c,0],
		[0x13e10740,0],
		[0x13e10744,0],
		[0x13e10748,0],
		[0x13e1074c,0],
		[0x13e10750,0],
		[0x13e10754,0],
		[0x13e10758,0],
		[0x13e1075c,0],
		[0x13e10760,0],
		[0x13e10764,0],
		[0x13e10768,0],
		[0x13e1076c,0],
		[0x13e10770,0],
		[0x13e10774,0],
		[0x13e10778,0],
		[0x13e1077c,0],
		[0x13e10780,0],
		[0x13e10784,0],
		[0x13e10788,0],
		[0x13e1078c,0],
		[0x13e10798,0],
		[0x13e1079c,0],
		[0x13e107a0,0],
		[0x13e107a4,0],
		[0x13e107a8,0],
		[0x13e107ac,0],
		[0x13e107b0,0],
		[0x13e107b4,0],
		[0x13e107c8,0],
		[0x13e107cc,0],
		[0x13e107d0,0],
		[0x13e107d4,0],
		[0x13e107d8,0],
		[0x13e107dc,0],
		[0x13e107e0,1],
		[0x13e107e4,0],
		[0x13e107e8,1],
		[0x13e107ec,0],
		[0x13e10be8,0],
		[0x13e10bec,0],
		[0x13e10bf0,0],
		[0x13e10bf4,0],
		[0x13e10c0c,0],
		[0x13e10c10,0],
		[0x13e10c14,0],
		[0x13e10c18,0],
		[0x13e10c1c,0],
		[0x13e10c20,0],
		[0x13e10c24,0],
		[0x13e10c28,0],
		[0x13e10c2c,0],
		[0x13e10c40,140],
		[0x13e10c44,0],
		[0x13e10c68,0],
		[0x13e10c6c,0],
		[0x13e10c70,0],
		[0x13e10c74,0],
		[0x13e10c78,0],
		[0x13e10c7c,0],
		[0x13e10c80,0],
		[0x13e10c84,0],
		[0x13e10c90,0],
		[0x13e10c94,0],
		[0x13e10c98,0],
		[0x13e10c9c,0],
		[0x13e10ca0,0],
		[0x13e10ca4,0],
		[0x13e10ca8,0],
		[0x13e10cac,0],
		[0x13e10cb0,0],
		[0x13e10cb4,0],
		[0x13e10cb8,0],
		[0x13e10cbc,0],
		[0x13e10cc0,0],
		[0x13e10cc4,0],
		[0x13e10cc8,0],
		[0x13e10ccc,0],
		[0x13e10cd0,0],
		[0x13e10cd4,0],
		[0x13e10cd8,0],
		[0x13e10cdc,0],
		[0x13e10ce0,0],
		[0x13e10ce4,0],
		[0x13e10ce8,0],
		[0x13e10cec,0],
		[0x13e10cf0,0],
		[0x13e10cf4,0],
		[0x13e10cf8,0],
		[0x13e10cfc,0],
		[0x13e10d08,0],
		[0x13e10d0c,0],
		[0x13e10d10,0],
		[0x13e10d14,0],
		[0x13e10d18,0],
		[0x13e10d1c,0],
		[0x13e10d20,0],
		[0x13e10d24,0],
		[0x13e10d28,0],
		[0x13e10d2c,0],
		[0x13e10d30,0],
		[0x13e10d34,0],
		[0x13e10d98,0],
		[0x13e10d9c,0],
		[0x13e10da0,0],
		[0x13e10da4,0],
		[0x13e10db0,0],
		[0x13e10db4,0],
		[0x13e10db8,0],
		[0x13e10dbc,0],
		[0x13e10dc8,0],
		[0x13e10dcc,0],
		[0x13e10dd0,0],
		[0x13e10dd4,0],
		[0x13e10e00,0],
		[0x13e10e04,0],
		[0x13e10e08,0],
		[0x13e10e0c,0],
		[0x13e10e10,0],
		[0x13e10e14,0],
		[0x13e10e18,0],
		[0x13e10e1c,0],
		[0x13e10e24,0],
		[0x13e10e28,0],
		[0x13e10e2c,0],
		[0x13e10e30,0],
		[0x13e10e34,0],
		[0x13e10e38,0],
		[0x13e10e3c,0],
		[0x13e10e40,0],
		[0x13e10e44,0],
		[0x13e10e48,0],
		[0x13e10e4c,0],
		[0x13e10e50,19398],
		[0x13e10e54,0],
		[0x13e10e58,0],
		[0x13e10e5c,0],
		[0x13e10e60,0],
		[0x13e10e64,0],
		[0x13e10e68,0],
		[0x13e10e6c,0],
		[0x13e10e70,0],
		[0x13e10e74,0],
		[0x13e10e78,0],
		[0x13e10e7c,0],
		[0x13e10e80,0],
		[0x13e10e84,0],
		[0x13e10e88,0],
		[0x13e10e8c,0],
		[0x13e10ec0,0],
		[0x13e10ec4,0],
		[0x13e10ee0,48],
		[0x13e10ee4,0],
		[0x13e10ee8,0],
		[0x13e10eec,0],
		[0x13e10ef0,0],
		[0x13e10ef4,0],
		[0x13e10ef8,0],
		[0x13e10efc,0],
		[0x13e10f00,0],
		[0x13e10f04,0],
		[0x13e10f08,0],
		[0x13e10f0c,0],
		[0x13e10f38,0],
		[0x13e10f3c,0],
		[0x13e10f40,0],
		[0x13e10f44,0],
		[0x13e10f48,0],
		[0x13e10f4c,0],
		[0x13e10f60,0],
		[0x13e10f64,0],
		[0x13e10f68,0],
		[0x13e10f6c,0],
		[0x13e10f70,0],
		[0x13e10f74,0],
		[0x13e10f78,0],
		[0x13e10f7c,0],
		[0x13e10f80,0],
		[0x13e10f84,0],
		[0x13e10f88,0],
		[0x13e10f8c,0],
		[0x13e10f98,0],
		[0x13e10f9c,0],
		[0x13e10fa0,0],
		[0x13e10fa4,0],
		[0x13e10fa8,0],
		[0x13e10fac,0],
		[0x13e10fb0,0],
		[0x13e10fb4,0],
		[0x13e10fb8,0],
		[0x13e10fbc,0],
		[0x13e10fc0,0],
		[0x13e10fc4,0],
		[0x13e10fc8,0],
		[0x13e10fcc,0],
		[0x13e10fd0,0],
		[0x13e10fd4,0],
		[0x13e10fd8,0],
		[0x13e10fdc,0],
		[0x13e10fe0,0],
		[0x13e10fe4,0],
		[0x13e10fe8,0],
		[0x13e10fec,0],
		[0x13e10ff0,0],
		[0x13e10ff4,0],
		[0x13e10ff8,0],
		[0x13e10ffc,0],
		[0, 0]
]).
string_val([
		[0x13e10368,3760564170055036978],
		[0x13e103a8,57408130267256],
		[0x13e10ed8,3418906600723806067],
		[0, 0]
]).
% use_module(library(clpfd)).
:- style_check(-singleton).


isTrue([X, Y]):-
    X == 49.

isTrue([X|Tail]):-
    isTrue(Tail).

possible_anything(Base_addr) :- 
    get_time(Current),
    % void *stack 
    %ispointer(Base_addr, Stack_offset, Stack_value),
    
    % sched_info sched_info 
    
    /* we need to use sched_info to help locate task */
    %ispointer(Base_addr, Sched_info_offset, Sched_info_value),
    %Sched_info_offset > Stack_offset,
    % possible_sched_info(Sched_info_value),

    
    ispointer(Base_addr, MM_offset, MM_pointer),
    ispointer(Base_addr, MM_offset2, MM_pointer2),
    MM_offset2 is MM_offset + 8,
    possible_mm_struct(MM_pointer2),

    ispointer(Base_addr, Tasks_offset, Task_value),
    % Tasks_offset > 1888,
    %Tasks_offset > Sched_info_offset,
    Tasks_offset > MM_offset2 - 100,
    Tasks_offset < MM_offset,


    isint(Base_addr, Pid_offset, Value),
    Pid_offset > MM_offset2,
    isint(Base_addr, Tgid_offset, Value2),
    Tgid_offset is Pid_offset + 4,
    Tgid_offset > Tasks_offset,

    ispointer(Base_addr, Parent_offset, Parent_value),
    Parent_offset > Tgid_offset,
    Parent_offset < Tgid_offset + 20,

    ispointer(Base_addr, Parent_offset2, Parent_value2),
    Parent_offset2 is Parent_offset + 8,

    ispointer(Base_addr, Child_offset, Child_value),
    Child_offset is Parent_offset2 + 8,

    /* task_struct *group_leader */

    ispointer(Base_addr, Group_leader_offset, Group_leader_value),
    Group_leader_offset > Child_offset,
    Group_leader_offset < Child_offset + 33,


    isstring(Base_addr, Comm_offset, Comm_value),
    Comm_offset > Child_offset,

    possible_ts(Parent_value, Comm_offset, Tasks_offset),
    possible_list_head(Task_value, Comm_offset, Tasks_offset),
    possible_ts(Parent_value2, Comm_offset, Tasks_offset),
    possible_ts(Group_leader_value, Comm_offset, Tasks_offset),


    ispointer(Base_addr, Thread_group_offset, Thread_group_value),
    Thread_group_offset > Group_leader_offset,

    /* This rule is very ad hoc */

    Thread_group_offset < Group_leader_offset + 150,
    possible_thread_group(Thread_group_value, Comm_offset, Thread_group_offset),

    ispointer(Base_addr, Cred_offset1, Cred_value1),
    Cred_offset1 > Group_leader_offset,
    Cred_offset1 < Comm_offset,
    ispointer(Base_addr, Cred_offset2, Cred_value2),
    Cred_offset2 is Cred_offset1 + 8,
    Cred_offset2 < Comm_offset,
    possible_cred(Cred_value1),

    ispointer(Base_addr, FS_struct_offset, FS_struct_value),
    FS_struct_offset > Comm_offset,
    FS_struct_offset < 3000,
    possible_fs_struct(FS_struct_value),

    get_time(End),
    Time_past is End - Current,
    log('profile.txt', 'task_struct', Current),
    /*log('profile.txt', 'stack', Stack_offset),
    log('profile.txt', 'Sched_info_offset', Sched_info_offset),*/
    log('profile.txt', 'task', Tasks_offset),
    log('profile.txt', 'mm_struct', MM_offset2),
    log('profile.txt', 'pid', Pid_offset),
    log('profile.txt', 'parent', Parent_offset),
    log('profile.txt', 'group_leader', Group_leader_offset),
    log('profile.txt', 'thread_group', Thread_group_offset),
    log('profile.txt', 'cred', Cred_offset1),
    log('profile.txt', 'comm', Comm_offset),
    log('profile.txt', 'fs', FS_struct_offset),
    log('profile.txt', 'end', Time_past),
    
    /*print_nl('stack', Stack_offset),
    print_nl('Sched_info_offset', Sched_info_offset),*/
    print_nl('task', Tasks_offset),
    print_nl('mm_struct', MM_offset2),
    print_nl('pid', Pid_offset),
    print_nl('parent', Parent_offset),
    print_nl('group_leader', Group_leader_offset),
    print_nl('thread_group', Thread_group_offset),
    print_nl('cred', Cred_offset1),
    print_nl('comm', Comm_offset),
    print('----------------------------'), nl.

possible_anything_no_order(Base_addr) :- 
    get_time(Current),

    % ispointer(Base_addr, MM_offset2, MM_pointer2),
    % possible_mm_struct(MM_pointer2),

    ispointer(Base_addr, Tasks_offset, Task_value),


    /*ispointer(Base_addr, Parent_offset, Parent_value),

    ispointer(Base_addr, Parent_offset2, Parent_value2),

    ispointer(Base_addr, Child_offset, Child_value),*/

    /* task_struct *group_leader */

    ispointer(Base_addr, Group_leader_offset, Group_leader_value),

    isstring(Base_addr, Comm_offset, Comm_value),

    possible_list_head_no_order(Task_value, Comm_offset, Tasks_offset),

/*
    possible_ts_no_order(Parent_value, Comm_offset, Tasks_offset),
    possible_list_head_no_order(Task_value, Comm_offset, Tasks_offset),
    possible_ts_no_order(Parent_value2, Comm_offset, Tasks_offset),
    possible_ts_no_order(Group_leader_value, Comm_offset, Tasks_offset),

    ispointer(Base_addr, Thread_group_offset, Thread_group_value),

    possible_thread_group_no_order(Thread_group_value, Comm_offset, Thread_group_offset),
*/
    % ispointer(Base_addr, Cred_offset1, Cred_value1),
    % possible_cred(Cred_value1),

 
    get_time(End),
    Time_past is End - Current,
    log('profile.txt', 'new answer', Current),
    log('profile.txt', 'task', Tasks_offset),
    log('profile.txt', 'mm_struct', MM_offset2),
    log('profile.txt', 'parent', Parent_offset),
    log('profile.txt', 'group_leader', Group_leader_offset),
    log('profile.txt', 'thread_group', Thread_group_offset),
    log('profile.txt', 'cred', Cred_offset1),
    log('profile.txt', 'comm', Comm_offset),
    log('profile.txt', 'end', Time_past),

    print_nl('stack', Stack_offset),
    print_nl('Sched_info_offset', Sched_info_offset),
    print_nl('task', Tasks_offset),
    print_nl('mm_struct', MM_offset2),
    print_nl('pid', Pid_offset),
    print_nl('parent', Parent_offset),
    print_nl('group_leader', Group_leader_offset),
    print_nl('thread_group', Thread_group_offset),
    print_nl('cred', Cred_offset1),
    print_nl('comm', Comm_offset),
    print('----------------------------'), nl.

possible_module(Base_addr) :- 
    ispointer(Base_addr, List_offset, List_value),
    isstring(Base_addr, M_name_offset, M_name_value),
    M_name_offset > List_offset,
    unknownpointer(Base_addr, Init_offset, Init_value),
    Init_offset > M_name_offset,
    Init_offset < 800,
    List_base is List_value - List_offset,
    List_base > 0,
    process_create(path('python'),
                    ['subquery.py', List_base, "module", M_name_offset, Init_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result),

    log("profile.txt", "-----", "module"),
    log("profile.txt", "list", List_offset),
    log("profile.txt", "name", M_name_offset),
    log("profile.txt", "init", Init_offset).

log(File_name, Name, Offset):-
    open(File_name, append, Stream),
    write(Stream, Name),
    write(Stream, ':'),
    write(Stream, Offset),
    nl(Stream),
    close(Stream).
% 
possible_task_struct(Current_addr) :- 
    get_time(Current),
    pagebase(Base_addr),

    ispointer(MM_addr, MM_pointer),
    MM_addr > Current_addr,
    ispointer(MM2_addr, MM2_pointer),
    MM2_addr is MM_addr + 8,
    possible_mm_struct(MM2_pointer),
    %1992

    ispointer(Tasks_addr, Tasks_value),
    Tasks_addr > MM2_addr - 100,
    Tasks_addr < MM_addr,
%1904
    isint(Pid_addr, Pid_value),%2160
    Pid_addr > MM2_addr,
    isint(Tgid_addr, Tgid_value),
    Tgid_addr is Pid_addr + 4,
%2176
    ispointer(Parent_addr, Parent_value),
    Parent_addr > Tgid_addr,
    Parent_addr < Tgid_addr + 20,

    ispointer(Parent2_addr, Parent2_value),
    Parent2_addr is Parent_addr + 8,

    ispointer(Child_addr, Child_value),
    Child_addr is Parent2_addr + 8,

    % task_struct group_leader
    ispointer(Group_leader_addr, Group_leader_value),
    Group_leader_addr > Child_addr,
    Group_leader_addr < Child_addr + 33,


    isstring(Comm_addr, Comm_value),
    Comm_addr > Child_addr,
    Comm_offset is Comm_addr - Current_addr,
    Tasks_offset is Tasks_addr - Current_addr,

    possible_ts(Parent_value, Comm_offset, Tasks_offset),
    possible_list_head(Tasks_value, Comm_offset, Tasks_offset),
    possible_ts(Parent2_value, Comm_offset, Tasks_offset),
    possible_ts(Group_leader_value, Comm_offset, Tasks_offset),


    ispointer(Thread_group_addr, Thread_group_value),
    Thread_group_addr > Group_leader_addr,
    % This rule is very ad hoc 
    Thread_group_addr < Group_leader_addr + 150,
    Thread_group_offset is Thread_group_addr - Current_addr,
    possible_thread_group(Thread_group_value, Comm_offset, Thread_group_offset),
    get_time(End),
    Time_past is End - Current,
    log('profile.txt', 'finish thread_group', Time_past),

    ispointer(Cred_addr, Cred_value),
    Cred_addr > Group_leader_addr,
    Cred_addr < Comm_addr,
    ispointer(Cred_addr2, Cred_value2),
    Cred_addr2 is Cred_addr + 8,
    possible_cred(Cred_value),

    ispointer(FS_struct_addr, FS_struct_value),
    FS_struct_addr > Comm_addr,
    FS_struct_addr is Current_addr + 2640,
    possible_fs_struct(FS_struct_value),

    get_time(End),
    Time_past is End - Current,
    log('profile.txt', 'task_struct', Current),
    log('profile.txt', 'task', Tasks_addr),
    log('profile.txt', 'mm_struct', MM2_addr),
    log('profile.txt', 'pid', Pid_addr),
    log('profile.txt', 'real_parent', Parent_addr),
    log('profile.txt', 'group_leader', Group_leader_addr),
    log('profile.txt', 'thread_group', Thread_group_addr),
    log('profile.txt', 'cred', Cred_addr),
    log('profile.txt', 'comm', Comm_addr),
    log('profile.txt', 'fs', FS_struct_addr),
    log('profile.txt', 'end', Time_past),

    print_nl('task', Tasks_addr),
    print_nl('mm_struct', MM2_addr),
    print_nl('pid', Pid_addr),
    print_nl('parent', Parent_addr),
    print_nl('group_leader', Group_leader_addr),
    print_nl('thread_group', Thread_group_addr),
    print_nl('cred', Cred_addr),
    print_nl('comm', Comm_addr),
    print('----------------------------'), nl.


test(Current_addr) :-
    get_time(Current),
    statistics(real_time, [Start|_]),
    
    isstring(Comm_addr, Comm_value),
    Comm_addr is Current_addr + 2584,
    ispointer(Tasks_addr, Tasks_value),
    Tasks_addr > Current_addr + 1900,
    Tasks_addr < Current_addr + 2048,
    get_time(End),
    Time_past is End - Current,
    print_nl('before ts', Time_past),
    print_nl('Tasks_addr', Tasks_addr),
    Comm_offset is Comm_addr - Current_addr,
    Tasks_offset is Tasks_addr - Current_addr,
    possible_list_head(Tasks_value, Comm_offset, Tasks_offset),
    possible_list_head(Tasks_value, Comm_offset, Tasks_offset),
    
    statistics(real_time, [Ended|_]),
    statistics(atoms, [Ato|_]),
    print_nl("atom", Ato),

    Time is Ended - Start,
    print_nl("start", Start),
    print_nl('Ended', Ended),
    print_nl('finish one ts', Time),
    false.


    

possible_mm_struct(Base_addr) :- 
    process_create(path('python'),
                    ['subquery.py', Base_addr, "mm_struct"],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).


possible_sched_info(Base_addr) :- 
    process_create(path('python'),
                    ['subquery.py', Base_addr, "sched_info"],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_list_head(Base_addr, Comm_offset, Tasks_offset) :- 
    process_create(path('python'),
                    ['subquery.py', Base_addr, "list_head", Comm_offset, Tasks_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_list_head_no_order(Base_addr, Comm_offset, Tasks_offset) :- 
    process_create(path('python'),
                    ['subquery.py', Base_addr, "list_head_no_order", Comm_offset, Tasks_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

task_struct_r(Base_addr):-
    process_create(path('python'),
                    ['subquery.py', Base_addr, "task_struct"],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    isTrue(Result),
    write(X), nl.

list_head_next(Base_addr, List_head_offset) :- 
    Task_addr is Base_addr - List_head_offset,
    task_struct_r(Task_addr).


possible_fs_struct(Base_addr) :- 
    process_create(path('python'),
                    ['subquery.py', Base_addr, "fs_struct"],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_tlbflush_unmap_batch(Base_addr):- 
    process_create(path('python'),
                    ['subquery.py', Base_addr, "tlbflush_unmap_batch"],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_ts(Base_addr, Comm_offset, Tasks_offset):-
    process_create(path('python'),
                    ['subquery.py', Base_addr, "ts", Comm_offset, Tasks_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_ts_no_order(Base_addr, Comm_offset, Tasks_offset):-
    process_create(path('python'),
                    ['subquery.py', Base_addr, "ts_no_order", Comm_offset, Tasks_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_group_leader(Base_addr, Comm_offset, Tasks_offset):-
    process_create(path('python'),
                    ['subquery.py', Base_addr, "group_leader", Comm_offset, Tasks_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_thread_group(Base_addr, Comm_offset, Tasks_offset):-
    process_create(path('python'),
                    ['subquery.py', Base_addr, "thread_group", Comm_offset, Tasks_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_thread_group_no_order(Base_addr, Comm_offset, Tasks_offset):-
    process_create(path('python'),
                    ['subquery.py', Base_addr, "thread_group_no_order", Comm_offset, Tasks_offset],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

possible_cred(Base_addr) :- 
    process_create(path('python'),
                    ['subquery.py', Base_addr, "cred"],
                    [stdout(pipe(In))]),
    read_string(In, Len, X),
    string_codes(X, Result),
    close(In),
    isTrue(Result).

print_nl(Name, Content):- 
    print(Name),
    print(':'),
    print(Content),
    nl.
