Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This file has been generated by the Hex-Rays decompiler.
- Copyright (c) 2007-2014 Hex-Rays <info@hex-rays.com>
- Detected compiler: GNU C++
- */
- #include <defs.h>
- //-------------------------------------------------------------------------
- // Function declarations
- // int __fastcall _cxa_finalize(_DWORD); weak
- // int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr);
- // int access(const char *name, int type);
- // void free(void *ptr);
- // int strcmp(const char *s1, const char *s2);
- // int open(const char *file, int oflag, ...);
- // int _android_log_print(_DWORD, _DWORD, const char *, ...); weak
- // int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
- // void *malloc(size_t size);
- // void *memset(void *s, int c, size_t n);
- // int _sprintf_chk(_DWORD, _DWORD, _DWORD, const char *, ...); weak
- // ssize_t write(int fd, const void *buf, size_t n);
- // int close(int fd);
- // int __fastcall _errno(_DWORD); weak
- // int __fastcall _stack_chk_fail(_DWORD); weak
- // int pthread_mutex_lock(pthread_mutex_t *mutex);
- // int pthread_mutex_unlock(pthread_mutex_t *mutex);
- // int ioctl(int fd, unsigned __int32 request, ...);
- // int nanosleep(const struct timespec *requested_time, struct timespec *remaining);
- // void perror(const char *s);
- // void abort(void);
- // int fprintf(FILE *stream, const char *format, ...);
- // int __fastcall _aeabi_memcpy(_DWORD); weak
- // int __fastcall _aeabi_memset(_DWORD, _DWORD, _DWORD); weak
- // int dladdr(void); weak
- // int __fastcall _snprintf_chk(_DWORD, _DWORD, _DWORD, _DWORD); weak
- // int __fastcall _gnu_Unwind_Find_exidx(_DWORD, _DWORD); weak
- int sub_D54();
- int (*__fastcall sub_D74(int (*result)(void)))(void);
- unsigned int init_globals();
- int __fastcall sub_E64(void *a1);
- signed int __fastcall sub_E70(int a1, const char *a2, int a3);
- int __fastcall sub_FB4(const char *a1);
- int __fastcall sub_1038(int a1, int a2);
- int __fastcall sub_107C(int a1, int a2);
- int sub_10B4();
- int __fastcall sub_10E8(int a1, int a2);
- int __fastcall sub_113C(int a1, int a2);
- int __fastcall sub_11A8(int a1);
- int __fastcall sub_12DC(int a1, int a2);
- int __fastcall sub_133C(int a1, int a2);
- int __fastcall led_wait_delay(int a1, int a2, __time_t a3, __int32 a4);
- signed int __fastcall sub_13E8(int a1, int a2, unsigned int a3, unsigned int a4);
- signed int __fastcall sub_1728(int a1, unsigned int a2, unsigned int a3, int a4, int *a5);
- signed int __fastcall sub_17CC(int a1, unsigned int a2, unsigned int a3, int a4);
- signed int __fastcall sub_18F4(int a1, int a2, int a3);
- void sub_1948();
- void sub_1950();
- signed int __fastcall sub_19EC(int a1, int a2, char a3);
- void __fastcall sub_1B08(int a1, int a2, int a3);
- int __fastcall sub_1B8C(int a1, int a2, int a3, int a4, int a5);
- int __fastcall sub_1BA4(int _R0);
- int __fastcall sub_1BAC(int _R0);
- int __fastcall sub_1BB4(int _R0);
- void sub_1BBC();
- void sub_1C00();
- int __fastcall sub_1C14(int a1);
- signed int __fastcall sub_1C64(int a1, int a2, int a3);
- signed int __fastcall sub_1C94(int a1, int a2, int a3);
- signed int __fastcall sub_1CD8(int a1, int a2, int a3);
- signed int __fastcall sub_1D08(int a1, int a2, int a3, int a4);
- int __fastcall sub_1D40(int a1);
- signed int __fastcall sub_1D48(int a1, int a2);
- signed int __fastcall sub_1D68(int a1);
- int __fastcall sub_1D80(int a1);
- int __fastcall sub_1D90(int a1, int a2);
- int __fastcall sub_1DB0(int a1, signed int a2);
- int __fastcall sub_1E4C(int result, signed int a2, int a3);
- int __fastcall sub_1EE4(int a1, int a2);
- __int64 __fastcall sub_1F04(int a1, int a2);
- int __fastcall sub_1FB4(int a1, int a2, int a3, int a4);
- signed int __fastcall sub_2088(int a1);
- int __fastcall sub_20D4(int a1, int a2);
- void __fastcall sub_210C(int a1);
- int __fastcall sub_2124(int a1);
- signed int __fastcall sub_212C(int a1, int a2, int a3, int a4);
- int __fastcall sub_2188(int a1, int a2);
- int __fastcall sub_21D8(int a1, signed int a2);
- int __fastcall sub_21E0(int result);
- void __fastcall sub_21E8(int a1, int a2, int a3, int a4);
- int __fastcall sub_221C(int a1);
- int sub_2270(); // weak
- int __fastcall sub_23F8(int result, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
- int sub_2ACC(); // weak
- int __fastcall sub_2AE0(int _R0);
- int __fastcall sub_2AE8(int _R0);
- int __fastcall sub_2AF0(int _R0);
- int __fastcall sub_2AF8(int a1);
- int __fastcall sub_2B3C(int a1);
- void sub_2B50();
- void sub_2B54();
- int __fastcall sub_2B60(int a1);
- int __fastcall sub_2B64(int a1);
- //-------------------------------------------------------------------------
- // Data declarations
- _UNKNOWN loc_18FC; // weak
- void *off_4E14 = (void *)0x1D89; // weak
- int GLOBAL_OFFSET_TABLE_ = 0; // weak
- void *off_5000 = &off_5000; // weak
- int dword_5008 = 255; // weak
- _UNKNOWN unk_508C; // weak
- int dword_5090; // weak
- _UNKNOWN unk_5094; // weak
- _UNKNOWN unk_5098; // weak
- _UNKNOWN unk_509C; // weak
- _UNKNOWN unk_50A0; // weak
- int dword_50A4; // weak
- _UNKNOWN unk_50A8; // weak
- int dword_50AC; // weak
- int dword_50B0; // weak
- _UNKNOWN unk_50B4; // weak
- _UNKNOWN unk_50B8; // weak
- _UNKNOWN unk_50BC; // weak
- _UNKNOWN unk_50C0; // weak
- _UNKNOWN unk_50C4; // weak
- int dword_50C8; // weak
- _UNKNOWN unk_50CC; // weak
- // extern _UNKNOWN _stack_chk_guard; weak
- // extern struct _IO_FILE *stderr;
- //----- (00000D54) --------------------------------------------------------
- int sub_D54()
- {
- return _cxa_finalize(&off_5000);
- }
- // BF8: using guessed type int __fastcall _cxa_finalize(_DWORD);
- // 5000: using guessed type void *off_5000;
- //----- (00000D74) --------------------------------------------------------
- int (*__fastcall sub_D74(int (*result)(void)))(void)
- {
- if ( result )
- result = (int (*)(void))result();
- return result;
- }
- //----- (00000E34) --------------------------------------------------------
- unsigned int init_globals()
- {
- unsigned int result; // r0@1
- pthread_mutex_init((pthread_mutex_t *)&unk_50A8, 0);
- result = __clz(access("/sys/class/leds/jogball-backlight/brightness", 2));
- dword_50A4 = result >> 5;
- return result;
- }
- // 50A4: using guessed type int dword_50A4;
- //----- (00000E64) --------------------------------------------------------
- int __fastcall sub_E64(void *a1)
- {
- if ( a1 )
- free(a1);
- return 0;
- }
- //----- (00000E70) --------------------------------------------------------
- signed int __fastcall sub_E70(int a1, const char *a2, int a3)
- {
- int v3; // r7@1
- const char *v4; // r4@1
- int v5; // r6@1
- int (__fastcall *v6)(int, int); // r4@7
- void *v7; // r5@15
- signed int result; // r0@15
- v3 = a1;
- v4 = a2;
- v5 = a3;
- if ( !strcmp("backlight", a2) )
- {
- v6 = sub_113C;
- goto LABEL_15;
- }
- if ( !strcmp("keyboard", v4) )
- {
- v6 = sub_107C;
- goto LABEL_15;
- }
- if ( !strcmp("buttons", v4) )
- {
- v6 = sub_1038;
- goto LABEL_15;
- }
- if ( !strcmp("battery", v4) )
- {
- v6 = sub_133C;
- goto LABEL_15;
- }
- if ( !strcmp("notifications", v4) )
- {
- dword_50AC = open("/dev/aw2013", 0);
- if ( dword_50AC < 0 )
- {
- v6 = sub_12DC;
- _android_log_print(3, "lights", " /dev/aw2013 open fail!");
- }
- else
- {
- v6 = sub_12DC;
- _android_log_print(3, "lights", " fd_led = %d \n");
- }
- goto LABEL_15;
- }
- if ( !strcmp("attention", v4) )
- {
- v6 = sub_10E8;
- LABEL_15:
- pthread_once((pthread_once_t *)&unk_508C, (void (*)(void))init_globals);
- v7 = malloc(0x44u);
- memset(v7, 0, 0x44u);
- *((_DWORD *)v7 + 15) = sub_E64;
- result = 0;
- *(_DWORD *)v7 = 1213678676;
- *((_DWORD *)v7 + 2) = v3;
- *((_DWORD *)v7 + 16) = v6;
- *(_DWORD *)v5 = v7;
- return result;
- }
- return -22;
- }
- // C58: using guessed type int _android_log_print(_DWORD, _DWORD, const char *, ...);
- // 50AC: using guessed type int dword_50AC;
- //----- (00000FB4) --------------------------------------------------------
- int __fastcall sub_FB4(const char *a1)
- {
- int v1; // r4@1
- int v2; // r0@1
- size_t v3; // r0@2
- ssize_t v4; // r5@2
- int result; // r0@3
- char v6; // [sp+8h] [bp-30h]@2
- int v7; // [sp+1Ch] [bp-1Ch]@1
- v7 = _stack_chk_guard;
- v1 = open(a1, 2);
- v2 = _android_log_print(3, "lights", "write_int open fd=%d\n", v1);
- if ( v1 < 0 || (v3 = _sprintf_chk(&v6, 0, 20, "%d\n"), v4 = write(v1, &v6, v3), v2 = close(v1), v4 == -1) )
- result = -*(_DWORD *)_errno(v2);
- else
- result = 0;
- if ( v7 != _stack_chk_guard )
- _stack_chk_fail(result);
- return result;
- }
- // C58: using guessed type int _android_log_print(_DWORD, _DWORD, const char *, ...);
- // C88: using guessed type int _sprintf_chk(_DWORD, _DWORD, _DWORD, const char *, ...);
- // CAC: using guessed type int __fastcall _errno(_DWORD);
- // CB8: using guessed type int __fastcall _stack_chk_fail(_DWORD);
- //----- (00001038) --------------------------------------------------------
- int __fastcall sub_1038(int a1, int a2)
- {
- int v2; // r4@1
- int v3; // r4@1
- v2 = *(_DWORD *)a2 & 0xFFFFFF;
- pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
- dword_50C8 = v2;
- v3 = sub_FB4("/sys/class/leds/button-backlight/brightness");
- pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
- return v3;
- }
- // 50C8: using guessed type int dword_50C8;
- //----- (0000107C) --------------------------------------------------------
- int __fastcall sub_107C(int a1, int a2)
- {
- int v2; // r4@1
- int v3; // r4@1
- v2 = *(_DWORD *)a2 & 0xFFFFFF;
- pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
- v3 = sub_FB4("/sys/class/leds/keyboard-backlight/brightness");
- pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
- return v3;
- }
- //----- (000010B4) --------------------------------------------------------
- int sub_10B4()
- {
- int result; // r0@3
- if ( dword_50B0 != 7 && dword_50B0 == -1 )
- result = 0;
- else
- result = sub_FB4("/sys/class/leds/jogball-backlight/brightness");
- return result;
- }
- // 50B0: using guessed type int dword_50B0;
- //----- (000010E8) --------------------------------------------------------
- int __fastcall sub_10E8(int a1, int a2)
- {
- int v2; // r4@1
- int v3; // r3@1
- v2 = a2;
- pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
- v3 = *(_DWORD *)(v2 + 4);
- if ( v3 == 2 )
- {
- dword_50B0 = *(_DWORD *)(v2 + 8);
- }
- else if ( !v3 )
- {
- dword_50B0 = 0;
- }
- if ( dword_50A4 )
- sub_10B4();
- pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
- return 0;
- }
- // 50A4: using guessed type int dword_50A4;
- // 50B0: using guessed type int dword_50B0;
- //----- (0000113C) --------------------------------------------------------
- int __fastcall sub_113C(int a1, int a2)
- {
- int v2; // r4@1
- int v3; // r4@1
- v2 = (150 * (unsigned __int16)(*(_WORD *)a2 >> 8) + 77 * ((*(_DWORD *)a2 & 0xFFFFFF) >> 16) + 29 * *(_DWORD *)a2) >> 8;
- pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
- dword_5008 = v2;
- v3 = sub_FB4("/sys/class/leds/lcd-backlight/brightness");
- if ( dword_50A4 )
- sub_10B4();
- pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
- return v3;
- }
- // 5008: using guessed type int dword_5008;
- // 50A4: using guessed type int dword_50A4;
- //----- (000011A8) --------------------------------------------------------
- int __fastcall sub_11A8(int a1)
- {
- int v1; // r6@0
- int v2; // r8@0
- int v3; // r10@0
- int v4; // r4@1
- int v5; // r3@1
- unsigned int v6; // r5@1
- int v7; // r0@7
- bool v8; // zf@7
- int v9; // r4@7
- int v10; // r1@17
- const char *v11; // r2@17
- int v13; // [sp+1Ch] [bp-4Ch]@11
- int v14; // [sp+20h] [bp-48h]@16
- int v15; // [sp+24h] [bp-44h]@16
- int v16; // [sp+28h] [bp-40h]@16
- unsigned int v17; // [sp+2Ch] [bp-3Ch]@16
- int v18; // [sp+30h] [bp-38h]@16
- int v19; // [sp+34h] [bp-34h]@16
- int v20; // [sp+38h] [bp-30h]@16
- int v21; // [sp+3Ch] [bp-2Ch]@16
- v4 = a1;
- _android_log_print(3, "lights", "state->flashMode =%d\n", *(_DWORD *)(a1 + 4));
- v5 = *(_DWORD *)(v4 + 4);
- v6 = *(_DWORD *)v4;
- if ( v5 == 1 )
- v2 = *(_DWORD *)(v4 + 8);
- else
- v1 = 0;
- if ( v5 == 1 )
- v1 = *(_DWORD *)(v4 + 12);
- else
- v2 = v1;
- v7 = _android_log_print(3, "lights", "set_led_state colorRGB=%08X, onMS=%d, offMS=%d\n", *(_DWORD *)v4, v2, v1);
- v9 = v6 >> 24;
- v8 = v6 >> 24 == 0;
- if ( v6 >> 24 )
- v7 = (unsigned __int16)v6 >> 8;
- else
- v6 = 0;
- if ( v8 )
- {
- v3 = v9;
- v13 = v9;
- }
- else
- {
- v13 = v7;
- }
- if ( !v8 )
- {
- v3 = (v6 >> 16) & 0xFF;
- v6 = (unsigned __int8)v6;
- }
- _android_log_print(
- 3,
- "lights",
- " alpha = %d red =%d green = %d blue =%d onMS = %d offMS = %d fd_led = %d \n",
- v9,
- v3,
- v13,
- v6,
- v2,
- v1,
- dword_50AC);
- if ( v9 )
- {
- v19 = v1;
- v14 = v9;
- v15 = v3;
- v16 = v13;
- v17 = v6;
- v18 = v2;
- v20 = 2000;
- v21 = 2000;
- if ( ioctl(dword_50AC, 0x40208803u, &v14) )
- {
- v10 = (int)"lights";
- v11 = " led ioctl AW2013_IOCTL_SETRGB_BRIGHNESS fail! alpha = %d \n";
- LABEL_21:
- _android_log_print(3, v10, v11, v9);
- return 0;
- }
- _android_log_print(3, "lights", " ioctl success! ");
- }
- else
- {
- memset(&v14, 0, 0x20u);
- if ( ioctl(dword_50AC, 0x40208803u, &v14) )
- {
- v10 = (int)"lights";
- v11 = " led ioctl AW2013_IOCTL_SETRGB_BRIGHNESS fail! alpha = %d \n ";
- goto LABEL_21;
- }
- }
- return 0;
- }
- // C58: using guessed type int _android_log_print(_DWORD, _DWORD, const char *, ...);
- // 50AC: using guessed type int dword_50AC;
- //----- (000012DC) --------------------------------------------------------
- int __fastcall sub_12DC(int a1, int a2)
- {
- int v2; // r4@1
- int v3; // r1@1
- int v4; // r2@1
- int v5; // r3@1
- int v6; // r0@3
- v2 = a2;
- pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
- v3 = *(_DWORD *)(v2 + 4);
- v4 = *(_DWORD *)(v2 + 8);
- v5 = *(_DWORD *)(v2 + 12);
- unk_50B4 = *(_DWORD *)v2;
- unk_50B8 = v3;
- unk_50BC = v4;
- unk_50C0 = v5;
- unk_50C4 = *(_DWORD *)(v2 + 16);
- if ( dword_50A4 )
- sub_10B4();
- v6 = (int)&dword_5090;
- if ( !(dword_5090 & 0xFFFFFF) )
- {
- sub_11A8((int)&dword_5090);
- v6 = (int)&unk_50B4;
- }
- sub_11A8(v6);
- pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
- return 0;
- }
- // 5090: using guessed type int dword_5090;
- // 50A4: using guessed type int dword_50A4;
- //----- (0000133C) --------------------------------------------------------
- int __fastcall sub_133C(int a1, int a2)
- {
- int v2; // r6@1
- int v3; // r5@1
- int v4; // r1@1
- int v5; // r2@1
- int v6; // r3@1
- int v7; // r0@3
- v2 = a2;
- v3 = a2;
- pthread_mutex_lock((pthread_mutex_t *)&unk_50A8);
- v4 = *(_DWORD *)(v3 + 4);
- v5 = *(_DWORD *)(v3 + 8);
- v6 = *(_DWORD *)(v3 + 12);
- dword_5090 = *(_DWORD *)v3;
- unk_5094 = v4;
- unk_5098 = v5;
- unk_509C = v6;
- unk_50A0 = *(_DWORD *)(v3 + 16);
- if ( dword_50A4 )
- sub_11A8(v2);
- v7 = (int)&dword_5090;
- if ( !(dword_5090 & 0xFFFFFF) )
- {
- sub_11A8((int)&dword_5090);
- v7 = (int)&unk_50B4;
- }
- sub_11A8(v7);
- pthread_mutex_unlock((pthread_mutex_t *)&unk_50A8);
- return 0;
- }
- // 5090: using guessed type int dword_5090;
- // 50A4: using guessed type int dword_50A4;
- //----- (000013A0) --------------------------------------------------------
- int __fastcall led_wait_delay(int a1, int a2, __time_t a3, __int32 a4)
- {
- int result; // r0@2
- int v5; // r6@3
- int v6; // [sp+0h] [bp-20h]@1
- int v7; // [sp+4h] [bp-1Ch]@1
- struct timespec remaining; // [sp+8h] [bp-18h]@1
- remaining.tv_sec = a3;
- remaining.tv_nsec = a4;
- v6 = 0;
- v7 = 1000000 * a1;
- while ( 1 )
- {
- result = nanosleep((const struct timespec *)&v6, &remaining);
- if ( !result )
- break;
- v5 = _errno(result);
- if ( *(_DWORD *)v5 != 4 )
- {
- perror("nanosleep");
- return *(_DWORD *)v5;
- }
- *(_QWORD *)&v6 = remaining;
- }
- return result;
- }
- // CAC: using guessed type int __fastcall _errno(_DWORD);
- //----- (000013E8) --------------------------------------------------------
- signed int __fastcall sub_13E8(int a1, int a2, unsigned int a3, unsigned int a4)
- {
- unsigned int v4; // r5@1
- unsigned int v5; // r7@1
- int v6; // r10@1
- int v7; // r4@1
- int v8; // r11@2
- int v9; // r8@7
- int v10; // r9@7
- int v11; // r0@8
- int v12; // r2@9
- int v13; // r1@10
- signed int result; // r0@10
- int v15; // r2@13
- int v16; // r3@19
- int v17; // r2@19
- int v18; // r0@19
- unsigned int v19; // r1@19
- int v20; // r2@38
- int v21; // r0@40
- unsigned int v22; // r1@40
- int v23; // r3@40
- unsigned int v24; // r1@41
- unsigned int v25; // r0@41
- int v26; // r1@43
- int v27; // r6@46
- char v28; // r1@46
- int v30; // r0@51
- unsigned int v36; // r0@52
- int v37; // [sp+4h] [bp-34h]@59
- int v38; // [sp+8h] [bp-30h]@6
- int v39; // [sp+Ch] [bp-2Ch]@22
- int v40; // [sp+10h] [bp-28h]@8
- v4 = a4;
- v5 = a3;
- v6 = a2;
- v7 = a1;
- if ( a3 >= a4 )
- goto LABEL_59;
- v8 = 0;
- do
- {
- v9 = v5 + 1;
- v10 = *(_BYTE *)(v6 + (v5 ^ 3));
- if ( !(v10 & 0x80) )
- {
- sub_1C64(v7, 13, (int)&v40);
- v11 = 4 * v10;
- if ( v10 & 0x40 )
- v12 = -4 - (unsigned __int8)(v11 & 0xFC) + v40;
- else
- v12 = v11 + v40 + 4;
- v40 = v12;
- LABEL_23:
- sub_1C94(v7, 13, v12);
- ++v5;
- continue;
- }
- v13 = v10 & 0xF0;
- result = 9;
- if ( (v10 & 0xF0) > 159 )
- {
- if ( v13 > 191 )
- {
- if ( v13 == 192 )
- {
- if ( (unsigned int)(v10 - 192) <= 9 )
- {
- switch ( v10 )
- {
- case 7:
- if ( !*(_BYTE *)(v6 + (v9 ^ 3)) || (unsigned int)*(_BYTE *)(v6 + (v9 ^ 3)) >= 0x10 )
- return 9;
- goto LABEL_56;
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- v19 = 3;
- v17 = ((v10 & 7) + 1) | 0xA0000;
- v18 = v7;
- goto LABEL_34;
- case 8:
- case 9:
- v24 = *(_BYTE *)(v6 + (v9 ^ 3));
- v25 = v24 >> 4;
- if ( v10 == 200 )
- v25 = (v24 >> 4) | 0x10;
- v26 = v24 & 0xF;
- if ( (signed int)(v25 + v26) > 31 )
- return 9;
- v20 = (v26 + 1) | (v25 << 16);
- v21 = v7;
- v22 = 1;
- goto LABEL_54;
- case 6:
- v36 = *(_BYTE *)(v6 + (v9 ^ 3));
- if ( (signed int)((v36 & 0xF) + (v36 >> 4)) > 15 )
- return 9;
- v20 = ((v36 & 0xF) + 1) | (v36 >> 4 << 16);
- v21 = v7;
- v22 = 3;
- LABEL_54:
- v23 = 5;
- LABEL_55:
- sub_17CC(v21, v22, v20, v23);
- goto LABEL_56;
- default:
- return 9;
- }
- }
- return 9;
- }
- if ( v13 != 208 )
- return result;
- if ( v10 & 8 )
- return 9;
- v19 = 1;
- v17 = ((v10 & 7) + 1) | 0x80000;
- v18 = v7;
- LABEL_34:
- v16 = 5;
- goto LABEL_35;
- }
- if ( v13 == 160 )
- {
- v16 = 0;
- v17 = ((16 << ((v10 & 7) + 1)) - 16) | (v10 << 11) & 0x4000;
- v18 = v7;
- v19 = 0;
- LABEL_35:
- sub_17CC(v18, v19, v17, v16);
- ++v5;
- continue;
- }
- if ( v13 != 176 )
- return result;
- if ( (unsigned int)(v10 - 176) > 7 )
- {
- def_1582:
- v19 = 1;
- v16 = 1;
- v17 = ((v10 & 7) + 1) | 0x80000;
- v18 = v7;
- goto LABEL_35;
- }
- result = 9;
- switch ( v10 )
- {
- case 1:
- if ( v9 >= v4 )
- return 9;
- v20 = *(_BYTE *)(v6 + (v9 ^ 3));
- result = 9;
- if ( !*(_BYTE *)(v6 + (v9 ^ 3)) || v20 & 0xF0 )
- return result;
- v21 = v7;
- v22 = 0;
- v23 = 0;
- goto LABEL_55;
- case 2:
- if ( v9 >= v4 )
- return 9;
- v5 += 2;
- v27 = 0;
- v28 = 0;
- break;
- case 3:
- v23 = 1;
- v30 = *(_BYTE *)(v6 + (v9 ^ 3));
- _R1 = v30 << 12;
- __asm { UXTB16.W R1, R1 }
- v20 = ((v30 & 0xF) + 1) | _R1;
- v21 = v7;
- v22 = 1;
- goto LABEL_55;
- case 0:
- goto LABEL_58;
- case 4:
- case 5:
- case 6:
- case 7:
- return result;
- default:
- goto def_1582;
- }
- while ( 1 )
- {
- v27 |= (*(_BYTE *)(v6 + ((v5 - 1) ^ 3)) & 0x7F) << v28;
- if ( !(*(_BYTE *)(v6 + ((v5 - 1) ^ 3)) & 0x80) )
- break;
- v28 += 7;
- _CF = v5 >= v4;
- result = 9;
- ++v5;
- if ( _CF )
- return result;
- }
- sub_1C64(v7, 13, (int)&v38);
- v38 += 4 * v27 + 516;
- sub_1C94(v7, 13, v38);
- }
- else
- {
- if ( v13 != 128 )
- {
- if ( v13 != 144 )
- return result;
- if ( (v10 & 0xF | 2) == 15 )
- return 9;
- sub_1C64(v7, v10 & 0xF, (int)&v39);
- v12 = v39;
- goto LABEL_23;
- }
- if ( v9 >= v4 )
- return 9;
- v15 = (unsigned __int16)((_WORD)v10 << 12) | 16 * *(_BYTE *)(v6 + (v9 ^ 3));
- if ( !v15 )
- return 9;
- sub_17CC(v7, 0, v15, 0);
- v8 |= (((_WORD)v10 << 12) & 0x8000u) >> 15;
- LABEL_56:
- v5 += 2;
- }
- }
- while ( v5 < v4 );
- LABEL_58:
- if ( v8 & 1 )
- return 8;
- LABEL_59:
- sub_1C64(v7, 14, (int)&v37);
- sub_1C94(v7, 15, v37);
- return 8;
- }
- //----- (00001728) --------------------------------------------------------
- signed int __fastcall sub_1728(int a1, unsigned int a2, unsigned int a3, int a4, int *a5)
- {
- int v5; // r5@1
- int v6; // r4@1
- signed int result; // r0@3
- int v8; // r2@5
- int v9; // r0@5
- int v10; // r1@5
- __int64 v11; // r2@11
- int v12; // r1@11
- v5 = a3;
- v6 = a1;
- if ( a2 > 4 )
- def_1734:
- sub_1B08(
- (int)"_Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, uint32_t, _Unwind_VRS_DataRepresentation, void *)",
- 831,
- (int)"unsupported register class");
- switch ( a2 )
- {
- case 0u:
- result = 2;
- if ( a3 > 0xF || a4 )
- return result;
- v8 = *a5;
- v9 = v6;
- v10 = v5;
- goto LABEL_15;
- case 1u:
- if ( a4 == 5 )
- {
- if ( a3 <= 0x1F )
- goto LABEL_22;
- return 2;
- }
- if ( a4 != 1 || a3 > 0xF )
- return 2;
- sub_1D80(a1);
- LABEL_22:
- v11 = *(_QWORD *)a5;
- v12 = v5 + 256;
- LABEL_23:
- result = sub_1D08(v6, v12, v11, SHIDWORD(v11));
- LABEL_24:
- if ( result )
- result = 2;
- return result;
- case 3u:
- result = 2;
- if ( a3 > 0x1F || a4 != 5 )
- return result;
- v11 = *(_QWORD *)a5;
- v12 = v5 + 112;
- goto LABEL_23;
- case 4u:
- result = 2;
- if ( a3 > 3 || a4 )
- return result;
- v8 = *a5;
- v10 = v5 + 192;
- v9 = v6;
- LABEL_15:
- result = sub_1C94(v9, v10, v8);
- goto LABEL_24;
- default:
- goto def_1734;
- }
- }
- //----- (000017CC) --------------------------------------------------------
- signed int __fastcall sub_17CC(int a1, unsigned int a2, unsigned int a3, int a4)
- {
- unsigned int v4; // r5@1
- int v5; // r7@1
- unsigned int v6; // r6@1
- int v7; // r8@1
- int v8; // r4@5
- unsigned int v9; // r7@5
- int v10; // r0@7
- signed int v11; // r0@7
- signed int v12; // r1@7
- signed int v13; // r2@7
- signed int result; // r0@15
- unsigned int v15; // r4@19
- int v16; // r6@19
- int v17; // r0@20
- int v18; // r2@20
- int v19; // r2@23
- int v20; // [sp+8h] [bp-38h]@20
- int v21; // [sp+Ch] [bp-34h]@20
- int v22; // [sp+14h] [bp-2Ch]@17
- int v23; // [sp+18h] [bp-28h]@7
- int v24; // [sp+1Ch] [bp-24h]@4
- v4 = a2;
- v5 = a4;
- v6 = a3;
- v7 = a1;
- if ( a2 > 4 )
- def_17E0:
- sub_1B08(
- (int)"_Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, uint32_t, _Unwind_VRS_DataRepresentation)",
- 965,
- (int)"unsupported register class");
- switch ( a2 )
- {
- case 0u:
- case 4u:
- if ( a4 || sub_1C64(a1, 13, (int)&v24) )
- return 2;
- v8 = 0;
- v9 = 0;
- do
- {
- if ( (1 << v9) & v6 )
- {
- v10 = v24;
- v24 += 4;
- v23 = *(_DWORD *)v10;
- v11 = sub_1728(v7, v4, v9, 0, &v23);
- v12 = 0;
- v13 = 0;
- if ( v9 == 13 )
- v12 = 1;
- if ( !v4 )
- v13 = 1;
- if ( v11 )
- return 2;
- v8 |= v13 & v12;
- }
- ++v9;
- }
- while ( v9 < 0x10 );
- if ( v8 & 1 )
- return 0;
- v19 = v24;
- goto LABEL_29;
- case 1u:
- case 3u:
- if ( (a4 | 4) != 5 || sub_1C64(a1, 13, (int)&v22) )
- return 2;
- if ( !(_WORD)v6 )
- goto LABEL_22;
- v15 = v6 >> 16;
- v16 = (v6 >> 16) + v6;
- break;
- default:
- goto def_17E0;
- }
- do
- {
- v17 = v22;
- v22 += 4;
- v18 = *(_DWORD *)v17;
- v22 = v17 + 8;
- v21 = *(_DWORD *)(v17 + 4);
- v20 = v18;
- if ( sub_1728(v7, v4, v15, v5, &v20) )
- return 2;
- ++v15;
- }
- while ( v15 < v16 );
- LABEL_22:
- if ( v5 == 1 )
- {
- v19 = v22 + 4;
- v22 += 4;
- }
- else
- {
- v19 = v22;
- }
- LABEL_29:
- result = sub_1C94(v7, 13, v19);
- if ( result )
- result = 2;
- return result;
- }
- //----- (000018F4) --------------------------------------------------------
- signed int __fastcall sub_18F4(int a1, int a2, int a3)
- {
- int v3; // r0@1
- int v4; // r1@1
- int v5; // r12@1
- int v6; // r3@1
- bool v7; // zf@2
- unsigned int v8; // r3@6
- unsigned int v9; // r2@6
- v3 = a2;
- v4 = a3;
- v5 = *(_DWORD *)(v3 + 76);
- v6 = (*(_DWORD *)v5 >> 24) & 0xF;
- if ( v6 )
- {
- v7 = v6 == 1;
- if ( v6 != 1 )
- v7 = v6 == 3;
- if ( !v7 )
- return 9;
- v8 = 4 * ((*(_DWORD *)v5 >> 16) & 0xFF) + 4;
- v9 = 2;
- }
- else
- {
- v9 = 1;
- v8 = 4;
- }
- if ( !v5 || !(*(_BYTE *)(v3 + 80) & 1) && *(_DWORD *)(v5 + v8) )
- return 9;
- return sub_13E8(v4, v5, v9, v8);
- }
- //----- (00001948) --------------------------------------------------------
- void sub_1948()
- {
- JUMPOUT(&loc_18FC);
- }
- //----- (00001950) --------------------------------------------------------
- void sub_1950()
- {
- JUMPOUT(&loc_18FC);
- }
- //----- (000019EC) --------------------------------------------------------
- signed int __fastcall sub_19EC(int a1, int a2, char a3)
- {
- int v3; // r4@1
- char v4; // r10@1
- signed int i; // r6@1
- signed int v6; // r7@3
- int v7; // r0@8
- int v8; // r3@11
- int v9; // r0@12
- int v11; // [sp+0h] [bp-4B0h]@17
- int v12; // [sp+4h] [bp-4ACh]@10
- int v13; // [sp+10h] [bp-4A0h]@11
- int v14; // [sp+18h] [bp-498h]@12
- int v15; // [sp+24h] [bp-48Ch]@12
- int v16; // [sp+2Ch] [bp-484h]@10
- char v17; // [sp+30h] [bp-480h]@1
- v3 = a2;
- v4 = a3;
- sub_1C14((int)&v17);
- for ( i = 1; ; --i )
- {
- v6 = 1;
- if ( v4 & 1 )
- {
- v6 = 2;
- if ( !i )
- {
- sub_1C94((int)&v17, -1, *(_DWORD *)(v3 + 16));
- v4 = 0;
- }
- }
- v7 = sub_1D40((int)&v17);
- if ( !v7 )
- break;
- if ( v7 < 0 )
- return 2;
- sub_1C64((int)&v17, -2, (int)&v16);
- if ( sub_1D48((int)&v17, (int)&v12) )
- return 2;
- v8 = v13;
- if ( v13 )
- {
- *(_DWORD *)(v3 + 72) = v12;
- *(_DWORD *)(v3 + 76) = v15;
- *(_DWORD *)(v3 + 80) = v14;
- v9 = ((int (__fastcall *)(signed int, int, char *))v8)(v6, v3, &v17);
- if ( v9 == 7 )
- {
- sub_1C64((int)&v17, -1, (int)&v11);
- *(_DWORD *)(v3 + 16) = v11;
- sub_1D68((int)&v17);
- return 2;
- }
- if ( v9 == 9 )
- abort();
- if ( v9 != 8 )
- return 2;
- if ( v16 == *(_DWORD *)(v3 + 32) )
- sub_1B08(
- (int)"_Unwind_Reason_Code unwind_phase2(unw_context_t *, _Unwind_Exception *, bool)",
- 642,
- (int)"during phase1 personality function said it would stop here, but now in phase2 it did not stop here");
- }
- }
- return 5;
- }
- //----- (00001B08) --------------------------------------------------------
- void __fastcall sub_1B08(int a1, int a2, int a3)
- {
- fprintf((FILE *)stderr, "libunwind: %s %s:%d - %s\n", a1, "external/libcxxabi/src/Unwind/Unwind-EHABI.cpp", a2, a3);
- abort();
- }
- //----- (00001B8C) --------------------------------------------------------
- int __fastcall sub_1B8C(int a1, int a2, int a3, int a4, int a5)
- {
- int v5; // r4@0
- int v6; // r5@0
- int v7; // r6@0
- int v8; // r7@0
- int v9; // r8@0
- int v10; // r9@0
- int v11; // r10@0
- int v12; // r11@0
- int v13; // r12@0
- int v14; // lr@0
- *(_DWORD *)a1 = a1;
- *(_DWORD *)(a1 + 4) = a2;
- *(_DWORD *)(a1 + 8) = a3;
- *(_DWORD *)(a1 + 12) = a4;
- *(_DWORD *)(a1 + 16) = v5;
- *(_DWORD *)(a1 + 20) = v6;
- *(_DWORD *)(a1 + 24) = v7;
- *(_DWORD *)(a1 + 28) = v8;
- *(_DWORD *)(a1 + 32) = v9;
- *(_DWORD *)(a1 + 36) = v10;
- *(_DWORD *)(a1 + 40) = v11;
- *(_DWORD *)(a1 + 44) = v12;
- *(_DWORD *)(a1 + 48) = v13;
- *(_DWORD *)(a1 + 52) = &a5;
- *(_DWORD *)(a1 + 56) = v14;
- *(_DWORD *)(a1 + 60) = v14;
- return 0;
- }
- //----- (00001BA4) --------------------------------------------------------
- int __fastcall sub_1BA4(int _R0)
- {
- int result; // r0@1
- __asm { VSTMIA R0, {D0-D15} }
- return result;
- }
- //----- (00001BAC) --------------------------------------------------------
- int __fastcall sub_1BAC(int _R0)
- {
- int result; // r0@1
- __asm { VSTMIA R0, {D0-D15} }
- return result;
- }
- //----- (00001BB4) --------------------------------------------------------
- int __fastcall sub_1BB4(int _R0)
- {
- int result; // r0@1
- __asm { VSTMIA R0, {D16-D31} }
- return result;
- }
- //----- (00001BBC) --------------------------------------------------------
- void sub_1BBC()
- {
- __asm
- {
- STCL p1, c0, [R0],#8
- STCL p1, c1, [R0],#8
- STCL p1, c2, [R0],#8
- STCL p1, c3, [R0],#8
- STCL p1, c4, [R0],#8
- STCL p1, c5, [R0],#8
- STCL p1, c6, [R0],#8
- STCL p1, c7, [R0],#8
- STCL p1, c8, [R0],#8
- STCL p1, c9, [R0],#8
- STCL p1, c10, [R0],#8
- STCL p1, c11, [R0],#8
- STCL p1, c12, [R0],#8
- STCL p1, c13, [R0],#8
- STCL p1, c14, [R0],#8
- STCL p1, c15, [R0],#8
- }
- }
- //----- (00001C00) --------------------------------------------------------
- void sub_1C00()
- {
- __asm
- {
- STC2 p1, c8, [R0],#4
- STC2 p1, c9, [R0],#4
- STC2 p1, c10, [R0],#4
- STC2 p1, c11, [R0],#4
- }
- }
- //----- (00001C14) --------------------------------------------------------
- int __fastcall sub_1C14(int a1)
- {
- int v1; // r4@1
- v1 = a1;
- *(_DWORD *)a1 = &off_4E14;
- *(_DWORD *)(a1 + 4) = &unk_50CC;
- *(_BYTE *)(a1 + 76) = 0;
- *(_DWORD *)(a1 + 72) = 0;
- _aeabi_memcpy(a1 + 8);
- _aeabi_memset(v1 + 80, 450, 0);
- sub_2188(v1, 0);
- return 0;
- }
- // D18: using guessed type int __fastcall _aeabi_memcpy(_DWORD);
- // D24: using guessed type int __fastcall _aeabi_memset(_DWORD, _DWORD, _DWORD);
- // 4E14: using guessed type void *;
- //----- (00001C64) --------------------------------------------------------
- signed int __fastcall sub_1C64(int a1, int a2, int a3)
- {
- int v3; // r6@1
- int v4; // r4@1
- int v5; // r5@1
- signed int result; // r0@2
- v3 = a1;
- v4 = a3;
- v5 = a2;
- if ( (*(int (**)(void))(*(_DWORD *)a1 + 8))() == 1 )
- {
- *(_DWORD *)v4 = (*(int (__fastcall **)(int, int))(*(_DWORD *)v3 + 12))(v3, v5);
- result = 0;
- }
- else
- {
- result = -6542;
- }
- return result;
- }
- //----- (00001C94) --------------------------------------------------------
- signed int __fastcall sub_1C94(int a1, int a2, int a3)
- {
- int v3; // r4@1
- int v4; // r6@1
- int v5; // r5@1
- signed int v6; // r5@3
- v3 = a1;
- v4 = a3;
- v5 = a2;
- if ( (*(int (**)(void))(*(_DWORD *)a1 + 8))() == 1 )
- {
- (*(void (__fastcall **)(int, int, int))(*(_DWORD *)v3 + 16))(v3, v5, v4);
- if ( v5 == -1 )
- {
- v6 = 0;
- (*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v3 + 52))(v3, 0);
- }
- else
- {
- v6 = 0;
- }
- }
- else
- {
- v6 = -6542;
- }
- return v6;
- }
- //----- (00001CD8) --------------------------------------------------------
- signed int __fastcall sub_1CD8(int a1, int a2, int a3)
- {
- int v3; // r6@1
- int v4; // r4@1
- int v5; // r5@1
- __int64 v6; // r0@2
- signed int result; // r0@2
- v3 = a1;
- v4 = a3;
- v5 = a2;
- if ( (*(int (**)(void))(*(_DWORD *)a1 + 20))() == 1 )
- {
- LODWORD(v6) = (*(int (__fastcall **)(int, int))(*(_DWORD *)v3 + 24))(v3, v5);
- *(_QWORD *)v4 = v6;
- result = 0;
- }
- else
- {
- result = -6542;
- }
- return result;
- }
- //----- (00001D08) --------------------------------------------------------
- signed int __fastcall sub_1D08(int a1, int a2, int a3, int a4)
- {
- int v4; // r7@1
- int v5; // r5@1
- int v6; // r6@1
- int v7; // r8@1
- signed int result; // r0@2
- v4 = a1;
- v5 = a3;
- v6 = a2;
- v7 = a4;
- if ( (*(int (**)(void))(*(_DWORD *)a1 + 20))() == 1 )
- {
- (*(void (__fastcall **)(int, int, int, int))(*(_DWORD *)v4 + 28))(v4, v6, v5, v7);
- result = 0;
- }
- else
- {
- result = -6542;
- }
- return result;
- }
- //----- (00001D40) --------------------------------------------------------
- int __fastcall sub_1D40(int a1)
- {
- return (*(int (**)(void))(*(_DWORD *)a1 + 32))();
- }
- //----- (00001D48) --------------------------------------------------------
- signed int __fastcall sub_1D48(int a1, int a2)
- {
- int v2; // r4@1
- signed int result; // r0@1
- v2 = a2;
- (*(void (**)(void))(*(_DWORD *)a1 + 36))();
- result = 0;
- if ( !*(_DWORD *)(v2 + 4) )
- result = -6549;
- return result;
- }
- //----- (00001D68) --------------------------------------------------------
- signed int __fastcall sub_1D68(int a1)
- {
- (*(void (**)(void))(*(_DWORD *)a1 + 40))();
- return -6540;
- }
- //----- (00001D80) --------------------------------------------------------
- int __fastcall sub_1D80(int a1)
- {
- return (*(int (**)(void))(*(_DWORD *)a1 + 60))();
- }
- //----- (00001D90) --------------------------------------------------------
- int __fastcall sub_1D90(int a1, int a2)
- {
- signed int v2; // r2@1
- bool v3; // zf@1
- signed int v4; // r0@1
- int v5; // r1@1
- v2 = 0;
- v3 = (a2 & 0xFFFFFFFC) == 192;
- v4 = 0;
- v5 = a2 - 16;
- if ( v3 )
- v4 = 1;
- if ( (unsigned int)v5 > 0xFFFFFFED )
- v2 = 1;
- return v4 | v2;
- }
- //----- (00001DB0) --------------------------------------------------------
- int __fastcall sub_1DB0(int a1, signed int a2)
- {
- signed int v2; // r5@1
- int v3; // r4@1
- int v4; // r0@7
- v2 = a2;
- v3 = a1;
- if ( a2 >= -1 )
- {
- if ( a2 > 13 )
- {
- if ( a2 == 14 )
- {
- v4 = a1 + 64;
- return *(_DWORD *)v4;
- }
- if ( a2 != 15 )
- goto LABEL_12;
- }
- else if ( a2 != -1 )
- {
- if ( a2 != 13 )
- goto LABEL_12;
- LABEL_7:
- v4 = a1 + 60;
- return *(_DWORD *)v4;
- }
- v4 = a1 + 68;
- return *(_DWORD *)v4;
- }
- if ( a2 == -2 )
- goto LABEL_7;
- LABEL_12:
- if ( (unsigned int)a2 > 0xC )
- {
- if ( (a2 & 0xFFFFFFFC) != 192 )
- sub_21E8(
- (int)"uint32_t libunwind::Registers_arm::getRegister(int)",
- (int)"external/libcxxabi/src/Unwind/Registers.hpp",
- 1452,
- (int)"unsupported arm register");
- if ( !*(_BYTE *)(a1 + 76) )
- {
- *(_BYTE *)(a1 + 76) = 1;
- sub_1C00();
- }
- v4 = v3 + 4 * v2 - 296;
- }
- else
- {
- v4 = a1 + 4 * a2 + 8;
- }
- return *(_DWORD *)v4;
- }
- //----- (00001E4C) --------------------------------------------------------
- int __fastcall sub_1E4C(int result, signed int a2, int a3)
- {
- signed int v3; // r6@1
- int v4; // r4@1
- int v5; // r5@1
- v3 = a2;
- v4 = a3;
- v5 = result;
- if ( a2 >= -1 )
- {
- if ( a2 > 13 )
- {
- if ( a2 == 14 )
- {
- *(_DWORD *)(result + 64) = a3;
- return result;
- }
- if ( a2 != 15 )
- goto LABEL_12;
- }
- else if ( a2 != -1 )
- {
- if ( a2 != 13 )
- goto LABEL_12;
- LABEL_7:
- *(_DWORD *)(result + 60) = a3;
- return result;
- }
- *(_DWORD *)(result + 68) = a3;
- return result;
- }
- if ( a2 == -2 )
- goto LABEL_7;
- LABEL_12:
- if ( (unsigned int)a2 > 0xC )
- {
- if ( (a2 & 0xFFFFFFFC) != 192 )
- sub_21E8(
- (int)"void libunwind::Registers_arm::setRegister(int, uint32_t)",
- (int)"external/libcxxabi/src/Unwind/Registers.hpp",
- 1471,
- (int)"unsupported arm register");
- if ( !*(_BYTE *)(result + 76) )
- {
- *(_BYTE *)(result + 76) = 1;
- sub_1C00();
- }
- result = v5 + 4 * v3;
- *(_DWORD *)(result - 296) = v4;
- }
- else
- {
- result += 4 * a2;
- *(_DWORD *)(result + 8) = a3;
- }
- return result;
- }
- //----- (00001EE4) --------------------------------------------------------
- int __fastcall sub_1EE4(int a1, int a2)
- {
- signed int v2; // r2@1
- bool v3; // zf@1
- signed int v4; // r0@1
- unsigned int v5; // r1@1
- v2 = 0;
- v3 = (a2 & 0xFFFFFFF0) == 112;
- v4 = 0;
- v5 = a2 & 0xFFFFFFE0;
- if ( v3 )
- v4 = 1;
- if ( v5 == 256 )
- v2 = 1;
- return v4 | v2;
- }
- //----- (00001F04) --------------------------------------------------------
- __int64 __fastcall sub_1F04(int a1, int a2)
- {
- int v2; // r4@1
- int v3; // r5@1
- unsigned int v4; // r0@1
- int v5; // r0@5
- int v6; // r0@11
- v2 = a2;
- v3 = a1;
- v4 = a2 & 0xFFFFFFF0;
- if ( (a2 & 0xFFFFFFF0) == 112 )
- {
- if ( !*(_BYTE *)(v3 + 75) )
- {
- *(_BYTE *)(v3 + 75) = 1;
- sub_1BBC();
- }
- v5 = v3 + 8 * v2 - 552;
- }
- else if ( v4 == 272 )
- {
- if ( !*(_BYTE *)(v3 + 74) )
- {
- *(_BYTE *)(v3 + 74) = 1;
- sub_1BB4(v3 + 216);
- }
- v5 = v3 + 8 * v2 - 1960;
- }
- else
- {
- if ( v4 != 256 )
- sub_21E8(
- (int)"unw_fpreg_t libunwind::Registers_arm::getFloatRegister(int)",
- (int)"external/libcxxabi/src/Unwind/Registers.hpp",
- 1673,
- (int)"Unknown ARM float register");
- if ( !*(_BYTE *)(v3 + 73) )
- {
- *(_BYTE *)(v3 + 73) = 1;
- v6 = v3 + 80;
- if ( *(_BYTE *)(v3 + 72) )
- sub_1BAC(v6);
- else
- sub_1BA4(v6);
- }
- v5 = v3 + 8 * v2 - 1968;
- }
- return *(_QWORD *)v5;
- }
- //----- (00001FB4) --------------------------------------------------------
- int __fastcall sub_1FB4(int a1, int a2, int a3, int a4)
- {
- int v4; // r6@1
- int v5; // r7@1
- unsigned int v6; // r0@1
- int v7; // r5@1
- int v8; // r4@1
- int result; // r0@5
- int v10; // r1@5
- int v11; // r0@11
- v4 = a2;
- v5 = a1;
- v6 = a2 & 0xFFFFFFF0;
- v7 = a4;
- v8 = a3;
- if ( (a2 & 0xFFFFFFF0) == 112 )
- {
- if ( !*(_BYTE *)(v5 + 75) )
- {
- *(_BYTE *)(v5 + 75) = 1;
- sub_1BBC();
- }
- result = v5 + 8 * v4;
- *(_DWORD *)(result - 548) = v7;
- LOWORD(v10) = -552;
- }
- else if ( v6 == 272 )
- {
- if ( !*(_BYTE *)(v5 + 74) )
- {
- *(_BYTE *)(v5 + 74) = 1;
- sub_1BB4(v5 + 216);
- }
- result = v5 + 8 * v4;
- *(_DWORD *)(result - 1828) = v7;
- LOWORD(v10) = -1832;
- }
- else
- {
- if ( v6 != 256 )
- sub_21E8(
- (int)"void libunwind::Registers_arm::setFloatRegister(int, unw_fpreg_t)",
- (int)"external/libcxxabi/src/Unwind/Registers.hpp",
- 1700,
- (int)"Unknown ARM float register");
- if ( !*(_BYTE *)(v5 + 73) )
- {
- *(_BYTE *)(v5 + 73) = 1;
- v11 = v5 + 80;
- if ( *(_BYTE *)(v5 + 72) )
- sub_1BAC(v11);
- else
- sub_1BA4(v11);
- }
- result = v5 + 8 * v4;
- *(_DWORD *)(result - 1964) = v7;
- LOWORD(v10) = -1968;
- }
- HIWORD(v10) = -1;
- *(_DWORD *)(result + v10) = v8;
- return result;
- }
- //----- (00002088) --------------------------------------------------------
- signed int __fastcall sub_2088(int a1)
- {
- int v1; // r4@1
- signed int result; // r0@3
- void (__fastcall *v3)(_DWORD, _DWORD, _DWORD); // r5@5
- int v4; // r0@5
- v1 = a1;
- if ( *(_BYTE *)(a1 + 528)
- || ((*(void (__fastcall **)(int, signed int))(*(_DWORD *)a1 + 52))(a1, 1), *(_BYTE *)(v1 + 528)) )
- {
- result = 0;
- }
- else
- {
- if ( *(_DWORD *)(v1 + 504) )
- {
- v3 = *(void (__fastcall **)(_DWORD, _DWORD, _DWORD))(*(_DWORD *)v1 + 16);
- v4 = (*(int (__fastcall **)(int, signed int))(*(_DWORD *)v1 + 12))(v1, -2);
- v3(v1, -2, *(_DWORD *)(v1 + 504) + v4);
- }
- result = 1;
- }
- return result;
- }
- //----- (000020D4) --------------------------------------------------------
- int __fastcall sub_20D4(int a1, int a2)
- {
- int v2; // r12@1
- int v3; // lr@1
- int v4; // r11@1
- int v5; // r3@1
- int v6; // r4@1
- int v7; // r5@1
- int v8; // r4@1
- int v9; // r2@1
- int v10; // r3@1
- int v11; // r5@1
- int result; // r0@1
- v2 = *(_DWORD *)(a1 + 488);
- v3 = *(_DWORD *)(a1 + 492);
- v4 = a2 + 8;
- v5 = *(_DWORD *)(a1 + 500);
- v6 = *(_DWORD *)(a1 + 504);
- v7 = *(_DWORD *)(a1 + 508);
- *(_DWORD *)v4 = *(_DWORD *)(a1 + 496);
- *(_DWORD *)(v4 + 4) = v5;
- *(_DWORD *)(v4 + 8) = v6;
- *(_DWORD *)(v4 + 12) = v7;
- v8 = a2 + 24;
- *(_DWORD *)a2 = v2;
- *(_DWORD *)(a2 + 4) = v3;
- v9 = *(_DWORD *)(a1 + 512);
- v10 = *(_DWORD *)(a1 + 516);
- v11 = *(_DWORD *)(a1 + 520);
- result = *(_DWORD *)(a1 + 524);
- *(_DWORD *)(a2 + 36) = result;
- *(_DWORD *)v8 = v9;
- *(_DWORD *)(v8 + 4) = v10;
- *(_DWORD *)(v8 + 8) = v11;
- return result;
- }
- //----- (0000210C) --------------------------------------------------------
- void __fastcall sub_210C(int a1)
- {
- sub_221C(a1 + 8);
- sub_2B50();
- }
- //----- (00002124) --------------------------------------------------------
- int __fastcall sub_2124(int a1)
- {
- return *(_BYTE *)(a1 + 529);
- }
- //----- (0000212C) --------------------------------------------------------
- signed int __fastcall sub_212C(int a1, int a2, int a3, int a4)
- {
- int v4; // r6@1
- int v5; // r5@1
- int v6; // r4@1
- int v7; // r7@1
- int v8; // r0@1
- bool v9; // zf@1
- signed int result; // r0@4
- int v11; // [sp+10h] [bp-20h]@2
- int v12; // [sp+14h] [bp-1Ch]@4
- v4 = a2;
- v5 = a3;
- v6 = a4;
- v7 = (*(int (**)(void))(*(_DWORD *)a1 + 12))();
- v8 = dladdr();
- v9 = v8 == 0;
- if ( v8 )
- v9 = v11 == 0;
- if ( v9 )
- {
- result = 0;
- }
- else
- {
- _snprintf_chk(v4, v5, 0, -1);
- *(_DWORD *)v6 = v7 - v12;
- result = 1;
- }
- return result;
- }
- // D30: using guessed type int dladdr(void);
- // D3C: using guessed type int __fastcall _snprintf_chk(_DWORD, _DWORD, _DWORD, _DWORD);
- //----- (00002188) --------------------------------------------------------
- int __fastcall sub_2188(int a1, int a2)
- {
- int v2; // r4@1
- int v3; // r6@1
- unsigned int v4; // r5@1
- int v5; // r0@3
- bool v6; // zf@3
- int result; // r0@6
- int v8; // [sp+4h] [bp-1Ch]@3
- int v9; // [sp+8h] [bp-18h]@3
- int v10; // [sp+Ch] [bp-14h]@1
- v2 = a1;
- v3 = a2;
- v4 = (*(int (**)(void))(*(_DWORD *)a1 + 12))() & 0xFFFFFFFE;
- v10 = 0;
- if ( v3 )
- --v4;
- v5 = _gnu_Unwind_Find_exidx(v4, &v10);
- v6 = v5 == 0;
- v8 = v5;
- v9 = v10;
- if ( v5 )
- v6 = v10 == 0;
- if ( v6 || (result = ((int (__fastcall *)(int, unsigned int, int *))sub_2270)(v2, v4, &v8)) == 0 )
- {
- result = 1;
- *(_BYTE *)(v2 + 528) = 1;
- }
- return result;
- }
- // D48: using guessed type int __fastcall _gnu_Unwind_Find_exidx(_DWORD, _DWORD);
- // 2270: using guessed type int sub_2270();
- //----- (000021D8) --------------------------------------------------------
- int __fastcall sub_21D8(int a1, signed int a2)
- {
- int v2; // r1@2
- int result; // r0@3
- signed int v4; // r1@4
- int *v5; // r0@4
- if ( a2 <= 255 )
- {
- v2 = a2 + 2;
- if ( (unsigned int)v2 <= 0x61 )
- {
- result = (int)"pc";
- switch ( v2 )
- {
- case 0:
- case 15:
- v4 = -6356;
- v5 = &GLOBAL_OFFSET_TABLE_;
- return (int)((char *)v5 + v4);
- default:
- goto def_2544;
- case 1:
- case 17:
- return result;
- case 2:
- v4 = -6353;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 3:
- v4 = -6350;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 4:
- v4 = -6347;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 5:
- v4 = -6344;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 6:
- v4 = -6341;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 7:
- v4 = -6338;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 8:
- v4 = -6335;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 9:
- v4 = -6332;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 10:
- v4 = -6329;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 11:
- v4 = -6326;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 12:
- v4 = -6323;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 13:
- v4 = -6319;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 14:
- v4 = -6315;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 16:
- v4 = -6359;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 66:
- v4 = -6311;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 67:
- v4 = -6308;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 68:
- v4 = -6305;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 69:
- v4 = -6302;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 70:
- v4 = -6299;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 71:
- v4 = -6296;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 72:
- v4 = -6293;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 73:
- v4 = -6290;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 74:
- v4 = -6287;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 75:
- v4 = -6284;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 76:
- v4 = -6281;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 77:
- v4 = -6277;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 78:
- v4 = -6273;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 79:
- v4 = -6269;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 80:
- v4 = -6265;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 81:
- v4 = -6261;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 82:
- v4 = -6257;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 83:
- v4 = -6253;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 84:
- v4 = -6249;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 85:
- v4 = -6245;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 86:
- v4 = -6241;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 87:
- v4 = -6237;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 88:
- v4 = -6233;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 89:
- v4 = -6229;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 90:
- v4 = -6225;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 91:
- v4 = -6221;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 92:
- v4 = -6217;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 93:
- v4 = -6213;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 94:
- v4 = -6209;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 95:
- v4 = -6205;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 96:
- v4 = -6201;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 97:
- v4 = -6197;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- }
- return (int)((char *)v5 + v4);
- }
- def_2544:
- v4 = -6075;
- v5 = &GLOBAL_OFFSET_TABLE_;
- return (int)((char *)v5 + v4);
- }
- if ( (unsigned int)(a2 - 256) > 0x1F )
- goto def_2544;
- switch ( a2 )
- {
- case 0:
- v4 = -6193;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 1:
- v4 = -6190;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 2:
- v4 = -6187;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 3:
- v4 = -6184;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 4:
- v4 = -6181;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 5:
- v4 = -6178;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 6:
- v4 = -6175;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 7:
- v4 = -6172;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 8:
- v4 = -6169;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 9:
- v4 = -6166;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 10:
- v4 = -6163;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 11:
- v4 = -6159;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 12:
- v4 = -6155;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 13:
- v4 = -6151;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 14:
- v4 = -6147;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 15:
- v4 = -6143;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 16:
- v4 = -6139;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 17:
- v4 = -6135;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 18:
- v4 = -6131;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 19:
- v4 = -6127;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 20:
- v4 = -6123;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 21:
- v4 = -6119;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 22:
- v4 = -6115;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 23:
- v4 = -6111;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 24:
- v4 = -6107;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 25:
- v4 = -6103;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 26:
- v4 = -6099;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 27:
- v4 = -6095;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 28:
- v4 = -6091;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 29:
- v4 = -6087;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 30:
- v4 = -6083;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- case 31:
- v4 = -6079;
- v5 = &GLOBAL_OFFSET_TABLE_;
- break;
- default:
- goto def_2544;
- }
- return (int)((char *)v5 + v4);
- }
- // 4F80: using guessed type int GLOBAL_OFFSET_TABLE_;
- //----- (000021E0) --------------------------------------------------------
- int __fastcall sub_21E0(int result)
- {
- *(_BYTE *)(result + 72) = 1;
- return result;
- }
- //----- (000021E8) --------------------------------------------------------
- void __fastcall sub_21E8(int a1, int a2, int a3, int a4)
- {
- fprintf((FILE *)stderr, "libunwind: %s %s:%d - %s\n", a1, a2, a3, a4);
- abort();
- }
- //----- (0000221C) --------------------------------------------------------
- int __fastcall sub_221C(int a1)
- {
- int v1; // r4@1
- int v2; // r0@2
- int result; // r0@9
- v1 = a1;
- if ( *(_BYTE *)(a1 + 65) )
- {
- v2 = a1 + 72;
- if ( *(_BYTE *)(v1 + 64) )
- sub_2AE8(v2);
- else
- sub_2AE0(v2);
- }
- if ( *(_BYTE *)(v1 + 66) )
- sub_2AF0(v1 + 208);
- if ( *(_BYTE *)(v1 + 67) )
- sub_2AF8(v1 + 336);
- result = *(_BYTE *)(v1 + 68);
- if ( *(_BYTE *)(v1 + 68) )
- result = sub_2B60(v1 + 464);
- return result;
- }
- //----- (000023F8) --------------------------------------------------------
- int __fastcall sub_23F8(int result, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
- {
- unsigned int v8; // r4@1
- unsigned int v9; // r5@2
- int v10; // r6@3
- v8 = a5 - a2;
- while ( 1 )
- {
- v9 = v8;
- if ( !v8 )
- break;
- v10 = a2 + (v8 >> 1);
- v8 >>= 1;
- if ( *(_DWORD *)a8 >= *(_DWORD *)a4
- + 8 * v10
- + (2 * *(_DWORD *)(*(_DWORD *)a4 + 8 * v10) & 0x80000000 | *(_DWORD *)(*(_DWORD *)a4 + 8 * v10)) )
- {
- v8 = v9 - 1 - v8;
- a2 = v10 + 1;
- }
- }
- *(_DWORD *)result = a2;
- *(_DWORD *)(result + 4) = a3;
- *(_DWORD *)(result + 8) = a4;
- return result;
- }
- //----- (00002AE0) --------------------------------------------------------
- int __fastcall sub_2AE0(int _R0)
- {
- int result; // r0@1
- __asm { VLDMIA R0, {D0-D15} }
- return result;
- }
- //----- (00002AE8) --------------------------------------------------------
- int __fastcall sub_2AE8(int _R0)
- {
- int result; // r0@1
- __asm { VLDMIA R0, {D0-D15} }
- return result;
- }
- //----- (00002AF0) --------------------------------------------------------
- int __fastcall sub_2AF0(int _R0)
- {
- int result; // r0@1
- __asm { VLDMIA R0, {D16-D31} }
- return result;
- }
- //----- (00002AF8) --------------------------------------------------------
- int __fastcall sub_2AF8(int a1)
- {
- int v5; // r0@1
- int result; // r0@1
- _T1 = *(_DWORD *)a1;
- v5 = a1 + 8;
- __asm { LDCL p1, c0, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c1, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c2, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c3, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c4, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c5, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c6, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c7, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c8, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c9, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c10, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c11, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c12, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c13, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- v5 += 8;
- __asm { LDCL p1, c14, [R0],#8 }
- _T1 = *(_DWORD *)v5;
- result = v5 + 8;
- __asm { LDCL p1, c15, [R0],#8 }
- return result;
- }
- //----- (00002B3C) --------------------------------------------------------
- int __fastcall sub_2B3C(int a1)
- {
- int v5; // r0@1
- int result; // r0@1
- _T1 = *(_DWORD *)a1;
- v5 = a1 + 4;
- __asm { LDC2 p1, c8, [R0],#4 }
- _T1 = *(_DWORD *)v5;
- v5 += 4;
- __asm { LDC2 p1, c9, [R0],#4 }
- _T1 = *(_DWORD *)v5;
- v5 += 4;
- __asm { LDC2 p1, c10, [R0],#4 }
- _T1 = *(_DWORD *)v5;
- result = v5 + 4;
- __asm { LDC2 p1, c11, [R0],#4 }
- return result;
- }
- //----- (00002B50) --------------------------------------------------------
- void sub_2B50()
- {
- sub_2B54();
- }
- //----- (00002B54) --------------------------------------------------------
- void sub_2B54()
- {
- JUMPOUT(sub_2ACC);
- }
- // 2ACC: using guessed type int sub_2ACC();
- //----- (00002B60) --------------------------------------------------------
- int __fastcall sub_2B60(int a1)
- {
- return sub_2B64(a1);
- }
- //----- (00002B64) --------------------------------------------------------
- int __fastcall sub_2B64(int a1)
- {
- return sub_2B3C(a1);
- }
- // ALL OK, 64 function(s) have been successfully decompiled
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement