Advertisement
Guest User

Untitled

a guest
May 23rd, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.13 KB | None | 0 0
  1.  
  2. //----- (018DB680) --------------------------------------------------------
  3. char __stdcall sub_18DB680(int a1, char *a2, int a3, unsigned int a4)
  4. {
  5. int v5; // eax@8
  6. unsigned int v6; // edx@10
  7. unsigned int v7; // edx@10
  8. unsigned int v8; // ebx@10
  9. int v9; // edi@11
  10. int v10; // eax@11
  11. unsigned int i; // esi@12
  12. int v12; // eax@13
  13. int v13; // edi@20
  14. int v14; // edi@22
  15. unsigned int v15; // esi@23
  16. int v16; // ebx@24
  17. int v17; // ebx@35
  18. int v18; // edx@39
  19. unsigned int v19; // eax@42
  20. unsigned int v20; // ecx@45
  21. unsigned int v21; // eax@47
  22. int v22; // esi@47
  23. int v23; // edi@47
  24. int v24; // ecx@47
  25. unsigned int v25; // eax@47
  26. void *v26; // edx@48
  27. int v27; // ST10_4@50
  28. int v28; // esi@50
  29. double v29; // st7@52
  30. int v30; // ecx@53
  31. int v31; // eax@53
  32. int v32; // eax@58
  33. const void *v33; // ebp@58
  34. unsigned int v34; // esi@58
  35. int v35; // ebx@58
  36. unsigned int v36; // edx@58
  37. int v37; // edi@59
  38. unsigned int v38; // eax@60
  39. size_t v39; // ST14_4@65
  40. void *v40; // ST0C_4@65
  41. int v41; // esi@65
  42. int v42; // eax@65
  43. int v43; // eax@66
  44. int v44; // ecx@75
  45. int v45; // eax@76
  46. signed int v46; // ecx@86
  47. int v47; // edi@88
  48. int v48; // ecx@89
  49. int v49; // eax@89
  50. int v50; // eax@89
  51. int v51; // ecx@89
  52. int v52; // eax@89
  53. int v53; // eax@89
  54. int v54; // ebx@90
  55. int v55; // ecx@91
  56. void *v56; // ecx@95
  57. int v57; // eax@95
  58. int v58; // eax@105
  59. int v59; // eax@106
  60. int v60; // eax@107
  61. int v61; // eax@116
  62. int v62; // eax@117
  63. void *v63; // eax@144
  64. int v64; // ecx@154
  65. int v65; // eax@154
  66. int v66; // eax@155
  67. int v67; // eax@156
  68. int v68; // eax@157
  69. int v69; // eax@166
  70. int v70; // eax@167
  71. bool v71; // zf@181
  72. int v72; // esi@193
  73. int v73; // eax@193
  74. int v74; // ecx@194
  75. char *v75; // [sp-4h] [bp-AF0h]@4
  76. int v76; // [sp+10h] [bp-ADCh]@44
  77. int v77; // [sp+10h] [bp-ADCh]@106
  78. int v78; // [sp+10h] [bp-ADCh]@116
  79. int v79; // [sp+10h] [bp-ADCh]@156
  80. int v80; // [sp+10h] [bp-ADCh]@166
  81. int v81; // [sp+14h] [bp-AD8h]@41
  82. int v82; // [sp+14h] [bp-AD8h]@103
  83. int v83; // [sp+18h] [bp-AD4h]@57
  84. int v84; // [sp+18h] [bp-AD4h]@105
  85. int v85; // [sp+18h] [bp-AD4h]@155
  86. unsigned int v86; // [sp+1Ch] [bp-AD0h]@56
  87. unsigned int v87; // [sp+1Ch] [bp-AD0h]@104
  88. int v88; // [sp+1Ch] [bp-AD0h]@153
  89. int v89; // [sp+20h] [bp-ACCh]@10
  90. unsigned int v90; // [sp+24h] [bp-AC8h]@10
  91. int v91; // [sp+28h] [bp-AC4h]@10
  92. int v92; // [sp+2Ch] [bp-AC0h]@13
  93. int v93; // [sp+30h] [bp-ABCh]@45
  94. int v94; // [sp+34h] [bp-AB8h]@65
  95. unsigned int v95; // [sp+38h] [bp-AB4h]@39
  96. int v96; // [sp+3Ch] [bp-AB0h]@8
  97. int v97; // [sp+40h] [bp-AACh]@90
  98. void *Memory; // [sp+44h] [bp-AA8h]@18
  99. int v99; // [sp+48h] [bp-AA4h]@18
  100. int v100; // [sp+4Ch] [bp-AA0h]@18
  101. int v101; // [sp+50h] [bp-A9Ch]@1
  102. LARGE_INTEGER PerformanceCount; // [sp+54h] [bp-A98h]@18
  103. int v103; // [sp+5Ch] [bp-A90h]@18
  104. int v104; // [sp+60h] [bp-A8Ch]@18
  105. char v105; // [sp+64h] [bp-A88h]@18
  106. int v106; // [sp+6Ch] [bp-A80h]@53
  107. int v107; // [sp+70h] [bp-A7Ch]@53
  108. int v108; // [sp+78h] [bp-A74h]@3
  109. unsigned int v109; // [sp+7Ch] [bp-A70h]@18
  110. unsigned int v110; // [sp+80h] [bp-A6Ch]@18
  111. unsigned int v111; // [sp+84h] [bp-A68h]@11
  112. int v112; // [sp+88h] [bp-A64h]@10
  113. unsigned int v113; // [sp+8Ch] [bp-A60h]@18
  114. int v114; // [sp+98h] [bp-A54h]@8
  115. unsigned int v115; // [sp+9Ch] [bp-A50h]@47
  116. unsigned int v116; // [sp+A0h] [bp-A4Ch]@47
  117. int v117; // [sp+A4h] [bp-A48h]@10
  118. int v118; // [sp+A8h] [bp-A44h]@63
  119. double v119; // [sp+ACh] [bp-A40h]@20
  120. unsigned __int64 v120; // [sp+B4h] [bp-A38h]@55
  121. unsigned __int64 v121; // [sp+BCh] [bp-A30h]@55
  122. void *Src; // [sp+C4h] [bp-A28h]@40
  123. char v123; // [sp+DCh] [bp-A10h]@127
  124. char DstBuf; // [sp+2DCh] [bp-810h]@97
  125. char Format; // [sp+4DCh] [bp-610h]@82
  126. char OutputString; // [sp+6DCh] [bp-410h]@71
  127. char v127; // [sp+8DCh] [bp-210h]@123
  128. int v128; // [sp+AE8h] [bp-4h]@10
  129.  
  130. sub_18D9940(a1);
  131. sub_18E3CA0(a1);
  132. *(_DWORD *)(a1 + 8) = 0;
  133. *(_DWORD *)(a1 + 12) = 0;
  134. *(_DWORD *)(a1 + 16) = 15;
  135. *(_DWORD *)(a1 + 20) = 0;
  136. *(_DWORD *)(a1 + 36) = -1;
  137. v101 = a1 + 40;
  138. sub_18E3CA0(a1 + 40);
  139. sub_18E4040(a1 + 40, (char *)L"Image file load failed");
  140. if ( !a3 || a4 < 1 )
  141. return 0;
  142. v108 = 36;
  143. if ( !sub_8AA8B0(a3, a4, (int)&v108) )
  144. {
  145. v75 = (char *)L"crnd_get_texture_info() failed";
  146. LABEL_5:
  147. sub_18E4040(a1 + 40, v75);
  148. return 0;
  149. }
  150. v5 = sub_89F990(v114);
  151. v96 = v5;
  152. if ( !v5 )
  153. {
  154. v75 = (char *)L"Unsupported DXT format";
  155. goto LABEL_5;
  156. }
  157. v117 = sub_40CE90(v5);
  158. v89 = 0;
  159. v90 = 0;
  160. v91 = 0;
  161. sub_40F630(v6, (int)&v89, v112);
  162. v128 = 0;
  163. v7 = v112;
  164. v8 = 0;
  165. if ( (unsigned int)v112 > 0 )
  166. {
  167. v9 = v89;
  168. v10 = v111;
  169. do
  170. {
  171. sub_410E30(v7, v9, v10);
  172. v10 = v111;
  173. for ( i = 0; i < v111; ++i )
  174. {
  175. v92 = 24;
  176. v12 = off_1FF05B0(0, 24, &v92, 1, dword_20B8AC4);
  177. if ( v12 && (unsigned int)v92 >= 0x18 )
  178. {
  179. *(_DWORD *)v12 = 0;
  180. *(_DWORD *)(v12 + 4) = 0;
  181. *(_DWORD *)(v12 + 8) = 15;
  182. *(_DWORD *)(v12 + 12) = 0;
  183. *(_DWORD *)(v12 + 16) = 0;
  184. *(_DWORD *)(v12 + 20) = 0;
  185. }
  186. else
  187. {
  188. sub_18E4870((int)"crnlib_malloc: out of memory");
  189. v12 = 0;
  190. }
  191. *(_DWORD *)(*(_DWORD *)v9 + 4 * i) = v12;
  192. v10 = v111;
  193. }
  194. v7 = v112;
  195. ++v8;
  196. v9 += 12;
  197. }
  198. while ( v8 < v112 );
  199. }
  200. Memory = 0;
  201. v99 = 0;
  202. v100 = 0;
  203. LOBYTE(v128) = 1;
  204. sub_40E300(v7, (int)&Memory, v7 * ((v109 + 3) >> 2) * ((v110 + 3) >> 2) * v113);
  205. sub_18E4040(v101, (char *)L"CRN unpack failed");
  206. v105 &= 0xFCu;
  207. PerformanceCount = 0i64;
  208. v103 = 0;
  209. v104 = 0;
  210. if ( 0.0 == dbl_20B9570 )
  211. sub_18C8E50();
  212. QueryPerformanceCounter(&PerformanceCount);
  213. v105 = v105 & 0xFD | 1;
  214. v13 = sub_8C2450_crunch_freesmth(a3, a4);
  215. v92 = v13;
  216. v119 = sub_18C8F40((int)&PerformanceCount) + 0.0;
  217. if ( !v13 )
  218. {
  219. if ( v90 > 0 )
  220. {
  221. v14 = v89 + 4;
  222. v92 = v90;
  223. do
  224. {
  225. v15 = 0;
  226. if ( *(_DWORD *)v14 > 0u )
  227. {
  228. do
  229. {
  230. v16 = *(_DWORD *)(*(_DWORD *)(v14 - 4) + 4 * v15);
  231. if ( v16 )
  232. {
  233. sub_411CF0(*(void **)(v16 + 16));
  234. sub_411D50(*(void **)(v16 + 20));
  235. if ( v16 & 7 )
  236. sub_18E4870((int)"crnlib_free: bad ptr");
  237. else
  238. off_1FF05B0(v16, 0, 0, 1, dword_20B8AC4);
  239. }
  240. ++v15;
  241. }
  242. while ( v15 < *(_DWORD *)v14 );
  243. }
  244. v14 += 12;
  245. --v92;
  246. }
  247. while ( v92 );
  248. }
  249. LOBYTE(v128) = 0;
  250. if ( Memory )
  251. {
  252. if ( (unsigned __int8)Memory & 7 )
  253. sub_18E4870((int)"crnlib_free: bad ptr");
  254. else
  255. off_1FF05B0(Memory, 0, 0, 1, dword_20B8AC4);
  256. }
  257. v128 = -1;
  258. v17 = v89;
  259. if ( v89 )
  260. {
  261. sub_40FBA0(v90, v89);
  262. if ( v17 & 7 )
  263. sub_18E4870((int)"crnlib_free: bad ptr");
  264. else
  265. off_1FF05B0(v17, 0, 0, 1, dword_20B8AC4);
  266. }
  267. return 0;
  268. }
  269. v18 = v112;
  270. v95 = 0;
  271. if ( (unsigned int)v112 < 6 )
  272. memset(&Src + v112, 0, 4 * (6 - v112));
  273. v81 = 0;
  274. if ( v111 > 0 )
  275. {
  276. while ( 1 )
  277. {
  278. v19 = v109 >> v81;
  279. if ( v109 >> v81 < 1 )
  280. v19 = 1;
  281. v76 = v19;
  282. if ( v110 >> v81 >= 1 )
  283. {
  284. v20 = v110 >> v81;
  285. v93 = v110 >> v81;
  286. }
  287. else
  288. {
  289. v20 = 1;
  290. v93 = 1;
  291. }
  292. v21 = (v19 + 3) >> 2;
  293. v22 = v113 * v21;
  294. v115 = (v20 + 3) >> 2;
  295. v23 = v115 * v113 * v21;
  296. v95 += 16 * v18 * v21 * v115;
  297. v116 = v21;
  298. QueryPerformanceCounter(&PerformanceCount);
  299. v24 = v112;
  300. v25 = 0;
  301. v105 = v105 & 0xFD | 1;
  302. if ( v112 )
  303. {
  304. v26 = Memory;
  305. do
  306. {
  307. *(&Src + v25++) = v26;
  308. v26 = (char *)v26 + v23;
  309. }
  310. while ( v25 < v24 );
  311. }
  312. v27 = v22;
  313. v28 = v92;
  314. if ( !sub_8B02E0(v92, (int)&Src, v99, v27, v81) )
  315. {
  316. sub_8C24B0(v28);
  317. if ( v90 )
  318. {
  319. v82 = v89 + 4;
  320. v93 = v90;
  321. do
  322. {
  323. v87 = 0;
  324. if ( *(_DWORD *)v82 )
  325. {
  326. do
  327. {
  328. v58 = *(_DWORD *)(*(_DWORD *)(v82 - 4) + 4 * v87);
  329. v84 = v58;
  330. if ( v58 )
  331. {
  332. v59 = *(_DWORD *)(v58 + 16);
  333. v77 = v59;
  334. if ( v59 )
  335. {
  336. v60 = *(_DWORD *)(v59 + 24);
  337. if ( v60 )
  338. {
  339. if ( v60 & 7 )
  340. {
  341. sprintf_s(
  342. &DstBuf,
  343. 0x200u,
  344. "%s(%u): Assertion failed: \"%s\"\n",
  345. ".\\crn_mem.cpp",
  346. 130,
  347. "crnlib_free: bad ptr");
  348. OutputDebugStringA(&DstBuf);
  349. printf(&DstBuf);
  350. if ( IsDebuggerPresent() )
  351. DebugBreak();
  352. }
  353. else
  354. {
  355. off_1FF05B0(v60, 0, 0, 1, dword_20B8AC4);
  356. }
  357. }
  358. if ( v77 & 7 )
  359. {
  360. sprintf_s(
  361. &Format,
  362. 0x200u,
  363. "%s(%u): Assertion failed: \"%s\"\n",
  364. ".\\crn_mem.cpp",
  365. 130,
  366. "crnlib_free: bad ptr");
  367. OutputDebugStringA(&Format);
  368. printf(&Format);
  369. if ( IsDebuggerPresent() )
  370. DebugBreak();
  371. }
  372. else
  373. {
  374. off_1FF05B0(v77, 0, 0, 1, dword_20B8AC4);
  375. }
  376. }
  377. v61 = *(_DWORD *)(v84 + 20);
  378. v78 = v61;
  379. if ( v61 )
  380. {
  381. v62 = *(_DWORD *)v61;
  382. if ( v62 )
  383. {
  384. if ( v62 & 7 )
  385. {
  386. sprintf_s(
  387. &OutputString,
  388. 0x200u,
  389. "%s(%u): Assertion failed: \"%s\"\n",
  390. ".\\crn_mem.cpp",
  391. 130,
  392. "crnlib_free: bad ptr");
  393. OutputDebugStringA(&OutputString);
  394. printf(&OutputString);
  395. if ( IsDebuggerPresent() )
  396. DebugBreak();
  397. }
  398. else
  399. {
  400. off_1FF05B0(v62, 0, 0, 1, dword_20B8AC4);
  401. }
  402. }
  403. if ( v78 & 7 )
  404. {
  405. sprintf_s(
  406. &v127,
  407. 0x200u,
  408. "%s(%u): Assertion failed: \"%s\"\n",
  409. ".\\crn_mem.cpp",
  410. 130,
  411. "crnlib_free: bad ptr");
  412. OutputDebugStringA(&v127);
  413. printf(&v127);
  414. if ( IsDebuggerPresent() )
  415. DebugBreak();
  416. }
  417. else
  418. {
  419. off_1FF05B0(v78, 0, 0, 1, dword_20B8AC4);
  420. }
  421. }
  422. if ( v84 & 7 )
  423. {
  424. sprintf_s(
  425. &v123,
  426. 0x200u,
  427. "%s(%u): Assertion failed: \"%s\"\n",
  428. ".\\crn_mem.cpp",
  429. 130,
  430. "crnlib_free: bad ptr");
  431. OutputDebugStringA(&v123);
  432. printf(&v123);
  433. if ( IsDebuggerPresent() )
  434. DebugBreak();
  435. }
  436. else
  437. {
  438. off_1FF05B0(v84, 0, 0, 1, dword_20B8AC4);
  439. }
  440. }
  441. ++v87;
  442. }
  443. while ( v87 < *(_DWORD *)v82 );
  444. }
  445. v82 += 12;
  446. --v93;
  447. }
  448. while ( v93 );
  449. }
  450. LOBYTE(v128) = 0;
  451. if ( Memory )
  452. {
  453. if ( (unsigned __int8)Memory & 7 )
  454. {
  455. sprintf_s(
  456. &v123,
  457. 0x200u,
  458. "%s(%u): Assertion failed: \"%s\"\n",
  459. ".\\crn_mem.cpp",
  460. 130,
  461. "crnlib_free: bad ptr");
  462. OutputDebugStringA(&v123);
  463. printf(&v123);
  464. if ( IsDebuggerPresent() )
  465. DebugBreak();
  466. }
  467. else
  468. {
  469. off_1FF05B0(Memory, 0, 0, 1, dword_20B8AC4);
  470. }
  471. }
  472. v128 = -1;
  473. if ( v89 )
  474. {
  475. sub_40FBA0(v90, v89);
  476. if ( v89 & 7 )
  477. {
  478. sprintf_s(
  479. &v123,
  480. 0x200u,
  481. "%s(%u): Assertion failed: \"%s\"\n",
  482. ".\\crn_mem.cpp",
  483. 130,
  484. "crnlib_free: bad ptr");
  485. OutputDebugStringA(&v123);
  486. printf(&v123);
  487. if ( IsDebuggerPresent() )
  488. DebugBreak();
  489. }
  490. else
  491. {
  492. off_1FF05B0(v89, 0, 0, 1, dword_20B8AC4);
  493. }
  494. }
  495. return 0;
  496. }
  497. if ( v105 & 1 )
  498. {
  499. v30 = v103;
  500. v31 = v104;
  501. v106 = v103;
  502. v107 = v104;
  503. if ( !(v105 & 2) )
  504. {
  505. QueryPerformanceCounter((LARGE_INTEGER *)&v106);
  506. v31 = v107;
  507. v30 = v106;
  508. }
  509. v121 = (__PAIR__(v31, v30) - *(_QWORD *)&PerformanceCount) & 0x8000000000000000ui64;
  510. v120 = (__PAIR__(v31, v30) - *(_QWORD *)&PerformanceCount) & 0x7FFFFFFFFFFFFFFFi64;
  511. v29 = (double)(__PAIR__(v31, v30) - *(_QWORD *)&PerformanceCount) * dbl_20B9570;
  512. }
  513. else
  514. {
  515. v29 = 0.0;
  516. }
  517. v18 = v112;
  518. v86 = 0;
  519. v119 = v29 + v119;
  520. if ( v112 )
  521. break;
  522. LABEL_87:
  523. ++v81;
  524. if ( v81 >= v111 )
  525. goto LABEL_88;
  526. }
  527. v83 = v89;
  528. while ( 1 )
  529. {
  530. v32 = sub_411DB0();
  531. v33 = *(&Src + v86);
  532. v34 = v116 * v115 * (v113 >> 3);
  533. v35 = v32;
  534. if ( !sub_18D8270(v32, v117, v76, v93) )
  535. {
  536. v57 = 0;
  537. goto LABEL_143;
  538. }
  539. v37 = *(_DWORD *)(v35 + 36);
  540. if ( v34 != v37 )
  541. break;
  542. v38 = *(_DWORD *)(v35 + 4);
  543. if ( v37 != v38 )
  544. {
  545. if ( v37 >= v38 && (unsigned int)v37 > *(_DWORD *)(v35 + 8) )
  546. {
  547. LOBYTE(v36) = v37 == v38 + 1;
  548. LOBYTE(v118) = v37 == v38 + 1;
  549. sub_18E7930(v37, v36, 0, v35, v37 == v38 + 1, 8u, 0);
  550. }
  551. *(_DWORD *)(v35 + 4) = v37;
  552. }
  553. v39 = 8 * *(_DWORD *)(v35 + 36);
  554. v40 = *(void **)v35;
  555. *(_DWORD *)(v35 + 12) = *(_DWORD *)v35;
  556. memcpy(v40, v33, v39);
  557. v41 = *(_DWORD *)(*(_DWORD *)v83 + 4 * v81);
  558. v42 = *(_DWORD *)(v41 + 16);
  559. *(_DWORD *)v41 = 0;
  560. *(_DWORD *)(v41 + 4) = 0;
  561. *(_DWORD *)(v41 + 8) = 15;
  562. *(_DWORD *)(v41 + 12) = 0;
  563. v94 = v42;
  564. if ( v42 )
  565. {
  566. v43 = *(_DWORD *)(v42 + 24);
  567. if ( v43 )
  568. {
  569. if ( v43 & 7 )
  570. sub_18E4870((int)"crnlib_free: bad ptr");
  571. else
  572. off_1FF05B0(v43, 0, 0, 1, dword_20B8AC4);
  573. }
  574. if ( v94 & 7 )
  575. {
  576. sprintf_s(
  577. &OutputString,
  578. 0x200u,
  579. "%s(%u): Assertion failed: \"%s\"\n",
  580. ".\\crn_mem.cpp",
  581. 130,
  582. "crnlib_free: bad ptr");
  583. OutputDebugStringA(&OutputString);
  584. printf(&OutputString);
  585. if ( IsDebuggerPresent() )
  586. DebugBreak();
  587. }
  588. else
  589. {
  590. off_1FF05B0(v94, 0, 0, 1, dword_20B8AC4);
  591. }
  592. *(_DWORD *)(v41 + 16) = 0;
  593. }
  594. v44 = *(_DWORD *)(v41 + 20);
  595. v94 = v44;
  596. if ( v44 )
  597. {
  598. v45 = *(_DWORD *)v44;
  599. if ( *(_DWORD *)v44 )
  600. {
  601. if ( v45 & 7 )
  602. sub_18E4870((int)"crnlib_free: bad ptr");
  603. else
  604. off_1FF05B0(v45, 0, 0, 1, dword_20B8AC4);
  605. LOBYTE(v44) = v94;
  606. }
  607. if ( v44 & 7 )
  608. {
  609. sprintf_s(
  610. &Format,
  611. 0x200u,
  612. "%s(%u): Assertion failed: \"%s\"\n",
  613. ".\\crn_mem.cpp",
  614. 130,
  615. "crnlib_free: bad ptr");
  616. OutputDebugStringA(&Format);
  617. printf(&Format);
  618. if ( IsDebuggerPresent() )
  619. DebugBreak();
  620. }
  621. else
  622. {
  623. off_1FF05B0(v94, 0, 0, 1, dword_20B8AC4);
  624. }
  625. *(_DWORD *)(v41 + 20) = 0;
  626. }
  627. *(_DWORD *)(v41 + 20) = v35;
  628. *(_DWORD *)v41 = *(_DWORD *)(v35 + 16);
  629. v46 = v96;
  630. *(_DWORD *)(v41 + 4) = *(_DWORD *)(v35 + 20);
  631. *(_DWORD *)(v41 + 12) = v46;
  632. v83 += 12;
  633. *(_DWORD *)(v41 + 8) = sub_18E11D0(v46);
  634. v18 = v112;
  635. ++v86;
  636. if ( v86 >= v112 )
  637. goto LABEL_87;
  638. }
  639. v56 = *(void **)v35;
  640. v57 = 0;
  641. if ( *(_DWORD *)v35 )
  642. {
  643. if ( (unsigned __int8)v56 & 7 )
  644. {
  645. sprintf_s(&DstBuf, 0x200u, "%s(%u): Assertion failed: \"%s\"\n", ".\\crn_mem.cpp", 130, "crnlib_free: bad ptr");
  646. OutputDebugStringA(&DstBuf);
  647. printf(&DstBuf);
  648. if ( IsDebuggerPresent() )
  649. DebugBreak();
  650. }
  651. else
  652. {
  653. off_1FF05B0(v56, 0, 0, 1, dword_20B8AC4);
  654. }
  655. v57 = 0;
  656. *(_DWORD *)v35 = 0;
  657. *(_DWORD *)(v35 + 4) = 0;
  658. *(_DWORD *)(v35 + 8) = 0;
  659. }
  660. *(_DWORD *)(v35 + 16) = v57;
  661. *(_DWORD *)(v35 + 20) = v57;
  662. *(_DWORD *)(v35 + 24) = v57;
  663. *(_DWORD *)(v35 + 28) = v57;
  664. *(_DWORD *)(v35 + 40) = v57;
  665. *(_DWORD *)(v35 + 44) = v57;
  666. *(_DWORD *)(v35 + 60) = -1;
  667. *(_DWORD *)(v35 + 52) = v57;
  668. *(_DWORD *)(v35 + 56) = v57;
  669. *(_WORD *)(v35 + 48) = 0;
  670. *(_DWORD *)(v35 + 32) = v57;
  671. *(_DWORD *)(v35 + 36) = v57;
  672. *(_DWORD *)(v35 + 12) = v57;
  673. LABEL_143:
  674. if ( v35 != v57 )
  675. {
  676. v63 = *(void **)v35;
  677. if ( *(_DWORD *)v35 )
  678. {
  679. if ( (unsigned __int8)v63 & 7 )
  680. sub_18E4870((int)"crnlib_free: bad ptr");
  681. else
  682. off_1FF05B0(v63, 0, 0, 1, dword_20B8AC4);
  683. }
  684. if ( v35 & 7 )
  685. {
  686. sprintf_s(&v123, 0x200u, "%s(%u): Assertion failed: \"%s\"\n", ".\\crn_mem.cpp", 130, "crnlib_free: bad ptr");
  687. OutputDebugStringA(&v123);
  688. printf(&v123);
  689. if ( IsDebuggerPresent() )
  690. DebugBreak();
  691. }
  692. else
  693. {
  694. off_1FF05B0(v35, 0, 0, 1, dword_20B8AC4);
  695. }
  696. }
  697. sub_8C24B0(v92);
  698. if ( v90 )
  699. {
  700. v88 = v89 + 4;
  701. v95 = v90;
  702. do
  703. {
  704. v64 = v88;
  705. v65 = 0;
  706. v93 = 0;
  707. if ( *(_DWORD *)v88 )
  708. {
  709. do
  710. {
  711. v66 = *(_DWORD *)(*(_DWORD *)(v64 - 4) + 4 * v65);
  712. v85 = v66;
  713. if ( v66 )
  714. {
  715. v67 = *(_DWORD *)(v66 + 16);
  716. v79 = v67;
  717. if ( v67 )
  718. {
  719. v68 = *(_DWORD *)(v67 + 24);
  720. if ( v68 )
  721. {
  722. if ( v68 & 7 )
  723. {
  724. sprintf_s(
  725. &v123,
  726. 0x200u,
  727. "%s(%u): Assertion failed: \"%s\"\n",
  728. ".\\crn_mem.cpp",
  729. 130,
  730. "crnlib_free: bad ptr");
  731. OutputDebugStringA(&v123);
  732. printf(&v123);
  733. if ( IsDebuggerPresent() )
  734. DebugBreak();
  735. }
  736. else
  737. {
  738. off_1FF05B0(v68, 0, 0, 1, dword_20B8AC4);
  739. }
  740. }
  741. if ( v79 & 7 )
  742. {
  743. sprintf_s(
  744. &v127,
  745. 0x200u,
  746. "%s(%u): Assertion failed: \"%s\"\n",
  747. ".\\crn_mem.cpp",
  748. 130,
  749. "crnlib_free: bad ptr");
  750. OutputDebugStringA(&v127);
  751. printf(&v127);
  752. if ( IsDebuggerPresent() )
  753. DebugBreak();
  754. }
  755. else
  756. {
  757. off_1FF05B0(v79, 0, 0, 1, dword_20B8AC4);
  758. }
  759. }
  760. v69 = *(_DWORD *)(v85 + 20);
  761. v80 = v69;
  762. if ( v69 )
  763. {
  764. v70 = *(_DWORD *)v69;
  765. if ( v70 )
  766. {
  767. if ( v70 & 7 )
  768. {
  769. sprintf_s(
  770. &DstBuf,
  771. 0x200u,
  772. "%s(%u): Assertion failed: \"%s\"\n",
  773. ".\\crn_mem.cpp",
  774. 130,
  775. "crnlib_free: bad ptr");
  776. OutputDebugStringA(&DstBuf);
  777. printf(&DstBuf);
  778. if ( IsDebuggerPresent() )
  779. DebugBreak();
  780. }
  781. else
  782. {
  783. off_1FF05B0(v70, 0, 0, 1, dword_20B8AC4);
  784. }
  785. }
  786. if ( v80 & 7 )
  787. {
  788. sprintf_s(
  789. &Format,
  790. 0x200u,
  791. "%s(%u): Assertion failed: \"%s\"\n",
  792. ".\\crn_mem.cpp",
  793. 130,
  794. "crnlib_free: bad ptr");
  795. OutputDebugStringA(&Format);
  796. printf(&Format);
  797. if ( IsDebuggerPresent() )
  798. DebugBreak();
  799. }
  800. else
  801. {
  802. off_1FF05B0(v80, 0, 0, 1, dword_20B8AC4);
  803. }
  804. }
  805. if ( v85 & 7 )
  806. {
  807. sprintf_s(
  808. &OutputString,
  809. 0x200u,
  810. "%s(%u): Assertion failed: \"%s\"\n",
  811. ".\\crn_mem.cpp",
  812. 130,
  813. "crnlib_free: bad ptr");
  814. OutputDebugStringA(&OutputString);
  815. printf(&OutputString);
  816. if ( IsDebuggerPresent() )
  817. DebugBreak();
  818. }
  819. else
  820. {
  821. off_1FF05B0(v85, 0, 0, 1, dword_20B8AC4);
  822. }
  823. }
  824. v64 = v88;
  825. v65 = v93 + 1;
  826. v93 = v65;
  827. }
  828. while ( (unsigned int)v65 < *(_DWORD *)v88 );
  829. }
  830. v71 = v95-- == 1;
  831. v88 = v64 + 12;
  832. }
  833. while ( !v71 );
  834. }
  835. LOBYTE(v128) = 0;
  836. if ( Memory )
  837. {
  838. if ( (unsigned __int8)Memory & 7 )
  839. {
  840. sprintf_s(&v123, 0x200u, "%s(%u): Assertion failed: \"%s\"\n", ".\\crn_mem.cpp", 130, "crnlib_free: bad ptr");
  841. OutputDebugStringA(&v123);
  842. printf(&v123);
  843. if ( IsDebuggerPresent() )
  844. DebugBreak();
  845. }
  846. else
  847. {
  848. off_1FF05B0(Memory, 0, 0, 1, dword_20B8AC4);
  849. }
  850. }
  851. v128 = -1;
  852. if ( v89 )
  853. {
  854. sub_40FBA0(v90, v89);
  855. if ( v89 & 7 )
  856. {
  857. sprintf_s(&v123, 0x200u, "%s(%u): Assertion failed: \"%s\"\n", ".\\crn_mem.cpp", 130, "crnlib_free: bad ptr");
  858. OutputDebugStringA(&v123);
  859. printf(&v123);
  860. if ( IsDebuggerPresent() )
  861. DebugBreak();
  862. }
  863. else
  864. {
  865. off_1FF05B0(v89, 0, 0, 1, dword_20B8AC4);
  866. }
  867. }
  868. return 0;
  869. }
  870. LABEL_88:
  871. sub_8C24B0(v92);
  872. v47 = v90;
  873. if ( v90 )
  874. {
  875. sub_18D9940(a1);
  876. v48 = v89;
  877. v49 = **(_DWORD **)v89;
  878. *(_DWORD *)(a1 + 8) = *(_DWORD *)v49;
  879. *(_DWORD *)(a1 + 12) = *(_DWORD *)(v49 + 4);
  880. *(_DWORD *)(a1 + 16) = *(_DWORD *)(v49 + 8);
  881. *(_DWORD *)(a1 + 20) = *(_DWORD *)(v49 + 12);
  882. v50 = *(_DWORD *)(a1 + 24);
  883. *(_DWORD *)(a1 + 24) = v48;
  884. v51 = v91;
  885. v89 = v50;
  886. v52 = *(_DWORD *)(a1 + 28);
  887. *(_DWORD *)(a1 + 28) = v47;
  888. v47 = v52;
  889. v53 = *(_DWORD *)(a1 + 32);
  890. v90 = v47;
  891. *(_DWORD *)(a1 + 32) = v51;
  892. v91 = v53;
  893. }
  894. v54 = v89;
  895. v96 = 0;
  896. v97 = 0;
  897. sub_18E4040((int)&v96, a2);
  898. LOBYTE(v128) = 2;
  899. sub_18E3F90(a1, (int)&v96);
  900. LOBYTE(v128) = 1;
  901. if ( v97 )
  902. {
  903. v55 = v97 - 8;
  904. if ( *(_DWORD *)(v97 - 4) == ~*(_DWORD *)(v97 - 8) )
  905. {
  906. if ( v97 != 8 )
  907. {
  908. if ( v55 & 7 )
  909. sub_18E4870((int)"crnlib_free: bad ptr");
  910. else
  911. off_1FF05B0(v55, 0, 0, 1, dword_20B8AC4);
  912. }
  913. }
  914. }
  915. *(_DWORD *)(a1 + 36) = 13;
  916. v72 = v101;
  917. v73 = *(_DWORD *)(v101 + 4);
  918. if ( v73 )
  919. {
  920. v74 = v73 - 8;
  921. if ( *(_DWORD *)(v73 - 4) == ~*(_DWORD *)(v73 - 8) && v73 != 8 )
  922. {
  923. if ( v74 & 7 )
  924. sub_18E4870((int)"crnlib_free: bad ptr");
  925. else
  926. off_1FF05B0(v74, 0, 0, 1, dword_20B8AC4);
  927. }
  928. *(_DWORD *)(v72 + 4) = 0;
  929. *(_WORD *)(v72 + 2) = 0;
  930. *(_WORD *)v72 = 0;
  931. }
  932. LOBYTE(v128) = 0;
  933. if ( Memory )
  934. {
  935. if ( (unsigned __int8)Memory & 7 )
  936. sub_18E4870((int)"crnlib_free: bad ptr");
  937. else
  938. off_1FF05B0(Memory, 0, 0, 1, dword_20B8AC4);
  939. }
  940. v128 = -1;
  941. if ( v54 )
  942. {
  943. sub_40FBA0(v47, v54);
  944. if ( v54 & 7 )
  945. {
  946. sub_18E4870((int)"crnlib_free: bad ptr");
  947. return 1;
  948. }
  949. off_1FF05B0(v54, 0, 0, 1, dword_20B8AC4);
  950. }
  951. return 1;
  952. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement