d4dag.c.006t.gimple 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. int d4d_version ()
  2. {
  3. int D.2254;
  4. D.2254 = 10;
  5. return D.2254;
  6. }
  7. int d4d_init (void * (*<T342>) (unsigned int) mallocer, void (*<Tee>) (void *) freeer)
  8. {
  9. int D.2258;
  10. if (mallocer == 0B) goto <D.2256>; else goto <D.2257>;
  11. <D.2256>:
  12. D.2258 = -1;
  13. // predicted unlikely by early return (on trees) predictor.
  14. return D.2258;
  15. <D.2257>:
  16. if (freeer == 0B) goto <D.2259>; else goto <D.2260>;
  17. <D.2259>:
  18. D.2258 = -1;
  19. // predicted unlikely by early return (on trees) predictor.
  20. return D.2258;
  21. <D.2260>:
  22. _1 = mallocer (16);
  23. d4d__main = _1;
  24. d4d__main.0_2 = d4d__main;
  25. if (d4d__main.0_2 == 0B) goto <D.2261>; else goto <D.2262>;
  26. <D.2261>:
  27. D.2258 = -2;
  28. // predicted unlikely by early return (on trees) predictor.
  29. return D.2258;
  30. <D.2262>:
  31. d4d__main.1_3 = d4d__main;
  32. d4d__memzero (d4d__main.1_3, 16);
  33. d4d__main.2_4 = d4d__main;
  34. d4d__main.2_4->d4d__malloc = mallocer;
  35. d4d__main.3_5 = d4d__main;
  36. d4d__main.3_5->d4d__free = freeer;
  37. {
  38. struct splay_tree_s * spt;
  39. long long unsigned int n;
  40. struct splay_tree_node_s * spn;
  41. spt = 0B;
  42. n = 0;
  43. spn = 0B;
  44. spt = splay_tree_new (splay_tree_compare_ints, 0B, 0B);
  45. n = 0;
  46. goto <D.2087>;
  47. <D.2086>:
  48. spn = d4dag___splay_tree_insert (spt, n, 0);
  49. if (spn == 0B) goto <D.2263>; else goto <D.2264>;
  50. <D.2263>:
  51. <D.2264>:
  52. n = n + 1;
  53. <D.2087>:
  54. if (n <= 9) goto <D.2086>; else goto <D.2084>;
  55. <D.2084>:
  56. d4dag___splay_tree_delete (spt);
  57. }
  58. D.2258 = 0;
  59. return D.2258;
  60. }
  61. int d4d_deinit ()
  62. {
  63. int D.2268;
  64. d4d__main.4_1 = d4d__main;
  65. if (d4d__main.4_1 == 0B) goto <D.2266>; else goto <D.2267>;
  66. <D.2266>:
  67. D.2268 = 0;
  68. // predicted unlikely by early return (on trees) predictor.
  69. return D.2268;
  70. <D.2267>:
  71. d4d__main.5_2 = d4d__main;
  72. _3 = d4d__main.5_2->d4d__free;
  73. d4d__main.6_4 = d4d__main;
  74. _3 (d4d__main.6_4);
  75. d4d__main = 0B;
  76. D.2268 = 0;
  77. return D.2268;
  78. }
  79. void d4d__memzero (void * ptr, unsigned int n)
  80. {
  81. unsigned char * p;
  82. p = 0B;
  83. p = ptr;
  84. goto <D.2097>;
  85. <D.2098>:
  86. *p = 0;
  87. p = p + 1;
  88. n = n + 4294967295;
  89. <D.2097>:
  90. if (n != 0) goto <D.2098>; else goto <D.2096>;
  91. <D.2096>:
  92. return;
  93. }
  94. void splay_tree_delete_helper (struct splay_tree_s * sp, struct splay_tree_node_s * node)
  95. {
  96. struct splay_tree_node_s * pending;
  97. struct splay_tree_node_s * active;
  98. pending = 0B;
  99. active = 0B;
  100. if (node == 0B) goto <D.2271>; else goto <D.2272>;
  101. <D.2271>:
  102. // predicted unlikely by early return (on trees) predictor.
  103. return;
  104. <D.2272>:
  105. _1 = sp->delete_key;
  106. if (_1 != 0B) goto <D.2273>; else goto <D.2274>;
  107. <D.2273>:
  108. _2 = sp->delete_key;
  109. _3 = node->key;
  110. _2 (_3);
  111. <D.2274>:
  112. _4 = sp->delete_value;
  113. if (_4 != 0B) goto <D.2275>; else goto <D.2276>;
  114. <D.2275>:
  115. _5 = sp->delete_value;
  116. _6 = node->value;
  117. _5 (_6);
  118. <D.2276>:
  119. pending.7_7 = (long long unsigned int) pending;
  120. node->key = pending.7_7;
  121. pending = node;
  122. goto <D.2107>;
  123. <D.2111>:
  124. active = pending;
  125. pending = 0B;
  126. goto <D.2109>;
  127. <D.2110>:
  128. {
  129. struct splay_tree_node_s * temp;
  130. temp = 0B;
  131. _8 = active->left;
  132. if (_8 != 0B) goto <D.2277>; else goto <D.2278>;
  133. <D.2277>:
  134. _9 = sp->delete_key;
  135. if (_9 != 0B) goto <D.2279>; else goto <D.2280>;
  136. <D.2279>:
  137. _10 = sp->delete_key;
  138. _11 = active->left;
  139. _12 = _11->key;
  140. _10 (_12);
  141. <D.2280>:
  142. _13 = sp->delete_value;
  143. if (_13 != 0B) goto <D.2281>; else goto <D.2282>;
  144. <D.2281>:
  145. _14 = sp->delete_value;
  146. _15 = active->left;
  147. _16 = _15->value;
  148. _14 (_16);
  149. <D.2282>:
  150. _17 = active->left;
  151. pending.8_18 = (long long unsigned int) pending;
  152. _17->key = pending.8_18;
  153. pending = active->left;
  154. <D.2278>:
  155. _19 = active->right;
  156. if (_19 != 0B) goto <D.2283>; else goto <D.2284>;
  157. <D.2283>:
  158. _20 = sp->delete_key;
  159. if (_20 != 0B) goto <D.2285>; else goto <D.2286>;
  160. <D.2285>:
  161. _21 = sp->delete_key;
  162. _22 = active->right;
  163. _23 = _22->key;
  164. _21 (_23);
  165. <D.2286>:
  166. _24 = sp->delete_value;
  167. if (_24 != 0B) goto <D.2287>; else goto <D.2288>;
  168. <D.2287>:
  169. _25 = sp->delete_value;
  170. _26 = active->right;
  171. _27 = _26->value;
  172. _25 (_27);
  173. <D.2288>:
  174. _28 = active->right;
  175. pending.9_29 = (long long unsigned int) pending;
  176. _28->key = pending.9_29;
  177. pending = active->right;
  178. <D.2284>:
  179. temp = active;
  180. _30 = temp->key;
  181. active = (struct splay_tree_node_s *) _30;
  182. _31 = sp->deallocate;
  183. _32 = sp->allocate_data;
  184. _31 (temp, _32);
  185. }
  186. <D.2109>:
  187. if (active != 0B) goto <D.2110>; else goto <D.2108>;
  188. <D.2108>:
  189. <D.2107>:
  190. if (pending != 0B) goto <D.2111>; else goto <D.2106>;
  191. <D.2106>:
  192. return;
  193. }
  194. void rotate_left (struct splay_tree_node_s * * pp, struct splay_tree_node_s * p, struct splay_tree_node_s * n)
  195. {
  196. struct splay_tree_node_s * tmp;
  197. tmp = 0B;
  198. tmp = n->right;
  199. n->right = p;
  200. p->left = tmp;
  201. *pp = n;
  202. return;
  203. }
  204. void rotate_right (struct splay_tree_node_s * * pp, struct splay_tree_node_s * p, struct splay_tree_node_s * n)
  205. {
  206. struct splay_tree_node_s * tmp;
  207. tmp = 0B;
  208. tmp = n->left;
  209. n->left = p;
  210. p->right = tmp;
  211. *pp = n;
  212. return;
  213. }
  214. void splay_tree_splay (struct splay_tree_s * sp, splay_tree_key key)
  215. {
  216. int cmp1;
  217. int cmp2;
  218. struct splay_tree_node_s * n;
  219. struct splay_tree_node_s * c;
  220. cmp1 = 0;
  221. cmp2 = 0;
  222. n = 0B;
  223. c = 0B;
  224. _1 = sp->root;
  225. if (_1 == 0B) goto <D.2292>; else goto <D.2293>;
  226. <D.2292>:
  227. // predicted unlikely by early return (on trees) predictor.
  228. return;
  229. <D.2293>:
  230. <D.2134>:
  231. n = sp->root;
  232. _2 = sp->comp;
  233. _3 = n->key;
  234. cmp1 = _2 (key, _3);
  235. if (cmp1 == 0) goto <D.2294>; else goto <D.2295>;
  236. <D.2294>:
  237. // predicted unlikely by early return (on trees) predictor.
  238. return;
  239. <D.2295>:
  240. if (cmp1 < 0) goto <D.2296>; else goto <D.2297>;
  241. <D.2296>:
  242. c = n->left;
  243. goto <D.2298>;
  244. <D.2297>:
  245. c = n->right;
  246. <D.2298>:
  247. if (c == 0B) goto <D.2299>; else goto <D.2300>;
  248. <D.2299>:
  249. // predicted unlikely by early return (on trees) predictor.
  250. return;
  251. <D.2300>:
  252. _4 = sp->comp;
  253. _5 = c->key;
  254. cmp2 = _4 (key, _5);
  255. if (cmp2 == 0) goto <D.2301>; else goto <D.2304>;
  256. <D.2304>:
  257. if (cmp2 < 0) goto <D.2305>; else goto <D.2302>;
  258. <D.2305>:
  259. _6 = c->left;
  260. if (_6 == 0B) goto <D.2301>; else goto <D.2302>;
  261. <D.2302>:
  262. if (cmp2 > 0) goto <D.2306>; else goto <D.2303>;
  263. <D.2306>:
  264. _7 = c->right;
  265. if (_7 == 0B) goto <D.2301>; else goto <D.2303>;
  266. <D.2301>:
  267. if (cmp1 < 0) goto <D.2307>; else goto <D.2308>;
  268. <D.2307>:
  269. _8 = &sp->root;
  270. rotate_left (_8, n, c);
  271. goto <D.2309>;
  272. <D.2308>:
  273. _9 = &sp->root;
  274. rotate_right (_9, n, c);
  275. <D.2309>:
  276. // predicted unlikely by early return (on trees) predictor.
  277. return;
  278. <D.2303>:
  279. if (cmp1 < 0) goto <D.2312>; else goto <D.2310>;
  280. <D.2312>:
  281. if (cmp2 < 0) goto <D.2313>; else goto <D.2310>;
  282. <D.2313>:
  283. _10 = c->left;
  284. _11 = &n->left;
  285. rotate_left (_11, c, _10);
  286. _12 = n->left;
  287. _13 = &sp->root;
  288. rotate_left (_13, n, _12);
  289. goto <D.2311>;
  290. <D.2310>:
  291. if (cmp1 > 0) goto <D.2316>; else goto <D.2314>;
  292. <D.2316>:
  293. if (cmp2 > 0) goto <D.2317>; else goto <D.2314>;
  294. <D.2317>:
  295. _14 = c->right;
  296. _15 = &n->right;
  297. rotate_right (_15, c, _14);
  298. _16 = n->right;
  299. _17 = &sp->root;
  300. rotate_right (_17, n, _16);
  301. goto <D.2315>;
  302. <D.2314>:
  303. if (cmp1 < 0) goto <D.2320>; else goto <D.2318>;
  304. <D.2320>:
  305. if (cmp2 > 0) goto <D.2321>; else goto <D.2318>;
  306. <D.2321>:
  307. _18 = c->right;
  308. _19 = &n->left;
  309. rotate_right (_19, c, _18);
  310. _20 = n->left;
  311. _21 = &sp->root;
  312. rotate_left (_21, n, _20);
  313. goto <D.2319>;
  314. <D.2318>:
  315. if (cmp1 > 0) goto <D.2322>; else goto <D.2323>;
  316. <D.2322>:
  317. if (cmp2 < 0) goto <D.2324>; else goto <D.2325>;
  318. <D.2324>:
  319. _22 = c->left;
  320. _23 = &n->right;
  321. rotate_left (_23, c, _22);
  322. _24 = n->right;
  323. _25 = &sp->root;
  324. rotate_right (_25, n, _24);
  325. goto <D.2326>;
  326. <D.2325>:
  327. <D.2326>:
  328. <D.2323>:
  329. <D.2319>:
  330. <D.2315>:
  331. <D.2311>:
  332. goto <D.2134>;
  333. return;
  334. }
  335. void * splay_tree_xmalloc_allocate (unsigned int size, void * data)
  336. {
  337. void * D.2330;
  338. void * ret;
  339. ret = 0B;
  340. if (data != 0B) goto <D.2328>; else goto <D.2329>;
  341. <D.2328>:
  342. <D.2329>:
  343. d4d__main.10_1 = d4d__main;
  344. _2 = d4d__main.10_1->d4d__malloc;
  345. ret = _2 (size);
  346. d4d__memzero (ret, size);
  347. D.2330 = ret;
  348. return D.2330;
  349. }
  350. void splay_tree_xmalloc_deallocate (void * object, void * data)
  351. {
  352. if (object != 0B) goto <D.2332>; else goto <D.2333>;
  353. <D.2332>:
  354. d4d__main.11_1 = d4d__main;
  355. _2 = d4d__main.11_1->d4d__free;
  356. _2 (object);
  357. <D.2333>:
  358. if (data != 0B) goto <D.2334>; else goto <D.2335>;
  359. <D.2334>:
  360. <D.2335>:
  361. return;
  362. }
  363. struct splay_tree_s * splay_tree_new (int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key) compare_fn, void (*splay_tree_delete_key_fn) (splay_tree_key) delete_key_fn, void (*splay_tree_delete_value_fn) (splay_tree_value) delete_value_fn)
  364. {
  365. struct splay_tree_s * D.2337;
  366. D.2337 = splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn, splay_tree_xmalloc_allocate, splay_tree_xmalloc_deallocate, 0B);
  367. return D.2337;
  368. }
  369. struct splay_tree_s * splay_tree_new_with_allocator (int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key) compare_fn, void (*splay_tree_delete_key_fn) (splay_tree_key) delete_key_fn, void (*splay_tree_delete_value_fn) (splay_tree_value) delete_value_fn, void * (*splay_tree_allocate_fn) (unsigned int, void *) allocate_fn, void (*splay_tree_deallocate_fn) (void *, void *) deallocate_fn, void * allocate_data)
  370. {
  371. struct splay_tree_s * D.2339;
  372. D.2339 = splay_tree_new_typed_alloc (compare_fn, delete_key_fn, delete_value_fn, allocate_fn, allocate_fn, deallocate_fn, allocate_data);
  373. return D.2339;
  374. }
  375. struct splay_tree_s * splay_tree_new_typed_alloc (int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key) compare_fn, void (*splay_tree_delete_key_fn) (splay_tree_key) delete_key_fn, void (*splay_tree_delete_value_fn) (splay_tree_value) delete_value_fn, void * (*splay_tree_allocate_fn) (unsigned int, void *) tree_allocate_fn, void * (*splay_tree_allocate_fn) (unsigned int, void *) node_allocate_fn, void (*splay_tree_deallocate_fn) (void *, void *) deallocate_fn, void * allocate_data)
  376. {
  377. struct splay_tree_s * D.2341;
  378. struct splay_tree_s * sp;
  379. sp = tree_allocate_fn (56, allocate_data);
  380. sp->root = 0B;
  381. sp->comp = compare_fn;
  382. sp->delete_key = delete_key_fn;
  383. sp->delete_value = delete_value_fn;
  384. sp->allocate = node_allocate_fn;
  385. sp->deallocate = deallocate_fn;
  386. sp->allocate_data = allocate_data;
  387. D.2341 = sp;
  388. return D.2341;
  389. }
  390. void d4dag___splay_tree_delete (struct splay_tree_s * sp)
  391. {
  392. _1 = sp->root;
  393. splay_tree_delete_helper (sp, _1);
  394. _2 = sp->deallocate;
  395. _3 = sp->allocate_data;
  396. _2 (sp, _3);
  397. return;
  398. }
  399. struct splay_tree_node_s * d4dag___splay_tree_insert (struct splay_tree_s * sp, splay_tree_key key, splay_tree_value value)
  400. {
  401. struct splay_tree_node_s * D.2360;
  402. int comparison;
  403. struct splay_tree_node_s * node;
  404. comparison = 0;
  405. node = 0B;
  406. splay_tree_splay (sp, key);
  407. _1 = sp->root;
  408. if (_1 != 0B) goto <D.2344>; else goto <D.2345>;
  409. <D.2344>:
  410. _2 = sp->comp;
  411. _3 = sp->root;
  412. _4 = _3->key;
  413. comparison = _2 (_4, key);
  414. <D.2345>:
  415. _5 = sp->root;
  416. if (_5 != 0B) goto <D.2348>; else goto <D.2346>;
  417. <D.2348>:
  418. if (comparison == 0) goto <D.2349>; else goto <D.2346>;
  419. <D.2349>:
  420. _6 = sp->delete_key;
  421. if (_6 != 0B) goto <D.2350>; else goto <D.2351>;
  422. <D.2350>:
  423. _7 = sp->delete_key;
  424. _8 = sp->root;
  425. _9 = _8->key;
  426. _7 (_9);
  427. <D.2351>:
  428. _10 = sp->delete_value;
  429. if (_10 != 0B) goto <D.2352>; else goto <D.2353>;
  430. <D.2352>:
  431. _11 = sp->delete_value;
  432. _12 = sp->root;
  433. _13 = _12->value;
  434. _11 (_13);
  435. <D.2353>:
  436. _14 = sp->root;
  437. _14->key = key;
  438. _15 = sp->root;
  439. _15->value = value;
  440. goto <D.2347>;
  441. <D.2346>:
  442. _16 = sp->allocate;
  443. _17 = sp->allocate_data;
  444. node = _16 (32, _17);
  445. node->key = key;
  446. node->value = value;
  447. _18 = sp->root;
  448. if (_18 == 0B) goto <D.2354>; else goto <D.2355>;
  449. <D.2354>:
  450. node->left = 0B;
  451. node->right = 0B;
  452. goto <D.2356>;
  453. <D.2355>:
  454. if (comparison < 0) goto <D.2357>; else goto <D.2358>;
  455. <D.2357>:
  456. _19 = sp->root;
  457. node->left = _19;
  458. _20 = node->left;
  459. _21 = _20->right;
  460. node->right = _21;
  461. _22 = node->left;
  462. _22->right = 0B;
  463. goto <D.2359>;
  464. <D.2358>:
  465. _23 = sp->root;
  466. node->right = _23;
  467. _24 = node->right;
  468. _25 = _24->left;
  469. node->left = _25;
  470. _26 = node->right;
  471. _26->left = 0B;
  472. <D.2359>:
  473. <D.2356>:
  474. sp->root = node;
  475. <D.2347>:
  476. D.2360 = sp->root;
  477. return D.2360;
  478. }
  479. void d4dag___splay_tree_remove (struct splay_tree_s * sp, splay_tree_key key)
  480. {
  481. struct splay_tree_node_s * left;
  482. struct splay_tree_node_s * right;
  483. left = 0B;
  484. right = 0B;
  485. splay_tree_splay (sp, key);
  486. _1 = sp->root;
  487. if (_1 != 0B) goto <D.2362>; else goto <D.2363>;
  488. <D.2362>:
  489. _2 = sp->comp;
  490. _3 = sp->root;
  491. _4 = _3->key;
  492. _5 = _2 (_4, key);
  493. if (_5 == 0) goto <D.2364>; else goto <D.2365>;
  494. <D.2364>:
  495. _6 = sp->root;
  496. left = _6->left;
  497. _7 = sp->root;
  498. right = _7->right;
  499. _8 = sp->delete_key;
  500. if (_8 != 0B) goto <D.2366>; else goto <D.2367>;
  501. <D.2366>:
  502. _9 = sp->delete_key;
  503. _10 = sp->root;
  504. _11 = _10->key;
  505. _9 (_11);
  506. <D.2367>:
  507. _12 = sp->delete_value;
  508. if (_12 != 0B) goto <D.2368>; else goto <D.2369>;
  509. <D.2368>:
  510. _13 = sp->delete_value;
  511. _14 = sp->root;
  512. _15 = _14->value;
  513. _13 (_15);
  514. <D.2369>:
  515. _16 = sp->deallocate;
  516. _17 = sp->allocate_data;
  517. _18 = sp->root;
  518. _16 (_18, _17);
  519. if (left != 0B) goto <D.2370>; else goto <D.2371>;
  520. <D.2370>:
  521. sp->root = left;
  522. if (right != 0B) goto <D.2372>; else goto <D.2373>;
  523. <D.2372>:
  524. goto <D.2184>;
  525. <D.2185>:
  526. left = left->right;
  527. <D.2184>:
  528. _19 = left->right;
  529. if (_19 != 0B) goto <D.2185>; else goto <D.2183>;
  530. <D.2183>:
  531. left->right = right;
  532. <D.2373>:
  533. goto <D.2374>;
  534. <D.2371>:
  535. sp->root = right;
  536. <D.2374>:
  537. <D.2365>:
  538. <D.2363>:
  539. return;
  540. }
  541. struct splay_tree_node_s * splay_tree_lookup (struct splay_tree_s * sp, splay_tree_key key)
  542. {
  543. struct splay_tree_node_s * D.2379;
  544. splay_tree_splay (sp, key);
  545. _1 = sp->root;
  546. if (_1 != 0B) goto <D.2377>; else goto <D.2376>;
  547. <D.2377>:
  548. _2 = sp->comp;
  549. _3 = sp->root;
  550. _4 = _3->key;
  551. _5 = _2 (_4, key);
  552. if (_5 == 0) goto <D.2378>; else goto <D.2376>;
  553. <D.2378>:
  554. D.2379 = sp->root;
  555. // predicted unlikely by early return (on trees) predictor.
  556. return D.2379;
  557. <D.2376>:
  558. D.2379 = 0B;
  559. // predicted unlikely by early return (on trees) predictor.
  560. return D.2379;
  561. }
  562. struct splay_tree_node_s * splay_tree_max (struct splay_tree_s * sp)
  563. {
  564. struct splay_tree_node_s * D.2383;
  565. struct splay_tree_node_s * n;
  566. n = sp->root;
  567. if (n == 0B) goto <D.2381>; else goto <D.2382>;
  568. <D.2381>:
  569. D.2383 = 0B;
  570. // predicted unlikely by early return (on trees) predictor.
  571. return D.2383;
  572. <D.2382>:
  573. goto <D.2195>;
  574. <D.2196>:
  575. n = n->right;
  576. <D.2195>:
  577. _1 = n->right;
  578. if (_1 != 0B) goto <D.2196>; else goto <D.2194>;
  579. <D.2194>:
  580. D.2383 = n;
  581. return D.2383;
  582. }
  583. struct splay_tree_node_s * d4dag___splay_tree_min (struct splay_tree_s * sp)
  584. {
  585. struct splay_tree_node_s * D.2387;
  586. struct splay_tree_node_s * n;
  587. n = 0B;
  588. if (sp == 0B) goto <D.2385>; else goto <D.2386>;
  589. <D.2385>:
  590. D.2387 = 0B;
  591. // predicted unlikely by early return (on trees) predictor.
  592. return D.2387;
  593. <D.2386>:
  594. n = sp->root;
  595. if (n == 0B) goto <D.2388>; else goto <D.2389>;
  596. <D.2388>:
  597. D.2387 = 0B;
  598. // predicted unlikely by early return (on trees) predictor.
  599. return D.2387;
  600. <D.2389>:
  601. goto <D.2202>;
  602. <D.2203>:
  603. n = n->left;
  604. <D.2202>:
  605. _1 = n->left;
  606. if (_1 != 0B) goto <D.2203>; else goto <D.2201>;
  607. <D.2201>:
  608. D.2387 = n;
  609. return D.2387;
  610. }
  611. struct splay_tree_node_s * d4dag___splay_tree_predecessor (struct splay_tree_s * sp, splay_tree_key key)
  612. {
  613. struct splay_tree_node_s * D.2393;
  614. int comparison;
  615. struct splay_tree_node_s * node;
  616. comparison = 0;
  617. node = 0B;
  618. if (sp == 0B) goto <D.2391>; else goto <D.2392>;
  619. <D.2391>:
  620. D.2393 = 0B;
  621. // predicted unlikely by early return (on trees) predictor.
  622. return D.2393;
  623. <D.2392>:
  624. _1 = sp->root;
  625. if (_1 == 0B) goto <D.2394>; else goto <D.2395>;
  626. <D.2394>:
  627. D.2393 = 0B;
  628. // predicted unlikely by early return (on trees) predictor.
  629. return D.2393;
  630. <D.2395>:
  631. splay_tree_splay (sp, key);
  632. _2 = sp->comp;
  633. _3 = sp->root;
  634. _4 = _3->key;
  635. comparison = _2 (_4, key);
  636. if (comparison < 0) goto <D.2396>; else goto <D.2397>;
  637. <D.2396>:
  638. D.2393 = sp->root;
  639. // predicted unlikely by early return (on trees) predictor.
  640. return D.2393;
  641. <D.2397>:
  642. _5 = sp->root;
  643. node = _5->left;
  644. if (node != 0B) goto <D.2398>; else goto <D.2399>;
  645. <D.2398>:
  646. goto <D.2211>;
  647. <D.2212>:
  648. node = node->right;
  649. <D.2211>:
  650. _6 = node->right;
  651. if (_6 != 0B) goto <D.2212>; else goto <D.2210>;
  652. <D.2210>:
  653. <D.2399>:
  654. D.2393 = node;
  655. return D.2393;
  656. }
  657. struct splay_tree_node_s * splay_tree_successor (struct splay_tree_s * sp, splay_tree_key key)
  658. {
  659. struct splay_tree_node_s * D.2403;
  660. int comparison;
  661. struct splay_tree_node_s * node;
  662. comparison = 0;
  663. node = 0B;
  664. _1 = sp->root;
  665. if (_1 == 0B) goto <D.2401>; else goto <D.2402>;
  666. <D.2401>:
  667. D.2403 = 0B;
  668. // predicted unlikely by early return (on trees) predictor.
  669. return D.2403;
  670. <D.2402>:
  671. splay_tree_splay (sp, key);
  672. _2 = sp->comp;
  673. _3 = sp->root;
  674. _4 = _3->key;
  675. comparison = _2 (_4, key);
  676. if (comparison > 0) goto <D.2404>; else goto <D.2405>;
  677. <D.2404>:
  678. D.2403 = sp->root;
  679. // predicted unlikely by early return (on trees) predictor.
  680. return D.2403;
  681. <D.2405>:
  682. _5 = sp->root;
  683. node = _5->right;
  684. if (node != 0B) goto <D.2406>; else goto <D.2407>;
  685. <D.2406>:
  686. goto <D.2220>;
  687. <D.2221>:
  688. node = node->left;
  689. <D.2220>:
  690. _6 = node->left;
  691. if (_6 != 0B) goto <D.2221>; else goto <D.2219>;
  692. <D.2219>:
  693. <D.2407>:
  694. D.2403 = node;
  695. return D.2403;
  696. }
  697. int splay_tree_foreach (struct splay_tree_s * sp, int (*splay_tree_foreach_fn) (struct splay_tree_node_s *, void *) fn, void * data)
  698. {
  699. int D.2411;
  700. struct splay_tree_node_s * spn;
  701. splay_tree_key key;
  702. int val;
  703. spn = 0B;
  704. key = 0;
  705. val = 0;
  706. if (sp == 0B) goto <D.2409>; else goto <D.2410>;
  707. <D.2409>:
  708. D.2411 = 0;
  709. // predicted unlikely by early return (on trees) predictor.
  710. return D.2411;
  711. <D.2410>:
  712. _1 = sp->root;
  713. if (_1 == 0B) goto <D.2412>; else goto <D.2413>;
  714. <D.2412>:
  715. D.2411 = 0;
  716. // predicted unlikely by early return (on trees) predictor.
  717. return D.2411;
  718. <D.2413>:
  719. val = 0;
  720. spn = d4dag___splay_tree_min (sp);
  721. goto <D.2231>;
  722. <D.2232>:
  723. key = spn->key;
  724. val = fn (spn, data);
  725. if (val != 0) goto <D.2414>; else goto <D.2415>;
  726. <D.2414>:
  727. goto <D.2230>;
  728. <D.2415>:
  729. spn = splay_tree_successor (sp, key);
  730. <D.2231>:
  731. if (spn != 0B) goto <D.2232>; else goto <D.2230>;
  732. <D.2230>:
  733. D.2411 = val;
  734. return D.2411;
  735. }
  736. int splay_tree_compare_ints (splay_tree_key k1, splay_tree_key k2)
  737. {
  738. int D.2419;
  739. _1 = (int) k1;
  740. _2 = (int) k2;
  741. if (_1 < _2) goto <D.2417>; else goto <D.2418>;
  742. <D.2417>:
  743. D.2419 = -1;
  744. // predicted unlikely by early return (on trees) predictor.
  745. return D.2419;
  746. <D.2418>:
  747. _3 = (int) k1;
  748. _4 = (int) k2;
  749. if (_3 > _4) goto <D.2420>; else goto <D.2421>;
  750. <D.2420>:
  751. D.2419 = 1;
  752. // predicted unlikely by early return (on trees) predictor.
  753. return D.2419;
  754. <D.2421>:
  755. D.2419 = 0;
  756. // predicted unlikely by early return (on trees) predictor.
  757. return D.2419;
  758. }
  759. int splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2)
  760. {
  761. int D.2425;
  762. k1.12_1 = (char *) k1;
  763. k2.13_2 = (char *) k2;
  764. if (k1.12_1 < k2.13_2) goto <D.2423>; else goto <D.2424>;
  765. <D.2423>:
  766. D.2425 = -1;
  767. // predicted unlikely by early return (on trees) predictor.
  768. return D.2425;
  769. <D.2424>:
  770. k1.14_3 = (char *) k1;
  771. k2.15_4 = (char *) k2;
  772. if (k1.14_3 > k2.15_4) goto <D.2426>; else goto <D.2427>;
  773. <D.2426>:
  774. D.2425 = 1;
  775. // predicted unlikely by early return (on trees) predictor.
  776. return D.2425;
  777. <D.2427>:
  778. D.2425 = 0;
  779. // predicted unlikely by early return (on trees) predictor.
  780. return D.2425;
  781. }
  782. int splay_tree_compare_strings (splay_tree_key k1, splay_tree_key k2)
  783. {
  784. int D.2430;
  785. char * s1;
  786. char * s2;
  787. s1 = (char *) k1;
  788. s2 = (char *) k2;
  789. goto <D.2248>;
  790. <D.2249>:
  791. s1 = s1 + 1;
  792. s2 = s2 + 1;
  793. <D.2248>:
  794. _1 = *s1;
  795. if (_1 != 0) goto <D.2429>; else goto <D.2247>;
  796. <D.2429>:
  797. _2 = *s1;
  798. _3 = *s2;
  799. if (_2 == _3) goto <D.2249>; else goto <D.2247>;
  800. <D.2247>:
  801. _4 = *s1;
  802. _5 = (int) _4;
  803. _6 = *s2;
  804. _7 = (int) _6;
  805. D.2430 = _5 - _7;
  806. return D.2430;
  807. }
  808. void splay_tree_delete_pointers (splay_tree_value value)
  809. {
  810. if (value != 0) goto <D.2432>; else goto <D.2433>;
  811. <D.2432>:
  812. d4d__main.16_1 = d4d__main;
  813. _2 = d4d__main.16_1->d4d__free;
  814. value.17_3 = (void *) value;
  815. _2 (value.17_3);
  816. <D.2433>:
  817. return;
  818. }