Advertisement
deadman96385

Untitled

Apr 26th, 2017
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.42 KB | None | 0 0
  1. /* This file has been generated by the Hex-Rays decompiler.
  2. Copyright (c) 2007-2014 Hex-Rays <info@hex-rays.com>
  3.  
  4. Detected compiler: GNU C++
  5. */
  6.  
  7. #include <defs.h>
  8.  
  9.  
  10. //-------------------------------------------------------------------------
  11. // Function declarations
  12.  
  13. // int __fastcall _cxa_finalize(_DWORD); weak
  14. // int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr);
  15. // int access(const char *name, int type);
  16. // void free(void *ptr);
  17. // int strcmp(const char *s1, const char *s2);
  18. // int open(const char *file, int oflag, ...);
  19. // int _android_log_print(_DWORD, _DWORD, const char *, ...); weak
  20. // int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
  21. // void *malloc(size_t size);
  22. // void *memset(void *s, int c, size_t n);
  23. // int _sprintf_chk(_DWORD, _DWORD, _DWORD, const char *, ...); weak
  24. // ssize_t write(int fd, const void *buf, size_t n);
  25. // int close(int fd);
  26. // int __fastcall _errno(_DWORD); weak
  27. // int __fastcall _stack_chk_fail(_DWORD); weak
  28. // int pthread_mutex_lock(pthread_mutex_t *mutex);
  29. // int pthread_mutex_unlock(pthread_mutex_t *mutex);
  30. // int ioctl(int fd, unsigned __int32 request, ...);
  31. // int nanosleep(const struct timespec *requested_time, struct timespec *remaining);
  32. // void perror(const char *s);
  33. // void abort(void);
  34. // int fprintf(FILE *stream, const char *format, ...);
  35. // int __fastcall _aeabi_memcpy(_DWORD); weak
  36. // int __fastcall _aeabi_memset(_DWORD, _DWORD, _DWORD); weak
  37. // int dladdr(void); weak
  38. // int __fastcall _snprintf_chk(_DWORD, _DWORD, _DWORD, _DWORD); weak
  39. // int __fastcall _gnu_Unwind_Find_exidx(_DWORD, _DWORD); weak
  40. int sub_D54();
  41. int (*__fastcall sub_D74(int (*result)(void)))(void);
  42. unsigned int init_globals();
  43. int __fastcall sub_E64(void *a1);
  44. signed int __fastcall sub_E70(int a1, const char *a2, int a3);
  45. int __fastcall sub_FB4(const char *a1);
  46. int __fastcall sub_1038(int a1, int a2);
  47. int __fastcall sub_107C(int a1, int a2);
  48. int sub_10B4();
  49. int __fastcall sub_10E8(int a1, int a2);
  50. int __fastcall sub_113C(int a1, int a2);
  51. int __fastcall sub_11A8(int a1);
  52. int __fastcall sub_12DC(int a1, int a2);
  53. int __fastcall sub_133C(int a1, int a2);
  54. int __fastcall led_wait_delay(int a1, int a2, __time_t a3, __int32 a4);
  55. signed int __fastcall sub_13E8(int a1, int a2, unsigned int a3, unsigned int a4);
  56. signed int __fastcall sub_1728(int a1, unsigned int a2, unsigned int a3, int a4, int *a5);
  57. signed int __fastcall sub_17CC(int a1, unsigned int a2, unsigned int a3, int a4);
  58. signed int __fastcall sub_18F4(int a1, int a2, int a3);
  59. void sub_1948();
  60. void sub_1950();
  61. signed int __fastcall sub_19EC(int a1, int a2, char a3);
  62. void __fastcall sub_1B08(int a1, int a2, int a3);
  63. int __fastcall sub_1B8C(int a1, int a2, int a3, int a4, int a5);
  64. int __fastcall sub_1BA4(int _R0);
  65. int __fastcall sub_1BAC(int _R0);
  66. int __fastcall sub_1BB4(int _R0);
  67. void sub_1BBC();
  68. void sub_1C00();
  69. int __fastcall sub_1C14(int a1);
  70. signed int __fastcall sub_1C64(int a1, int a2, int a3);
  71. signed int __fastcall sub_1C94(int a1, int a2, int a3);
  72. signed int __fastcall sub_1CD8(int a1, int a2, int a3);
  73. signed int __fastcall sub_1D08(int a1, int a2, int a3, int a4);
  74. int __fastcall sub_1D40(int a1);
  75. signed int __fastcall sub_1D48(int a1, int a2);
  76. signed int __fastcall sub_1D68(int a1);
  77. int __fastcall sub_1D80(int a1);
  78. int __fastcall sub_1D90(int a1, int a2);
  79. int __fastcall sub_1DB0(int a1, signed int a2);
  80. int __fastcall sub_1E4C(int result, signed int a2, int a3);
  81. int __fastcall sub_1EE4(int a1, int a2);
  82. __int64 __fastcall sub_1F04(int a1, int a2);
  83. int __fastcall sub_1FB4(int a1, int a2, int a3, int a4);
  84. signed int __fastcall sub_2088(int a1);
  85. int __fastcall sub_20D4(int a1, int a2);
  86. void __fastcall sub_210C(int a1);
  87. int __fastcall sub_2124(int a1);
  88. signed int __fastcall sub_212C(int a1, int a2, int a3, int a4);
  89. int __fastcall sub_2188(int a1, int a2);
  90. int __fastcall sub_21D8(int a1, signed int a2);
  91. int __fastcall sub_21E0(int result);
  92. void __fastcall sub_21E8(int a1, int a2, int a3, int a4);
  93. int __fastcall sub_221C(int a1);
  94. int sub_2270(); // weak
  95. int __fastcall sub_23F8(int result, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
  96. int sub_2ACC(); // weak
  97. int __fastcall sub_2AE0(int _R0);
  98. int __fastcall sub_2AE8(int _R0);
  99. int __fastcall sub_2AF0(int _R0);
  100. int __fastcall sub_2AF8(int a1);
  101. int __fastcall sub_2B3C(int a1);
  102. void sub_2B50();
  103. void sub_2B54();
  104. int __fastcall sub_2B60(int a1);
  105. int __fastcall sub_2B64(int a1);
  106.  
  107. //-------------------------------------------------------------------------
  108. // Data declarations
  109.  
  110. _UNKNOWN loc_18FC; // weak
  111. void *off_4E14 = (void *)0x1D89; // weak
  112. int GLOBAL_OFFSET_TABLE_ = 0; // weak
  113. void *off_5000 = &off_5000; // weak
  114. int dword_5008 = 255; // weak
  115. _UNKNOWN unk_508C; // weak
  116. int dword_5090; // weak
  117. _UNKNOWN unk_5094; // weak
  118. _UNKNOWN unk_5098; // weak
  119. _UNKNOWN unk_509C; // weak
  120. _UNKNOWN unk_50A0; // weak
  121. int dword_50A4; // weak
  122. _UNKNOWN unk_50A8; // weak
  123. int dword_50AC; // weak
  124. int dword_50B0; // weak
  125. _UNKNOWN unk_50B4; // weak
  126. _UNKNOWN unk_50B8; // weak
  127. _UNKNOWN unk_50BC; // weak
  128. _UNKNOWN unk_50C0; // weak
  129. _UNKNOWN unk_50C4; // weak
  130. int dword_50C8; // weak
  131. _UNKNOWN unk_50CC; // weak
  132. // extern _UNKNOWN _stack_chk_guard; weak
  133. // extern struct _IO_FILE *stderr;
  134.  
  135.  
  136. //----- (00000D54) --------------------------------------------------------
  137. int sub_D54()
  138. {
  139. return _cxa_finalize(&off_5000);
  140. }
  141. // BF8: using guessed type int __fastcall _cxa_finalize(_DWORD);
  142. // 5000: using guessed type void *off_5000;
  143.  
  144. //----- (00000D74) --------------------------------------------------------
  145. int (*__fastcall sub_D74(int (*result)(void)))(void)
  146. {
  147. if ( result )
  148. result = (int (*)(void))result();
  149. return result;
  150. }
  151.  
  152. //----- (00000E34) --------------------------------------------------------
  153. unsigned int init_globals()
  154. {
  155. unsigned int result; // r0@1
  156.  
  157. pthread_mutex_init((pthread_mutex_t *)&unk_50A8, 0);
  158. result = __clz(access("/sys/class/leds/jogball-backlight/brightness", 2));
  159. dword_50A4 = result >> 5;
  160. return result;
  161. }
  162. // 50A4: using guessed type int dword_50A4;
  163.  
  164. //----- (00000E64) --------------------------------------------------------
  165. int __fastcall sub_E64(void *a1)
  166. {
  167. if ( a1 )
  168. free(a1);
  169. return 0;
  170. }
  171.  
  172. //----- (00000E70) --------------------------------------------------------
  173. signed int __fastcall sub_E70(int a1, const char *a2, int a3)
  174. {
  175. int v3; // r7@1
  176. const char *v4; // r4@1
  177. int v5; // r6@1
  178. int (__fastcall *v6)(int, int); // r4@7
  179. void *v7; // r5@15
  180. signed int result; // r0@15
  181.  
  182. v3 = a1;
  183. v4 = a2;
  184. v5 = a3;
  185. if ( !strcmp("backlight", a2) )
  186. {
  187. v6 = sub_113C;
  188. goto LABEL_15;
  189. }
  190. if ( !strcmp("keyboard", v4) )
  191. {
  192. v6 = sub_107C;
  193. goto LABEL_15;
  194. }
  195. if ( !strcmp("buttons", v4) )
  196. {
  197. v6 = sub_1038;
  198. goto LABEL_15;
  199. }
  200. if ( !strcmp("battery", v4) )
  201. {
  202. v6 = sub_133C;
  203. goto LABEL_15;
  204. }
  205. if ( !strcmp("notifications", v4) )
  206. {
  207. dword_50AC = open("/dev/aw2013", 0);
  208. if ( dword_50AC < 0 )
  209. {
  210. v6 = sub_12DC;
  211. _android_log_print(3, "lights", " /dev/aw2013 open fail!");
  212. }
  213. else
  214. {
  215. v6 = sub_12DC;
  216. _android_log_print(3, "lights", " fd_led = %d \n");
  217. }
  218. goto LABEL_15;
  219. }
  220. if ( !strcmp("attention", v4) )
  221. {
  222. v6 = sub_10E8;
  223. LABEL_15:
  224. pthread_once((pthread_once_t *)&unk_508C, (void (*)(void))init_globals);
  225. v7 = malloc(0x44u);
  226. memset(v7, 0, 0x44u);
  227. *((_DWORD *)v7 + 15) = sub_E64;
  228. result = 0;
  229. *(_DWORD *)v7 = 1213678676;
  230. *((_DWORD *)v7 + 2) = v3;
  231. *((_DWORD *)v7 + 16) = v6;
  232. *(_DWORD *)v5 = v7;
  233. return result;
  234. }
  235. return -22;
  236. }
  237. // C58: using guessed type int _android_log_print(_DWORD, _DWORD, const char *, ...);
  238. // 50AC: using guessed type int dword_50AC;
  239.  
  240. //----- (00000FB4) --------------------------------------------------------
  241. int __fastcall sub_FB4(const char *a1)
  242. {
  243. int v1; // r4@1
  244. int v2; // r0@1
  245. size_t v3; // r0@2
  246. ssize_t v4; // r5@2
  247. int result; // r0@3
  248. char v6; // [sp+8h] [bp-30h]@2
  249. int v7; // [sp+1Ch] [bp-1Ch]@1
  250.  
  251. v7 = _stack_chk_guard;
  252. v1 = open(a1, 2);
  253. v2 = _android_log_print(3, "lights", "write_int open fd=%d\n", v1);
  254. if ( v1 < 0 || (v3 = _sprintf_chk(&v6, 0, 20, "%d\n"), v4 = write(v1, &v6, v3), v2 = close(v1), v4 == -1) )
  255. result = -*(_DWORD *)_errno(v2);
  256. else
  257. result = 0;
  258. if ( v7 != _stack_chk_guard )
  259. _stack_chk_fail(result);
  260. return result;
  261. }
  262. // C58: using guessed type int _android_log_print(_DWORD, _DWORD, const char *, ...);
  263. // C88: using guessed type int _sprintf_chk(_DWORD, _DWORD, _DWORD, const char *, ...);
  264. // CAC: using guessed type int __fastcall _errno(_DWORD);
  265. // CB8: using guessed type int __fastcall _stack_chk_fail(_DWORD);
  266.  
  267. //----- (00001038) --------------------------------------------------------
  268. int __fastcall sub_1038(int a1, int a2)
  269. {
  270. int v2; // r4@1
  271. int v3; // r4@1
  272.  
  273. v2 = *(_DWORD *)a2 & 0xFFFFFF;
  274. pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
  275. dword_50C8 = v2;
  276. v3 = sub_FB4("/sys/class/leds/button-backlight/brightness");
  277. pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
  278. return v3;
  279. }
  280. // 50C8: using guessed type int dword_50C8;
  281.  
  282. //----- (0000107C) --------------------------------------------------------
  283. int __fastcall sub_107C(int a1, int a2)
  284. {
  285. int v2; // r4@1
  286. int v3; // r4@1
  287.  
  288. v2 = *(_DWORD *)a2 & 0xFFFFFF;
  289. pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
  290. v3 = sub_FB4("/sys/class/leds/keyboard-backlight/brightness");
  291. pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
  292. return v3;
  293. }
  294.  
  295. //----- (000010B4) --------------------------------------------------------
  296. int sub_10B4()
  297. {
  298. int result; // r0@3
  299.  
  300. if ( dword_50B0 != 7 && dword_50B0 == -1 )
  301. result = 0;
  302. else
  303. result = sub_FB4("/sys/class/leds/jogball-backlight/brightness");
  304. return result;
  305. }
  306. // 50B0: using guessed type int dword_50B0;
  307.  
  308. //----- (000010E8) --------------------------------------------------------
  309. int __fastcall sub_10E8(int a1, int a2)
  310. {
  311. int v2; // r4@1
  312. int v3; // r3@1
  313.  
  314. v2 = a2;
  315. pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
  316. v3 = *(_DWORD *)(v2 + 4);
  317. if ( v3 == 2 )
  318. {
  319. dword_50B0 = *(_DWORD *)(v2 + 8);
  320. }
  321. else if ( !v3 )
  322. {
  323. dword_50B0 = 0;
  324. }
  325. if ( dword_50A4 )
  326. sub_10B4();
  327. pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
  328. return 0;
  329. }
  330. // 50A4: using guessed type int dword_50A4;
  331. // 50B0: using guessed type int dword_50B0;
  332.  
  333. //----- (0000113C) --------------------------------------------------------
  334. int __fastcall sub_113C(int a1, int a2)
  335. {
  336. int v2; // r4@1
  337. int v3; // r4@1
  338.  
  339. v2 = (150 * (unsigned __int16)(*(_WORD *)a2 >> 8) + 77 * ((*(_DWORD *)a2 & 0xFFFFFF) >> 16) + 29 * *(_DWORD *)a2) >> 8;
  340. pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
  341. dword_5008 = v2;
  342. v3 = sub_FB4("/sys/class/leds/lcd-backlight/brightness");
  343. if ( dword_50A4 )
  344. sub_10B4();
  345. pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
  346. return v3;
  347. }
  348. // 5008: using guessed type int dword_5008;
  349. // 50A4: using guessed type int dword_50A4;
  350.  
  351. //----- (000011A8) --------------------------------------------------------
  352. int __fastcall sub_11A8(int a1)
  353. {
  354. int v1; // r6@0
  355. int v2; // r8@0
  356. int v3; // r10@0
  357. int v4; // r4@1
  358. int v5; // r3@1
  359. unsigned int v6; // r5@1
  360. int v7; // r0@7
  361. bool v8; // zf@7
  362. int v9; // r4@7
  363. int v10; // r1@17
  364. const char *v11; // r2@17
  365. int v13; // [sp+1Ch] [bp-4Ch]@11
  366. int v14; // [sp+20h] [bp-48h]@16
  367. int v15; // [sp+24h] [bp-44h]@16
  368. int v16; // [sp+28h] [bp-40h]@16
  369. unsigned int v17; // [sp+2Ch] [bp-3Ch]@16
  370. int v18; // [sp+30h] [bp-38h]@16
  371. int v19; // [sp+34h] [bp-34h]@16
  372. int v20; // [sp+38h] [bp-30h]@16
  373. int v21; // [sp+3Ch] [bp-2Ch]@16
  374.  
  375. v4 = a1;
  376. _android_log_print(3, "lights", "state->flashMode =%d\n", *(_DWORD *)(a1 + 4));
  377. v5 = *(_DWORD *)(v4 + 4);
  378. v6 = *(_DWORD *)v4;
  379. if ( v5 == 1 )
  380. v2 = *(_DWORD *)(v4 + 8);
  381. else
  382. v1 = 0;
  383. if ( v5 == 1 )
  384. v1 = *(_DWORD *)(v4 + 12);
  385. else
  386. v2 = v1;
  387. v7 = _android_log_print(3, "lights", "set_led_state colorRGB=%08X, onMS=%d, offMS=%d\n", *(_DWORD *)v4, v2, v1);
  388. v9 = v6 >> 24;
  389. v8 = v6 >> 24 == 0;
  390. if ( v6 >> 24 )
  391. v7 = (unsigned __int16)v6 >> 8;
  392. else
  393. v6 = 0;
  394. if ( v8 )
  395. {
  396. v3 = v9;
  397. v13 = v9;
  398. }
  399. else
  400. {
  401. v13 = v7;
  402. }
  403. if ( !v8 )
  404. {
  405. v3 = (v6 >> 16) & 0xFF;
  406. v6 = (unsigned __int8)v6;
  407. }
  408. _android_log_print(
  409. 3,
  410. "lights",
  411. " alpha = %d red =%d green = %d blue =%d onMS = %d offMS = %d fd_led = %d \n",
  412. v9,
  413. v3,
  414. v13,
  415. v6,
  416. v2,
  417. v1,
  418. dword_50AC);
  419. if ( v9 )
  420. {
  421. v19 = v1;
  422. v14 = v9;
  423. v15 = v3;
  424. v16 = v13;
  425. v17 = v6;
  426. v18 = v2;
  427. v20 = 2000;
  428. v21 = 2000;
  429. if ( ioctl(dword_50AC, 0x40208803u, &v14) )
  430. {
  431. v10 = (int)"lights";
  432. v11 = " led ioctl AW2013_IOCTL_SETRGB_BRIGHNESS fail! alpha = %d \n";
  433. LABEL_21:
  434. _android_log_print(3, v10, v11, v9);
  435. return 0;
  436. }
  437. _android_log_print(3, "lights", " ioctl success! ");
  438. }
  439. else
  440. {
  441. memset(&v14, 0, 0x20u);
  442. if ( ioctl(dword_50AC, 0x40208803u, &v14) )
  443. {
  444. v10 = (int)"lights";
  445. v11 = " led ioctl AW2013_IOCTL_SETRGB_BRIGHNESS fail! alpha = %d \n ";
  446. goto LABEL_21;
  447. }
  448. }
  449. return 0;
  450. }
  451. // C58: using guessed type int _android_log_print(_DWORD, _DWORD, const char *, ...);
  452. // 50AC: using guessed type int dword_50AC;
  453.  
  454. //----- (000012DC) --------------------------------------------------------
  455. int __fastcall sub_12DC(int a1, int a2)
  456. {
  457. int v2; // r4@1
  458. int v3; // r1@1
  459. int v4; // r2@1
  460. int v5; // r3@1
  461. int v6; // r0@3
  462.  
  463. v2 = a2;
  464. pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
  465. v3 = *(_DWORD *)(v2 + 4);
  466. v4 = *(_DWORD *)(v2 + 8);
  467. v5 = *(_DWORD *)(v2 + 12);
  468. unk_50B4 = *(_DWORD *)v2;
  469. unk_50B8 = v3;
  470. unk_50BC = v4;
  471. unk_50C0 = v5;
  472. unk_50C4 = *(_DWORD *)(v2 + 16);
  473. if ( dword_50A4 )
  474. sub_10B4();
  475. v6 = (int)&dword_5090;
  476. if ( !(dword_5090 & 0xFFFFFF) )
  477. {
  478. sub_11A8((int)&dword_5090);
  479. v6 = (int)&unk_50B4;
  480. }
  481. sub_11A8(v6);
  482. pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
  483. return 0;
  484. }
  485. // 5090: using guessed type int dword_5090;
  486. // 50A4: using guessed type int dword_50A4;
  487.  
  488. //----- (0000133C) --------------------------------------------------------
  489. int __fastcall sub_133C(int a1, int a2)
  490. {
  491. int v2; // r6@1
  492. int v3; // r5@1
  493. int v4; // r1@1
  494. int v5; // r2@1
  495. int v6; // r3@1
  496. int v7; // r0@3
  497.  
  498. v2 = a2;
  499. v3 = a2;
  500. pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
  501. v4 = *(_DWORD *)(v3 + 4);
  502. v5 = *(_DWORD *)(v3 + 8);
  503. v6 = *(_DWORD *)(v3 + 12);
  504. dword_5090 = *(_DWORD *)v3;
  505. unk_5094 = v4;
  506. unk_5098 = v5;
  507. unk_509C = v6;
  508. unk_50A0 = *(_DWORD *)(v3 + 16);
  509. if ( dword_50A4 )
  510. sub_11A8(v2);
  511. v7 = (int)&dword_5090;
  512. if ( !(dword_5090 & 0xFFFFFF) )
  513. {
  514. sub_11A8((int)&dword_5090);
  515. v7 = (int)&unk_50B4;
  516. }
  517. sub_11A8(v7);
  518. pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
  519. return 0;
  520. }
  521. // 5090: using guessed type int dword_5090;
  522. // 50A4: using guessed type int dword_50A4;
  523.  
  524. //----- (000013A0) --------------------------------------------------------
  525. int __fastcall led_wait_delay(int a1, int a2, __time_t a3, __int32 a4)
  526. {
  527. int result; // r0@2
  528. int v5; // r6@3
  529. int v6; // [sp+0h] [bp-20h]@1
  530. int v7; // [sp+4h] [bp-1Ch]@1
  531. struct timespec remaining; // [sp+8h] [bp-18h]@1
  532.  
  533. remaining.tv_sec = a3;
  534. remaining.tv_nsec = a4;
  535. v6 = 0;
  536. v7 = 1000000 * a1;
  537. while ( 1 )
  538. {
  539. result = nanosleep((const struct timespec *)&v6, &remaining);
  540. if ( !result )
  541. break;
  542. v5 = _errno(result);
  543. if ( *(_DWORD *)v5 != 4 )
  544. {
  545. perror("nanosleep");
  546. return *(_DWORD *)v5;
  547. }
  548. *(_QWORD *)&v6 = remaining;
  549. }
  550. return result;
  551. }
  552. // CAC: using guessed type int __fastcall _errno(_DWORD);
  553.  
  554. //----- (000013E8) --------------------------------------------------------
  555. signed int __fastcall sub_13E8(int a1, int a2, unsigned int a3, unsigned int a4)
  556. {
  557. unsigned int v4; // r5@1
  558. unsigned int v5; // r7@1
  559. int v6; // r10@1
  560. int v7; // r4@1
  561. int v8; // r11@2
  562. int v9; // r8@7
  563. int v10; // r9@7
  564. int v11; // r0@8
  565. int v12; // r2@9
  566. int v13; // r1@10
  567. signed int result; // r0@10
  568. int v15; // r2@13
  569. int v16; // r3@19
  570. int v17; // r2@19
  571. int v18; // r0@19
  572. unsigned int v19; // r1@19
  573. int v20; // r2@38
  574. int v21; // r0@40
  575. unsigned int v22; // r1@40
  576. int v23; // r3@40
  577. unsigned int v24; // r1@41
  578. unsigned int v25; // r0@41
  579. int v26; // r1@43
  580. int v27; // r6@46
  581. char v28; // r1@46
  582. int v30; // r0@51
  583. unsigned int v36; // r0@52
  584. int v37; // [sp+4h] [bp-34h]@59
  585. int v38; // [sp+8h] [bp-30h]@6
  586. int v39; // [sp+Ch] [bp-2Ch]@22
  587. int v40; // [sp+10h] [bp-28h]@8
  588.  
  589. v4 = a4;
  590. v5 = a3;
  591. v6 = a2;
  592. v7 = a1;
  593. if ( a3 >= a4 )
  594. goto LABEL_59;
  595. v8 = 0;
  596. do
  597. {
  598. v9 = v5 + 1;
  599. v10 = *(_BYTE *)(v6 + (v5 ^ 3));
  600. if ( !(v10 & 0x80) )
  601. {
  602. sub_1C64(v7, 13, (int)&v40);
  603. v11 = 4 * v10;
  604. if ( v10 & 0x40 )
  605. v12 = -4 - (unsigned __int8)(v11 & 0xFC) + v40;
  606. else
  607. v12 = v11 + v40 + 4;
  608. v40 = v12;
  609. LABEL_23:
  610. sub_1C94(v7, 13, v12);
  611. ++v5;
  612. continue;
  613. }
  614. v13 = v10 & 0xF0;
  615. result = 9;
  616. if ( (v10 & 0xF0) > 159 )
  617. {
  618. if ( v13 > 191 )
  619. {
  620. if ( v13 == 192 )
  621. {
  622. if ( (unsigned int)(v10 - 192) <= 9 )
  623. {
  624. switch ( v10 )
  625. {
  626. case 7:
  627. if ( !*(_BYTE *)(v6 + (v9 ^ 3)) || (unsigned int)*(_BYTE *)(v6 + (v9 ^ 3)) >= 0x10 )
  628. return 9;
  629. goto LABEL_56;
  630. case 0:
  631. case 1:
  632. case 2:
  633. case 3:
  634. case 4:
  635. case 5:
  636. v19 = 3;
  637. v17 = ((v10 & 7) + 1) | 0xA0000;
  638. v18 = v7;
  639. goto LABEL_34;
  640. case 8:
  641. case 9:
  642. v24 = *(_BYTE *)(v6 + (v9 ^ 3));
  643. v25 = v24 >> 4;
  644. if ( v10 == 200 )
  645. v25 = (v24 >> 4) | 0x10;
  646. v26 = v24 & 0xF;
  647. if ( (signed int)(v25 + v26) > 31 )
  648. return 9;
  649. v20 = (v26 + 1) | (v25 << 16);
  650. v21 = v7;
  651. v22 = 1;
  652. goto LABEL_54;
  653. case 6:
  654. v36 = *(_BYTE *)(v6 + (v9 ^ 3));
  655. if ( (signed int)((v36 & 0xF) + (v36 >> 4)) > 15 )
  656. return 9;
  657. v20 = ((v36 & 0xF) + 1) | (v36 >> 4 << 16);
  658. v21 = v7;
  659. v22 = 3;
  660. LABEL_54:
  661. v23 = 5;
  662. LABEL_55:
  663. sub_17CC(v21, v22, v20, v23);
  664. goto LABEL_56;
  665. default:
  666. return 9;
  667. }
  668. }
  669. return 9;
  670. }
  671. if ( v13 != 208 )
  672. return result;
  673. if ( v10 & 8 )
  674. return 9;
  675. v19 = 1;
  676. v17 = ((v10 & 7) + 1) | 0x80000;
  677. v18 = v7;
  678. LABEL_34:
  679. v16 = 5;
  680. goto LABEL_35;
  681. }
  682. if ( v13 == 160 )
  683. {
  684. v16 = 0;
  685. v17 = ((16 << ((v10 & 7) + 1)) - 16) | (v10 << 11) & 0x4000;
  686. v18 = v7;
  687. v19 = 0;
  688. LABEL_35:
  689. sub_17CC(v18, v19, v17, v16);
  690. ++v5;
  691. continue;
  692. }
  693. if ( v13 != 176 )
  694. return result;
  695. if ( (unsigned int)(v10 - 176) > 7 )
  696. {
  697. def_1582:
  698. v19 = 1;
  699. v16 = 1;
  700. v17 = ((v10 & 7) + 1) | 0x80000;
  701. v18 = v7;
  702. goto LABEL_35;
  703. }
  704. result = 9;
  705. switch ( v10 )
  706. {
  707. case 1:
  708. if ( v9 >= v4 )
  709. return 9;
  710. v20 = *(_BYTE *)(v6 + (v9 ^ 3));
  711. result = 9;
  712. if ( !*(_BYTE *)(v6 + (v9 ^ 3)) || v20 & 0xF0 )
  713. return result;
  714. v21 = v7;
  715. v22 = 0;
  716. v23 = 0;
  717. goto LABEL_55;
  718. case 2:
  719. if ( v9 >= v4 )
  720. return 9;
  721. v5 += 2;
  722. v27 = 0;
  723. v28 = 0;
  724. break;
  725. case 3:
  726. v23 = 1;
  727. v30 = *(_BYTE *)(v6 + (v9 ^ 3));
  728. _R1 = v30 << 12;
  729. __asm { UXTB16.W R1, R1 }
  730. v20 = ((v30 & 0xF) + 1) | _R1;
  731. v21 = v7;
  732. v22 = 1;
  733. goto LABEL_55;
  734. case 0:
  735. goto LABEL_58;
  736. case 4:
  737. case 5:
  738. case 6:
  739. case 7:
  740. return result;
  741. default:
  742. goto def_1582;
  743. }
  744. while ( 1 )
  745. {
  746. v27 |= (*(_BYTE *)(v6 + ((v5 - 1) ^ 3)) & 0x7F) << v28;
  747. if ( !(*(_BYTE *)(v6 + ((v5 - 1) ^ 3)) & 0x80) )
  748. break;
  749. v28 += 7;
  750. _CF = v5 >= v4;
  751. result = 9;
  752. ++v5;
  753. if ( _CF )
  754. return result;
  755. }
  756. sub_1C64(v7, 13, (int)&v38);
  757. v38 += 4 * v27 + 516;
  758. sub_1C94(v7, 13, v38);
  759. }
  760. else
  761. {
  762. if ( v13 != 128 )
  763. {
  764. if ( v13 != 144 )
  765. return result;
  766. if ( (v10 & 0xF | 2) == 15 )
  767. return 9;
  768. sub_1C64(v7, v10 & 0xF, (int)&v39);
  769. v12 = v39;
  770. goto LABEL_23;
  771. }
  772. if ( v9 >= v4 )
  773. return 9;
  774. v15 = (unsigned __int16)((_WORD)v10 << 12) | 16 * *(_BYTE *)(v6 + (v9 ^ 3));
  775. if ( !v15 )
  776. return 9;
  777. sub_17CC(v7, 0, v15, 0);
  778. v8 |= (((_WORD)v10 << 12) & 0x8000u) >> 15;
  779. LABEL_56:
  780. v5 += 2;
  781. }
  782. }
  783. while ( v5 < v4 );
  784. LABEL_58:
  785. if ( v8 & 1 )
  786. return 8;
  787. LABEL_59:
  788. sub_1C64(v7, 14, (int)&v37);
  789. sub_1C94(v7, 15, v37);
  790. return 8;
  791. }
  792.  
  793. //----- (00001728) --------------------------------------------------------
  794. signed int __fastcall sub_1728(int a1, unsigned int a2, unsigned int a3, int a4, int *a5)
  795. {
  796. int v5; // r5@1
  797. int v6; // r4@1
  798. signed int result; // r0@3
  799. int v8; // r2@5
  800. int v9; // r0@5
  801. int v10; // r1@5
  802. __int64 v11; // r2@11
  803. int v12; // r1@11
  804.  
  805. v5 = a3;
  806. v6 = a1;
  807. if ( a2 > 4 )
  808. def_1734:
  809. sub_1B08(
  810. (int)"_Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, uint32_t, _Unwind_VRS_DataRepresentation, void *)",
  811. 831,
  812. (int)"unsupported register class");
  813. switch ( a2 )
  814. {
  815. case 0u:
  816. result = 2;
  817. if ( a3 > 0xF || a4 )
  818. return result;
  819. v8 = *a5;
  820. v9 = v6;
  821. v10 = v5;
  822. goto LABEL_15;
  823. case 1u:
  824. if ( a4 == 5 )
  825. {
  826. if ( a3 <= 0x1F )
  827. goto LABEL_22;
  828. return 2;
  829. }
  830. if ( a4 != 1 || a3 > 0xF )
  831. return 2;
  832. sub_1D80(a1);
  833. LABEL_22:
  834. v11 = *(_QWORD *)a5;
  835. v12 = v5 + 256;
  836. LABEL_23:
  837. result = sub_1D08(v6, v12, v11, SHIDWORD(v11));
  838. LABEL_24:
  839. if ( result )
  840. result = 2;
  841. return result;
  842. case 3u:
  843. result = 2;
  844. if ( a3 > 0x1F || a4 != 5 )
  845. return result;
  846. v11 = *(_QWORD *)a5;
  847. v12 = v5 + 112;
  848. goto LABEL_23;
  849. case 4u:
  850. result = 2;
  851. if ( a3 > 3 || a4 )
  852. return result;
  853. v8 = *a5;
  854. v10 = v5 + 192;
  855. v9 = v6;
  856. LABEL_15:
  857. result = sub_1C94(v9, v10, v8);
  858. goto LABEL_24;
  859. default:
  860. goto def_1734;
  861. }
  862. }
  863.  
  864. //----- (000017CC) --------------------------------------------------------
  865. signed int __fastcall sub_17CC(int a1, unsigned int a2, unsigned int a3, int a4)
  866. {
  867. unsigned int v4; // r5@1
  868. int v5; // r7@1
  869. unsigned int v6; // r6@1
  870. int v7; // r8@1
  871. int v8; // r4@5
  872. unsigned int v9; // r7@5
  873. int v10; // r0@7
  874. signed int v11; // r0@7
  875. signed int v12; // r1@7
  876. signed int v13; // r2@7
  877. signed int result; // r0@15
  878. unsigned int v15; // r4@19
  879. int v16; // r6@19
  880. int v17; // r0@20
  881. int v18; // r2@20
  882. int v19; // r2@23
  883. int v20; // [sp+8h] [bp-38h]@20
  884. int v21; // [sp+Ch] [bp-34h]@20
  885. int v22; // [sp+14h] [bp-2Ch]@17
  886. int v23; // [sp+18h] [bp-28h]@7
  887. int v24; // [sp+1Ch] [bp-24h]@4
  888.  
  889. v4 = a2;
  890. v5 = a4;
  891. v6 = a3;
  892. v7 = a1;
  893. if ( a2 > 4 )
  894. def_17E0:
  895. sub_1B08(
  896. (int)"_Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, uint32_t, _Unwind_VRS_DataRepresentation)",
  897. 965,
  898. (int)"unsupported register class");
  899. switch ( a2 )
  900. {
  901. case 0u:
  902. case 4u:
  903. if ( a4 || sub_1C64(a1, 13, (int)&v24) )
  904. return 2;
  905. v8 = 0;
  906. v9 = 0;
  907. do
  908. {
  909. if ( (1 << v9) & v6 )
  910. {
  911. v10 = v24;
  912. v24 += 4;
  913. v23 = *(_DWORD *)v10;
  914. v11 = sub_1728(v7, v4, v9, 0, &v23);
  915. v12 = 0;
  916. v13 = 0;
  917. if ( v9 == 13 )
  918. v12 = 1;
  919. if ( !v4 )
  920. v13 = 1;
  921. if ( v11 )
  922. return 2;
  923. v8 |= v13 & v12;
  924. }
  925. ++v9;
  926. }
  927. while ( v9 < 0x10 );
  928. if ( v8 & 1 )
  929. return 0;
  930. v19 = v24;
  931. goto LABEL_29;
  932. case 1u:
  933. case 3u:
  934. if ( (a4 | 4) != 5 || sub_1C64(a1, 13, (int)&v22) )
  935. return 2;
  936. if ( !(_WORD)v6 )
  937. goto LABEL_22;
  938. v15 = v6 >> 16;
  939. v16 = (v6 >> 16) + v6;
  940. break;
  941. default:
  942. goto def_17E0;
  943. }
  944. do
  945. {
  946. v17 = v22;
  947. v22 += 4;
  948. v18 = *(_DWORD *)v17;
  949. v22 = v17 + 8;
  950. v21 = *(_DWORD *)(v17 + 4);
  951. v20 = v18;
  952. if ( sub_1728(v7, v4, v15, v5, &v20) )
  953. return 2;
  954. ++v15;
  955. }
  956. while ( v15 < v16 );
  957. LABEL_22:
  958. if ( v5 == 1 )
  959. {
  960. v19 = v22 + 4;
  961. v22 += 4;
  962. }
  963. else
  964. {
  965. v19 = v22;
  966. }
  967. LABEL_29:
  968. result = sub_1C94(v7, 13, v19);
  969. if ( result )
  970. result = 2;
  971. return result;
  972. }
  973.  
  974. //----- (000018F4) --------------------------------------------------------
  975. signed int __fastcall sub_18F4(int a1, int a2, int a3)
  976. {
  977. int v3; // r0@1
  978. int v4; // r1@1
  979. int v5; // r12@1
  980. int v6; // r3@1
  981. bool v7; // zf@2
  982. unsigned int v8; // r3@6
  983. unsigned int v9; // r2@6
  984.  
  985. v3 = a2;
  986. v4 = a3;
  987. v5 = *(_DWORD *)(v3 + 76);
  988. v6 = (*(_DWORD *)v5 >> 24) & 0xF;
  989. if ( v6 )
  990. {
  991. v7 = v6 == 1;
  992. if ( v6 != 1 )
  993. v7 = v6 == 3;
  994. if ( !v7 )
  995. return 9;
  996. v8 = 4 * ((*(_DWORD *)v5 >> 16) & 0xFF) + 4;
  997. v9 = 2;
  998. }
  999. else
  1000. {
  1001. v9 = 1;
  1002. v8 = 4;
  1003. }
  1004. if ( !v5 || !(*(_BYTE *)(v3 + 80) & 1) && *(_DWORD *)(v5 + v8) )
  1005. return 9;
  1006. return sub_13E8(v4, v5, v9, v8);
  1007. }
  1008.  
  1009. //----- (00001948) --------------------------------------------------------
  1010. void sub_1948()
  1011. {
  1012. JUMPOUT(&loc_18FC);
  1013. }
  1014.  
  1015. //----- (00001950) --------------------------------------------------------
  1016. void sub_1950()
  1017. {
  1018. JUMPOUT(&loc_18FC);
  1019. }
  1020.  
  1021. //----- (000019EC) --------------------------------------------------------
  1022. signed int __fastcall sub_19EC(int a1, int a2, char a3)
  1023. {
  1024. int v3; // r4@1
  1025. char v4; // r10@1
  1026. signed int i; // r6@1
  1027. signed int v6; // r7@3
  1028. int v7; // r0@8
  1029. int v8; // r3@11
  1030. int v9; // r0@12
  1031. int v11; // [sp+0h] [bp-4B0h]@17
  1032. int v12; // [sp+4h] [bp-4ACh]@10
  1033. int v13; // [sp+10h] [bp-4A0h]@11
  1034. int v14; // [sp+18h] [bp-498h]@12
  1035. int v15; // [sp+24h] [bp-48Ch]@12
  1036. int v16; // [sp+2Ch] [bp-484h]@10
  1037. char v17; // [sp+30h] [bp-480h]@1
  1038.  
  1039. v3 = a2;
  1040. v4 = a3;
  1041. sub_1C14((int)&v17);
  1042. for ( i = 1; ; --i )
  1043. {
  1044. v6 = 1;
  1045. if ( v4 & 1 )
  1046. {
  1047. v6 = 2;
  1048. if ( !i )
  1049. {
  1050. sub_1C94((int)&v17, -1, *(_DWORD *)(v3 + 16));
  1051. v4 = 0;
  1052. }
  1053. }
  1054. v7 = sub_1D40((int)&v17);
  1055. if ( !v7 )
  1056. break;
  1057. if ( v7 < 0 )
  1058. return 2;
  1059. sub_1C64((int)&v17, -2, (int)&v16);
  1060. if ( sub_1D48((int)&v17, (int)&v12) )
  1061. return 2;
  1062. v8 = v13;
  1063. if ( v13 )
  1064. {
  1065. *(_DWORD *)(v3 + 72) = v12;
  1066. *(_DWORD *)(v3 + 76) = v15;
  1067. *(_DWORD *)(v3 + 80) = v14;
  1068. v9 = ((int (__fastcall *)(signed int, int, char *))v8)(v6, v3, &v17);
  1069. if ( v9 == 7 )
  1070. {
  1071. sub_1C64((int)&v17, -1, (int)&v11);
  1072. *(_DWORD *)(v3 + 16) = v11;
  1073. sub_1D68((int)&v17);
  1074. return 2;
  1075. }
  1076. if ( v9 == 9 )
  1077. abort();
  1078. if ( v9 != 8 )
  1079. return 2;
  1080. if ( v16 == *(_DWORD *)(v3 + 32) )
  1081. sub_1B08(
  1082. (int)"_Unwind_Reason_Code unwind_phase2(unw_context_t *, _Unwind_Exception *, bool)",
  1083. 642,
  1084. (int)"during phase1 personality function said it would stop here, but now in phase2 it did not stop here");
  1085. }
  1086. }
  1087. return 5;
  1088. }
  1089.  
  1090. //----- (00001B08) --------------------------------------------------------
  1091. void __fastcall sub_1B08(int a1, int a2, int a3)
  1092. {
  1093. fprintf((FILE *)stderr, "libunwind: %s %s:%d - %s\n", a1, "external/libcxxabi/src/Unwind/Unwind-EHABI.cpp", a2, a3);
  1094. abort();
  1095. }
  1096.  
  1097. //----- (00001B8C) --------------------------------------------------------
  1098. int __fastcall sub_1B8C(int a1, int a2, int a3, int a4, int a5)
  1099. {
  1100. int v5; // r4@0
  1101. int v6; // r5@0
  1102. int v7; // r6@0
  1103. int v8; // r7@0
  1104. int v9; // r8@0
  1105. int v10; // r9@0
  1106. int v11; // r10@0
  1107. int v12; // r11@0
  1108. int v13; // r12@0
  1109. int v14; // lr@0
  1110.  
  1111. *(_DWORD *)a1 = a1;
  1112. *(_DWORD *)(a1 + 4) = a2;
  1113. *(_DWORD *)(a1 + 8) = a3;
  1114. *(_DWORD *)(a1 + 12) = a4;
  1115. *(_DWORD *)(a1 + 16) = v5;
  1116. *(_DWORD *)(a1 + 20) = v6;
  1117. *(_DWORD *)(a1 + 24) = v7;
  1118. *(_DWORD *)(a1 + 28) = v8;
  1119. *(_DWORD *)(a1 + 32) = v9;
  1120. *(_DWORD *)(a1 + 36) = v10;
  1121. *(_DWORD *)(a1 + 40) = v11;
  1122. *(_DWORD *)(a1 + 44) = v12;
  1123. *(_DWORD *)(a1 + 48) = v13;
  1124. *(_DWORD *)(a1 + 52) = &a5;
  1125. *(_DWORD *)(a1 + 56) = v14;
  1126. *(_DWORD *)(a1 + 60) = v14;
  1127. return 0;
  1128. }
  1129.  
  1130. //----- (00001BA4) --------------------------------------------------------
  1131. int __fastcall sub_1BA4(int _R0)
  1132. {
  1133. int result; // r0@1
  1134.  
  1135. __asm { VSTMIA R0, {D0-D15} }
  1136. return result;
  1137. }
  1138.  
  1139. //----- (00001BAC) --------------------------------------------------------
  1140. int __fastcall sub_1BAC(int _R0)
  1141. {
  1142. int result; // r0@1
  1143.  
  1144. __asm { VSTMIA R0, {D0-D15} }
  1145. return result;
  1146. }
  1147.  
  1148. //----- (00001BB4) --------------------------------------------------------
  1149. int __fastcall sub_1BB4(int _R0)
  1150. {
  1151. int result; // r0@1
  1152.  
  1153. __asm { VSTMIA R0, {D16-D31} }
  1154. return result;
  1155. }
  1156.  
  1157. //----- (00001BBC) --------------------------------------------------------
  1158. void sub_1BBC()
  1159. {
  1160. __asm
  1161. {
  1162. STCL p1, c0, [R0],#8
  1163. STCL p1, c1, [R0],#8
  1164. STCL p1, c2, [R0],#8
  1165. STCL p1, c3, [R0],#8
  1166. STCL p1, c4, [R0],#8
  1167. STCL p1, c5, [R0],#8
  1168. STCL p1, c6, [R0],#8
  1169. STCL p1, c7, [R0],#8
  1170. STCL p1, c8, [R0],#8
  1171. STCL p1, c9, [R0],#8
  1172. STCL p1, c10, [R0],#8
  1173. STCL p1, c11, [R0],#8
  1174. STCL p1, c12, [R0],#8
  1175. STCL p1, c13, [R0],#8
  1176. STCL p1, c14, [R0],#8
  1177. STCL p1, c15, [R0],#8
  1178. }
  1179. }
  1180.  
  1181. //----- (00001C00) --------------------------------------------------------
  1182. void sub_1C00()
  1183. {
  1184. __asm
  1185. {
  1186. STC2 p1, c8, [R0],#4
  1187. STC2 p1, c9, [R0],#4
  1188. STC2 p1, c10, [R0],#4
  1189. STC2 p1, c11, [R0],#4
  1190. }
  1191. }
  1192.  
  1193. //----- (00001C14) --------------------------------------------------------
  1194. int __fastcall sub_1C14(int a1)
  1195. {
  1196. int v1; // r4@1
  1197.  
  1198. v1 = a1;
  1199. *(_DWORD *)a1 = &off_4E14;
  1200. *(_DWORD *)(a1 + 4) = &unk_50CC;
  1201. *(_BYTE *)(a1 + 76) = 0;
  1202. *(_DWORD *)(a1 + 72) = 0;
  1203. _aeabi_memcpy(a1 + 8);
  1204. _aeabi_memset(v1 + 80, 450, 0);
  1205. sub_2188(v1, 0);
  1206. return 0;
  1207. }
  1208. // D18: using guessed type int __fastcall _aeabi_memcpy(_DWORD);
  1209. // D24: using guessed type int __fastcall _aeabi_memset(_DWORD, _DWORD, _DWORD);
  1210. // 4E14: using guessed type void *;
  1211.  
  1212. //----- (00001C64) --------------------------------------------------------
  1213. signed int __fastcall sub_1C64(int a1, int a2, int a3)
  1214. {
  1215. int v3; // r6@1
  1216. int v4; // r4@1
  1217. int v5; // r5@1
  1218. signed int result; // r0@2
  1219.  
  1220. v3 = a1;
  1221. v4 = a3;
  1222. v5 = a2;
  1223. if ( (*(int (**)(void))(*(_DWORD *)a1 + 8))() == 1 )
  1224. {
  1225. *(_DWORD *)v4 = (*(int (__fastcall **)(int, int))(*(_DWORD *)v3 + 12))(v3, v5);
  1226. result = 0;
  1227. }
  1228. else
  1229. {
  1230. result = -6542;
  1231. }
  1232. return result;
  1233. }
  1234.  
  1235. //----- (00001C94) --------------------------------------------------------
  1236. signed int __fastcall sub_1C94(int a1, int a2, int a3)
  1237. {
  1238. int v3; // r4@1
  1239. int v4; // r6@1
  1240. int v5; // r5@1
  1241. signed int v6; // r5@3
  1242.  
  1243. v3 = a1;
  1244. v4 = a3;
  1245. v5 = a2;
  1246. if ( (*(int (**)(void))(*(_DWORD *)a1 + 8))() == 1 )
  1247. {
  1248. (*(void (__fastcall **)(int, int, int))(*(_DWORD *)v3 + 16))(v3, v5, v4);
  1249. if ( v5 == -1 )
  1250. {
  1251. v6 = 0;
  1252. (*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v3 + 52))(v3, 0);
  1253. }
  1254. else
  1255. {
  1256. v6 = 0;
  1257. }
  1258. }
  1259. else
  1260. {
  1261. v6 = -6542;
  1262. }
  1263. return v6;
  1264. }
  1265.  
  1266. //----- (00001CD8) --------------------------------------------------------
  1267. signed int __fastcall sub_1CD8(int a1, int a2, int a3)
  1268. {
  1269. int v3; // r6@1
  1270. int v4; // r4@1
  1271. int v5; // r5@1
  1272. __int64 v6; // r0@2
  1273. signed int result; // r0@2
  1274.  
  1275. v3 = a1;
  1276. v4 = a3;
  1277. v5 = a2;
  1278. if ( (*(int (**)(void))(*(_DWORD *)a1 + 20))() == 1 )
  1279. {
  1280. LODWORD(v6) = (*(int (__fastcall **)(int, int))(*(_DWORD *)v3 + 24))(v3, v5);
  1281. *(_QWORD *)v4 = v6;
  1282. result = 0;
  1283. }
  1284. else
  1285. {
  1286. result = -6542;
  1287. }
  1288. return result;
  1289. }
  1290.  
  1291. //----- (00001D08) --------------------------------------------------------
  1292. signed int __fastcall sub_1D08(int a1, int a2, int a3, int a4)
  1293. {
  1294. int v4; // r7@1
  1295. int v5; // r5@1
  1296. int v6; // r6@1
  1297. int v7; // r8@1
  1298. signed int result; // r0@2
  1299.  
  1300. v4 = a1;
  1301. v5 = a3;
  1302. v6 = a2;
  1303. v7 = a4;
  1304. if ( (*(int (**)(void))(*(_DWORD *)a1 + 20))() == 1 )
  1305. {
  1306. (*(void (__fastcall **)(int, int, int, int))(*(_DWORD *)v4 + 28))(v4, v6, v5, v7);
  1307. result = 0;
  1308. }
  1309. else
  1310. {
  1311. result = -6542;
  1312. }
  1313. return result;
  1314. }
  1315.  
  1316. //----- (00001D40) --------------------------------------------------------
  1317. int __fastcall sub_1D40(int a1)
  1318. {
  1319. return (*(int (**)(void))(*(_DWORD *)a1 + 32))();
  1320. }
  1321.  
  1322. //----- (00001D48) --------------------------------------------------------
  1323. signed int __fastcall sub_1D48(int a1, int a2)
  1324. {
  1325. int v2; // r4@1
  1326. signed int result; // r0@1
  1327.  
  1328. v2 = a2;
  1329. (*(void (**)(void))(*(_DWORD *)a1 + 36))();
  1330. result = 0;
  1331. if ( !*(_DWORD *)(v2 + 4) )
  1332. result = -6549;
  1333. return result;
  1334. }
  1335.  
  1336. //----- (00001D68) --------------------------------------------------------
  1337. signed int __fastcall sub_1D68(int a1)
  1338. {
  1339. (*(void (**)(void))(*(_DWORD *)a1 + 40))();
  1340. return -6540;
  1341. }
  1342.  
  1343. //----- (00001D80) --------------------------------------------------------
  1344. int __fastcall sub_1D80(int a1)
  1345. {
  1346. return (*(int (**)(void))(*(_DWORD *)a1 + 60))();
  1347. }
  1348.  
  1349. //----- (00001D90) --------------------------------------------------------
  1350. int __fastcall sub_1D90(int a1, int a2)
  1351. {
  1352. signed int v2; // r2@1
  1353. bool v3; // zf@1
  1354. signed int v4; // r0@1
  1355. int v5; // r1@1
  1356.  
  1357. v2 = 0;
  1358. v3 = (a2 & 0xFFFFFFFC) == 192;
  1359. v4 = 0;
  1360. v5 = a2 - 16;
  1361. if ( v3 )
  1362. v4 = 1;
  1363. if ( (unsigned int)v5 > 0xFFFFFFED )
  1364. v2 = 1;
  1365. return v4 | v2;
  1366. }
  1367.  
  1368. //----- (00001DB0) --------------------------------------------------------
  1369. int __fastcall sub_1DB0(int a1, signed int a2)
  1370. {
  1371. signed int v2; // r5@1
  1372. int v3; // r4@1
  1373. int v4; // r0@7
  1374.  
  1375. v2 = a2;
  1376. v3 = a1;
  1377. if ( a2 >= -1 )
  1378. {
  1379. if ( a2 > 13 )
  1380. {
  1381. if ( a2 == 14 )
  1382. {
  1383. v4 = a1 + 64;
  1384. return *(_DWORD *)v4;
  1385. }
  1386. if ( a2 != 15 )
  1387. goto LABEL_12;
  1388. }
  1389. else if ( a2 != -1 )
  1390. {
  1391. if ( a2 != 13 )
  1392. goto LABEL_12;
  1393. LABEL_7:
  1394. v4 = a1 + 60;
  1395. return *(_DWORD *)v4;
  1396. }
  1397. v4 = a1 + 68;
  1398. return *(_DWORD *)v4;
  1399. }
  1400. if ( a2 == -2 )
  1401. goto LABEL_7;
  1402. LABEL_12:
  1403. if ( (unsigned int)a2 > 0xC )
  1404. {
  1405. if ( (a2 & 0xFFFFFFFC) != 192 )
  1406. sub_21E8(
  1407. (int)"uint32_t libunwind::Registers_arm::getRegister(int)",
  1408. (int)"external/libcxxabi/src/Unwind/Registers.hpp",
  1409. 1452,
  1410. (int)"unsupported arm register");
  1411. if ( !*(_BYTE *)(a1 + 76) )
  1412. {
  1413. *(_BYTE *)(a1 + 76) = 1;
  1414. sub_1C00();
  1415. }
  1416. v4 = v3 + 4 * v2 - 296;
  1417. }
  1418. else
  1419. {
  1420. v4 = a1 + 4 * a2 + 8;
  1421. }
  1422. return *(_DWORD *)v4;
  1423. }
  1424.  
  1425. //----- (00001E4C) --------------------------------------------------------
  1426. int __fastcall sub_1E4C(int result, signed int a2, int a3)
  1427. {
  1428. signed int v3; // r6@1
  1429. int v4; // r4@1
  1430. int v5; // r5@1
  1431.  
  1432. v3 = a2;
  1433. v4 = a3;
  1434. v5 = result;
  1435. if ( a2 >= -1 )
  1436. {
  1437. if ( a2 > 13 )
  1438. {
  1439. if ( a2 == 14 )
  1440. {
  1441. *(_DWORD *)(result + 64) = a3;
  1442. return result;
  1443. }
  1444. if ( a2 != 15 )
  1445. goto LABEL_12;
  1446. }
  1447. else if ( a2 != -1 )
  1448. {
  1449. if ( a2 != 13 )
  1450. goto LABEL_12;
  1451. LABEL_7:
  1452. *(_DWORD *)(result + 60) = a3;
  1453. return result;
  1454. }
  1455. *(_DWORD *)(result + 68) = a3;
  1456. return result;
  1457. }
  1458. if ( a2 == -2 )
  1459. goto LABEL_7;
  1460. LABEL_12:
  1461. if ( (unsigned int)a2 > 0xC )
  1462. {
  1463. if ( (a2 & 0xFFFFFFFC) != 192 )
  1464. sub_21E8(
  1465. (int)"void libunwind::Registers_arm::setRegister(int, uint32_t)",
  1466. (int)"external/libcxxabi/src/Unwind/Registers.hpp",
  1467. 1471,
  1468. (int)"unsupported arm register");
  1469. if ( !*(_BYTE *)(result + 76) )
  1470. {
  1471. *(_BYTE *)(result + 76) = 1;
  1472. sub_1C00();
  1473. }
  1474. result = v5 + 4 * v3;
  1475. *(_DWORD *)(result - 296) = v4;
  1476. }
  1477. else
  1478. {
  1479. result += 4 * a2;
  1480. *(_DWORD *)(result + 8) = a3;
  1481. }
  1482. return result;
  1483. }
  1484.  
  1485. //----- (00001EE4) --------------------------------------------------------
  1486. int __fastcall sub_1EE4(int a1, int a2)
  1487. {
  1488. signed int v2; // r2@1
  1489. bool v3; // zf@1
  1490. signed int v4; // r0@1
  1491. unsigned int v5; // r1@1
  1492.  
  1493. v2 = 0;
  1494. v3 = (a2 & 0xFFFFFFF0) == 112;
  1495. v4 = 0;
  1496. v5 = a2 & 0xFFFFFFE0;
  1497. if ( v3 )
  1498. v4 = 1;
  1499. if ( v5 == 256 )
  1500. v2 = 1;
  1501. return v4 | v2;
  1502. }
  1503.  
  1504. //----- (00001F04) --------------------------------------------------------
  1505. __int64 __fastcall sub_1F04(int a1, int a2)
  1506. {
  1507. int v2; // r4@1
  1508. int v3; // r5@1
  1509. unsigned int v4; // r0@1
  1510. int v5; // r0@5
  1511. int v6; // r0@11
  1512.  
  1513. v2 = a2;
  1514. v3 = a1;
  1515. v4 = a2 & 0xFFFFFFF0;
  1516. if ( (a2 & 0xFFFFFFF0) == 112 )
  1517. {
  1518. if ( !*(_BYTE *)(v3 + 75) )
  1519. {
  1520. *(_BYTE *)(v3 + 75) = 1;
  1521. sub_1BBC();
  1522. }
  1523. v5 = v3 + 8 * v2 - 552;
  1524. }
  1525. else if ( v4 == 272 )
  1526. {
  1527. if ( !*(_BYTE *)(v3 + 74) )
  1528. {
  1529. *(_BYTE *)(v3 + 74) = 1;
  1530. sub_1BB4(v3 + 216);
  1531. }
  1532. v5 = v3 + 8 * v2 - 1960;
  1533. }
  1534. else
  1535. {
  1536. if ( v4 != 256 )
  1537. sub_21E8(
  1538. (int)"unw_fpreg_t libunwind::Registers_arm::getFloatRegister(int)",
  1539. (int)"external/libcxxabi/src/Unwind/Registers.hpp",
  1540. 1673,
  1541. (int)"Unknown ARM float register");
  1542. if ( !*(_BYTE *)(v3 + 73) )
  1543. {
  1544. *(_BYTE *)(v3 + 73) = 1;
  1545. v6 = v3 + 80;
  1546. if ( *(_BYTE *)(v3 + 72) )
  1547. sub_1BAC(v6);
  1548. else
  1549. sub_1BA4(v6);
  1550. }
  1551. v5 = v3 + 8 * v2 - 1968;
  1552. }
  1553. return *(_QWORD *)v5;
  1554. }
  1555.  
  1556. //----- (00001FB4) --------------------------------------------------------
  1557. int __fastcall sub_1FB4(int a1, int a2, int a3, int a4)
  1558. {
  1559. int v4; // r6@1
  1560. int v5; // r7@1
  1561. unsigned int v6; // r0@1
  1562. int v7; // r5@1
  1563. int v8; // r4@1
  1564. int result; // r0@5
  1565. int v10; // r1@5
  1566. int v11; // r0@11
  1567.  
  1568. v4 = a2;
  1569. v5 = a1;
  1570. v6 = a2 & 0xFFFFFFF0;
  1571. v7 = a4;
  1572. v8 = a3;
  1573. if ( (a2 & 0xFFFFFFF0) == 112 )
  1574. {
  1575. if ( !*(_BYTE *)(v5 + 75) )
  1576. {
  1577. *(_BYTE *)(v5 + 75) = 1;
  1578. sub_1BBC();
  1579. }
  1580. result = v5 + 8 * v4;
  1581. *(_DWORD *)(result - 548) = v7;
  1582. LOWORD(v10) = -552;
  1583. }
  1584. else if ( v6 == 272 )
  1585. {
  1586. if ( !*(_BYTE *)(v5 + 74) )
  1587. {
  1588. *(_BYTE *)(v5 + 74) = 1;
  1589. sub_1BB4(v5 + 216);
  1590. }
  1591. result = v5 + 8 * v4;
  1592. *(_DWORD *)(result - 1828) = v7;
  1593. LOWORD(v10) = -1832;
  1594. }
  1595. else
  1596. {
  1597. if ( v6 != 256 )
  1598. sub_21E8(
  1599. (int)"void libunwind::Registers_arm::setFloatRegister(int, unw_fpreg_t)",
  1600. (int)"external/libcxxabi/src/Unwind/Registers.hpp",
  1601. 1700,
  1602. (int)"Unknown ARM float register");
  1603. if ( !*(_BYTE *)(v5 + 73) )
  1604. {
  1605. *(_BYTE *)(v5 + 73) = 1;
  1606. v11 = v5 + 80;
  1607. if ( *(_BYTE *)(v5 + 72) )
  1608. sub_1BAC(v11);
  1609. else
  1610. sub_1BA4(v11);
  1611. }
  1612. result = v5 + 8 * v4;
  1613. *(_DWORD *)(result - 1964) = v7;
  1614. LOWORD(v10) = -1968;
  1615. }
  1616. HIWORD(v10) = -1;
  1617. *(_DWORD *)(result + v10) = v8;
  1618. return result;
  1619. }
  1620.  
  1621. //----- (00002088) --------------------------------------------------------
  1622. signed int __fastcall sub_2088(int a1)
  1623. {
  1624. int v1; // r4@1
  1625. signed int result; // r0@3
  1626. void (__fastcall *v3)(_DWORD, _DWORD, _DWORD); // r5@5
  1627. int v4; // r0@5
  1628.  
  1629. v1 = a1;
  1630. if ( *(_BYTE *)(a1 + 528)
  1631. || ((*(void (__fastcall **)(int, signed int))(*(_DWORD *)a1 + 52))(a1, 1), *(_BYTE *)(v1 + 528)) )
  1632. {
  1633. result = 0;
  1634. }
  1635. else
  1636. {
  1637. if ( *(_DWORD *)(v1 + 504) )
  1638. {
  1639. v3 = *(void (__fastcall **)(_DWORD, _DWORD, _DWORD))(*(_DWORD *)v1 + 16);
  1640. v4 = (*(int (__fastcall **)(int, signed int))(*(_DWORD *)v1 + 12))(v1, -2);
  1641. v3(v1, -2, *(_DWORD *)(v1 + 504) + v4);
  1642. }
  1643. result = 1;
  1644. }
  1645. return result;
  1646. }
  1647.  
  1648. //----- (000020D4) --------------------------------------------------------
  1649. int __fastcall sub_20D4(int a1, int a2)
  1650. {
  1651. int v2; // r12@1
  1652. int v3; // lr@1
  1653. int v4; // r11@1
  1654. int v5; // r3@1
  1655. int v6; // r4@1
  1656. int v7; // r5@1
  1657. int v8; // r4@1
  1658. int v9; // r2@1
  1659. int v10; // r3@1
  1660. int v11; // r5@1
  1661. int result; // r0@1
  1662.  
  1663. v2 = *(_DWORD *)(a1 + 488);
  1664. v3 = *(_DWORD *)(a1 + 492);
  1665. v4 = a2 + 8;
  1666. v5 = *(_DWORD *)(a1 + 500);
  1667. v6 = *(_DWORD *)(a1 + 504);
  1668. v7 = *(_DWORD *)(a1 + 508);
  1669. *(_DWORD *)v4 = *(_DWORD *)(a1 + 496);
  1670. *(_DWORD *)(v4 + 4) = v5;
  1671. *(_DWORD *)(v4 + 8) = v6;
  1672. *(_DWORD *)(v4 + 12) = v7;
  1673. v8 = a2 + 24;
  1674. *(_DWORD *)a2 = v2;
  1675. *(_DWORD *)(a2 + 4) = v3;
  1676. v9 = *(_DWORD *)(a1 + 512);
  1677. v10 = *(_DWORD *)(a1 + 516);
  1678. v11 = *(_DWORD *)(a1 + 520);
  1679. result = *(_DWORD *)(a1 + 524);
  1680. *(_DWORD *)(a2 + 36) = result;
  1681. *(_DWORD *)v8 = v9;
  1682. *(_DWORD *)(v8 + 4) = v10;
  1683. *(_DWORD *)(v8 + 8) = v11;
  1684. return result;
  1685. }
  1686.  
  1687. //----- (0000210C) --------------------------------------------------------
  1688. void __fastcall sub_210C(int a1)
  1689. {
  1690. sub_221C(a1 + 8);
  1691. sub_2B50();
  1692. }
  1693.  
  1694. //----- (00002124) --------------------------------------------------------
  1695. int __fastcall sub_2124(int a1)
  1696. {
  1697. return *(_BYTE *)(a1 + 529);
  1698. }
  1699.  
  1700. //----- (0000212C) --------------------------------------------------------
  1701. signed int __fastcall sub_212C(int a1, int a2, int a3, int a4)
  1702. {
  1703. int v4; // r6@1
  1704. int v5; // r5@1
  1705. int v6; // r4@1
  1706. int v7; // r7@1
  1707. int v8; // r0@1
  1708. bool v9; // zf@1
  1709. signed int result; // r0@4
  1710. int v11; // [sp+10h] [bp-20h]@2
  1711. int v12; // [sp+14h] [bp-1Ch]@4
  1712.  
  1713. v4 = a2;
  1714. v5 = a3;
  1715. v6 = a4;
  1716. v7 = (*(int (**)(void))(*(_DWORD *)a1 + 12))();
  1717. v8 = dladdr();
  1718. v9 = v8 == 0;
  1719. if ( v8 )
  1720. v9 = v11 == 0;
  1721. if ( v9 )
  1722. {
  1723. result = 0;
  1724. }
  1725. else
  1726. {
  1727. _snprintf_chk(v4, v5, 0, -1);
  1728. *(_DWORD *)v6 = v7 - v12;
  1729. result = 1;
  1730. }
  1731. return result;
  1732. }
  1733. // D30: using guessed type int dladdr(void);
  1734. // D3C: using guessed type int __fastcall _snprintf_chk(_DWORD, _DWORD, _DWORD, _DWORD);
  1735.  
  1736. //----- (00002188) --------------------------------------------------------
  1737. int __fastcall sub_2188(int a1, int a2)
  1738. {
  1739. int v2; // r4@1
  1740. int v3; // r6@1
  1741. unsigned int v4; // r5@1
  1742. int v5; // r0@3
  1743. bool v6; // zf@3
  1744. int result; // r0@6
  1745. int v8; // [sp+4h] [bp-1Ch]@3
  1746. int v9; // [sp+8h] [bp-18h]@3
  1747. int v10; // [sp+Ch] [bp-14h]@1
  1748.  
  1749. v2 = a1;
  1750. v3 = a2;
  1751. v4 = (*(int (**)(void))(*(_DWORD *)a1 + 12))() & 0xFFFFFFFE;
  1752. v10 = 0;
  1753. if ( v3 )
  1754. --v4;
  1755. v5 = _gnu_Unwind_Find_exidx(v4, &v10);
  1756. v6 = v5 == 0;
  1757. v8 = v5;
  1758. v9 = v10;
  1759. if ( v5 )
  1760. v6 = v10 == 0;
  1761. if ( v6 || (result = ((int (__fastcall *)(int, unsigned int, int *))sub_2270)(v2, v4, &v8)) == 0 )
  1762. {
  1763. result = 1;
  1764. *(_BYTE *)(v2 + 528) = 1;
  1765. }
  1766. return result;
  1767. }
  1768. // D48: using guessed type int __fastcall _gnu_Unwind_Find_exidx(_DWORD, _DWORD);
  1769. // 2270: using guessed type int sub_2270();
  1770.  
  1771. //----- (000021D8) --------------------------------------------------------
  1772. int __fastcall sub_21D8(int a1, signed int a2)
  1773. {
  1774. int v2; // r1@2
  1775. int result; // r0@3
  1776. signed int v4; // r1@4
  1777. int *v5; // r0@4
  1778.  
  1779. if ( a2 <= 255 )
  1780. {
  1781. v2 = a2 + 2;
  1782. if ( (unsigned int)v2 <= 0x61 )
  1783. {
  1784. result = (int)"pc";
  1785. switch ( v2 )
  1786. {
  1787. case 0:
  1788. case 15:
  1789. v4 = -6356;
  1790. v5 = &GLOBAL_OFFSET_TABLE_;
  1791. return (int)((char *)v5 + v4);
  1792. default:
  1793. goto def_2544;
  1794. case 1:
  1795. case 17:
  1796. return result;
  1797. case 2:
  1798. v4 = -6353;
  1799. v5 = &GLOBAL_OFFSET_TABLE_;
  1800. break;
  1801. case 3:
  1802. v4 = -6350;
  1803. v5 = &GLOBAL_OFFSET_TABLE_;
  1804. break;
  1805. case 4:
  1806. v4 = -6347;
  1807. v5 = &GLOBAL_OFFSET_TABLE_;
  1808. break;
  1809. case 5:
  1810. v4 = -6344;
  1811. v5 = &GLOBAL_OFFSET_TABLE_;
  1812. break;
  1813. case 6:
  1814. v4 = -6341;
  1815. v5 = &GLOBAL_OFFSET_TABLE_;
  1816. break;
  1817. case 7:
  1818. v4 = -6338;
  1819. v5 = &GLOBAL_OFFSET_TABLE_;
  1820. break;
  1821. case 8:
  1822. v4 = -6335;
  1823. v5 = &GLOBAL_OFFSET_TABLE_;
  1824. break;
  1825. case 9:
  1826. v4 = -6332;
  1827. v5 = &GLOBAL_OFFSET_TABLE_;
  1828. break;
  1829. case 10:
  1830. v4 = -6329;
  1831. v5 = &GLOBAL_OFFSET_TABLE_;
  1832. break;
  1833. case 11:
  1834. v4 = -6326;
  1835. v5 = &GLOBAL_OFFSET_TABLE_;
  1836. break;
  1837. case 12:
  1838. v4 = -6323;
  1839. v5 = &GLOBAL_OFFSET_TABLE_;
  1840. break;
  1841. case 13:
  1842. v4 = -6319;
  1843. v5 = &GLOBAL_OFFSET_TABLE_;
  1844. break;
  1845. case 14:
  1846. v4 = -6315;
  1847. v5 = &GLOBAL_OFFSET_TABLE_;
  1848. break;
  1849. case 16:
  1850. v4 = -6359;
  1851. v5 = &GLOBAL_OFFSET_TABLE_;
  1852. break;
  1853. case 66:
  1854. v4 = -6311;
  1855. v5 = &GLOBAL_OFFSET_TABLE_;
  1856. break;
  1857. case 67:
  1858. v4 = -6308;
  1859. v5 = &GLOBAL_OFFSET_TABLE_;
  1860. break;
  1861. case 68:
  1862. v4 = -6305;
  1863. v5 = &GLOBAL_OFFSET_TABLE_;
  1864. break;
  1865. case 69:
  1866. v4 = -6302;
  1867. v5 = &GLOBAL_OFFSET_TABLE_;
  1868. break;
  1869. case 70:
  1870. v4 = -6299;
  1871. v5 = &GLOBAL_OFFSET_TABLE_;
  1872. break;
  1873. case 71:
  1874. v4 = -6296;
  1875. v5 = &GLOBAL_OFFSET_TABLE_;
  1876. break;
  1877. case 72:
  1878. v4 = -6293;
  1879. v5 = &GLOBAL_OFFSET_TABLE_;
  1880. break;
  1881. case 73:
  1882. v4 = -6290;
  1883. v5 = &GLOBAL_OFFSET_TABLE_;
  1884. break;
  1885. case 74:
  1886. v4 = -6287;
  1887. v5 = &GLOBAL_OFFSET_TABLE_;
  1888. break;
  1889. case 75:
  1890. v4 = -6284;
  1891. v5 = &GLOBAL_OFFSET_TABLE_;
  1892. break;
  1893. case 76:
  1894. v4 = -6281;
  1895. v5 = &GLOBAL_OFFSET_TABLE_;
  1896. break;
  1897. case 77:
  1898. v4 = -6277;
  1899. v5 = &GLOBAL_OFFSET_TABLE_;
  1900. break;
  1901. case 78:
  1902. v4 = -6273;
  1903. v5 = &GLOBAL_OFFSET_TABLE_;
  1904. break;
  1905. case 79:
  1906. v4 = -6269;
  1907. v5 = &GLOBAL_OFFSET_TABLE_;
  1908. break;
  1909. case 80:
  1910. v4 = -6265;
  1911. v5 = &GLOBAL_OFFSET_TABLE_;
  1912. break;
  1913. case 81:
  1914. v4 = -6261;
  1915. v5 = &GLOBAL_OFFSET_TABLE_;
  1916. break;
  1917. case 82:
  1918. v4 = -6257;
  1919. v5 = &GLOBAL_OFFSET_TABLE_;
  1920. break;
  1921. case 83:
  1922. v4 = -6253;
  1923. v5 = &GLOBAL_OFFSET_TABLE_;
  1924. break;
  1925. case 84:
  1926. v4 = -6249;
  1927. v5 = &GLOBAL_OFFSET_TABLE_;
  1928. break;
  1929. case 85:
  1930. v4 = -6245;
  1931. v5 = &GLOBAL_OFFSET_TABLE_;
  1932. break;
  1933. case 86:
  1934. v4 = -6241;
  1935. v5 = &GLOBAL_OFFSET_TABLE_;
  1936. break;
  1937. case 87:
  1938. v4 = -6237;
  1939. v5 = &GLOBAL_OFFSET_TABLE_;
  1940. break;
  1941. case 88:
  1942. v4 = -6233;
  1943. v5 = &GLOBAL_OFFSET_TABLE_;
  1944. break;
  1945. case 89:
  1946. v4 = -6229;
  1947. v5 = &GLOBAL_OFFSET_TABLE_;
  1948. break;
  1949. case 90:
  1950. v4 = -6225;
  1951. v5 = &GLOBAL_OFFSET_TABLE_;
  1952. break;
  1953. case 91:
  1954. v4 = -6221;
  1955. v5 = &GLOBAL_OFFSET_TABLE_;
  1956. break;
  1957. case 92:
  1958. v4 = -6217;
  1959. v5 = &GLOBAL_OFFSET_TABLE_;
  1960. break;
  1961. case 93:
  1962. v4 = -6213;
  1963. v5 = &GLOBAL_OFFSET_TABLE_;
  1964. break;
  1965. case 94:
  1966. v4 = -6209;
  1967. v5 = &GLOBAL_OFFSET_TABLE_;
  1968. break;
  1969. case 95:
  1970. v4 = -6205;
  1971. v5 = &GLOBAL_OFFSET_TABLE_;
  1972. break;
  1973. case 96:
  1974. v4 = -6201;
  1975. v5 = &GLOBAL_OFFSET_TABLE_;
  1976. break;
  1977. case 97:
  1978. v4 = -6197;
  1979. v5 = &GLOBAL_OFFSET_TABLE_;
  1980. break;
  1981. }
  1982. return (int)((char *)v5 + v4);
  1983. }
  1984. def_2544:
  1985. v4 = -6075;
  1986. v5 = &GLOBAL_OFFSET_TABLE_;
  1987. return (int)((char *)v5 + v4);
  1988. }
  1989. if ( (unsigned int)(a2 - 256) > 0x1F )
  1990. goto def_2544;
  1991. switch ( a2 )
  1992. {
  1993. case 0:
  1994. v4 = -6193;
  1995. v5 = &GLOBAL_OFFSET_TABLE_;
  1996. break;
  1997. case 1:
  1998. v4 = -6190;
  1999. v5 = &GLOBAL_OFFSET_TABLE_;
  2000. break;
  2001. case 2:
  2002. v4 = -6187;
  2003. v5 = &GLOBAL_OFFSET_TABLE_;
  2004. break;
  2005. case 3:
  2006. v4 = -6184;
  2007. v5 = &GLOBAL_OFFSET_TABLE_;
  2008. break;
  2009. case 4:
  2010. v4 = -6181;
  2011. v5 = &GLOBAL_OFFSET_TABLE_;
  2012. break;
  2013. case 5:
  2014. v4 = -6178;
  2015. v5 = &GLOBAL_OFFSET_TABLE_;
  2016. break;
  2017. case 6:
  2018. v4 = -6175;
  2019. v5 = &GLOBAL_OFFSET_TABLE_;
  2020. break;
  2021. case 7:
  2022. v4 = -6172;
  2023. v5 = &GLOBAL_OFFSET_TABLE_;
  2024. break;
  2025. case 8:
  2026. v4 = -6169;
  2027. v5 = &GLOBAL_OFFSET_TABLE_;
  2028. break;
  2029. case 9:
  2030. v4 = -6166;
  2031. v5 = &GLOBAL_OFFSET_TABLE_;
  2032. break;
  2033. case 10:
  2034. v4 = -6163;
  2035. v5 = &GLOBAL_OFFSET_TABLE_;
  2036. break;
  2037. case 11:
  2038. v4 = -6159;
  2039. v5 = &GLOBAL_OFFSET_TABLE_;
  2040. break;
  2041. case 12:
  2042. v4 = -6155;
  2043. v5 = &GLOBAL_OFFSET_TABLE_;
  2044. break;
  2045. case 13:
  2046. v4 = -6151;
  2047. v5 = &GLOBAL_OFFSET_TABLE_;
  2048. break;
  2049. case 14:
  2050. v4 = -6147;
  2051. v5 = &GLOBAL_OFFSET_TABLE_;
  2052. break;
  2053. case 15:
  2054. v4 = -6143;
  2055. v5 = &GLOBAL_OFFSET_TABLE_;
  2056. break;
  2057. case 16:
  2058. v4 = -6139;
  2059. v5 = &GLOBAL_OFFSET_TABLE_;
  2060. break;
  2061. case 17:
  2062. v4 = -6135;
  2063. v5 = &GLOBAL_OFFSET_TABLE_;
  2064. break;
  2065. case 18:
  2066. v4 = -6131;
  2067. v5 = &GLOBAL_OFFSET_TABLE_;
  2068. break;
  2069. case 19:
  2070. v4 = -6127;
  2071. v5 = &GLOBAL_OFFSET_TABLE_;
  2072. break;
  2073. case 20:
  2074. v4 = -6123;
  2075. v5 = &GLOBAL_OFFSET_TABLE_;
  2076. break;
  2077. case 21:
  2078. v4 = -6119;
  2079. v5 = &GLOBAL_OFFSET_TABLE_;
  2080. break;
  2081. case 22:
  2082. v4 = -6115;
  2083. v5 = &GLOBAL_OFFSET_TABLE_;
  2084. break;
  2085. case 23:
  2086. v4 = -6111;
  2087. v5 = &GLOBAL_OFFSET_TABLE_;
  2088. break;
  2089. case 24:
  2090. v4 = -6107;
  2091. v5 = &GLOBAL_OFFSET_TABLE_;
  2092. break;
  2093. case 25:
  2094. v4 = -6103;
  2095. v5 = &GLOBAL_OFFSET_TABLE_;
  2096. break;
  2097. case 26:
  2098. v4 = -6099;
  2099. v5 = &GLOBAL_OFFSET_TABLE_;
  2100. break;
  2101. case 27:
  2102. v4 = -6095;
  2103. v5 = &GLOBAL_OFFSET_TABLE_;
  2104. break;
  2105. case 28:
  2106. v4 = -6091;
  2107. v5 = &GLOBAL_OFFSET_TABLE_;
  2108. break;
  2109. case 29:
  2110. v4 = -6087;
  2111. v5 = &GLOBAL_OFFSET_TABLE_;
  2112. break;
  2113. case 30:
  2114. v4 = -6083;
  2115. v5 = &GLOBAL_OFFSET_TABLE_;
  2116. break;
  2117. case 31:
  2118. v4 = -6079;
  2119. v5 = &GLOBAL_OFFSET_TABLE_;
  2120. break;
  2121. default:
  2122. goto def_2544;
  2123. }
  2124. return (int)((char *)v5 + v4);
  2125. }
  2126. // 4F80: using guessed type int GLOBAL_OFFSET_TABLE_;
  2127.  
  2128. //----- (000021E0) --------------------------------------------------------
  2129. int __fastcall sub_21E0(int result)
  2130. {
  2131. *(_BYTE *)(result + 72) = 1;
  2132. return result;
  2133. }
  2134.  
  2135. //----- (000021E8) --------------------------------------------------------
  2136. void __fastcall sub_21E8(int a1, int a2, int a3, int a4)
  2137. {
  2138. fprintf((FILE *)stderr, "libunwind: %s %s:%d - %s\n", a1, a2, a3, a4);
  2139. abort();
  2140. }
  2141.  
  2142. //----- (0000221C) --------------------------------------------------------
  2143. int __fastcall sub_221C(int a1)
  2144. {
  2145. int v1; // r4@1
  2146. int v2; // r0@2
  2147. int result; // r0@9
  2148.  
  2149. v1 = a1;
  2150. if ( *(_BYTE *)(a1 + 65) )
  2151. {
  2152. v2 = a1 + 72;
  2153. if ( *(_BYTE *)(v1 + 64) )
  2154. sub_2AE8(v2);
  2155. else
  2156. sub_2AE0(v2);
  2157. }
  2158. if ( *(_BYTE *)(v1 + 66) )
  2159. sub_2AF0(v1 + 208);
  2160. if ( *(_BYTE *)(v1 + 67) )
  2161. sub_2AF8(v1 + 336);
  2162. result = *(_BYTE *)(v1 + 68);
  2163. if ( *(_BYTE *)(v1 + 68) )
  2164. result = sub_2B60(v1 + 464);
  2165. return result;
  2166. }
  2167.  
  2168. //----- (000023F8) --------------------------------------------------------
  2169. int __fastcall sub_23F8(int result, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
  2170. {
  2171. unsigned int v8; // r4@1
  2172. unsigned int v9; // r5@2
  2173. int v10; // r6@3
  2174.  
  2175. v8 = a5 - a2;
  2176. while ( 1 )
  2177. {
  2178. v9 = v8;
  2179. if ( !v8 )
  2180. break;
  2181. v10 = a2 + (v8 >> 1);
  2182. v8 >>= 1;
  2183. if ( *(_DWORD *)a8 >= *(_DWORD *)a4
  2184. + 8 * v10
  2185. + (2 * *(_DWORD *)(*(_DWORD *)a4 + 8 * v10) & 0x80000000 | *(_DWORD *)(*(_DWORD *)a4 + 8 * v10)) )
  2186. {
  2187. v8 = v9 - 1 - v8;
  2188. a2 = v10 + 1;
  2189. }
  2190. }
  2191. *(_DWORD *)result = a2;
  2192. *(_DWORD *)(result + 4) = a3;
  2193. *(_DWORD *)(result + 8) = a4;
  2194. return result;
  2195. }
  2196.  
  2197. //----- (00002AE0) --------------------------------------------------------
  2198. int __fastcall sub_2AE0(int _R0)
  2199. {
  2200. int result; // r0@1
  2201.  
  2202. __asm { VLDMIA R0, {D0-D15} }
  2203. return result;
  2204. }
  2205.  
  2206. //----- (00002AE8) --------------------------------------------------------
  2207. int __fastcall sub_2AE8(int _R0)
  2208. {
  2209. int result; // r0@1
  2210.  
  2211. __asm { VLDMIA R0, {D0-D15} }
  2212. return result;
  2213. }
  2214.  
  2215. //----- (00002AF0) --------------------------------------------------------
  2216. int __fastcall sub_2AF0(int _R0)
  2217. {
  2218. int result; // r0@1
  2219.  
  2220. __asm { VLDMIA R0, {D16-D31} }
  2221. return result;
  2222. }
  2223.  
  2224. //----- (00002AF8) --------------------------------------------------------
  2225. int __fastcall sub_2AF8(int a1)
  2226. {
  2227. int v5; // r0@1
  2228. int result; // r0@1
  2229.  
  2230. _T1 = *(_DWORD *)a1;
  2231. v5 = a1 + 8;
  2232. __asm { LDCL p1, c0, [R0],#8 }
  2233. _T1 = *(_DWORD *)v5;
  2234. v5 += 8;
  2235. __asm { LDCL p1, c1, [R0],#8 }
  2236. _T1 = *(_DWORD *)v5;
  2237. v5 += 8;
  2238. __asm { LDCL p1, c2, [R0],#8 }
  2239. _T1 = *(_DWORD *)v5;
  2240. v5 += 8;
  2241. __asm { LDCL p1, c3, [R0],#8 }
  2242. _T1 = *(_DWORD *)v5;
  2243. v5 += 8;
  2244. __asm { LDCL p1, c4, [R0],#8 }
  2245. _T1 = *(_DWORD *)v5;
  2246. v5 += 8;
  2247. __asm { LDCL p1, c5, [R0],#8 }
  2248. _T1 = *(_DWORD *)v5;
  2249. v5 += 8;
  2250. __asm { LDCL p1, c6, [R0],#8 }
  2251. _T1 = *(_DWORD *)v5;
  2252. v5 += 8;
  2253. __asm { LDCL p1, c7, [R0],#8 }
  2254. _T1 = *(_DWORD *)v5;
  2255. v5 += 8;
  2256. __asm { LDCL p1, c8, [R0],#8 }
  2257. _T1 = *(_DWORD *)v5;
  2258. v5 += 8;
  2259. __asm { LDCL p1, c9, [R0],#8 }
  2260. _T1 = *(_DWORD *)v5;
  2261. v5 += 8;
  2262. __asm { LDCL p1, c10, [R0],#8 }
  2263. _T1 = *(_DWORD *)v5;
  2264. v5 += 8;
  2265. __asm { LDCL p1, c11, [R0],#8 }
  2266. _T1 = *(_DWORD *)v5;
  2267. v5 += 8;
  2268. __asm { LDCL p1, c12, [R0],#8 }
  2269. _T1 = *(_DWORD *)v5;
  2270. v5 += 8;
  2271. __asm { LDCL p1, c13, [R0],#8 }
  2272. _T1 = *(_DWORD *)v5;
  2273. v5 += 8;
  2274. __asm { LDCL p1, c14, [R0],#8 }
  2275. _T1 = *(_DWORD *)v5;
  2276. result = v5 + 8;
  2277. __asm { LDCL p1, c15, [R0],#8 }
  2278. return result;
  2279. }
  2280.  
  2281. //----- (00002B3C) --------------------------------------------------------
  2282. int __fastcall sub_2B3C(int a1)
  2283. {
  2284. int v5; // r0@1
  2285. int result; // r0@1
  2286.  
  2287. _T1 = *(_DWORD *)a1;
  2288. v5 = a1 + 4;
  2289. __asm { LDC2 p1, c8, [R0],#4 }
  2290. _T1 = *(_DWORD *)v5;
  2291. v5 += 4;
  2292. __asm { LDC2 p1, c9, [R0],#4 }
  2293. _T1 = *(_DWORD *)v5;
  2294. v5 += 4;
  2295. __asm { LDC2 p1, c10, [R0],#4 }
  2296. _T1 = *(_DWORD *)v5;
  2297. result = v5 + 4;
  2298. __asm { LDC2 p1, c11, [R0],#4 }
  2299. return result;
  2300. }
  2301.  
  2302. //----- (00002B50) --------------------------------------------------------
  2303. void sub_2B50()
  2304. {
  2305. sub_2B54();
  2306. }
  2307.  
  2308. //----- (00002B54) --------------------------------------------------------
  2309. void sub_2B54()
  2310. {
  2311. JUMPOUT(sub_2ACC);
  2312. }
  2313. // 2ACC: using guessed type int sub_2ACC();
  2314.  
  2315. //----- (00002B60) --------------------------------------------------------
  2316. int __fastcall sub_2B60(int a1)
  2317. {
  2318. return sub_2B64(a1);
  2319. }
  2320.  
  2321. //----- (00002B64) --------------------------------------------------------
  2322. int __fastcall sub_2B64(int a1)
  2323. {
  2324. return sub_2B3C(a1);
  2325. }
  2326.  
  2327. // ALL OK, 64 function(s) have been successfully decompiled
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement