aaaaaa123456789

ddump.c (decompiled)

Dec 13th, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 460.23 KB | None | 0 0
  1. //
  2. // This file was generated by the Retargetable Decompiler
  3. // Website: https://retdec.com
  4. // Copyright (c) 2017 Retargetable Decompiler <info@retdec.com>
  5. //
  6.  
  7. #include <math.h>
  8. #include <stdbool.h>
  9. #include <stdint.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13.  
  14. // ---------------- Integer Types Definitions -----------------
  15.  
  16. typedef int8_t int2_t;
  17.  
  18. // ----------------- Float Types Definitions ------------------
  19.  
  20. typedef float float32_t;
  21.  
  22. // ------------------------ Structures ------------------------
  23.  
  24. struct ProgramVars {
  25.     int32_t e0;
  26. };
  27.  
  28. struct _IO_FILE {
  29.     int32_t e0;
  30. };
  31.  
  32. struct _Unwind_Context {
  33.     int32_t e0;
  34. };
  35.  
  36. struct _Unwind_Context_1 {
  37.     int32_t e0;
  38. };
  39.  
  40. struct __EIT_entry {
  41.     int32_t e0;
  42.     int32_t e1;
  43. };
  44.  
  45. struct anon_struct_0 {
  46.     int32_t e0;
  47.     int32_t e1;
  48.     int32_t e2;
  49.     int32_t e3;
  50.     int32_t e4;
  51. };
  52.  
  53. struct anon_struct_1 {
  54.     int32_t e0;
  55.     int32_t e1[5];
  56. };
  57.  
  58. struct anon_struct_10 {
  59.     int32_t e0;
  60.     int32_t e1[5];
  61. };
  62.  
  63. struct anon_struct_11 {
  64.     int32_t e0[4];
  65. };
  66.  
  67. struct anon_struct_12 {
  68.     int32_t e0;
  69.     int32_t * e1;
  70.     int32_t e2;
  71.     int32_t e3;
  72. };
  73.  
  74. struct anon_struct_13 {
  75.     int32_t e0;
  76.     int32_t * e1;
  77.     char e2;
  78.     char e3;
  79. };
  80.  
  81. struct anon_struct_2 {
  82.     int32_t e0[4];
  83. };
  84.  
  85. struct anon_struct_3 {
  86.     int32_t e0;
  87.     int32_t * e1;
  88.     int32_t e2;
  89.     int32_t e3;
  90. };
  91.  
  92. struct _Unwind_Control_Block {
  93.     char e0[8];
  94.     void (*e1)(int32_t, struct _Unwind_Control_Block *);
  95.     struct anon_struct_0 e2;
  96.     struct anon_struct_1 e3;
  97.     struct anon_struct_2 e4;
  98.     struct anon_struct_3 e5;
  99. };
  100.  
  101. struct anon_struct_4 {
  102.     int32_t e0;
  103.     int32_t * e1;
  104.     char e2;
  105.     char e3;
  106. };
  107.  
  108. struct anon_struct_9 {
  109.     int32_t e0;
  110.     int32_t e1;
  111.     int32_t e2;
  112.     int32_t e3;
  113.     int32_t e4;
  114. };
  115.  
  116. struct _Unwind_Control_Block_1 {
  117.     char e0[8];
  118.     void (*e1)(int32_t, struct _Unwind_Control_Block_1 *);
  119.     struct anon_struct_9 e2;
  120.     struct anon_struct_10 e3;
  121.     struct anon_struct_11 e4;
  122.     struct anon_struct_12 e5;
  123. };
  124.  
  125. struct core_regs {
  126.     int32_t e0[16];
  127. };
  128.  
  129. struct anon_struct_6 {
  130.     int32_t e0;
  131.     struct core_regs e1;
  132. };
  133.  
  134. struct vfp_regs {
  135.     int64_t e0[16];
  136.     int32_t e1;
  137. };
  138.  
  139. struct vfpv3_regs {
  140.     int64_t e0[16];
  141. };
  142.  
  143. struct vtable_1e0e0_type {
  144.     int32_t (*e0)(int32_t, int32_t, int32_t *);
  145. };
  146.  
  147. struct wmmxc_regs {
  148.     int32_t e0[4];
  149. };
  150.  
  151. struct wmmxd_regs {
  152.     int64_t e0[16];
  153. };
  154.  
  155. struct anon_struct_5 {
  156.     int32_t e0;
  157.     struct core_regs e1;
  158.     int32_t e2;
  159.     struct vfp_regs e3;
  160.     struct vfpv3_regs e4;
  161.     struct wmmxd_regs e5;
  162.     struct wmmxc_regs e6;
  163. };
  164.  
  165. // ------------------------- Classes --------------------------
  166.  
  167. // PLAYER
  168.  
  169. // ------------------- Function Prototypes --------------------
  170.  
  171. int32_t ___Unwind_Backtrace(int32_t (*a1)(struct _Unwind_Context *, char *), char * a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13);
  172. int32_t ___Unwind_Resume(struct _Unwind_Control_Block * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13);
  173. int32_t ___Unwind_Resume_or_Rethrow(struct _Unwind_Control_Block * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13);
  174. void __aeabi_idiv(void);
  175. int32_t __aeabi_idivmod(int32_t a1, int32_t a2);
  176. int32_t __aeabi_uidivmod(uint32_t a1, uint32_t a2);
  177. int32_t __aeabi_unwind_cpp_pr0(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context);
  178. int32_t __aeabi_unwind_cpp_pr1(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context);
  179. int32_t __aeabi_unwind_cpp_pr2(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context);
  180. void __atexit_handler_wrapper(int32_t a1);
  181. void __gnu_unwind_24bit(struct _Unwind_Context * context, int32_t data, int32_t compact);
  182. int32_t __gnu_Unwind_Backtrace(int32_t (*trace)(struct _Unwind_Context *, char *), char * trace_argument, struct anon_struct_6 * entry_vrs);
  183. int32_t __gnu_unwind_execute(struct _Unwind_Context_1 * context, struct anon_struct_13 * uws);
  184. int32_t __gnu_Unwind_ForcedUnwind(struct _Unwind_Control_Block * ucbp, int32_t (*stop_fn)(int32_t, int32_t, char *, struct _Unwind_Control_Block *, struct _Unwind_Context *, char *), char * stop_arg, struct anon_struct_6 * entry_vrs);
  185. int32_t __gnu_unwind_frame(struct _Unwind_Control_Block_1 * ucbp, struct _Unwind_Context_1 * context);
  186. int32_t __gnu_unwind_get_pr_addr(int32_t idx);
  187. int32_t __gnu_unwind_pr_common(uint32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context, int32_t id);
  188. int32_t __gnu_Unwind_RaiseException(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs);
  189. void __gnu_Unwind_Restore_VFP(void);
  190. void __gnu_Unwind_Restore_VFP_D(void);
  191. void __gnu_Unwind_Restore_VFP_D_16_to_31(void);
  192. void __gnu_Unwind_Restore_WMMXC(void);
  193. void __gnu_Unwind_Restore_WMMXD(void);
  194. int32_t __gnu_Unwind_Resume(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs);
  195. int32_t __gnu_Unwind_Resume_or_Rethrow(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs);
  196. void __gnu_Unwind_Save_VFP(void);
  197. void __gnu_Unwind_Save_VFP_D(void);
  198. void __gnu_Unwind_Save_VFP_D_16_to_31(void);
  199. void __gnu_Unwind_Save_WMMXC(void);
  200. void __gnu_Unwind_Save_WMMXD(void);
  201. int32_t __udivsi3(int32_t result);
  202. int32_t _start(int32_t a1, int32_t a2, int32_t a3);
  203. void _Unwind_Complete(struct _Unwind_Control_Block * ucbp);
  204. void _Unwind_DebugHook(char * cfa, char * handler);
  205. void _Unwind_decode_typeinfo_ptr(int32_t base, int32_t ptr);
  206. void _Unwind_DeleteException(struct _Unwind_Control_Block * exc);
  207. int32_t _Unwind_ForcedUnwind(struct _Unwind_Control_Block * a1, int32_t (*a2)(int32_t, int32_t, char *, struct _Unwind_Control_Block *, struct _Unwind_Context *, char *), char * a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13);
  208. int32_t _Unwind_GetCFA(struct _Unwind_Context * context);
  209. int32_t _Unwind_GetDataRelBase(struct _Unwind_Context_1 * context);
  210. int32_t _Unwind_GetGR(struct _Unwind_Context * context, int32_t regno);
  211. void _Unwind_GetGR_1(struct _Unwind_Context_1 * context, int32_t regno);
  212. char * _Unwind_GetLanguageSpecificData(struct _Unwind_Context_1 * context);
  213. int32_t _Unwind_GetRegionStart(struct _Unwind_Context_1 * context);
  214. int32_t _Unwind_GetTextRelBase(struct _Unwind_Context_1 * context);
  215. int32_t _Unwind_RaiseException(struct _Unwind_Control_Block * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13);
  216. void _Unwind_SetGR(struct _Unwind_Context * context, int32_t regno, int32_t val);
  217. int32_t _Unwind_VRS_Get(struct _Unwind_Context * context, int32_t regclass, int32_t regno, int32_t representation, char * valuep);
  218. int32_t _Unwind_VRS_Pop(struct _Unwind_Context * context, int32_t regclass, int32_t discriminator, int32_t representation);
  219. int32_t _Unwind_VRS_Set(struct _Unwind_Context * context, uint32_t regclass, int32_t regno, int32_t representation, char * valuep);
  220. int32_t assign_script_value(int32_t * a1, char * a2, int32_t a3, int32_t result);
  221. int32_t check_exact_symbol_match(int32_t a1, int32_t a2, int32_t a3);
  222. int32_t code_labels_setting_handler(char * str, int32_t a2, int32_t a3);
  223. int32_t compare_ELF_symbols(int32_t * a1, int32_t * a2);
  224. int32_t concatenate(int32_t * a1, int32_t * a2, char * a3, int32_t a4);
  225. int64_t convert_string_to_number(char * str, int32_t a2);
  226. int32_t copy_script_value(char * a1, char a2, int32_t a3, char * a4);
  227. int32_t data_labels_setting_handler(char * str, int32_t a2, int32_t a3);
  228. int32_t destroy_ELF_symbols(char * a1, int32_t a2);
  229. void destroy_script_value(int32_t a1);
  230. int32_t destroy_script_variables(char * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6);
  231. int32_t destroy_string_array(char * a1, int32_t a2, int32_t a3, int32_t a4);
  232. int32_t dump_data_line_as_text(struct _IO_FILE * stream, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9);
  233. int32_t dump_incbin_as_binary(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11);
  234. int32_t dump_incbin_as_text(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12);
  235. int32_t dump_incbins(struct _IO_FILE * stream, struct _IO_FILE * a2, int32_t a3);
  236. int32_t duplicate_string(void);
  237. int32_t enforce_value_size(int32_t a1, uint32_t a2);
  238. int32_t execute_script(int32_t a1, int32_t a2, int32_t a3);
  239. int32_t execute_script_once(int32_t a1, int32_t a2, int32_t a3, int32_t * a4, char * a5, char * format, int32_t a7, int32_t a8, char * a9, char * format2, int32_t a11, int32_t a12, int32_t a13, int32_t * a14, int32_t a15);
  240. int32_t execute_transforms(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5);
  241. int32_t find_first_non_space(char * str);
  242. int32_t find_script_variable(int32_t * a1, char * str);
  243. int32_t find_symbol_for_address(uint32_t a1);
  244. void function_27e0(void);
  245. void function_2a08(int32_t (*a1)(int32_t));
  246. int32_t function_2a88(char * a1);
  247. int32_t function_6eb4(int32_t a1);
  248. int32_t function_7ae8(int32_t a1);
  249. int32_t function_7d34(int32_t a1);
  250. int32_t function_a830(uint32_t a1, uint32_t a2, int32_t a3);
  251. int32_t function_a8f8(int32_t a1);
  252. void function_a9bc(int32_t a1);
  253. int32_t function_add(int32_t a1, int32_t a2, int32_t * a3);
  254. int32_t function_af90(int32_t a1);
  255. int32_t function_and(int32_t a1, int32_t a2, int32_t * a3);
  256. int32_t function_asr(int32_t a1, uint32_t a2, int32_t * a3);
  257. int32_t function_checkmax(int32_t a1, int32_t a2, int32_t * a3, int32_t a4);
  258. int32_t function_checkmaxu(uint32_t a1, uint32_t a2, int32_t * a3);
  259. int32_t function_checkmin(int32_t a1, int32_t a2, int32_t * a3);
  260. int32_t function_checkminu(uint32_t a1, uint32_t a2, int32_t * a3);
  261. int32_t function_checkptr(int32_t a1, int32_t a2, int32_t * a3, int32_t a4);
  262. int32_t function_compare(int32_t a1, int32_t a2, int32_t * a3);
  263. int32_t function_compareu(uint32_t a1, uint32_t a2, int32_t * a3);
  264. int32_t function_divide(int32_t a1, int32_t a2);
  265. int32_t function_forcemax(int32_t a1, int32_t a2, int32_t * a3);
  266. int32_t function_forcemaxu(uint32_t a1, uint32_t a2, int32_t * a3);
  267. int32_t function_forcemin(int32_t a1, int32_t a2, int32_t * a3);
  268. int32_t function_forceminu(uint32_t a1, uint32_t a2, int32_t * a3);
  269. int32_t function_modulo(uint32_t a1, uint32_t a2);
  270. int32_t function_multiply(int32_t a1, int32_t a2, int32_t * a3);
  271. int32_t function_or(int32_t a1, int32_t a2, int32_t * a3);
  272. int32_t function_rdiv(int32_t a1, int32_t a2, int32_t * a3);
  273. int32_t function_require(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5);
  274. int32_t function_requirenot(int32_t a1, int32_t a2, int32_t * a3);
  275. int32_t function_rmod(uint32_t a1, uint32_t a2, int32_t * a3);
  276. int32_t function_rsub(int32_t a1, int32_t a2, int32_t * a3);
  277. int32_t function_shl(int32_t a1, uint32_t a2, int32_t * a3);
  278. int32_t function_shr(uint32_t a1, uint32_t a2, int32_t * a3);
  279. int32_t function_subtract(int32_t a1, int32_t a2, int32_t * a3);
  280. int32_t function_xor(int32_t a1, int32_t a2, int32_t * a3);
  281. int32_t generate_incbin(int32_t a1, int32_t a2, int32_t a3);
  282. int32_t generate_initial_indented_line(int32_t * a1, int32_t * a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7);
  283. int32_t generate_script_error(char * str, int32_t a2);
  284. int32_t generate_script_output_line(char * a1, int32_t a2, int32_t * a3);
  285. int32_t get_command(int32_t a1, int32_t a2);
  286. int32_t get_dump_file(char * a1, int32_t a2, int32_t a3);
  287. int32_t get_eit_entry(struct _Unwind_Control_Block * ucbp, int32_t return_address);
  288. int32_t get_file_length(struct _IO_FILE * stream);
  289. char * get_incbin_data(void);
  290. int32_t get_line_type(void);
  291. int32_t get_value_from_string(char * a1, int32_t a2);
  292. int32_t handle_incbin_data(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, char * a6, int32_t a7, int32_t a8, uint32_t a9);
  293. int32_t handle_incbin_text(int32_t * a1, int32_t a2, struct _IO_FILE * a3, int32_t a4, int32_t a5, int32_t a6, char * format2, char * format, int32_t a9, int32_t a10);
  294. int32_t headers_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4);
  295. int32_t indent_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4);
  296. int32_t init_script_variables(int32_t a1, int32_t a2, int32_t a3);
  297. int32_t is_incbin(char * str);
  298. int32_t load_symbols(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5);
  299. char next_unwind_byte(struct anon_struct_13 * uws);
  300. int32_t output_binary_data(char * a1, int32_t a2, int32_t a3, struct _IO_FILE * stream, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12);
  301. int32_t output_pointer(int32_t a1, struct _IO_FILE * a2);
  302. int32_t output_pointers(int32_t result, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8);
  303. int32_t parse_buffer(char * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13, int32_t a14, int32_t a15, int32_t a16, int32_t a17, int32_t a18, int32_t a19, int32_t a20, int32_t a21, int32_t a22, int32_t a23, int32_t a24, int32_t a25, int32_t a26, int32_t a27, int32_t a28, char * a29, int32_t a30, int32_t a31, char * a32, int32_t a33, int32_t a34, char * a35, int32_t a36, int32_t a37, int32_t a38, int32_t a39, int32_t a40);
  304. int32_t parse_incbin(int32_t * a1, int32_t a2, int32_t a3);
  305. int32_t preview_incbin(int32_t a1, int32_t a2, int32_t a3);
  306. int32_t print_command_help(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10);
  307. int32_t print_script_variable_contents(uint32_t a1, int32_t a2, char * a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8);
  308. int32_t read_16(char * a1);
  309. int32_t read_32(char * a1);
  310. int32_t read_ELF_section_table(struct _IO_FILE * a1, int32_t * a2, int32_t * a3);
  311. int32_t read_ELF_symbols_from_section(struct _IO_FILE * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7);
  312. int32_t read_file_buffer(struct _IO_FILE * a1, int32_t offset, int32_t size);
  313. int32_t read_file_by_lines(struct _IO_FILE * stream);
  314. int32_t read_file_string(struct _IO_FILE * stream, int32_t offset);
  315. int32_t read_file_value(struct _IO_FILE * a1);
  316. int32_t read_line(struct _IO_FILE * stream);
  317. struct _IO_FILE * read_symbols_from_ELF(void);
  318. void restore_core_regs(void);
  319. void restore_non_core_regs(struct anon_struct_5 * vrs);
  320. int32_t run_script(int32_t a1, int32_t a2, struct _IO_FILE * a3, int32_t a4);
  321. int32_t run_script_auto(int32_t a1, int32_t a2, char * file_path, struct _IO_FILE * a4);
  322. int32_t script_get_expression_value(char * a1, int32_t a2, int32_t * a3, int32_t a4);
  323. int32_t script_get_initializer_value(char * a1, int32_t * a2, int32_t * a3);
  324. int32_t script_get_transforms_for_line(int32_t * a1, int32_t str4, int32_t * a3);
  325. int32_t script_loop_test(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5);
  326. int32_t script_parse_assignment_line(int32_t a1);
  327. int32_t script_transform_add(int32_t a1, int32_t a2, int32_t a3);
  328. int32_t script_transform_all(void);
  329. int32_t script_transform_and(int32_t a1, int32_t a2, int32_t a3);
  330. int32_t script_transform_any(void);
  331. int32_t script_transform_append(char a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t (*a12)(int32_t), int32_t a13, int32_t a14, int32_t a15, int32_t a16, int32_t a17, int32_t a18);
  332. int32_t script_transform_asr(int32_t a1, int32_t a2);
  333. int32_t script_transform_basic(char a1, int32_t a2, int32_t a3);
  334. int32_t script_transform_byte_count(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5);
  335. int32_t script_transform_bytesuntil(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4);
  336. int32_t script_transform_byteswhile(uint32_t a1, uint32_t a2, int32_t a3);
  337. int32_t script_transform_checkmax(int32_t a1, int32_t a2);
  338. int32_t script_transform_checkmaxu(void);
  339. int32_t script_transform_checkmin(int32_t a1, int32_t a2);
  340. int32_t script_transform_checkminu(void);
  341. int32_t script_transform_checkptr(void);
  342. int32_t script_transform_compare(int32_t a1, int32_t a2);
  343. int32_t script_transform_compareu(int32_t a1, int32_t a2, int32_t a3);
  344. int32_t script_transform_copy(unsigned char a1, int32_t a2, char * a3, int32_t a4);
  345. int32_t script_transform_count(void);
  346. int32_t script_transform_count_values(int32_t a1, int32_t a2, int32_t * a3, int32_t a4);
  347. int32_t script_transform_divide(int32_t a1, int32_t a2);
  348. int32_t script_transform_forcemax(int32_t a1, int32_t a2, int32_t a3);
  349. int32_t script_transform_forcemaxu(int32_t a1, int32_t a2, int32_t a3);
  350. int32_t script_transform_forcemin(int32_t a1, int32_t a2, int32_t a3);
  351. int32_t script_transform_forceminu(int32_t a1, int32_t a2);
  352. int32_t script_transform_int(uint32_t a1, int32_t a2, int32_t a3, char a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13, int32_t a14, int32_t a15, int32_t a16);
  353. int32_t script_transform_item(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5);
  354. int32_t script_transform_length(uint32_t a1, int32_t a2, int32_t a3, uint32_t a4, char * a5);
  355. int32_t script_transform_modulo(int32_t a1, int32_t a2);
  356. int32_t script_transform_multi(uint32_t a1, int32_t a2, int32_t a3, int32_t a4);
  357. int32_t script_transform_multi16(uint32_t a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8);
  358. int32_t script_transform_multi32(uint32_t a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8);
  359. int32_t script_transform_multi8(uint32_t a1, int32_t a2, char * a3, int32_t size, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9);
  360. int32_t script_transform_multiply(int32_t a1, int32_t a2);
  361. int32_t script_transform_multiXX(uint32_t a1, int32_t a2, int32_t a3, int32_t size, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t (*a12)(int32_t), int32_t a13, int32_t a14, int32_t a15, int32_t a16);
  362. int32_t script_transform_or(int32_t a1, int32_t a2);
  363. int32_t script_transform_prepend(char a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t (*a12)(int32_t), int32_t a13, int32_t a14, int32_t a15, int32_t a16, int32_t a17, int32_t a18);
  364. int32_t script_transform_rdiv(int32_t a1, int32_t a2, int32_t a3);
  365. int32_t script_transform_require(void);
  366. int32_t script_transform_requirenot(int32_t a1, int32_t a2, int32_t a3);
  367. int32_t script_transform_rmod(int32_t a1, int32_t a2, int32_t a3);
  368. int32_t script_transform_rotate(char a1, int32_t a2, char * a3, uint32_t a4);
  369. int32_t script_transform_rotateback(char a1, int32_t a2, char * a3, int32_t a4);
  370. int32_t script_transform_rsub(int32_t a1, int32_t a2, int32_t a3);
  371. int32_t script_transform_shl(void);
  372. int32_t script_transform_shr(int32_t a1, int32_t a2, int32_t a3);
  373. int32_t script_transform_skip(unsigned char a1, int32_t a2, int32_t a3, int32_t a4);
  374. int32_t script_transform_subtract(int32_t a1, int32_t a2);
  375. int32_t script_transform_text(uint32_t a1, int32_t a2, char * a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12);
  376. int32_t script_transform_xor(void);
  377. struct __EIT_entry * search_EIT_table(struct __EIT_entry * table, int32_t nrec, int32_t return_address);
  378. int32_t selfrel_offset31(int32_t * p);
  379. int32_t settings_help(int32_t a1, int32_t a2, int32_t a3, int32_t a4);
  380. int32_t settings_mode(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, char * a6, char * a7, int32_t a8, int32_t a9, char * a10, char * a11, int32_t a12, int32_t a13, char * a14, int32_t a15, int32_t a16, int32_t a17);
  381. int32_t split_by_spaces(void);
  382. int32_t string_array_size(int32_t * a1);
  383. int32_t unload_symbols(void);
  384. void unwind_phase2(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * vrs);
  385. int32_t unwind_phase2_forced(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs, int32_t resuming);
  386. struct _Unwind_Control_Block_1 * unwind_UCB_from_context(struct _Unwind_Context_1 * context);
  387. int32_t validate_ELF_file(int32_t a1, int32_t a2);
  388. int32_t validate_file_value(int32_t a1, int32_t a2);
  389. int32_t validate_pointers(int32_t a1, uint32_t a2, int32_t a3);
  390. int32_t validate_variable_name(char * str);
  391. int32_t write_header_comment(int32_t * a1, struct _IO_FILE * stream);
  392. int32_t write_incbin_for_segment(int32_t a1, int32_t a2, int32_t a3, struct _IO_FILE * a4);
  393.  
  394. // --------------------- Global Variables ---------------------
  395.  
  396. int32_t g126 = 0; // LR
  397. int32_t g127 = 0; // R0
  398. int32_t g128 = 0; // R1
  399. int32_t g129 = 0; // R10
  400. int32_t g130 = 0; // R11
  401. int32_t g131 = 0; // R12
  402. int32_t g132 = 0; // R2
  403. int32_t g133 = 0; // R3
  404. int32_t g134 = 0; // R4
  405. int32_t g135 = 0; // R5
  406. int32_t g136 = 0; // R6
  407. int32_t g137 = 0; // R7
  408. int32_t g138 = 0; // R8
  409. int32_t g139 = 0; // R9
  410. bool g1 = false; // flagc
  411. bool g2 = false; // flagn
  412. bool g3 = false; // flagz
  413. int32_t g4 = 0x82bc; // 0x1e0b8
  414. int32_t g5 = 0x833c; // 0x1e0bc
  415. int32_t g7 = 0xd840; // 0x1e0c8
  416. int32_t g8 = 0x8974; // 0x1e0cc
  417. int32_t g10 = 0xb558; // 0x1e0d4
  418. int32_t g11 = 0; // 0x1e0d8
  419. int32_t g14 = 0x844c; // 0x1e0e8
  420. int32_t g15 = 0xb568; // 0x1e0ec
  421. int32_t g16 = 0x890c; // 0x1e0f0
  422. int32_t g18 = 0x83c4; // 0x1e0f8
  423. int32_t g19 = 0x87d4; // 0x1e0fc
  424. int32_t g20 = 0x8784; // 0x1e100
  425. int32_t g21 = 0x8524; // 0x1e104
  426. int32_t g22 = 0x88a4; // 0x1e108
  427. int32_t g23 = 0x85a4; // 0x1e10c
  428. int32_t g24; // 0x1e110
  429. int32_t g25 = 0x8624; // 0x1e118
  430. int32_t g26 = 0x8a68; // 0x1e11c
  431. int32_t g27 = 0x85e4; // 0x1e124
  432. int32_t g28 = 0x8a00; // 0x1e128
  433. int32_t g29 = 0x883c; // 0x1e12c
  434. int32_t g30 = 0x1e8c000; // 0x1e12f
  435. int32_t g32 = 0x86f0; // 0x1e134
  436. int32_t g33 = 0; // 0x1e138
  437. int32_t g34 = 0x82fc; // 0x1e13c
  438. int32_t g35 = 0x8668; // 0x1e140
  439. int32_t g36; // 0x1e144
  440. int32_t g37 = 0x84a4; // 0x1e14c
  441. int32_t g38 = 0; // 0x1e150
  442. int32_t g40 = 0x8378; // 0x1e160
  443. int32_t g41 = 0x8564; // 0x1e164
  444. int32_t g42 = 0x86ac; // 0x1e168
  445. int32_t g43 = 0x84e4; // 0x1e170
  446. int32_t g45 = 0xb560; // 0x1e178
  447. int32_t g47 = 0x8734; // 0x1e180
  448. int32_t g48 = 161; // 0x1e184
  449. char * g49[16] = {
  450.     "TRANSPARENT",
  451.     "DARK_GREY",
  452.     "RED",
  453.     "GREEN",
  454.     "BLUE",
  455.     "YELLOW",
  456.     "CYAN",
  457.     "MAGENTA",
  458.     "LIGHT_GRAY",
  459.     "BLACK",
  460.     "BLACK2",
  461.     "SILVER",
  462.     "WHITE",
  463.     "SKY_BLUE",
  464.     "LIGHT_BLUE",
  465.     "WHITE2"
  466. }; // 0x1e588
  467. int32_t g50 = 0; // 0x1e5c8
  468. char (*g51)[8] = "headers"; // 0x1e704
  469. char (*g52)[4] = "add"; // 0x1e740
  470. int32_t g53 = 0; // 0x1e8c0
  471. int32_t g54 = 32; // 0x4108
  472. int32_t g55 = 0x8dcb; // 0x4318
  473. int32_t g56 = 40; // 0x4e28
  474. int32_t g57 = 432; // 0x5170
  475. int32_t g58 = 644; // 0x5c78
  476. int32_t g59 = 32; // 0x6230
  477. int32_t g60 = 40; // 0x70a4
  478. int32_t g61 = -0x1f7f0000; // 0x827c
  479. int32_t g62 = 28; // 0x8e0c
  480. int32_t g63 = 32; // 0x9314
  481. int32_t g64 = 0xa000013; // 0x9354
  482. int32_t g65 = 0xa000012; // 0x94b4
  483. int32_t g66 = 80; // 0x9638
  484. int32_t g67 = -0x1e5fb000; // 0xa100
  485. int32_t g68 = -0x1c5fffff; // 0xa104
  486. char * g69; // 0xa114
  487. char * g70 = "\xe4"; // 0xa118
  488. int32_t g71 = -0x1a3ff000; // 0xa11c
  489. char * g72 = "\xe0\x10\x8d\xe5\x89\x01"; // 0xa120
  490. char * g73 = "\x89\x01"; // 0xa124
  491. int32_t g74 = -0x1a60f984; // 0xa128
  492. int32_t g75 = -0x1d725f28; // 0xa12c
  493. int32_t g76 = -0x1a60c998; // 0xa130
  494. int32_t g77 = -0x1d729f1c; // 0xa134
  495. int32_t g78 = -0x1f710000; // 0xa138
  496. int32_t g79 = -0x1a72ffe0; // 0xa13c
  497. char ** g80 = (char **)-0x1a60f998; // 0xa140
  498. char ** g81 = (char **)-0x1d728f20; // 0xa144
  499. int32_t g82 = -0x1a60e99c; // 0xa148
  500. char * g83; // 0xa14c
  501. int32_t g84 = -0x1f710000; // 0xa150
  502. char * g85 = "\x18"; // 0xa154
  503. char * g86 = "\x44\x06\x9f\xe5\x01\x10\x8f\xe0\x34\x26\x9f\xe5"; // 0xa158
  504. int32_t g87 = -0x1f70efff; // 0xa15c
  505. char * g88 = "\x34\x26\x9f\xe5"; // 0xa160
  506. char * g89; // 0xa164
  507. int32_t g90 = -0x1a72ffec; // 0xa168
  508. char * g91 = "\x34\x06\x9f\xe5\x1c\x10\x8d\xe5"; // 0xa16c
  509. char * g92 = "\x1c\x10\x8d\xe5"; // 0xa170
  510. int32_t g93 = -0x1f710000; // 0xa174
  511. char * g94 = "$"; // 0xa178
  512. char * g95 = "\x10\x06\x9f\xe5\x10\x16\x9f\xe5"; // 0xa17c
  513. char * g96 = "\x10\x16\x9f\xe5"; // 0xa180
  514. int32_t g97 = -0x1f710000; // 0xa184
  515. int32_t g98 = -0x11f6f4f0; // 0xa188
  516. char ** g99 = (char **)-0x1f70fffd; // 0xa18c
  517. int32_t g100 = -0x11f7f4f0; // 0xa190
  518. int32_t g101 = -0x1f70fffe; // 0xa194
  519. int32_t g102 = -0x1a60d990; // 0xa198
  520. char * g103 = "\x10\x0b\x29\xee\x01"; // 0xa19c
  521. char * g104 = "\x01"; // 0xa1a0
  522. char * g105 = "\xd8\x15\x9f\xe5\x10\x0b\x28\xee\xc8\x05\x9f\xe5\x01\x10\x8f\xe0\x34\x10\x8d\xe5\xd0\x15\x9f\xe5"; // 0xa1a4
  523. char * g106 = "\x10\x0b\x28\xee\xc8\x05\x9f\xe5\x01\x10\x8f\xe0\x34\x10\x8d\xe5\xd0\x15\x9f\xe5"; // 0xa1a8
  524. char * g107 = "\xc8\x05\x9f\xe5\x01\x10\x8f\xe0\x34\x10\x8d\xe5\xd0\x15\x9f\xe5"; // 0xa1ac
  525. int32_t g108 = -0x1a60fa58; // 0xa1d8
  526. int32_t g109 = -0x1f710000; // 0xa1e0
  527. char * g110 = "T"; // 0xa1e4
  528. int32_t g111 = 260; // 0xa400
  529. int32_t g112 = -776; // 0xa680
  530. int32_t g113 = -0x1caffff8; // 0xacd4
  531. int32_t g114 = -0x1caffff8; // 0xae98
  532. int32_t g115 = -0x7e1cffd5; // 0xc12f
  533. int32_t g116 = 0xa19ee2; // 0xc25f
  534. int32_t g117 = 0x42002f; // 0xc328
  535. int32_t g118 = 0x7efffbff; // 0xcd73
  536. int32_t g119 = 0x30250020; // 0xce21
  537. int32_t g120 = 0x20732500; // 0xd393
  538. int32_t g121 = 1; // 0xd520
  539. int32_t g122 = 0x4f43007b; // 0xd61b
  540. int32_t g123 = 0x557b007d; // 0xd6e6
  541. int32_t g124 = 0x7fff5370; // 0xd738
  542. int32_t g125 = 0x7c500;
  543. char * (*g6)[16] = &g49; // 0x1e0c0
  544. char (**g9)[8] = &g51; // 0x1e0d0
  545. int32_t * g12 = &g50; // 0x1e0dc
  546. struct vtable_1e0e0_type g13 = {
  547.     .e0 = function_rdiv
  548. }; // 0x1e0e0
  549. int32_t * g17 = &g124; // 0x1e0f4
  550. int32_t * g31 = &g53; // 0x1e130
  551. int32_t * g39 = &g118; // 0x1e154
  552. int32_t * g44 = &g48; // 0x1e174
  553. char (**g46)[4] = &g52; // 0x1e17c
  554.  
  555. // ------------------------ Functions -------------------------
  556.  
  557. // Address range: 0x27e0 - 0x29f7
  558. void function_27e0(void) {
  559.     // 0x27e0
  560.     return;
  561. }
  562.  
  563. // Address range: 0x2a00 - 0x2a07
  564. void __atexit_handler_wrapper(int32_t a1) {
  565.     // 0x2a00
  566.     return;
  567. }
  568.  
  569. // Address range: 0x2a08 - 0x2a0b
  570. void function_2a08(int32_t (*a1)(int32_t)) {
  571.     int32_t v1 = (int32_t)a1;
  572.     g127 = v1;
  573.     a1(v1);
  574. }
  575.  
  576. // Address range: 0x2a0c - 0x2a87
  577. int32_t _start(int32_t a1, int32_t a2, int32_t a3) {
  578.     char ** v1 = (char **)g130;
  579.     int32_t v2 = *(int32_t *)0x2a70 + 0x2a20; // 0x2a18
  580.     int32_t v3 = *(int32_t *)(v2 + *(int32_t *)0x2a74);
  581.     int32_t v4;
  582.     int32_t result = &v4; // 0x2a54_0
  583.     g127 = result;
  584.     int32_t v5 = *(int32_t *)(*(int32_t *)0x2a84 + v2); // 0x2a58
  585.     __libc_init((struct ProgramVars *)&v4, NULL, (void (**)())v5, (void (**)())&v3, v1);
  586.     g130 = (int32_t)v1;
  587.     return result;
  588. }
  589.  
  590. // Address range: 0x2a88 - 0x2aa7
  591. int32_t function_2a88(char * a1) {
  592.     int32_t v1 = *(int32_t *)0x2aa0; // 0x2a8c
  593.     int32_t v2 = *(int32_t *)0x2aa4; // 0x2a90
  594.     return __cxa_atexit((void (**)(char *))(v2 + 0x2aa0), a1, (char *)(v1 + 0x2a9c));
  595. }
  596.  
  597. // Address range: 0x2aa8 - 0x2d47
  598. int32_t get_command(int32_t a1, int32_t a2) {
  599.     int32_t v1 = g134; // 0x2aa8
  600.     int32_t v2 = g135; // 0x2aa8
  601.     int32_t v3 = g136; // 0x2aa8
  602.     int32_t v4 = g137; // 0x2aa8
  603.     int32_t v5 = g138; // 0x2aa8
  604.     int32_t v6 = g129; // 0x2aa8
  605.     int32_t v7 = g130; // bp-8
  606.     g130 = &v7;
  607.     g134 = a2;
  608.     int32_t v8 = *(int32_t *)0x2d44; // 0x2ad0
  609.     g132 = v8;
  610.     int32_t v9 = v8 + 0x2b04; // 0x2afc
  611.     g136 = *(int32_t *)(*(int32_t *)0x2d38 + 0x2b10);
  612.     g138 = *(int32_t *)0x2d28 + 0x2b18;
  613.     int32_t v10 = *(int32_t *)(*(int32_t *)0x2d2c + 0x2b20); // 0x2b18
  614.     int32_t v11 = *(int32_t *)(*(int32_t *)0x2d34 + 0x2b2c); // 0x2b24
  615.     int32_t v12 = *(int32_t *)(*(int32_t *)0x2d1c + 0x2b70); // 0x2b68
  616.     int32_t v13 = *(int32_t *)(*(int32_t *)0x2d18 + 0x2b7c); // 0x2b74
  617.     int32_t * v14 = (int32_t *)*(int32_t *)(*(int32_t *)0x2d24 + 0x2ae8); // 0x2c7c_0
  618.     char * format = (char *)(*(int32_t *)0x2d3c + 0x2af4);
  619.     // branch -> 0x2b98
  620.     while (true) {
  621.         // 0x2b98
  622.         printf((char *)(*(int32_t *)0x2d04 + 0x2acc));
  623.         int32_t v15 = read_line((struct _IO_FILE *)*(int32_t *)(*(int32_t *)0x2d08 + 0x2adc)); // 0x2ba8
  624.         g129 = v15;
  625.         char * str = (char *)v15; // 0x2bb0_0
  626.         if (*str != 0) {
  627.             // 0x2bbc
  628.             if (strcmp(str, (char *)(*(int32_t *)0x2d0c + 0x2b40)) != 0) {
  629.                 // 0x2bd0
  630.                 if (strcmp((char *)g129, (char *)(*(int32_t *)0x2d10 + 0x2b4c)) != 0) {
  631.                     int32_t v16 = g129; // 0x2be8
  632.                     g137 = v16;
  633.                     int32_t str2 = *(int32_t *)*(int32_t *)(*(int32_t *)0x2d14 + 0x2b58); // 0x2bec
  634.                     if (str2 != 0) {
  635.                         // 0x2bf8
  636.                         g135 = 0;
  637.                         g129 = 0;
  638.                         uint32_t v17 = 0; // 0x2c04
  639.                         // branch -> 0x2c00
  640.                         while (true) {
  641.                             // 0x2c00
  642.                             if (((v17 == 0 ? 1 : v17 < 32 ? 1 << v17 : 0) & g134) != 0) {
  643.                                 int32_t strcmp_rc = strcmp((char *)g137, (char *)str2); // 0x2c10
  644.                                 g3 = strcmp_rc == 0;
  645.                                 int32_t result; // 0x2cf8
  646.                                 if (strcmp_rc == 0) {
  647.                                     // 0x2cf0
  648.                                     free((char *)g137);
  649.                                     result = g129 % 256;
  650.                                     g127 = result;
  651.                                     g134 = v1;
  652.                                     g135 = v2;
  653.                                     g136 = v3;
  654.                                     g137 = v4;
  655.                                     g138 = v5;
  656.                                     g129 = v6;
  657.                                     g130 = v7;
  658.                                     return result;
  659.                                 }
  660.                                 int32_t str3 = *(int32_t *)(12 * g135 + v13 + 4); // 0x2c28
  661.                                 if (str3 != 0) {
  662.                                     int32_t strcmp_rc2 = strcmp((char *)g137, (char *)str3); // 0x2c38
  663.                                     g3 = strcmp_rc2 == 0;
  664.                                     if (strcmp_rc2 == 0) {
  665.                                         // 0x2cf0
  666.                                         free((char *)g137);
  667.                                         result = g129 % 256;
  668.                                         g127 = result;
  669.                                         g134 = v1;
  670.                                         g135 = v2;
  671.                                         g136 = v3;
  672.                                         g137 = v4;
  673.                                         g138 = v5;
  674.                                         g129 = v6;
  675.                                         g130 = v7;
  676.                                         return result;
  677.                                     }
  678.                                 }
  679.                             }
  680.                             int32_t v18 = g129 + 1; // 0x2c44
  681.                             g129 = v18;
  682.                             int32_t v19 = v18 % 256; // 0x2c4c
  683.                             g135 = v19;
  684.                             int32_t v20 = *(int32_t *)(12 * v19 + v12); // 0x2c58
  685.                             if (v20 == 0) {
  686.                                 // break -> 0x2c64
  687.                                 break;
  688.                             }
  689.                             str2 = v20;
  690.                             v17 = v19;
  691.                             // continue -> 0x2c00
  692.                         }
  693.                         // 0x2c64
  694.                         v16 = g137;
  695.                         // branch -> 0x2c64
  696.                     }
  697.                     // 0x2c64
  698.                     free((char *)v16);
  699.                     puts((char *)(*(int32_t *)0x2d20 + 0x2b64));
  700.                     // branch -> 0x2b98
  701.                     continue;
  702.                 }
  703.                 // 0x2c78
  704.                 if (*v14 != 0) {
  705.                   lab_0x2c88_2:
  706.                     // 0x2c88
  707.                     g137 = 0;
  708.                     g135 = 0;
  709.                     int32_t v21 = 0; // 0x2cd08
  710.                     uint32_t v22 = 0; // 0x2c94
  711.                     // branch -> 0x2c90
  712.                     while (true) {
  713.                         int32_t v23 = v21; // 0x2cd0
  714.                         if (((v22 == 0 ? 1 : v22 < 32 ? 1 << v22 : 0) & g134) != 0) {
  715.                             // 0x2c9c
  716.                             printf((char *)g138);
  717.                             int32_t v24 = g137; // 0x2ca4
  718.                             int32_t v25 = 3 * v24; // 0x2ca4
  719.                             if (*(int32_t *)(12 * v24 + v10 + 4) != 0) {
  720.                                 // 0x2cbc
  721.                                 printf((char *)(*(int32_t *)0x2d30 + 0x2b34));
  722.                                 // branch -> 0x2cc4
  723.                             }
  724.                             // 0x2cc4
  725.                             puts((char *)*(int32_t *)(v11 + 4 * v25 + 8));
  726.                             v23 = g135;
  727.                             // branch -> 0x2cd0
  728.                         }
  729.                         int32_t v26 = v23 + 1; // 0x2cd0
  730.                         g135 = v26;
  731.                         int32_t v27 = v26 % 256; // 0x2cd4
  732.                         g137 = v27;
  733.                         if (*(int32_t *)(12 * v27 + g136) == 0) {
  734.                             // break -> 0x2b80
  735.                             break;
  736.                         }
  737.                         v21 = v26;
  738.                         v22 = v27;
  739.                         // continue -> 0x2c90
  740.                     }
  741.                     // 0x2b80
  742.                     g132 = v9;
  743.                     printf(format);
  744.                     free((char *)g129);
  745.                     // branch -> 0x2b98
  746.                     continue;
  747.                 }
  748.               lab_0x2b80_2:
  749.                 // 0x2b80
  750.                 g132 = v9;
  751.                 printf(format);
  752.                 free((char *)g129);
  753.                 // branch -> 0x2b98
  754.                 continue;
  755.             }
  756.             // 0x2c78
  757.             if (*v14 == 0) {
  758.                 goto lab_0x2b80_2;
  759.             }
  760.             goto lab_0x2c88_2;
  761.         }
  762.         // 0x2c78
  763.         if (*v14 == 0) {
  764.             goto lab_0x2b80_2;
  765.         }
  766.         goto lab_0x2c88_2;
  767.     }
  768. }
  769.  
  770. // Address range: 0x2d48 - 0x2e43
  771. int32_t print_command_help(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10) {
  772.     int32_t v1 = g135; // 0x2d48
  773.     int32_t v2 = g138; // 0x2d48
  774.     if (*(int32_t *)*(int32_t *)(*(int32_t *)0x2e20 + 0x2d64) == 0) {
  775.         // 0x2dfc
  776.         g135 = v1;
  777.         g138 = v2;
  778.         return printf((char *)(*(int32_t *)0x2e38 + 0x2e10));
  779.     }
  780.     int32_t v3 = 0; // R9
  781.     g138 = 0;
  782.     int32_t v4 = *(int32_t *)(*(int32_t *)0x2e34 + 0x2d80); // 0x2d78
  783.     int32_t v5 = *(int32_t *)(*(int32_t *)0x2e28 + 0x2d94); // 0x2d8c
  784.     g135 = *(int32_t *)(*(int32_t *)0x2e30 + 0x2d9c);
  785.     int32_t v6 = v4; // 0x2df07
  786.     int32_t v7 = 0; // 0x2de05
  787.     uint32_t v8 = 0; // 0x2da8
  788.     // branch -> 0x2da4
  789.     while (true) {
  790.         int32_t v9 = v6; // 0x2df0
  791.         int32_t v10 = v7; // 0x2de0
  792.         if (((v8 == 0 ? 1 : v8 < 32 ? 1 << v8 : 0) & a1) != 0) {
  793.             // 0x2db0
  794.             printf((char *)(*(int32_t *)0x2e24 + 0x2d88));
  795.             int32_t v11 = v3; // 0x2db8
  796.             int32_t v12 = 3 * v11; // 0x2db8
  797.             if (*(int32_t *)(v5 + 12 * v11 + 4) != 0) {
  798.                 // 0x2dcc
  799.                 printf((char *)(*(int32_t *)0x2e2c + 0x2da4));
  800.                 // branch -> 0x2dd4
  801.             }
  802.             // 0x2dd4
  803.             puts((char *)*(int32_t *)(g135 + 4 * v12 + 8));
  804.             v9 = v4;
  805.             v10 = g138;
  806.             // branch -> 0x2de0
  807.         }
  808.         int32_t v13 = v10 + 1; // 0x2de0
  809.         g138 = v13;
  810.         int32_t v14 = v13 % 256; // 0x2de4
  811.         v3 = v14;
  812.         if (*(int32_t *)(12 * v14 + v9) == 0) {
  813.             // 0x2dfc
  814.             // branch -> 0x2dfc
  815.             // 0x2dfc
  816.             g135 = v1;
  817.             g138 = v2;
  818.             return printf((char *)(*(int32_t *)0x2e38 + 0x2e10));
  819.         }
  820.         // 0x2de0
  821.         v6 = v9;
  822.         v7 = v13;
  823.         v8 = v14;
  824.         // branch -> 0x2da4
  825.     }
  826. }
  827.  
  828. // Address range: 0x2e44 - 0x313f
  829. struct _IO_FILE * read_symbols_from_ELF(void) {
  830.     int32_t v1 = g134; // 0x2e44
  831.     int32_t v2 = g135; // 0x2e44
  832.     int32_t v3 = g136; // 0x2e44
  833.     int32_t v4 = g137; // 0x2e44
  834.     int32_t v5 = g138; // 0x2e44
  835.     int32_t v6 = g129; // 0x2e44
  836.     int32_t v7 = g130; // bp-8
  837.     g130 = &v7;
  838.     int32_t v8 = g128; // 0x2e50
  839.     g136 = v8;
  840.     g137 = 0;
  841.     g134 = g132;
  842.     *(int32_t *)v8 = 0;
  843.     struct _IO_FILE * file = fopen((char *)g127, (char *)(*(int32_t *)0x3124 + 0x2e68)); // 0x2e68
  844.     int32_t v9; // 0x2f5c
  845.     if (file == NULL) {
  846.         // 0x2f0c
  847.         *(int32_t *)g134 = *(int32_t *)0x313c + 0x2f18;
  848.         // branch -> 0x2f5c
  849.     } else {
  850.         // 0x2e78
  851.         int32_t v10;
  852.         int32_t v11 = &v10; // 0x2e7c_0
  853.         g133 = v11;
  854.         g128 = 0;
  855.         g132 = 4;
  856.         int32_t v12 = read_file_value(file); // 0x2e88
  857.         int32_t v13 = v10; // 0x2e8c
  858.         int32_t v14 = v13; // 0x2f28
  859.         int32_t v15; // 0x2fb0
  860.         int32_t * v16; // 0x2f44_0
  861.         int32_t v17; // 0x2f3c
  862.         int32_t v18; // R6
  863.         int32_t v19; // 0x305410
  864.         int32_t nmemb; // 0x3080
  865.         int32_t v20; // 0x2f80
  866.         int32_t v21; // 0x2f44
  867.         int32_t v22; // 0x305c
  868.         int32_t v23; // 0x2f68
  869.         int32_t v24; // 0x2f74
  870.         int32_t v25; // 0x2fa0
  871.         int32_t v26; // 0x3094
  872.         if (v13 == 0) {
  873.             // 0x2e98
  874.             if (v12 == 0x464c457f) {
  875.                 // 0x2ea8
  876.                 g133 = v11;
  877.                 g128 = 16;
  878.                 g132 = 4;
  879.                 int32_t v27 = read_file_value(file); // 0x2eb8
  880.                 int32_t v28 = v10; // 0x2ebc
  881.                 if (v28 == 0) {
  882.                     // 0x2ec8
  883.                     if (v27 == 0x280002) {
  884.                         // 0x2ed8
  885.                         g133 = v11;
  886.                         g128 = 20;
  887.                         g132 = 4;
  888.                         int32_t v29 = read_file_value(file); // 0x2ee8
  889.                         int32_t v30 = v10; // 0x2eec
  890.                         if (v30 == 0) {
  891.                             int32_t v31 = *(int32_t *)0x3130 + 0x2f08; // 0x2f00
  892.                             if (v29 == 1) {
  893.                                 // if_2f04_0_true
  894.                                 v14 = v31 & -0x10000;
  895.                                 // branch -> 0x2f24
  896.                             } else {
  897.                                 v14 = v31;
  898.                             }
  899.                         } else {
  900.                             v14 = v30;
  901.                         }
  902.                     } else {
  903.                         // 0x30d8
  904.                         v14 = *(int32_t *)0x312c + 0x30e4;
  905.                         // branch -> 0x2f24
  906.                     }
  907.                     // 0x2f24
  908.                     *(int32_t *)g134 = v14;
  909.                     if (v14 == 0) {
  910.                         // 0x2f30
  911.                         v17 = read_ELF_section_table(file, &v10, (int32_t *)g134);
  912.                         g135 = v17;
  913.                         v21 = g134;
  914.                         v16 = (int32_t *)v21;
  915.                         if (*v16 == 0) {
  916.                             // 0x2f68
  917.                             v23 = v10;
  918.                             v24 = g136;
  919.                             if (v23 == 0) {
  920.                                 // 0x3068
  921.                                 g137 = 0;
  922.                                 v18 = 0;
  923.                                 // branch -> 0x3070
  924.                                 // 0x3070
  925.                                 fclose(file);
  926.                                 free((char *)g135);
  927.                                 nmemb = v18;
  928.                                 if (nmemb == 0) {
  929.                                     // 0x30b8
  930.                                     free((char *)g137);
  931.                                     g137 = 0;
  932.                                     *v16 = *(int32_t *)0x3138 + 0x30d4;
  933.                                     // branch -> 0x2f5c
  934.                                 } else {
  935.                                     // 0x3088
  936.                                     v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
  937.                                     qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
  938.                                     *v16 = 0;
  939.                                     *(int32_t *)v24 = v18;
  940.                                     // branch -> 0x2f5c
  941.                                 }
  942.                                 // 0x2f5c
  943.                                 v9 = g137;
  944.                                 g134 = v1;
  945.                                 g135 = v2;
  946.                                 g136 = v3;
  947.                                 g137 = v4;
  948.                                 g138 = v5;
  949.                                 g129 = v6;
  950.                                 g130 = v7;
  951.                                 return (struct _IO_FILE *)v9;
  952.                             }
  953.                             // 0x2f7c
  954.                             g129 = v21;
  955.                             v20 = v17 + 8;
  956.                             g139 = v20;
  957.                             v18 = 0;
  958.                             g138 = 0;
  959.                             g137 = 0;
  960.                             int32_t v32 = v23; // 0x305c13
  961.                             v19 = 0;
  962.                             v25 = 0;
  963.                             v15 = v20;
  964.                             // branch -> 0x2f94
  965.                             while (true) {
  966.                                 // 0x2f94
  967.                                 v22 = v32;
  968.                                 int32_t v33; // 0x3054
  969.                                 int32_t v34; // 0x3058
  970.                                 if (*(int32_t *)(v15 - 8) == 2) {
  971.                                   lab_0x2fa0_2:;
  972.                                     int32_t v35 = g137; // 0x2fa8
  973.                                     int32_t v36 = *(int32_t *)(v15 - 4); // 0x2fac
  974.                                     int32_t v37 = *(int32_t *)v15; // 0x2fac
  975.                                     int32_t v38 = *(int32_t *)(v15 + 4); // 0x2fb0
  976.                                     int32_t v39 = *(int32_t *)(v15 + 8); // 0x2fb0
  977.                                     int32_t v40 = 20 * v38 + v17; // 0x2fc0
  978.                                     int32_t v41 = *(int32_t *)v40; // 0x2fc0
  979.                                     g134 = v41;
  980.                                     g135 = *(int32_t *)(v40 + 8);
  981.                                     int32_t v42;
  982.                                     g137 = &v42;
  983.                                     g136 = *(int32_t *)(v40 + 16);
  984.                                     int32_t v43 = read_ELF_symbols_from_section(file, 2, v36, v37, v38, v39, v41); // R4
  985.                                     if (*(int32_t *)g129 == 0) {
  986.                                         // 0x3010
  987.                                         v18 = v25;
  988.                                         int32_t mem = (int32_t)realloc((char *)v35, 4 * (v42 + v25)); // 0x3024_5
  989.                                         int32_t v44 = v42; // 0x3028
  990.                                         g135 = v44;
  991.                                         g137 = mem;
  992.                                         __aeabi_memcpy4(4 * v18 + mem, v43, 4 * v44);
  993.                                         free((char *)v43);
  994.                                         int32_t v45 = g135 + v18; // 0x3048
  995.                                         v18 = v45;
  996.                                         g135 = v17;
  997.                                         v22 = v10;
  998.                                         // branch -> 0x3054
  999.                                         // 0x3054
  1000.                                         v33 = g138 + 1;
  1001.                                         g138 = v33;
  1002.                                         v34 = g139 + 20;
  1003.                                         g139 = v34;
  1004.                                         if (v33 >= v22) {
  1005.                                             // break -> 0x3070
  1006.                                             break;
  1007.                                         }
  1008.                                         v32 = v22;
  1009.                                         v19 = v33;
  1010.                                         v25 = v45;
  1011.                                         v15 = v34;
  1012.                                         // continue -> 0x2f94
  1013.                                         continue;
  1014.                                     }
  1015.                                     // 0x30e4
  1016.                                     fclose(file);
  1017.                                     free((char *)v17);
  1018.                                     v18 = v25;
  1019.                                     g135 = v35;
  1020.                                     if (v25 == 0) {
  1021.                                         // 0x3118
  1022.                                         free((char *)v35);
  1023.                                         // branch -> 0x2f58
  1024.                                         // 0x2f58
  1025.                                         g137 = 0;
  1026.                                         // branch -> 0x2f5c
  1027.                                         // 0x2f5c
  1028.                                         v9 = g137;
  1029.                                         g134 = v1;
  1030.                                         g135 = v2;
  1031.                                         g136 = v3;
  1032.                                         g137 = v4;
  1033.                                         g138 = v5;
  1034.                                         g129 = v6;
  1035.                                         g130 = v7;
  1036.                                         return (struct _IO_FILE *)v9;
  1037.                                     }
  1038.                                     int32_t v46 = v35; // 0x3108
  1039.                                     // branch -> 0x3108
  1040.                                     while (true) {
  1041.                                         // 0x3108
  1042.                                         free((char *)*(int32_t *)v46);
  1043.                                         int32_t v47 = v18; // 0x3110
  1044.                                         v18 = v47 - 1;
  1045.                                         if (v47 == 1) {
  1046.                                             // 0x3118
  1047.                                             // branch -> 0x3118
  1048.                                             // 0x3118
  1049.                                             free((char *)g135);
  1050.                                             // branch -> 0x2f58
  1051.                                             // 0x2f58
  1052.                                             g137 = 0;
  1053.                                             // branch -> 0x2f5c
  1054.                                             // 0x2f5c
  1055.                                             v9 = g137;
  1056.                                             g134 = v1;
  1057.                                             g135 = v2;
  1058.                                             g136 = v3;
  1059.                                             g137 = v4;
  1060.                                             g138 = v5;
  1061.                                             g129 = v6;
  1062.                                             g130 = v7;
  1063.                                             return (struct _IO_FILE *)v9;
  1064.                                         }
  1065.                                         // 0x3108
  1066.                                         v46 += 4;
  1067.                                         // branch -> 0x3108
  1068.                                     }
  1069.                                     // 0x3070
  1070.                                     fclose(file);
  1071.                                     int32_t v48 = g135; // 0x3078
  1072.                                     free((char *)v48);
  1073.                                     nmemb = v18;
  1074.                                     int32_t v49; // 0x2f64
  1075.                                     if (nmemb == 0) {
  1076.                                         int32_t v50 = g137; // 0x30b8
  1077.                                         free((char *)v50);
  1078.                                         g137 = 0;
  1079.                                         int32_t v51 = *(int32_t *)0x3138; // 0x30c8
  1080.                                         *v16 = v51 + 0x30d4;
  1081.                                         // branch -> 0x2f5c
  1082.                                         // 0x2f5c
  1083.                                         v9 = g137;
  1084.                                         g134 = v1;
  1085.                                         g135 = v2;
  1086.                                         g136 = v3;
  1087.                                         g137 = v4;
  1088.                                         g138 = v5;
  1089.                                         g129 = v6;
  1090.                                         v49 = v7;
  1091.                                         g130 = v49;
  1092.                                         return (struct _IO_FILE *)v9;
  1093.                                     }
  1094.                                     int32_t v52 = *(int32_t *)0x3134; // 0x3088
  1095.                                     v26 = *(int32_t *)(v52 + 0x309c);
  1096.                                     int32_t base = g137; // 0x3098
  1097.                                     qsort((char *)base, nmemb, 4, (int32_t (**)(char *, char *))v26);
  1098.                                     *v16 = 0;
  1099.                                     int32_t v53 = v18; // 0x30b0
  1100.                                     *(int32_t *)v24 = v53;
  1101.                                     // branch -> 0x2f5c
  1102.                                     // 0x2f5c
  1103.                                     v9 = g137;
  1104.                                     g134 = v1;
  1105.                                     g135 = v2;
  1106.                                     g136 = v3;
  1107.                                     g137 = v4;
  1108.                                     g138 = v5;
  1109.                                     g129 = v6;
  1110.                                     v49 = v7;
  1111.                                     g130 = v49;
  1112.                                     return (struct _IO_FILE *)v9;
  1113.                                 }
  1114.                               lab_0x3054_2:
  1115.                                 // 0x3054
  1116.                                 v33 = v19 + 1;
  1117.                                 g138 = v33;
  1118.                                 v34 = v15 + 20;
  1119.                                 g139 = v34;
  1120.                                 if (v33 >= v22) {
  1121.                                     // break -> 0x3070
  1122.                                     break;
  1123.                                 }
  1124.                                 v32 = v22;
  1125.                                 v19 = v33;
  1126.                                 v15 = v34;
  1127.                                 // continue -> 0x2f94
  1128.                             }
  1129.                             // 0x3070
  1130.                             fclose(file);
  1131.                             free((char *)g135);
  1132.                             nmemb = v18;
  1133.                             if (nmemb == 0) {
  1134.                                 // 0x30b8
  1135.                                 free((char *)g137);
  1136.                                 g137 = 0;
  1137.                                 *v16 = *(int32_t *)0x3138 + 0x30d4;
  1138.                                 // branch -> 0x2f5c
  1139.                             } else {
  1140.                                 // 0x3088
  1141.                                 v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
  1142.                                 qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
  1143.                                 *v16 = 0;
  1144.                                 *(int32_t *)v24 = v18;
  1145.                                 // branch -> 0x2f5c
  1146.                             }
  1147.                             // 0x2f5c
  1148.                             v9 = g137;
  1149.                             g134 = v1;
  1150.                             g135 = v2;
  1151.                             g136 = v3;
  1152.                             g137 = v4;
  1153.                             g138 = v5;
  1154.                             g129 = v6;
  1155.                             g130 = v7;
  1156.                             return (struct _IO_FILE *)v9;
  1157.                         }
  1158.                     }
  1159.                     // 0x2f50
  1160.                     fclose(file);
  1161.                     // branch -> 0x2f58
  1162.                     // 0x2f58
  1163.                     g137 = 0;
  1164.                     // branch -> 0x2f5c
  1165.                     // 0x2f5c
  1166.                     v9 = g137;
  1167.                     g134 = v1;
  1168.                     g135 = v2;
  1169.                     g136 = v3;
  1170.                     g137 = v4;
  1171.                     g138 = v5;
  1172.                     g129 = v6;
  1173.                     g130 = v7;
  1174.                     return (struct _IO_FILE *)v9;
  1175.                 }
  1176.                 v14 = v28;
  1177.             } else {
  1178.                 // 0x2f1c
  1179.                 v14 = *(int32_t *)0x3128 + 0x2f28;
  1180.                 // branch -> 0x2f24
  1181.             }
  1182.             // 0x2f24
  1183.             *(int32_t *)g134 = v14;
  1184.             if (v14 == 0) {
  1185.                 // 0x2f30
  1186.                 v17 = read_ELF_section_table(file, &v10, (int32_t *)g134);
  1187.                 g135 = v17;
  1188.                 v21 = g134;
  1189.                 v16 = (int32_t *)v21;
  1190.                 if (*v16 == 0) {
  1191.                     // 0x2f68
  1192.                     v23 = v10;
  1193.                     v24 = g136;
  1194.                     if (v23 == 0) {
  1195.                         // 0x3068
  1196.                         g137 = 0;
  1197.                         v18 = 0;
  1198.                         // branch -> 0x3070
  1199.                     } else {
  1200.                         // 0x2f7c
  1201.                         g129 = v21;
  1202.                         v20 = v17 + 8;
  1203.                         g139 = v20;
  1204.                         v18 = 0;
  1205.                         g138 = 0;
  1206.                         g137 = 0;
  1207.                         v25 = 0;
  1208.                         v15 = v20;
  1209.                         // branch -> 0x2f94
  1210.                         while (true) {
  1211.                             // 0x2f94
  1212.                             if (*(int32_t *)(v15 - 8) == 2) {
  1213.                                 goto lab_0x2fa0_2;
  1214.                             }
  1215.                             v22 = v23;
  1216.                             goto lab_0x3054_2;
  1217.                         }
  1218.                     }
  1219.                     // 0x3070
  1220.                     fclose(file);
  1221.                     free((char *)g135);
  1222.                     nmemb = v18;
  1223.                     if (nmemb == 0) {
  1224.                         // 0x30b8
  1225.                         free((char *)g137);
  1226.                         g137 = 0;
  1227.                         *v16 = *(int32_t *)0x3138 + 0x30d4;
  1228.                         // branch -> 0x2f5c
  1229.                     } else {
  1230.                         // 0x3088
  1231.                         v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
  1232.                         qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
  1233.                         *v16 = 0;
  1234.                         *(int32_t *)v24 = v18;
  1235.                         // branch -> 0x2f5c
  1236.                     }
  1237.                     // 0x2f5c
  1238.                     v9 = g137;
  1239.                     g134 = v1;
  1240.                     g135 = v2;
  1241.                     g136 = v3;
  1242.                     g137 = v4;
  1243.                     g138 = v5;
  1244.                     g129 = v6;
  1245.                     g130 = v7;
  1246.                     return (struct _IO_FILE *)v9;
  1247.                 }
  1248.             }
  1249.             // 0x2f50
  1250.             fclose(file);
  1251.             // branch -> 0x2f58
  1252.             // 0x2f58
  1253.             g137 = 0;
  1254.             // branch -> 0x2f5c
  1255.             // 0x2f5c
  1256.             v9 = g137;
  1257.             g134 = v1;
  1258.             g135 = v2;
  1259.             g136 = v3;
  1260.             g137 = v4;
  1261.             g138 = v5;
  1262.             g129 = v6;
  1263.             g130 = v7;
  1264.             return (struct _IO_FILE *)v9;
  1265.         }
  1266.         // 0x2f24
  1267.         *(int32_t *)g134 = v14;
  1268.         if (v14 == 0) {
  1269.             // 0x2f30
  1270.             v17 = read_ELF_section_table(file, &v10, (int32_t *)g134);
  1271.             g135 = v17;
  1272.             v21 = g134;
  1273.             v16 = (int32_t *)v21;
  1274.             if (*v16 == 0) {
  1275.                 // 0x2f68
  1276.                 v23 = v10;
  1277.                 v24 = g136;
  1278.                 if (v23 == 0) {
  1279.                     // 0x3068
  1280.                     g137 = 0;
  1281.                     v18 = 0;
  1282.                     // branch -> 0x3070
  1283.                 } else {
  1284.                     // 0x2f7c
  1285.                     g129 = v21;
  1286.                     v20 = v17 + 8;
  1287.                     g139 = v20;
  1288.                     v18 = 0;
  1289.                     g138 = 0;
  1290.                     g137 = 0;
  1291.                     v19 = 0;
  1292.                     v25 = 0;
  1293.                     v15 = v20;
  1294.                     // branch -> 0x2f94
  1295.                     while (true) {
  1296.                         // 0x2f94
  1297.                         if (*(int32_t *)(v15 - 8) == 2) {
  1298.                             goto lab_0x2fa0_2;
  1299.                         }
  1300.                         v22 = v23;
  1301.                         goto lab_0x3054_2;
  1302.                     }
  1303.                 }
  1304.                 // 0x3070
  1305.                 fclose(file);
  1306.                 free((char *)g135);
  1307.                 nmemb = v18;
  1308.                 if (nmemb == 0) {
  1309.                     // 0x30b8
  1310.                     free((char *)g137);
  1311.                     g137 = 0;
  1312.                     *v16 = *(int32_t *)0x3138 + 0x30d4;
  1313.                     // branch -> 0x2f5c
  1314.                 } else {
  1315.                     // 0x3088
  1316.                     v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
  1317.                     qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
  1318.                     *v16 = 0;
  1319.                     *(int32_t *)v24 = v18;
  1320.                     // branch -> 0x2f5c
  1321.                 }
  1322.                 // 0x2f5c
  1323.                 v9 = g137;
  1324.                 g134 = v1;
  1325.                 g135 = v2;
  1326.                 g136 = v3;
  1327.                 g137 = v4;
  1328.                 g138 = v5;
  1329.                 g129 = v6;
  1330.                 g130 = v7;
  1331.                 return (struct _IO_FILE *)v9;
  1332.             }
  1333.         }
  1334.         // 0x2f50
  1335.         fclose(file);
  1336.         // branch -> 0x2f58
  1337.         // 0x2f58
  1338.         g137 = 0;
  1339.         // branch -> 0x2f5c
  1340.     }
  1341.     // 0x2f5c
  1342.     v9 = g137;
  1343.     g134 = v1;
  1344.     g135 = v2;
  1345.     g136 = v3;
  1346.     g137 = v4;
  1347.     g138 = v5;
  1348.     g129 = v6;
  1349.     g130 = v7;
  1350.     return (struct _IO_FILE *)v9;
  1351. }
  1352.  
  1353. // Address range: 0x3140 - 0x3223
  1354. int32_t validate_ELF_file(int32_t a1, int32_t a2) {
  1355.     int32_t v1 = g134; // 0x3140
  1356.     int32_t v2 = g130; // bp-8
  1357.     g130 = &v2;
  1358.     int32_t v3;
  1359.     g133 = &v3;
  1360.     g128 = 0;
  1361.     g132 = 4;
  1362.     g134 = a1;
  1363.     int32_t v4 = read_file_value((struct _IO_FILE *)a1); // 0x315c
  1364.     g127 = v3;
  1365.     g3 = v3 == 0;
  1366.     int32_t result4 = v3; // 0x3174_2
  1367.     if (v3 == 0) {
  1368.         // 0x3178
  1369.         g3 = v4 == 0x464c457f;
  1370.         if (v4 != 0x464c457f) {
  1371.             int32_t result = *(int32_t *)0x3218 + 0x3204; // 0x31fc
  1372.             g127 = result;
  1373.             g134 = v1;
  1374.             g130 = v2;
  1375.             return result;
  1376.         }
  1377.         // 0x3188
  1378.         int32_t v5;
  1379.         g133 = &v5;
  1380.         g128 = 16;
  1381.         g132 = 4;
  1382.         int32_t v6 = read_file_value((struct _IO_FILE *)g134); // 0x3198
  1383.         g127 = v5;
  1384.         g3 = v5 == 0;
  1385.         if (v5 == 0) {
  1386.             // 0x31ac
  1387.             g3 = v6 == 0x280002;
  1388.             if (v6 != 0x280002) {
  1389.                 int32_t result2 = *(int32_t *)0x321c + 0x3214; // 0x320c
  1390.                 g127 = result2;
  1391.                 g134 = v1;
  1392.                 g130 = v2;
  1393.                 return result2;
  1394.             }
  1395.             // 0x31bc
  1396.             int32_t v7;
  1397.             g133 = &v7;
  1398.             g128 = 20;
  1399.             g132 = 4;
  1400.             int32_t v8 = read_file_value((struct _IO_FILE *)g134); // 0x31cc
  1401.             g127 = v7;
  1402.             g3 = v7 == 0;
  1403.             if (v7 == 0) {
  1404.                 // 0x31e0
  1405.                 g3 = v8 == 1;
  1406.                 int32_t v9 = *(int32_t *)0x3220 + 0x31f0; // 0x31e8
  1407.                 int32_t result3 = v8 == 1 ? v9 & -0x10000 : v9; // 0x31e8
  1408.                 g127 = result3;
  1409.                 g134 = v1;
  1410.                 g130 = v2;
  1411.                 return result3;
  1412.             }
  1413.             result4 = v7;
  1414.         } else {
  1415.             result4 = v5;
  1416.         }
  1417.     }
  1418.     // 0x3170
  1419.     g134 = v1;
  1420.     g130 = v2;
  1421.     return result4;
  1422. }
  1423.  
  1424. // Address range: 0x3224 - 0x33ff
  1425. int32_t read_ELF_section_table(struct _IO_FILE * a1, int32_t * a2, int32_t * a3) {
  1426.     int32_t v1 = (int32_t)a3;
  1427.     int32_t v2 = g134; // 0x3224
  1428.     int32_t v3 = g135; // 0x3224
  1429.     int32_t v4 = g136; // 0x3224
  1430.     int32_t v5 = g138; // 0x3224
  1431.     int32_t v6 = g130; // bp-8
  1432.     g130 = &v6;
  1433.     g135 = v1;
  1434.     g129 = (int32_t)a2;
  1435.     g128 = 32;
  1436.     g132 = 4;
  1437.     g133 = v1;
  1438.     g137 = (int32_t)a1;
  1439.     g136 = read_file_value(a1);
  1440.     int32_t v7 = g135; // 0x3250
  1441.     g134 = 0;
  1442.     int32_t result; // 0x33ec
  1443.     if (*(int32_t *)v7 == 0) {
  1444.         // 0x3260
  1445.         g128 = 46;
  1446.         g132 = 2;
  1447.         g133 = v7;
  1448.         g138 = read_file_value((struct _IO_FILE *)g137);
  1449.         int32_t v8 = g135; // 0x3278
  1450.         if (*(int32_t *)v8 == 0) {
  1451.             // 0x3284
  1452.             g128 = 48;
  1453.             g132 = 2;
  1454.             g133 = v8;
  1455.             uint32_t v9 = read_file_value((struct _IO_FILE *)g137); // 0x3294
  1456.             int32_t * v10 = (int32_t *)g135; // 0x3298_0
  1457.             if (*v10 == 0) {
  1458.                 // 0x32a4
  1459.                 if (g136 != 0) {
  1460.                     uint32_t v11 = g138; // 0x32a8
  1461.                     if (v11 != 0) {
  1462.                         // 0x32b0
  1463.                         if (v9 != 0) {
  1464.                             // 0x32b8
  1465.                             if (v11 > 39) {
  1466.                                 int32_t mem = (int32_t)malloc(20 * v9); // 0x32f0_3
  1467.                                 g134 = mem;
  1468.                                 int32_t v12 = g136 + 36; // 0x32f8
  1469.                                 g136 = v12;
  1470.                                 int32_t v13 = mem + 8; // R9
  1471.                                 g138 = 0;
  1472.                                 int32_t v14 = g135; // 0x3310
  1473.                                 // branch -> 0x3304
  1474.                                 while (true) {
  1475.                                     // 0x3304
  1476.                                     g128 = v12 - 32;
  1477.                                     g132 = 4;
  1478.                                     g133 = v14;
  1479.                                     *(int32_t *)(v13 - 8) = read_file_value((struct _IO_FILE *)g137);
  1480.                                     int32_t v15 = g135; // 0x331c
  1481.                                     if (*(int32_t *)v15 == 0) {
  1482.                                         // 0x3328
  1483.                                         g128 = g136 - 20;
  1484.                                         g132 = 4;
  1485.                                         g133 = v15;
  1486.                                         *(int32_t *)(v13 - 4) = read_file_value((struct _IO_FILE *)g137);
  1487.                                         int32_t v16 = g135; // 0x3340
  1488.                                         if (*(int32_t *)v16 == 0) {
  1489.                                             // 0x334c
  1490.                                             g128 = g136 - 16;
  1491.                                             g132 = 4;
  1492.                                             g133 = v16;
  1493.                                             *(int32_t *)v13 = read_file_value((struct _IO_FILE *)g137);
  1494.                                             int32_t v17 = g135; // 0x3364
  1495.                                             if (*(int32_t *)v17 == 0) {
  1496.                                                 // 0x3370
  1497.                                                 g128 = g136 - 12;
  1498.                                                 g132 = 4;
  1499.                                                 g133 = v17;
  1500.                                                 *(int32_t *)(v13 + 4) = read_file_value((struct _IO_FILE *)g137);
  1501.                                                 int32_t v18 = g135; // 0x3388
  1502.                                                 if (*(int32_t *)v18 == 0) {
  1503.                                                     // 0x3394
  1504.                                                     g128 = g136;
  1505.                                                     g132 = 4;
  1506.                                                     g133 = v18;
  1507.                                                     *(int32_t *)(v13 + 8) = read_file_value((struct _IO_FILE *)g137);
  1508.                                                     int32_t v19 = g135; // 0x33ac
  1509.                                                     if (*(int32_t *)v19 == 0) {
  1510.                                                         // 0x33b8
  1511.                                                         v13 += 20;
  1512.                                                         int32_t v20 = g138 + 1; // 0x33c0
  1513.                                                         g138 = v20;
  1514.                                                         int32_t v21 = g136 + v11; // 0x33c4
  1515.                                                         g136 = v21;
  1516.                                                         if (v20 >= v9) {
  1517.                                                             // break -> 0x33d4
  1518.                                                             break;
  1519.                                                         }
  1520.                                                         v14 = v19;
  1521.                                                         v12 = v21;
  1522.                                                         // continue -> 0x3304
  1523.                                                         continue;
  1524.                                                     }
  1525.                                                 }
  1526.                                             }
  1527.                                         }
  1528.                                     }
  1529.                                     // 0x33e0
  1530.                                     free((char *)g134);
  1531.                                     g134 = 0;
  1532.                                     // branch -> 0x33ec
  1533.                                     // 0x33ec
  1534.                                     result = g134;
  1535.                                     g134 = v2;
  1536.                                     g135 = v3;
  1537.                                     g136 = v4;
  1538.                                     g138 = v5;
  1539.                                     g130 = v6;
  1540.                                     return result;
  1541.                                 }
  1542.                                 // 0x33d4
  1543.                                 *(int32_t *)g129 = v9;
  1544.                                 // branch -> 0x33ec
  1545.                             } else {
  1546.                                 // 0x32c0
  1547.                                 *v10 = *(int32_t *)0x33fc + 0x32cc;
  1548.                                 // branch -> 0x33ec
  1549.                             }
  1550.                             // 0x33ec
  1551.                             result = g134;
  1552.                             g134 = v2;
  1553.                             g135 = v3;
  1554.                             g136 = v4;
  1555.                             g138 = v5;
  1556.                             g130 = v6;
  1557.                             return result;
  1558.                         }
  1559.                     }
  1560.                 }
  1561.                 // 0x32d0
  1562.                 *v10 = *(int32_t *)0x33f8 + 0x32dc;
  1563.                 // branch -> 0x33ec
  1564.             }
  1565.         }
  1566.     }
  1567.     // 0x33ec
  1568.     result = g134;
  1569.     g134 = v2;
  1570.     g135 = v3;
  1571.     g136 = v4;
  1572.     g138 = v5;
  1573.     g130 = v6;
  1574.     return result;
  1575. }
  1576.  
  1577. // Address range: 0x3400 - 0x3627
  1578. int32_t read_ELF_symbols_from_section(struct _IO_FILE * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7) {
  1579.     int32_t v1 = g135; // 0x3400
  1580.     int32_t v2 = g138; // 0x3400
  1581.     int32_t v3 = g139; // 0x3400
  1582.     int32_t v4 = g129; // 0x3400
  1583.     int32_t v5 = g130; // bp-8
  1584.     g130 = &v5;
  1585.     g135 = (int32_t)a1;
  1586.     int32_t v6;
  1587.     g134 = v6;
  1588.     g137 = a4;
  1589.     int32_t v7;
  1590.     int32_t * v8 = (int32_t *)v7; // 0x3428_0
  1591.     *v8 = 0;
  1592.     int32_t result2; // 0x361c
  1593.     if (a4 == 0) {
  1594.         // 0x3584
  1595.         g138 = 0;
  1596.         // branch -> 0x358c
  1597.         // 0x358c
  1598.         *v8 = 0;
  1599.         *(int32_t *)g134 = 0;
  1600.         result2 = g138;
  1601.         // branch -> 0x361c
  1602.     } else {
  1603.         // 0x3430
  1604.         g139 = 0;
  1605.         g138 = 0;
  1606.         g129 = 0;
  1607.         int32_t v9 = g137; // bp-56
  1608.         int32_t v10 = g135; // 0x3440
  1609.         struct _IO_FILE * v11 = (struct _IO_FILE *)v10;
  1610.         int32_t v12 = 0; // 0x3450
  1611.         int32_t v13 = g134; // 0x344c
  1612.         // branch -> 0x3444
  1613.         while (true) {
  1614.             // 0x3444
  1615.             g132 = 1;
  1616.             g133 = v13;
  1617.             int32_t v14 = v12 + a3; // 0x3450
  1618.             g136 = v14;
  1619.             g128 = v14 + 12;
  1620.             uint32_t v15 = read_file_value(v11); // 0x345c
  1621.             int32_t v16 = g134; // 0x3460
  1622.             if (*(int32_t *)v16 == 0) {
  1623.                 uint32_t v17 = v15 % 16; // 0x346c
  1624.                 int32_t v18; // 0x3578
  1625.                 int32_t v19; // 0x344c5
  1626.                 if ((v17 + 255) % 256 <= 1) {
  1627.                     int32_t v20 = g138; // 0x3480
  1628.                     g128 = g136;
  1629.                     g132 = 4;
  1630.                     g135 = v10;
  1631.                     g133 = v16;
  1632.                     int32_t v21 = read_file_value(v11); // 0x3498
  1633.                     int32_t v22 = g134; // 0x349c
  1634.                     if (*(int32_t *)v22 == 0) {
  1635.                         // 0x34a8
  1636.                         g132 = v22;
  1637.                         int32_t v23;
  1638.                         int32_t str = read_file_string((struct _IO_FILE *)g135, v21 + v23); // 0x34b8
  1639.                         g138 = str;
  1640.                         if (*(int32_t *)g134 == 0) {
  1641.                             int32_t len = strlen((char *)str); // 0x34d0
  1642.                             int32_t mem = (int32_t)malloc(len + 13); // 0x34d8_3
  1643.                             g137 = g134;
  1644.                             g134 = mem;
  1645.                             strcpy((char *)(mem + 9), (char *)g138);
  1646.                             free((char *)g138);
  1647.                             g128 = g136 + 4;
  1648.                             *(char *)(g134 + 8) = (char)v17;
  1649.                             g132 = 4;
  1650.                             g133 = g137;
  1651.                             *(int32_t *)g134 = read_file_value((struct _IO_FILE *)g135);
  1652.                             int32_t v24 = g137; // 0x3518
  1653.                             if (*(int32_t *)v24 == 0) {
  1654.                                 // 0x3524
  1655.                                 g128 = g136 + 8;
  1656.                                 g132 = 4;
  1657.                                 g133 = v24;
  1658.                                 *(int32_t *)(g134 + 4) = read_file_value((struct _IO_FILE *)g135);
  1659.                                 if (*(int32_t *)g137 == 0) {
  1660.                                     int32_t v25 = g139 + 1; // 0x3548
  1661.                                     g135 = v25;
  1662.                                     int32_t mem2 = (int32_t)realloc((char *)v20, 4 * v25); // 0x3554_5
  1663.                                     g138 = mem2;
  1664.                                     *(int32_t *)(4 * g139 + mem2) = g134;
  1665.                                     int32_t v26 = g137; // 0x3560
  1666.                                     g134 = v26;
  1667.                                     g139 = g135;
  1668.                                     g137 = v9;
  1669.                                     v18 = v9;
  1670.                                     v19 = v26;
  1671.                                     // branch -> 0x356c
  1672.                                     goto lab_0x356c;
  1673.                                 }
  1674.                             }
  1675.                             // 0x35e8
  1676.                             free((char *)g134);
  1677.                             g135 = v20;
  1678.                             if (g139 == 0) {
  1679.                                 // 0x3614
  1680.                                 free((char *)*&g135);
  1681.                                 g138 = 0;
  1682.                                 // branch -> 0x361c
  1683.                                 // 0x361c
  1684.                                 g135 = v1;
  1685.                                 g138 = v2;
  1686.                                 g139 = v3;
  1687.                                 g129 = v4;
  1688.                                 g130 = v5;
  1689.                                 return 0;
  1690.                             }
  1691.                             int32_t v27 = v20; // 0x3600
  1692.                             // branch -> 0x3600
  1693.                             while (true) {
  1694.                                 // 0x3600
  1695.                                 free((char *)*(int32_t *)v27);
  1696.                                 int32_t v28 = g139; // 0x3608
  1697.                                 g139 = v28 - 1;
  1698.                                 if (v28 != 1) {
  1699.                                     // 0x3600
  1700.                                     v27 += 4;
  1701.                                     // branch -> 0x3600
  1702.                                     continue;
  1703.                                 }
  1704.                             }
  1705.                             // 0x358c
  1706.                             // branch -> 0x358c
  1707.                             // 0x358c
  1708.                             *v8 = g139;
  1709.                             *(int32_t *)g134 = 0;
  1710.                             int32_t result = g138;
  1711.                             // branch -> 0x361c
  1712.                             // 0x361c
  1713.                             g135 = v1;
  1714.                             g138 = v2;
  1715.                             g139 = v3;
  1716.                             g129 = v4;
  1717.                             g130 = v5;
  1718.                             return result;
  1719.                         }
  1720.                     }
  1721.                     // 0x35c4
  1722.                     g135 = v20;
  1723.                     if (g139 != 0) {
  1724.                         // branch -> 0x35d4
  1725.                         while (true) {
  1726.                             // 0x35d4
  1727.                             free((char *)*(int32_t *)v20);
  1728.                             int32_t v29 = g139; // 0x35dc
  1729.                             g139 = v29 - 1;
  1730.                             if (v29 != 1) {
  1731.                                 // 0x35d4
  1732.                                 v20 += 4;
  1733.                                 // branch -> 0x35d4
  1734.                                 continue;
  1735.                             }
  1736.                         }
  1737.                     }
  1738.                     // 0x3614
  1739.                     free((char *)g135);
  1740.                     g138 = 0;
  1741.                     // branch -> 0x361c
  1742.                     // 0x361c
  1743.                     g135 = v1;
  1744.                     g138 = v2;
  1745.                     g139 = v3;
  1746.                     g129 = v4;
  1747.                     g130 = v5;
  1748.                     return 0;
  1749.                 }
  1750.                 // 0x346c
  1751.                 v18 = g137;
  1752.                 v19 = v16;
  1753.                 // branch -> 0x356c
  1754.               lab_0x356c:
  1755.                 // 0x356c
  1756.                 g135 = v10;
  1757.                 int32_t v30 = g129 + a6; // 0x3574
  1758.                 g129 = v30;
  1759.                 if (v30 >= v18) {
  1760.                     // break -> 0x358c
  1761.                     break;
  1762.                 }
  1763.                 v12 = v30;
  1764.                 v13 = v19;
  1765.                 // continue -> 0x3444
  1766.                 continue;
  1767.             } else {
  1768.                 // 0x35a0
  1769.                 if (g139 != 0) {
  1770.                     int32_t v31 = g138; // 0x35ac
  1771.                     // branch -> 0x35ac
  1772.                     while (true) {
  1773.                         // 0x35ac
  1774.                         free((char *)*(int32_t *)v31);
  1775.                         int32_t v32 = g139; // 0x35b4
  1776.                         g139 = v32 - 1;
  1777.                         if (v32 != 1) {
  1778.                             // 0x35ac
  1779.                             v31 += 4;
  1780.                             // branch -> 0x35ac
  1781.                             continue;
  1782.                         }
  1783.                     }
  1784.                 }
  1785.             }
  1786.             // 0x3614
  1787.             free((char *)g138);
  1788.             g138 = 0;
  1789.             // branch -> 0x361c
  1790.             // 0x361c
  1791.             g135 = v1;
  1792.             g138 = v2;
  1793.             g139 = v3;
  1794.             g129 = v4;
  1795.             g130 = v5;
  1796.             return 0;
  1797.         }
  1798.     }
  1799.     // 0x361c
  1800.     g135 = v1;
  1801.     g138 = v2;
  1802.     g139 = v3;
  1803.     g129 = v4;
  1804.     g130 = v5;
  1805.     return result2;
  1806. }
  1807.  
  1808. // Address range: 0x3628 - 0x365f
  1809. int32_t destroy_ELF_symbols(char * a1, int32_t a2) {
  1810.     int32_t result2 = (int32_t)a1;
  1811.     int32_t v1 = g134; // 0x3628
  1812.     int32_t v2 = g135; // 0x3628
  1813.     g135 = a2;
  1814.     g134 = result2;
  1815.     g3 = a2 == 0;
  1816.     if (a2 != 0) {
  1817.         int32_t result = *(int32_t *)a1; // 0x3644
  1818.         free((char *)result);
  1819.         return result;
  1820.     }
  1821.     // 0x3654
  1822.     g134 = v1;
  1823.     g135 = v2;
  1824.     free(a1);
  1825.     return result2;
  1826. }
  1827.  
  1828. // Address range: 0x3660 - 0x36b3
  1829. int32_t compare_ELF_symbols(int32_t * a1, int32_t * a2) {
  1830.     int32_t v1 = *a2; // 0x3660
  1831.     int32_t v2 = *a1; // 0x3664
  1832.     uint32_t v3 = *(int32_t *)v1; // 0x3668
  1833.     uint32_t v4 = *(int32_t *)v2; // 0x366c
  1834.     int32_t result; // 0x36b0_1
  1835.     int32_t v5; // 0x36ac
  1836.     if (v4 != v3) {
  1837.         int32_t v6 = (int32_t)(v4 >= v3) ^ 1;
  1838.         if (v4 < v3) {
  1839.             v5 = 0;
  1840.             // 0x36a8
  1841.             if (v6 != 0) {
  1842.                 // if_36ac_0_true
  1843.                 result = v5 - 1;
  1844.                 // branch -> after_if_36ac_0
  1845.             } else {
  1846.                 result = v5;
  1847.             }
  1848.             // after_if_36ac_0
  1849.             return result;
  1850.         }
  1851.         // 0x36a8
  1852.         v5 = 1;
  1853.         // branch -> 0x36a8
  1854.         // 0x36a8
  1855.         if (v6 != 0) {
  1856.             // if_36ac_0_true
  1857.             result = v5 - 1;
  1858.             // branch -> after_if_36ac_0
  1859.         } else {
  1860.             result = v5;
  1861.         }
  1862.         // after_if_36ac_0
  1863.         return result;
  1864.     }
  1865.     uint32_t v7 = *(int32_t *)(v2 + 4); // 0x3678
  1866.     uint32_t v8 = *(int32_t *)(v1 + 4); // 0x3680
  1867.     int32_t v9 = v7 > v8;
  1868.     if (v7 >= v8) {
  1869.         v5 = 0;
  1870.         // 0x36a8
  1871.         if (v9 != 0) {
  1872.             // if_36ac_0_true
  1873.             result = v5 - 1;
  1874.             // branch -> after_if_36ac_0
  1875.         } else {
  1876.             result = v5;
  1877.         }
  1878.         // after_if_36ac_0
  1879.         return result;
  1880.     }
  1881.     // 0x36a8
  1882.     v5 = 1;
  1883.     // branch -> 0x36a8
  1884.     // 0x36a8
  1885.     if (v9 != 0) {
  1886.         // if_36ac_0_true
  1887.         result = v5 - 1;
  1888.         // branch -> after_if_36ac_0
  1889.     } else {
  1890.         result = v5;
  1891.     }
  1892.     // after_if_36ac_0
  1893.     return result;
  1894. }
  1895.  
  1896. // Address range: 0x36b4 - 0x36ff
  1897. int32_t validate_file_value(int32_t a1, int32_t a2) {
  1898.     g128 = a2;
  1899.     int32_t v1 = g134; // 0x36b4
  1900.     int32_t v2 = g130; // bp-8
  1901.     g130 = &v2;
  1902.     g134 = g133;
  1903.     int32_t v3;
  1904.     g133 = &v3;
  1905.     g132 %= 256;
  1906.     int32_t v4 = read_file_value((struct _IO_FILE *)a1); // 0x36cc
  1907.     g127 = v3;
  1908.     g3 = v3 == 0;
  1909.     int32_t result = v3; // 0x36f0_2
  1910.     if (v3 == 0) {
  1911.         // 0x36e0
  1912.         int32_t v5;
  1913.         g127 = v5;
  1914.         g3 = v4 == g134;
  1915.         if (v4 == g134) {
  1916.             int32_t v6 = v5 & -0x10000; // 0x36e8
  1917.             g127 = v6;
  1918.             result = v6;
  1919.             // branch -> 0x36ec
  1920.         } else {
  1921.             result = v5;
  1922.         }
  1923.     }
  1924.     // 0x36ec
  1925.     g134 = v1;
  1926.     g130 = v2;
  1927.     return result;
  1928. }
  1929.  
  1930. // Address range: 0x3700 - 0x3763
  1931. int32_t read_line(struct _IO_FILE * stream) {
  1932.     int32_t v1 = g135; // 0x3700
  1933.     int32_t v2 = g138; // 0x3700
  1934.     g135 = 0;
  1935.     g138 = 0;
  1936.     // branch -> 0x3720
  1937.     while (true) {
  1938.         int32_t v3 = 0x1000000 * getc((struct _IO_FILE *)(int32_t)stream);
  1939.         int32_t v4 = v3 / 0x1000000; // R6
  1940.         if (v3 != 0xd000000) {
  1941.             int32_t v5 = g138 + 1; // 0x3734
  1942.             int32_t mem = (int32_t)realloc((char *)g135, v5); // 0x3740_5
  1943.             g135 = mem;
  1944.             if (v4 == -1 || v4 == 10) {
  1945.                 // 0x3754
  1946.                 *(char *)(g138 + mem) = 0;
  1947.                 int32_t result = g135; // 0x375c
  1948.                 g135 = v1;
  1949.                 g138 = v2;
  1950.                 return result;
  1951.             }
  1952.             // 0x3718
  1953.             *(char *)(g138 + mem) = (char)v4;
  1954.             g138 = v5;
  1955.             // branch -> 0x3720
  1956.         }
  1957.         // 0x3720
  1958.         // branch -> 0x3720
  1959.     }
  1960. }
  1961.  
  1962. // Address range: 0x3764 - 0x37d7
  1963. int32_t get_file_length(struct _IO_FILE * stream) {
  1964.     int32_t v1 = g134; // 0x3764
  1965.     int32_t v2 = g135; // 0x3764
  1966.     int32_t v3 = g130; // 0x3764
  1967.     int32_t stream2 = (int32_t)stream; // R4
  1968.     int32_t curr_file_offset = ftell(stream); // 0x3770
  1969.     g135 = 0;
  1970.     int32_t result; // 0x37d0
  1971.     if (curr_file_offset < 0) {
  1972.         // 0x37d0
  1973.         result = g135;
  1974.         g134 = v1;
  1975.         g135 = v2;
  1976.         g130 = v3;
  1977.         return result;
  1978.     }
  1979.     // 0x3784
  1980.     if (fseek((struct _IO_FILE *)stream2, 0, SEEK_END) == 0) {
  1981.         int32_t curr_file_offset2 = ftell((struct _IO_FILE *)stream2); // R7
  1982.         g135 = 0;
  1983.         if (fseek((struct _IO_FILE *)stream2, curr_file_offset, SEEK_SET) == 0) {
  1984.             int32_t v4 = curr_file_offset2; // 0x37cc
  1985.             if (curr_file_offset2 == -1) {
  1986.                 // if_37c8_0_true
  1987.                 v4 = curr_file_offset2 & -0x10000;
  1988.                 // branch -> after_if_37c8_0
  1989.             }
  1990.             // after_if_37c8_0
  1991.             g135 = v4;
  1992.             // branch -> 0x37d0
  1993.         }
  1994.     }
  1995.     // 0x37d0
  1996.     result = g135;
  1997.     g134 = v1;
  1998.     g135 = v2;
  1999.     g130 = v3;
  2000.     return result;
  2001. }
  2002.  
  2003. // Address range: 0x37d8 - 0x38af
  2004. int32_t read_file_by_lines(struct _IO_FILE * stream) {
  2005.     int32_t v1 = g135; // 0x37d8
  2006.     int32_t v2 = g138; // 0x37d8
  2007.     int32_t v3 = g130; // 0x37d8
  2008.     int32_t stream2 = (int32_t)stream; // R4
  2009.     int32_t is_feof = feof(stream); // 0x37e8
  2010.     g135 = is_feof;
  2011.     int32_t mem = (int32_t)realloc(NULL, 4); // 0x37f8_5
  2012.     g138 = mem;
  2013.     int32_t result; // 0x38a4
  2014.     if (is_feof == 0) {
  2015.         int32_t v4 = 1; // 0x3818
  2016.         int32_t v5 = 0; // 0x3814
  2017.         // branch -> 0x3814
  2018.         while (true) {
  2019.             int32_t v6 = v4; // R9
  2020.             int32_t v7 = 0; // R6
  2021.             int32_t v8 = 0; // R10
  2022.             // branch -> 0x3830
  2023.             int32_t v9; // R7
  2024.             while (true) {
  2025.               lab_0x3830:;
  2026.                 int32_t v10 = 0x1000000 * getc((struct _IO_FILE *)stream2);
  2027.                 v9 = v10 / 0x1000000;
  2028.                 if (v10 != 0xd000000) {
  2029.                     // break -> 0x3844
  2030.                     break;
  2031.                 }
  2032.                 // continue -> 0x3830
  2033.             }
  2034.             int32_t v11 = v8 + 1; // 0x3844
  2035.             g135 = v11;
  2036.             int32_t mem2 = (int32_t)realloc((char *)v7, v11); // 0x3850_5
  2037.             v7 = mem2;
  2038.             if (v9 != -1) {
  2039.                 // after_if_385c_0
  2040.                 if (v9 != 10) {
  2041.                     // 0x3828
  2042.                     *(char *)(v8 + mem2) = (char)v9;
  2043.                     v8 = g135;
  2044.                     // branch -> 0x3830
  2045.                     goto lab_0x3830;
  2046.                 }
  2047.             }
  2048.             // 0x3864
  2049.             *(char *)(v8 + mem2) = 0;
  2050.             *(int32_t *)(4 * v5 + g138) = v7;
  2051.             int32_t is_feof2 = feof((struct _IO_FILE *)stream2); // 0x3878
  2052.             int32_t v12 = v6 + 1; // 0x387c
  2053.             g135 = is_feof2;
  2054.             int32_t mem3 = (int32_t)realloc((char *)g138, 4 * v12); // 0x388c_5
  2055.             g138 = mem3;
  2056.             if (is_feof2 != 0) {
  2057.                 // 0x389c
  2058.                 // branch -> 0x389c
  2059.                 // 0x389c
  2060.                 *(int32_t *)(mem3 + 4 * v6) = 0;
  2061.                 result = g138;
  2062.                 g135 = v1;
  2063.                 g138 = v2;
  2064.                 g130 = v3;
  2065.                 return result;
  2066.             }
  2067.             // 0x3864
  2068.             v4 = v12;
  2069.             v5 = v6;
  2070.             // branch -> 0x3814
  2071.         }
  2072.     }
  2073.     // 0x389c
  2074.     *(int32_t *)mem = 0;
  2075.     result = g138;
  2076.     g135 = v1;
  2077.     g138 = v2;
  2078.     g130 = v3;
  2079.     return result;
  2080. }
  2081.  
  2082. // Address range: 0x38b0 - 0x396f
  2083. int32_t read_file_buffer(struct _IO_FILE * a1, int32_t offset, int32_t size) {
  2084.     int32_t v1 = g135; // 0x38b0
  2085.     int32_t v2 = g138; // 0x38b0
  2086.     g135 = g133;
  2087.     int32_t stream = (int32_t)a1; // R7
  2088.     *(int32_t *)g133 = 0;
  2089.     if (size == 0) {
  2090.         // 0x3950
  2091.         g135 = v1;
  2092.         g138 = v2;
  2093.         return 0;
  2094.     }
  2095.     int32_t result = 0; // R4
  2096.     if (fseek((struct _IO_FILE *)stream, offset, SEEK_SET) != 0) {
  2097.         // 0x38ec
  2098.         *(int32_t *)g135 = *(int32_t *)0x3958 + 0x38f8;
  2099.         g135 = v1;
  2100.         g138 = v2;
  2101.         return result;
  2102.     }
  2103.     char * mem = malloc(size); // 0x3904
  2104.     g138 = (int32_t)mem;
  2105.     int32_t items_read = fread(mem, 1, size, (struct _IO_FILE *)stream); // 0x3918
  2106.     if (items_read == size) {
  2107.         int32_t result2 = g138; // 0x3924
  2108.         g135 = v1;
  2109.         g138 = v2;
  2110.         return result2;
  2111.     }
  2112.     int32_t v3 = *(int32_t *)0x3960; // 0x3938
  2113.     *(int32_t *)g135 = items_read == 0 ? *(int32_t *)0x395c + 0x3948 : v3 + 0x394c;
  2114.     free((char *)g138);
  2115.     // branch -> 0x3950
  2116.     // 0x3950
  2117.     g135 = v1;
  2118.     g138 = v2;
  2119.     return result;
  2120. }
  2121.  
  2122. // Address range: 0x3970 - 0x3b1f
  2123. int32_t read_file_value(struct _IO_FILE * a1) {
  2124.     int32_t v1 = g135; // 0x3970
  2125.     int32_t v2 = g138; // 0x3970
  2126.     int32_t v3 = g130; // 0x3970
  2127.     g135 = (int32_t)a1;
  2128.     *(int32_t *)g133 = 0;
  2129.     if (g132 != 0) {
  2130.         // 0x3998
  2131.         if (g132 < 9) {
  2132.             // 0x39b0
  2133.             *(int32_t *)g133 = 0;
  2134.             int32_t result; // 0x3a84
  2135.             if (fseek((struct _IO_FILE *)g135, g128, SEEK_SET) == 0) {
  2136.                 char * mem = malloc(g132); // 0x39ec
  2137.                 g138 = (int32_t)mem;
  2138.                 int32_t items_read = fread(mem, 1, g132, (struct _IO_FILE *)g135); // 0x3a00
  2139.                 if (items_read != g132) {
  2140.                     int32_t v4 = *(int32_t *)0x3b18; // 0x3a14
  2141.                     *(int32_t *)g133 = items_read == 0 ? *(int32_t *)0x3b14 + 0x3a24 : v4 + 0x3a28;
  2142.                     free((char *)g138);
  2143.                     g138 = 0;
  2144.                     // branch -> 0x3a30
  2145.                 }
  2146.                 // 0x3a30
  2147.                 if (*(int32_t *)g133 == 0) {
  2148.                     // 0x3a44
  2149.                     int32_t v5; // 0x3a60
  2150.                     if (g132 < 4) {
  2151.                         uint32_t v6 = g132 % 4; // 0x3a58
  2152.                         v5 = g132 - v6;
  2153.                         if (g132 != v6) {
  2154.                             int32_t v7 = g138; // 0x3a84
  2155.                             result = *(int32_t *)v7;
  2156.                             // branch -> 0x3a84
  2157.                             while (v5 != 4) {
  2158.                                 // 0x3a84
  2159.                                 v5 -= 4;
  2160.                                 v7 += 4;
  2161.                                 result = *(int32_t *)v7;
  2162.                                 // continue -> 0x3a84
  2163.                             }
  2164.                             // 0x3ab0
  2165.                             if (v6 == 0) {
  2166.                                 // 0x3af0
  2167.                                 free((char *)g138);
  2168.                                 // branch -> 0x39d8
  2169.                                 // 0x39d8
  2170.                                 // branch -> 0x39dc
  2171.                                 // 0x39dc
  2172.                                 g135 = v1;
  2173.                                 g138 = v2;
  2174.                                 g130 = v3;
  2175.                                 return result;
  2176.                             }
  2177.                         } else {
  2178.                             result = 0;
  2179.                             v5 = 0;
  2180.                         }
  2181.                     } else {
  2182.                         // 0x3a50
  2183.                         result = 0;
  2184.                         v5 = 0;
  2185.                         // branch -> 0x3ad0
  2186.                     }
  2187.                     int32_t v8 = 8 * v5; // 0x3ae8
  2188.                     int32_t v9 = g132 - v5; // 0x3ae0
  2189.                     int32_t v10 = g138 + v5; // 0x3adc
  2190.                     int32_t v11 = (int32_t)*(char *)v10; // 0x3adc
  2191.                     uint32_t v12 = v8 & 248; // 0x3ae4
  2192.                     int32_t v13 = (v12 == 0 ? v11 : v12 < 32 ? v11 << v12 : 0) | result; // 0x3ae4
  2193.                     result = v13;
  2194.                     // branch -> 0x3adc
  2195.                     while (v9 != 1) {
  2196.                         // 0x3adc
  2197.                         v8 += 8;
  2198.                         v9--;
  2199.                         v10++;
  2200.                         v11 = (int32_t)*(char *)v10;
  2201.                         v12 = v8 & 248;
  2202.                         v13 |= (v12 == 0 ? v11 : v12 < 32 ? v11 << v12 : 0);
  2203.                         result = v13;
  2204.                         // continue -> 0x3adc
  2205.                     }
  2206.                     // 0x3af0
  2207.                     free((char *)g138);
  2208.                     // branch -> 0x39d8
  2209.                     // branch -> 0x39dc
  2210.                 } else {
  2211.                     result = 0;
  2212.                 }
  2213.             } else {
  2214.                 // 0x39cc
  2215.                 // branch -> 0x39d4
  2216.                 // 0x39d4
  2217.                 *(int32_t *)g133 = *(int32_t *)0x3b10 + 0x39d8;
  2218.                 // branch -> 0x39d8
  2219.                 // 0x39d8
  2220.                 result = 0;
  2221.                 // branch -> 0x39dc
  2222.             }
  2223.             // 0x39dc
  2224.             g135 = v1;
  2225.             g138 = v2;
  2226.             g130 = v3;
  2227.             return result;
  2228.         }
  2229.         // 0x39a0
  2230.         // branch -> 0x39d4
  2231.         // 0x39d4
  2232.         *(int32_t *)g133 = *(int32_t *)0x3b1c + 0x39b0;
  2233.         // branch -> 0x39d8
  2234.     }
  2235.     // 0x39d8
  2236.     // branch -> 0x39dc
  2237.     // 0x39dc
  2238.     g135 = v1;
  2239.     g138 = v2;
  2240.     g130 = v3;
  2241.     return 0;
  2242. }
  2243.  
  2244. // Address range: 0x3b20 - 0x3bdf
  2245. int32_t read_file_string(struct _IO_FILE * stream, int32_t offset) {
  2246.     int32_t v1 = g134; // bp-32
  2247.     int32_t v2 = g135; // 0x3b20
  2248.     int32_t v3 = g138; // 0x3b20
  2249.     int32_t v4 = g130; // bp-8
  2250.     g138 = g132;
  2251.     if (fseek(stream, offset, SEEK_SET) != 0) {
  2252.         // 0x3b44
  2253.         // branch -> 0x3b94
  2254.         // 0x3b94
  2255.         *(int32_t *)g138 = *(int32_t *)0x3bcc + 0x3b50;
  2256.         g134 = v1;
  2257.         g135 = v2;
  2258.         g138 = v3;
  2259.         g130 = v4;
  2260.         return 0;
  2261.     }
  2262.     int32_t result = 0; // R4
  2263.     g135 = 0;
  2264.     // branch -> 0x3b58
  2265.     while (true) {
  2266.         int32_t v5 = 0x1000000 * getc((struct _IO_FILE *)(int32_t)stream);
  2267.         if (v5 == -0x1000000) {
  2268.             int32_t v6 = *(int32_t *)0x3bd4; // 0x3ba8
  2269.             *(int32_t *)g138 = g135 == 0 ? *(int32_t *)0x3bd0 + 0x3bb4 : v6 + 0x3bb8;
  2270.             free((char *)result);
  2271.             g134 = v1;
  2272.             g135 = v2;
  2273.             g138 = v3;
  2274.             g130 = v4;
  2275.             return 0;
  2276.         }
  2277.         int32_t v7 = g135 + 1; // 0x3b6c
  2278.         int32_t mem = (int32_t)realloc((char *)result, v7); // 0x3b78_5
  2279.         result = mem;
  2280.         int32_t v8 = v5 / 0x1000000; // 0x3b80
  2281.         *(char *)(g135 + mem) = (char)v8;
  2282.         g135 = v7;
  2283.         if (v8 == 0) {
  2284.             // break -> 0x3b94
  2285.             break;
  2286.         }
  2287.         // continue -> 0x3b58
  2288.     }
  2289.     // 0x3b94
  2290.     *(int32_t *)g138 = 0;
  2291.     g134 = v1;
  2292.     g135 = v2;
  2293.     g138 = v3;
  2294.     g130 = v4;
  2295.     return result;
  2296. }
  2297.  
  2298. // Address range: 0x3be0 - 0x3fbf
  2299. int32_t output_binary_data(char * a1, int32_t a2, int32_t a3, struct _IO_FILE * stream, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12) {
  2300.     int32_t v1;
  2301.     char * v2 = (char *)v1; // bp-60
  2302.     g133 = (int32_t)stream;
  2303.     int32_t v3 = g134; // 0x3be0
  2304.     int32_t v4 = g135; // 0x3be0
  2305.     int32_t v5 = g136; // 0x3be0
  2306.     int32_t v6 = g137; // 0x3be0
  2307.     int32_t (*v7)() = (int32_t (*)())g138;
  2308.     int32_t v8 = g130; // bp-8
  2309.     g130 = &v8;
  2310.     g129 = a3;
  2311.     g135 = a2;
  2312.     g137 = (int32_t)a1;
  2313.     int32_t str;
  2314.     if (a3 < 2) {
  2315.         // 0x3c24
  2316.         str = 0x7479622e;
  2317.         // branch -> 0x3c38
  2318.     } else {
  2319.         // 0x3c0c
  2320.         sprintf((char *)&str, (char *)(*(int32_t *)0x3f90 + 0x3c1c));
  2321.         a3 = g129;
  2322.         // branch -> 0x3c38
  2323.     }
  2324.     // 0x3c38
  2325.     g132 = 2 * a3;
  2326.     int32_t format = *(int32_t *)0x3f94 + 0x3c48; // 0x3c40
  2327.     g128 = format;
  2328.     int32_t str2;
  2329.     int32_t v9 = &str2; // 0x3c44_0
  2330.     g127 = sprintf((char *)&str2, (char *)format);
  2331.     int32_t v10 = g135; // 0x3c4c
  2332.     g1 = true;
  2333.     g2 = v10 < 0;
  2334.     g3 = v10 == 0;
  2335.     int32_t result; // 0x3fbc_1
  2336.     int32_t v11;
  2337.     int32_t v12;
  2338.     int32_t v13;
  2339.     int32_t v14;
  2340.     int32_t v15; // 0x3f8c
  2341.     if (v10 == 0) {
  2342.       lab_0x3f68:
  2343.         // 0x3f68
  2344.         g134 = v14;
  2345.         g135 = v13;
  2346.         g136 = v12;
  2347.         g137 = v11;
  2348.         g138 = v3;
  2349.         g139 = v4;
  2350.         g129 = v5;
  2351.         g130 = v6;
  2352.         v7();
  2353.         if (g3) {
  2354.             // if_3fb8_0_true
  2355.             v15 = g127 & g128 & g132 & g133;
  2356.             g138 = g136 / 0x40000000 & v15;
  2357.             result = v15;
  2358.             // branch -> after_if_3fb8_0
  2359.         } else {
  2360.             // 0x3f68
  2361.             result = g127;
  2362.             // branch -> after_if_3fb8_0
  2363.         }
  2364.         // after_if_3fb8_0
  2365.         return result;
  2366.     }
  2367.     uint32_t v16 = g129; // 0x3c54
  2368.     int32_t v17;
  2369.     int32_t str3;
  2370.     if (v16 == 0) {
  2371.         int32_t v18 = (int32_t)&v2;
  2372.         g134 = v18;
  2373.         g138 = v9;
  2374.         int32_t v19 = *(int32_t *)0x3fac + 0x3e5c; // 0x3e54
  2375.         int32_t v20 = *(int32_t *)0x3fbc + 0x3e74; // 0x3e6c
  2376.         char * format3 = (char *)v20;
  2377.         int32_t v21 = &str3; // 0x3edc_0
  2378.         char * format2 = (char *)(*(int32_t *)0x3fb8 + 0x3e68);
  2379.         // branch -> 0x3e80
  2380.         while (true) {
  2381.             // 0x3e80
  2382.             int32_t v22;
  2383.             generate_initial_indented_line((int32_t *)v18, &str2, g132, g133, v17, 0, v22);
  2384.             v17 = 0;
  2385.             concatenate((int32_t *)g134, &str2, (char *)&str, v19);
  2386.             uint32_t v23 = g135; // 0x3ea8
  2387.             uint32_t v24 = v23 < 32 ? v23 : 32; // 0x3eac
  2388.             g137 = v24;
  2389.             uint32_t v25 = g129; // 0x3eb4
  2390.             int32_t v26 = v23 - v24; // 0x3ebc
  2391.             g136 = g134;
  2392.             g134 = *(int32_t *)0x3fb4 + 0x3e80;
  2393.             g135 = v9;
  2394.             g139 = v21;
  2395.             int32_t v27 = v24 / v25; // R10
  2396.             char * v28;
  2397.             int32_t v29; // 0x3f58
  2398.             if (v25 <= v24) {
  2399.                 // 0x3ee8
  2400.                 g137 = 0;
  2401.                 // branch -> 0x3eec
  2402.                 while (true) {
  2403.                     // 0x3eec
  2404.                     sprintf((char *)&str3, (char *)&str2);
  2405.                     v17 = 0;
  2406.                     int32_t v30 = g134; // 0x3f20
  2407.                     if (g137 != 0) {
  2408.                         // if_3f18_0_true
  2409.                         v30 = *(int32_t *)0x3fb0 + 0x3f20;
  2410.                         // branch -> after_if_3f18_0
  2411.                     }
  2412.                     // after_if_3f18_0
  2413.                     concatenate((int32_t *)g136, &str2, (char *)v30, v21);
  2414.                     int32_t v31 = g137 + 1; // 0x3f24
  2415.                     g137 = v31;
  2416.                     if (v31 >= v27) {
  2417.                         // break -> 0x3f30
  2418.                         break;
  2419.                     }
  2420.                     // continue -> 0x3eec
  2421.                 }
  2422.                 // 0x3f30
  2423.                 printf(format2);
  2424.                 g132 = (int32_t)v2;
  2425.                 g128 = v20;
  2426.                 fprintf(stream, format3);
  2427.                 v28 = v2;
  2428.                 g127 = (int32_t)v28;
  2429.                 free(v28);
  2430.                 g135 = v26;
  2431.                 v29 = g136;
  2432.                 g134 = v29;
  2433.                 g129 = 0;
  2434.                 g1 = true;
  2435.                 g2 = v26 < 0;
  2436.                 g3 = v23 == v24;
  2437.                 if (v23 == v24) {
  2438.                     // break -> 0x3f68
  2439.                     break;
  2440.                 }
  2441.                 v18 = v29;
  2442.                 // continue -> 0x3e80
  2443.                 continue;
  2444.             }
  2445.             // 0x3f30
  2446.             printf(format2);
  2447.             g132 = (int32_t)v2;
  2448.             g128 = v20;
  2449.             fprintf(stream, format3);
  2450.             v28 = v2;
  2451.             g127 = (int32_t)v28;
  2452.             free(v28);
  2453.             g135 = v26;
  2454.             v29 = g136;
  2455.             g134 = v29;
  2456.             g129 = 0;
  2457.             g1 = true;
  2458.             g2 = v26 < 0;
  2459.             g3 = v23 == v24;
  2460.             if (v23 == v24) {
  2461.                 // break -> 0x3f68
  2462.                 break;
  2463.             }
  2464.             v18 = v29;
  2465.             // continue -> 0x3e80
  2466.         }
  2467.         // 0x3f68
  2468.         g134 = v14;
  2469.         g135 = v13;
  2470.         g136 = v12;
  2471.         g137 = v11;
  2472.         g138 = v3;
  2473.         g139 = v4;
  2474.         g129 = v5;
  2475.         g130 = v6;
  2476.         v7();
  2477.         if (g3) {
  2478.             // if_3fb8_0_true
  2479.             v15 = g127 & g128 & g132 & g133;
  2480.             g138 = g136 / 0x40000000 & v15;
  2481.             result = v15;
  2482.             // branch -> after_if_3fb8_0
  2483.         } else {
  2484.             // 0x3f68
  2485.             result = g127;
  2486.             // branch -> after_if_3fb8_0
  2487.         }
  2488.         // after_if_3fb8_0
  2489.         return result;
  2490.     }
  2491.     uint32_t v32 = v16 % 4; // 0x3c60
  2492.     g134 = v16 - v32;
  2493.     int32_t v33;
  2494.     g138 = &v33;
  2495.     int32_t v34 = *(int32_t *)0x3f98 + 0x3c90; // 0x3c88
  2496.     int32_t v35 = *(int32_t *)0x3fa8 + 0x3ca8; // 0x3ca0
  2497.     char * format5 = (char *)v35;
  2498.     int32_t v36 = *(int32_t *)0x3fa0 + 0x3cb4; // 0x3cac
  2499.     char * format4 = (char *)(*(int32_t *)0x3fa4 + 0x3c9c);
  2500.     int32_t v37 = &str3; // 0x3dc8_0
  2501.     // branch -> 0x3cb4
  2502.   lab_0x3cb4:
  2503.     while (true) {
  2504.         // 0x3cb4
  2505.         g136 = (int32_t)&v2;
  2506.         g139 = v9;
  2507.         generate_initial_indented_line((int32_t *)&v2, &str2, g132, g133, v17, 0, v35);
  2508.         v17 = 0;
  2509.         concatenate((int32_t *)&v2, &str2, (char *)&str, v34);
  2510.         int32_t v38 = g135; // 0x3ce4
  2511.         uint32_t v39 = v38; // 0x3d0c
  2512.         if (v38 > 31) {
  2513.             // if_3cf0_0_true
  2514.             v39 = 32;
  2515.             // branch -> after_if_3cf0_0
  2516.         }
  2517.         int32_t v40 = v38 - v39; // 0x3cf8
  2518.         g135 = v40;
  2519.         g139 = v39 / v16;
  2520.         g129 = v16;
  2521.         char * v41;
  2522.         if (v16 <= v39) {
  2523.             // 0x3d18
  2524.             g136 = 0;
  2525.             int32_t v42 = g137; // 0x3d50
  2526.             int32_t v43 = v16; // 0x3dac
  2527.             // branch -> 0x3d1c
  2528.             while (true) {
  2529.                 int32_t v44 = v42; // 0x3db441
  2530.                 int32_t v45 = 0; // 0x3dac
  2531.                 int32_t v46; // 0x3dfc
  2532.                 if (v43 >= 4) {
  2533.                     int32_t v47 = g134; // 0x3d30
  2534.                     if (v47 != 0) {
  2535.                         int32_t v48 = v47 + v42; // 0x3d50
  2536.                         int32_t v49 = 0; // 0x3d58
  2537.                         v33 = *(int32_t *)(v49 + v42);
  2538.                         // branch -> 0x3d58
  2539.                         while (v47 != v49 + 4) {
  2540.                             // 0x3d58
  2541.                             v49 += 4;
  2542.                             v33 = *(int32_t *)(v49 + v42);
  2543.                             // continue -> 0x3d58
  2544.                         }
  2545.                         // 0x3d88
  2546.                         if (v32 == 0) {
  2547.                             // 0x3dc8
  2548.                             g135 = v37;
  2549.                             sprintf((char *)&str3, (char *)&str2);
  2550.                             v17 = 0;
  2551.                             v46 = v36;
  2552.                             if (g136 != 0) {
  2553.                               lab_if_3df4_0_true:
  2554.                                 // if_3df4_0_true
  2555.                                 v46 = *(int32_t *)0x3f9c + 0x3dfc;
  2556.                                 // branch -> after_if_3df4_0
  2557.                             }
  2558.                           lab_after_if_3df4_0:
  2559.                             // after_if_3df4_0
  2560.                             concatenate((int32_t *)&v2, &str2, (char *)v46, v37);
  2561.                             int32_t v50 = g136 + 1; // 0x3e04
  2562.                             g136 = v50;
  2563.                             int32_t v51 = g137 + (v16 + 255) % 256 + 1; // 0x3e0c
  2564.                             g137 = v51;
  2565.                             if (v50 < g139) {
  2566.                                 // after_if_3df4_0.dec_label_pc_3d1c_crit_edge
  2567.                                 v42 = v51;
  2568.                                 v43 = g129;
  2569.                                 // branch -> 0x3d1c
  2570.                                 continue;
  2571.                             } else {
  2572.                                 // 0x3e14
  2573.                                 printf(format4);
  2574.                                 g132 = (int32_t)v2;
  2575.                                 g128 = v35;
  2576.                                 fprintf(stream, format5);
  2577.                                 v41 = v2;
  2578.                                 g127 = (int32_t)v41;
  2579.                                 free(v41);
  2580.                                 g135 = v40;
  2581.                                 g1 = true;
  2582.                                 g2 = v40 < 0;
  2583.                                 g3 = v38 == v39;
  2584.                                 if (v38 == v39) {
  2585.                                     // break (via goto) -> 0x3f68
  2586.                                     goto lab_0x3f68;
  2587.                                 }
  2588.                                 // continue (via goto) -> 0x3cb4
  2589.                                 goto lab_0x3cb4;
  2590.                             }
  2591.                         } else {
  2592.                             v44 = v48;
  2593.                             v45 = v47;
  2594.                         }
  2595.                     } else {
  2596.                         v44 = v42;
  2597.                         v45 = 0;
  2598.                     }
  2599.                 }
  2600.                 int32_t v52 = v43 - v45; // 0x3db8
  2601.                 int32_t v53 = v44; // 0x3db4
  2602.                 g135 = (int32_t)*(char *)v53;
  2603.                 // branch -> 0x3db4
  2604.                 while (v52 != 1) {
  2605.                     // 0x3db4
  2606.                     v52--;
  2607.                     v53++;
  2608.                     g135 = (int32_t)*(char *)v53;
  2609.                     // continue -> 0x3db4
  2610.                 }
  2611.                 // 0x3dc8
  2612.                 g135 = v37;
  2613.                 sprintf((char *)&str3, (char *)&str2);
  2614.                 v17 = 0;
  2615.                 if (g136 == 0) {
  2616.                     v46 = v36;
  2617.                     goto lab_after_if_3df4_0;
  2618.                 }
  2619.                 goto lab_if_3df4_0_true;
  2620.             }
  2621.         }
  2622.         // 0x3e14
  2623.         printf(format4);
  2624.         g132 = (int32_t)v2;
  2625.         g128 = v35;
  2626.         fprintf(stream, format5);
  2627.         v41 = v2;
  2628.         g127 = (int32_t)v41;
  2629.         free(v41);
  2630.         g135 = v40;
  2631.         g1 = true;
  2632.         g2 = v40 < 0;
  2633.         g3 = v38 == v39;
  2634.         if (v38 == v39) {
  2635.             // break -> 0x3f68
  2636.             break;
  2637.         }
  2638.         // continue -> 0x3cb4
  2639.     }
  2640.     // 0x3f68
  2641.     g134 = v14;
  2642.     g135 = v13;
  2643.     g136 = v12;
  2644.     g137 = v11;
  2645.     g138 = v3;
  2646.     g139 = v4;
  2647.     g129 = v5;
  2648.     g130 = v6;
  2649.     v7();
  2650.     if (g3) {
  2651.         // if_3fb8_0_true
  2652.         v15 = g127 & g128 & g132 & g133;
  2653.         g138 = g136 / 0x40000000 & v15;
  2654.         result = v15;
  2655.         // branch -> after_if_3fb8_0
  2656.     } else {
  2657.         // 0x3f68
  2658.         result = g127;
  2659.         // branch -> after_if_3fb8_0
  2660.     }
  2661.     // after_if_3fb8_0
  2662.     return result;
  2663. }
  2664.  
  2665. // Address range: 0x3fc0 - 0x433f
  2666. int32_t handle_incbin_data(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, char * a6, int32_t a7, int32_t a8, uint32_t a9) {
  2667.     // 0x3fc0
  2668.     g133 = a4;
  2669.     int32_t v1 = g134; // 0x3fc0
  2670.     int32_t v2 = g135; // 0x3fc0
  2671.     int32_t v3 = g138; // 0x3fc0
  2672.     int32_t v4 = g129; // 0x3fc0
  2673.     int32_t v5 = g130; // bp-8
  2674.     g130 = &v5;
  2675.     g139 = a2;
  2676.     g137 = a4;
  2677.     int32_t * v6 = (int32_t *)(a1 + 4); // 0x3fe0_0
  2678.     int32_t v7 = *v6; // 0x3fe0
  2679.     printf("Binary inclusion size: %u\n", v7);
  2680.     g138 = 16;
  2681.     int32_t v8 = v7; // 0x4004
  2682.     if (v7 < 16) {
  2683.         // if_3ffc_0_true
  2684.         v8 = 16;
  2685.         // branch -> after_if_3ffc_0
  2686.     }
  2687.     int32_t v9 = v8 % 256; // R4
  2688.     printf("First %hhu bytes:", (char)v8);
  2689.     if (v9 != 0) {
  2690.         // 0x4018
  2691.         g135 = 0;
  2692.         g136 = (int32_t)" %02hhx";
  2693.         int32_t format = (int32_t)" %02hhx"; // 0x4028
  2694.         int32_t v10 = 0; // 0x4024
  2695.         // branch -> 0x4024
  2696.         while (true) {
  2697.             // 0x4024
  2698.             printf((char *)format, *(char *)(g139 + v10));
  2699.             int32_t v11 = g135 + 1; // 0x4030
  2700.             g135 = v11;
  2701.             if (v11 < v9) {
  2702.                 // 0x4024
  2703.                 format = g136;
  2704.                 v10 = v11;
  2705.                 // branch -> 0x4024
  2706.                 continue;
  2707.             }
  2708.         }
  2709.     }
  2710.     // 0x403c
  2711.     putchar(10);
  2712.     g134 = a1;
  2713.     int32_t v12 = *v6; // 0x4048
  2714.     int32_t v13 = g137; // 0x404c
  2715.     int32_t v14 = g138 & 16 * v12 ^ 0x7f09f; // 0x405c
  2716.     g129 = v14;
  2717.     if ((v12 & 2) == 0) {
  2718.         int32_t v15 = 32; // 0x4078
  2719.         if (validate_pointers(g139, v12, a3) != 0) {
  2720.             // if_4074_0_true
  2721.             v15 = 96;
  2722.             // branch -> after_if_4074_0
  2723.         }
  2724.         int32_t v16 = g129 | v15; // 0x4078
  2725.         g129 = v16;
  2726.         v14 = v16;
  2727.         // branch -> 0x407c
  2728.     }
  2729.     int32_t v17 = v14; // 0x4098
  2730.     if (*(int32_t *)*(int32_t *)0x1e110 != 0) {
  2731.         int32_t v18 = v14 | 0x80000; // 0x4094
  2732.         g129 = v18;
  2733.         v17 = v18;
  2734.         // branch -> after_if_4094_0
  2735.     }
  2736.     uint32_t v19 = get_command((int32_t)"Action for current .incbin: ", v17); // 0x409c
  2737.     g138 = v19;
  2738.     if (v19 < 12) {
  2739.         // 0x4244
  2740.         if (v19 == 0) {
  2741.             // 0x430c
  2742.             g126 = &g55;
  2743.             exit(0);
  2744.             // UNREACHABLE
  2745.         }
  2746.         // 0x424c
  2747.         if (v19 <= 1 || v19 == 2) {
  2748.             // 0x4254
  2749.             g135 = v2;
  2750.             g138 = v3;
  2751.             g129 = v4;
  2752.             return 3 - v19;
  2753.         }
  2754.         // 0x4260
  2755.         if (0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2 != 0) {
  2756.             // 0x4274
  2757.             return write_header_comment((int32_t *)g134, (struct _IO_FILE *)a3);
  2758.         }
  2759.         uint32_t result = v19 - 3; // 0x4280
  2760.         if (result < 3) {
  2761.             // 0x42ec
  2762.             g135 = v2;
  2763.             g138 = v3;
  2764.             g129 = v4;
  2765.             return result;
  2766.         }
  2767.         int32_t v20 = *(int32_t *)(g134 + 4); // 0x4294
  2768.         uint32_t v21 = result % 256; // 0x429c
  2769.         int32_t v22 = v21 == 0 ? 1 : v21 < 32 ? (1 << v21) % 256 : 0; // 0x42a0
  2770.         int32_t v23;
  2771.         int32_t v24;
  2772.         int32_t v25;
  2773.         int32_t v26;
  2774.         return output_binary_data((char *)g139, v20, v22, (struct _IO_FILE *)a3, v26, v25, v13, a3, v24, a1, v23, v1);
  2775.     }
  2776.     // 0x40ac
  2777.     g137 = 0;
  2778.     g135 = -12;
  2779.     int32_t v27 = g33; // 0x40c4
  2780.     g136 = v27 + 84;
  2781.     uint32_t v28 = v19 % 256; // 0x40ec
  2782.     uint32_t v29 = v28 - 12; // 0x40ec
  2783.     g1 = v29 > 6;
  2784.     g2 = v28 < 19;
  2785.     g3 = v29 == 7;
  2786.     if (v29 > 7) {
  2787.         // 0x422c
  2788.         return get_command((int32_t)"Action for current .incbin: ", g129);
  2789.     }
  2790.     // 0x40f8
  2791.     g128 = &g54;
  2792.     int32_t v30 = *(int32_t *)(4 * v29 + (int32_t)&g54); // 0x4100
  2793.     g127 = v30;
  2794.     ((int32_t (*)(int32_t, int32_t))(v30 + (int32_t)&g54))(v30, (int32_t)&g54);
  2795.     if (g3) {
  2796.         // after_if_4114_0
  2797.         abort();
  2798.         // UNREACHABLE
  2799.     }
  2800.     // after_if_4124_0
  2801.     g138 = a9;
  2802.     int32_t v31 = *(int32_t *)(g134 + 4); // 0x4130
  2803.     g137 = v31;
  2804.     g135 = 0;
  2805.     int32_t v32 = 256 * (a9 % 256) | 16; // 0x413c
  2806.     g134 = v32;
  2807.     // branch -> 0x4140
  2808.     int32_t v33;
  2809.     int32_t v34; // 0x4178
  2810.     while (true) {
  2811.         // 0x4140
  2812.         dump_data_line_as_text((struct _IO_FILE *)g136, g139, v32 - 16, v31, v27, (int32_t)"Script file: ", v13, a3, 0);
  2813.         int32_t v35 = g135 + 1; // 0x4154
  2814.         g135 = v35;
  2815.         if (v35 % 256 <= 15) {
  2816.             uint32_t v36 = g134; // 0x4164
  2817.             int32_t v37 = v36 + 16; // 0x4164
  2818.             int32_t v38 = g137; // 0x4168
  2819.             g134 = v37;
  2820.             if (v36 >= v38) {
  2821.                 // break -> 0x4174
  2822.                 break;
  2823.             }
  2824.             v31 = v38;
  2825.             v32 = v37;
  2826.             // continue -> 0x4140
  2827.             continue;
  2828.         }
  2829.         // 0x4174
  2830.         g134 = v33;
  2831.         v34 = g138 + 1;
  2832.         g138 = v34;
  2833.         g137 = 0;
  2834.         g135 = -12;
  2835.         if (256 * (v34 % 256) >= *(int32_t *)(v33 + 4)) {
  2836.             // 0x422c
  2837.             return get_command((int32_t)"Action for current .incbin: ", g129);
  2838.         }
  2839.         // if_4194_0_true
  2840.         g138 = 0;
  2841.         // branch -> 0x422c
  2842.         // 0x422c
  2843.         return get_command((int32_t)"Action for current .incbin: ", g129);
  2844.     }
  2845.     // 0x4174
  2846.     g134 = v33;
  2847.     v34 = g138 + 1;
  2848.     g138 = v34;
  2849.     g137 = 0;
  2850.     g135 = -12;
  2851.     if (256 * (v34 % 256) < *(int32_t *)(v33 + 4)) {
  2852.         // if_4194_0_true
  2853.         g138 = 0;
  2854.         // branch -> 0x422c
  2855.     }
  2856.     // 0x422c
  2857.     return get_command((int32_t)"Action for current .incbin: ", g129);
  2858. }
  2859.  
  2860. // Address range: 0x4340 - 0x4397
  2861. int32_t preview_incbin(int32_t a1, int32_t a2, int32_t a3) {
  2862.     int32_t v1 = g134; // 0x4340
  2863.     int32_t v2 = g135; // 0x4340
  2864.     int32_t v3 = g136; // 0x4340
  2865.     int32_t v4 = g137; // 0x4340
  2866.     int32_t v5 = g138; // 0x4340
  2867.     int32_t v6 = g130; // bp-8
  2868.     g130 = &v6;
  2869.     g138 = a1;
  2870.     g134 = a3;
  2871.     g135 = a2;
  2872.     g136 = 0;
  2873.     int32_t v7 = g33 + 84; // 0x4360
  2874.     g137 = v7;
  2875.     // branch -> 0x4364
  2876.     while (true) {
  2877.         // 0x4364
  2878.         dump_data_line_as_text((struct _IO_FILE *)v7, a1, a2, a3, v1, v2, v3, v4, v5);
  2879.         int32_t v8 = g135 + 16; // 0x4378
  2880.         g135 = v8;
  2881.         uint32_t v9 = g134; // 0x437c
  2882.         g1 = v8 >= v9;
  2883.         g3 = v8 == v9;
  2884.         uint32_t v10 = g136; // 0x4380
  2885.         if (v8 >= v9) {
  2886.             int32_t result = v10 % 256; // 0x43847
  2887.             g127 = result;
  2888.             // branch -> 0x4390
  2889.             // 0x4390
  2890.             g134 = v1;
  2891.             g135 = v2;
  2892.             g136 = v3;
  2893.             g137 = v4;
  2894.             g138 = v5;
  2895.             g130 = v6;
  2896.             return result;
  2897.         }
  2898.         int32_t v11 = v10 + 1; // 0x4380
  2899.         g136 = v11;
  2900.         uint32_t result2 = v11 % 256; // 0x43842
  2901.         g127 = result2;
  2902.         g1 = result2 > 15;
  2903.         g3 = result2 == 16;
  2904.         if (result2 <= 15) {
  2905.             // 0x4364
  2906.             a3 = v9;
  2907.             a2 = v8;
  2908.             a1 = g138;
  2909.             v7 = g137;
  2910.             // branch -> 0x4364
  2911.             continue;
  2912.         }
  2913.         // 0x4390
  2914.         g134 = v1;
  2915.         g135 = v2;
  2916.         g136 = v3;
  2917.         g137 = v4;
  2918.         g138 = v5;
  2919.         g130 = v6;
  2920.         return result2;
  2921.     }
  2922. }
  2923.  
  2924. // Address range: 0x4398 - 0x445b
  2925. int32_t dump_incbin_as_text(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12) {
  2926.     int32_t v1 = g135; // 0x4398
  2927.     int32_t v2 = g130; // bp-8
  2928.     g130 = &v2;
  2929.     g135 = a1;
  2930.     g134 = a2;
  2931.     printf("File to write: ");
  2932.     int32_t result = read_line((struct _IO_FILE *)g33); // 0x43bc
  2933.     char * file_path = (char *)result; // 0x43c4_0
  2934.     if (*file_path != 0) {
  2935.         // 0x43d0
  2936.         return (int32_t)fopen(file_path, "w");
  2937.     }
  2938.     // 0x4440
  2939.     g135 = v1;
  2940.     free(file_path);
  2941.     return result;
  2942. }
  2943.  
  2944. // Address range: 0x445c - 0x44e7
  2945. int32_t get_dump_file(char * a1, int32_t a2, int32_t a3) {
  2946.     int32_t v1 = g135; // 0x445c
  2947.     int32_t v2 = g130; // bp-8
  2948.     g130 = &v2;
  2949.     g135 = (int32_t)a1;
  2950.     printf("File to write: ");
  2951.     int32_t v3 = read_line((struct _IO_FILE *)g33); // 0x447c
  2952.     char * file_path = (char *)v3; // 0x4484_0
  2953.     if (*file_path == 0) {
  2954.         // 0x44c8
  2955.         free((char *)v3);
  2956.         g135 = v1;
  2957.         return 0;
  2958.     }
  2959.     struct _IO_FILE * file = fopen(file_path, (char *)g135); // 0x4498
  2960.     g135 = (int32_t)file;
  2961.     char * v4 = (char *)v3;
  2962.     if (file != NULL) {
  2963.         // 0x44a8
  2964.         free(v4);
  2965.         int32_t result = g135; // 0x44b0
  2966.         g135 = v1;
  2967.         return result;
  2968.     }
  2969.     // 0x44b8
  2970.     printf("err: could not open file %s for writing\n", v4);
  2971.     // branch -> 0x44c8
  2972.     // 0x44c8
  2973.     free((char *)v3);
  2974.     g135 = v1;
  2975.     return 0;
  2976. }
  2977.  
  2978. // Address range: 0x44e8 - 0x4647
  2979. int32_t dump_data_line_as_text(struct _IO_FILE * stream, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9) {
  2980.     int32_t v1 = g134; // 0x44e8
  2981.     int32_t v2 = g135; // 0x44e8
  2982.     int32_t v3 = g136; // 0x44e8
  2983.     int32_t v4 = g137; // 0x44e8
  2984.     int32_t v5 = g138; // 0x44e8
  2985.     int32_t v6 = g139; // 0x44e8
  2986.     int32_t v7 = g129; // 0x44e8
  2987.     int32_t v8 = g130; // bp-8
  2988.     int32_t v9 = g126; // 0x44e8
  2989.     g130 = &v8;
  2990.     g134 = (int32_t)stream;
  2991.     g138 = a2;
  2992.     g139 = a3;
  2993.     fprintf(stream, "%08x:   ", a3);
  2994.     uint32_t v10 = a4 - g139; // 0x4514
  2995.     int32_t v11 = v10 > 16 ? 16 : v10 % 256; // 0x451c
  2996.     g136 = v11;
  2997.     int32_t v12; // 0x458c
  2998.     int32_t stream2; // 0x4620
  2999.     int32_t v13; // 0x45d0
  3000.     uint32_t v14; // 0x45dc
  3001.     if (v11 == 0) {
  3002.         // 0x456c
  3003.         g135 = 0;
  3004.         // branch -> 0x4570
  3005.     } else {
  3006.         // 0x452c
  3007.         g135 = 0;
  3008.         int32_t v15 = 0; // 0x453c
  3009.         // branch -> 0x453c
  3010.         while (true) {
  3011.             char v16 = *(char *)(g138 + g139 + v15); // 0x4544
  3012.             fprintf((struct _IO_FILE *)g134, (char *)(int32_t)"%02hhx ", v16);
  3013.             int32_t v17 = g135 + 1; // 0x4550
  3014.             g135 = v17;
  3015.             uint32_t v18 = v17 % 256; // 0x4554
  3016.             if (v18 >= g136) {
  3017.                 // 0x4560
  3018.                 if (v18 < 16) {
  3019.                     // 0x4570
  3020.                     // branch -> 0x4578
  3021.                     while (true) {
  3022.                         // 0x4578
  3023.                         fwrite((char *)(int32_t)"   ", 3, 1, (struct _IO_FILE *)g134);
  3024.                         v12 = g135 + 1;
  3025.                         g135 = v12;
  3026.                         if (v12 % 256 < 16) {
  3027.                           lab_0x4578:
  3028.                             // 0x4578
  3029.                             // branch -> 0x4578
  3030.                             continue;
  3031.                         }
  3032.                     }
  3033.                 }
  3034.                 // 0x459c
  3035.                 fwrite("  ", 2, 1, (struct _IO_FILE *)g134);
  3036.                 if (g136 != 0) {
  3037.                     // 0x45bc
  3038.                     g129 = 0;
  3039.                     g135 = *(int32_t *)&g39;
  3040.                     v13 = *(int32_t *)0x1e144;
  3041.                     g137 = v13;
  3042.                     v14 = (int32_t)*(char *)(g138 + g139);
  3043.                     if (v14 % 8 == 0) {
  3044.                         // 0x4600
  3045.                         return putc(64, (struct _IO_FILE *)g134);
  3046.                     }
  3047.                     // 0x45f0
  3048.                     return fputs((char *)*(int32_t *)(4 * v14 + v13), (struct _IO_FILE *)g134);
  3049.                 }
  3050.                 // 0x461c
  3051.                 stream2 = g134;
  3052.                 g134 = v1;
  3053.                 g135 = v2;
  3054.                 g136 = v3;
  3055.                 g137 = v4;
  3056.                 g138 = v5;
  3057.                 g139 = v6;
  3058.                 g129 = v7;
  3059.                 g130 = v8;
  3060.                 g126 = v9;
  3061.                 return putc(10, (struct _IO_FILE *)stream2);
  3062.             }
  3063.             // 0x453c
  3064.             v15 = v18;
  3065.             // branch -> 0x453c
  3066.         }
  3067.     }
  3068.     // 0x4570
  3069.     // branch -> 0x4578
  3070.     while (true) {
  3071.         // 0x4578
  3072.         fwrite((char *)(int32_t)"   ", 3, 1, (struct _IO_FILE *)g134);
  3073.         v12 = g135 + 1;
  3074.         g135 = v12;
  3075.         if (v12 % 256 < 16) {
  3076.             goto lab_0x4578;
  3077.         }
  3078.         // 0x459c
  3079.         fwrite("  ", 2, 1, (struct _IO_FILE *)g134);
  3080.         if (g136 != 0) {
  3081.             // 0x45bc
  3082.             g129 = 0;
  3083.             g135 = *(int32_t *)&g39;
  3084.             v13 = *(int32_t *)0x1e144;
  3085.             g137 = v13;
  3086.             v14 = (int32_t)*(char *)(g138 + g139);
  3087.             if (v14 % 8 == 0) {
  3088.                 // 0x4600
  3089.                 return putc(64, (struct _IO_FILE *)g134);
  3090.             }
  3091.             // 0x45f0
  3092.             return fputs((char *)*(int32_t *)(4 * v14 + v13), (struct _IO_FILE *)g134);
  3093.         }
  3094.         // 0x461c
  3095.         stream2 = g134;
  3096.         g134 = v1;
  3097.         g135 = v2;
  3098.         g136 = v3;
  3099.         g137 = v4;
  3100.         g138 = v5;
  3101.         g139 = v6;
  3102.         g129 = v7;
  3103.         g130 = v8;
  3104.         g126 = v9;
  3105.         return putc(10, (struct _IO_FILE *)stream2);
  3106.     }
  3107. }
  3108.  
  3109. // Address range: 0x4648 - 0x470b
  3110. int32_t dump_incbin_as_binary(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11) {
  3111.     int32_t v1 = g135; // 0x4648
  3112.     int32_t v2 = g130; // bp-8
  3113.     g130 = &v2;
  3114.     g134 = a1;
  3115.     g135 = a2;
  3116.     printf("File to write: ");
  3117.     int32_t result = read_line((struct _IO_FILE *)g33); // 0x466c
  3118.     char * file_path = (char *)result; // 0x4674_0
  3119.     if (*file_path != 0) {
  3120.         // 0x4680
  3121.         return (int32_t)fopen(file_path, "wb");
  3122.     }
  3123.     // 0x46ec
  3124.     g135 = v1;
  3125.     free(file_path);
  3126.     return result;
  3127. }
  3128.  
  3129. // Address range: 0x470c - 0x4867
  3130. char * get_incbin_data(void) {
  3131.     int32_t v1 = g135; // 0x470c
  3132.     int32_t v2 = g136; // 0x470c
  3133.     int32_t v3 = g137; // 0x470c
  3134.     int32_t v4 = g138; // 0x470c
  3135.     int32_t v5 = g130; // bp-8
  3136.     g130 = &v5;
  3137.     char * found_char_pos = strchr(strstr((char *)g127, ".incbin"), 34); // 0x4724
  3138.     int32_t v6; // 0x484c
  3139.     if (found_char_pos == NULL) {
  3140.         // 0x47b8
  3141.         puts("err: no filename specified");
  3142.         // branch -> 0x4848
  3143.         // 0x4848
  3144.         g138 = 0;
  3145.         // branch -> 0x484c
  3146.         // 0x484c
  3147.         v6 = g138;
  3148.         g135 = v1;
  3149.         g136 = v2;
  3150.         g137 = v3;
  3151.         g138 = v4;
  3152.         g130 = v5;
  3153.         return (char *)v6;
  3154.     }
  3155.     int32_t str = (int32_t)found_char_pos + 1; // 0x4730
  3156.     char * found_char_pos2 = strchr((char *)str, 34); // 0x473c
  3157.     int32_t v7 = (int32_t)found_char_pos2; // 0x473c_4
  3158.     g135 = v7;
  3159.     if (found_char_pos2 == NULL) {
  3160.         // 0x47c8
  3161.         puts("err: invalid filename specification");
  3162.         // branch -> 0x4848
  3163.         // 0x4848
  3164.         g138 = 0;
  3165.         // branch -> 0x484c
  3166.     } else {
  3167.         int32_t v8 = v7 - str; // 0x474c
  3168.         g137 = v8;
  3169.         char * mem = malloc(v8 + 9); // 0x4754
  3170.         int32_t v9 = (int32_t)mem; // 0x4754_3
  3171.         g138 = v9;
  3172.         int32_t v10 = v9 + 8; // 0x475c
  3173.         g134 = v10;
  3174.         int32_t v11 = 0; // R9
  3175.         *(int32_t *)mem = 0;
  3176.         *(int32_t *)(g138 + 4) = v11;
  3177.         __aeabi_memcpy((char *)v10, (char *)str, g137);
  3178.         *(char *)(g137 + g134) = (char)v11;
  3179.         char * found_char_pos3 = strchr((char *)g135, 44); // 0x4788
  3180.         if (found_char_pos3 != NULL) {
  3181.             int32_t str2 = (int32_t)found_char_pos3 + 1; // 0x4794
  3182.             g136 = str2;
  3183.             char * found_char_pos4 = strchr((char *)str2, 44); // 0x47a0
  3184.             int32_t v12 = (int32_t)found_char_pos4; // 0x47a0_4
  3185.             g135 = v12;
  3186.             int32_t len;
  3187.             if (found_char_pos4 == NULL) {
  3188.                 // 0x47d8
  3189.                 len = strlen((char *)g136);
  3190.                 // branch -> 0x47e4
  3191.             } else {
  3192.                 // 0x47b0
  3193.                 len = v12 - g136;
  3194.                 // branch -> 0x47e4
  3195.             }
  3196.             int32_t v13 = get_value_from_string((char *)g136, len); // 0x47e8
  3197.             *(int32_t *)g138 = v13;
  3198.             if (v13 == -1) {
  3199.                 // 0x4834
  3200.                 // branch -> 0x483c
  3201.                 // 0x483c
  3202.                 puts((char *)(int32_t)"err: invalid offset");
  3203.                 free((char *)g138);
  3204.                 // branch -> 0x4848
  3205.                 // 0x4848
  3206.                 g138 = 0;
  3207.                 // branch -> 0x484c
  3208.             } else {
  3209.                 int32_t v14 = g135; // 0x47f8
  3210.                 if (v14 != 0) {
  3211.                     int32_t str3 = v14 + 1; // 0x4800
  3212.                     g134 = str3;
  3213.                     int32_t len2 = strlen((char *)str3); // 0x4808
  3214.                     int32_t v15 = get_value_from_string((char *)g134, len2); // 0x4814
  3215.                     *(int32_t *)(g138 + 4) = v15;
  3216.                     if (v15 <= 0) {
  3217.                         // 0x483c
  3218.                         puts((char *)(int32_t)"err: invalid length");
  3219.                         free((char *)g138);
  3220.                         // branch -> 0x4848
  3221.                         // 0x4848
  3222.                         g138 = 0;
  3223.                         // branch -> 0x484c
  3224.                     }
  3225.                 }
  3226.             }
  3227.             // 0x484c
  3228.             v6 = g138;
  3229.             g135 = v1;
  3230.             g136 = v2;
  3231.             g137 = v3;
  3232.             g138 = v4;
  3233.             g130 = v5;
  3234.             return (char *)v6;
  3235.         }
  3236.     }
  3237.     // 0x484c
  3238.     v6 = g138;
  3239.     g135 = v1;
  3240.     g136 = v2;
  3241.     g137 = v3;
  3242.     g138 = v4;
  3243.     g130 = v5;
  3244.     return (char *)v6;
  3245. }
  3246.  
  3247. // Address range: 0x4868 - 0x48c7
  3248. int32_t is_incbin(char * str) {
  3249.     int32_t v1 = g134; // bp-16
  3250.     int32_t v2 = g135; // 0x4868
  3251.     int32_t v3 = g130; // bp-8
  3252.     char * substr_pos = strstr(str, ".incbin"); // 0x4880
  3253.     g135 = (int32_t)substr_pos;
  3254.     if (substr_pos == NULL) {
  3255.         // 0x48bc
  3256.         g134 = v1;
  3257.         g135 = v2;
  3258.         g130 = v3;
  3259.         return 0;
  3260.     }
  3261.     char * found_char_pos = strchr((char *)(int32_t)str, 64); // 0x4898
  3262.     uint32_t v4 = g135; // 0x489c
  3263.     int32_t v5 = 0; // 0x48b4
  3264.     if (found_char_pos == NULL) {
  3265.         // if_48b0_0_true
  3266.         v5 = 1;
  3267.         // branch -> after_if_48b0_0
  3268.     }
  3269.     // after_if_48b0_0
  3270.     g134 = v1;
  3271.     g135 = v2;
  3272.     g130 = v3;
  3273.     return v5 | (int32_t)(v4 < (int32_t)found_char_pos);
  3274. }
  3275.  
  3276. // Address range: 0x48c8 - 0x49d3
  3277. int32_t write_header_comment(int32_t * a1, struct _IO_FILE * stream) {
  3278.     int32_t v1;
  3279.     char * v2 = (char *)v1; // bp-40
  3280.     int32_t v3 = (int32_t)a1;
  3281.     int32_t v4 = g134; // 0x48c8
  3282.     int32_t v5 = g135; // 0x48c8
  3283.     int32_t v6 = g136; // 0x48c8
  3284.     int32_t v7 = g137; // 0x48c8
  3285.     int32_t v8 = g138; // 0x48c8
  3286.     int32_t v9 = g139; // 0x48c8
  3287.     int32_t v10 = g130; // bp-8
  3288.     g130 = &v10;
  3289.     int32_t v11 = *a1; // 0x48dc
  3290.     g134 = v11;
  3291.     int32_t v12 = *(int32_t *)(v3 + 4); // 0x48dc
  3292.     g139 = v12;
  3293.     g138 = (int32_t)stream;
  3294.     char * mem = malloc(1); // 0x48e4
  3295.     g137 = 0;
  3296.     g136 = (int32_t)&v2;
  3297.     v2 = mem;
  3298.     *mem = 0;
  3299.     int32_t v13 = g137;
  3300.     concatenate((int32_t *)&v2, &v13, ".incbin \"", v3 + 8);
  3301.     int32_t str;
  3302.     g135 = &str;
  3303.     sprintf((char *)&str, "0x%08x", v11);
  3304.     concatenate((int32_t *)&v2, &v13, (char *)&str, (int32_t)", ");
  3305.     sprintf((char *)&str, "0x%x", v12);
  3306.     concatenate((int32_t *)&v2, &v13, (char *)&str, 0);
  3307.     int32_t result = (int32_t)v2; // R4
  3308.     printf(">>>> @ replacing: %s\n", v2);
  3309.     g132 = result;
  3310.     fprintf(stream, "@ replacing %s\n", (char *)result);
  3311.     free((char *)result);
  3312.     g134 = v4;
  3313.     g135 = v5;
  3314.     g136 = v6;
  3315.     g137 = v7;
  3316.     g138 = v8;
  3317.     g139 = v9;
  3318.     g130 = v10;
  3319.     return result;
  3320. }
  3321.  
  3322. // Address range: 0x49d4 - 0x4aab
  3323. int32_t generate_incbin(int32_t a1, int32_t a2, int32_t a3) {
  3324.     int32_t v1 = g134; // 0x49d4
  3325.     int32_t v2 = g135; // 0x49d4
  3326.     int32_t v3 = g136; // 0x49d4
  3327.     int32_t v4 = g137; // 0x49d4
  3328.     int32_t v5 = g138; // 0x49d4
  3329.     int32_t v6 = g139; // 0x49d4
  3330.     int32_t v7 = g130; // bp-8
  3331.     g130 = &v7;
  3332.     g134 = a1;
  3333.     g138 = a3;
  3334.     g137 = a2;
  3335.     char * mem = malloc(1); // 0x49f0
  3336.     g135 = 0;
  3337.     char * v8; // bp-36
  3338.     g139 = (int32_t)&v8;
  3339.     int32_t v9; // bp-40
  3340.     g136 = &v9;
  3341.     v8 = mem;
  3342.     *mem = 0;
  3343.     v9 = g135;
  3344.     concatenate((int32_t *)&v8, &v9, ".incbin \"", a1);
  3345.     int32_t str;
  3346.     g134 = &str;
  3347.     sprintf((char *)&str, "0x%08x", a2);
  3348.     concatenate((int32_t *)&v8, &v9, (char *)&str, (int32_t)", ");
  3349.     sprintf((char *)&str, "0x%x", a3);
  3350.     concatenate((int32_t *)&v8, &v9, (char *)&str, 0);
  3351.     int32_t result = (int32_t)v8;
  3352.     g127 = result;
  3353.     g134 = v1;
  3354.     g135 = v2;
  3355.     g136 = v3;
  3356.     g137 = v4;
  3357.     g138 = v5;
  3358.     g139 = v6;
  3359.     g130 = v7;
  3360.     return result;
  3361. }
  3362.  
  3363. // Address range: 0x4aac - 0x4bdf
  3364. int32_t write_incbin_for_segment(int32_t a1, int32_t a2, int32_t a3, struct _IO_FILE * a4) {
  3365.     // 0x4aac
  3366.     int32_t v1;
  3367.     char * str = (char *)v1; // bp-60
  3368.     int32_t v2;
  3369.     char * v3 = (char *)v2; // bp-40
  3370.     int32_t v4 = g134; // 0x4aac
  3371.     int32_t v5 = g135; // 0x4aac
  3372.     int32_t v6 = g136; // 0x4aac
  3373.     int32_t v7 = g137; // 0x4aac
  3374.     int32_t v8 = g138; // 0x4aac
  3375.     int32_t v9 = g129; // 0x4aac
  3376.     int32_t v10 = g130; // 0x4aac
  3377.     int32_t v11 = v10; // bp-8
  3378.     g130 = &v11;
  3379.     g135 = a3;
  3380.     g138 = (int32_t)a4;
  3381.     g136 = a2;
  3382.     g134 = a1;
  3383.     int32_t result; // 0x4bc0_2
  3384.     if (a3 != 0) {
  3385.         char * mem = malloc(1); // 0x4ad4
  3386.         g137 = 0;
  3387.         g129 = (int32_t)&v3;
  3388.         int32_t v12;
  3389.         g139 = &v12;
  3390.         v3 = mem;
  3391.         *mem = 0;
  3392.         int32_t v13 = g137; // 0x4afc
  3393.         v12 = v13;
  3394.         concatenate((int32_t *)&v3, &v12, ".incbin \"", g134);
  3395.         int32_t v14 = (int32_t)&str;
  3396.         g134 = v14;
  3397.         sprintf((char *)&str, "0x%08x", g136);
  3398.         concatenate((int32_t *)&v3, &v12, (char *)&str, (int32_t)", ");
  3399.         sprintf((char *)&str, "0x%x", g135);
  3400.         concatenate((int32_t *)&v3, &v12, (char *)&str, 0);
  3401.         g134 = (int32_t)v3;
  3402.         generate_initial_indented_line((int32_t *)&str, NULL, v14, 0, (int32_t)(char *)g137, v13, 0);
  3403.         printf(">>>> %s%s\n", str, (char *)g134);
  3404.         fprintf((struct _IO_FILE *)g138, "%s%s\n", str, (char *)g134);
  3405.         free((char *)g134);
  3406.         free(str);
  3407.         result = (int32_t)str;
  3408.         // branch -> 0x4bbc
  3409.     } else {
  3410.         result = a1;
  3411.         v11 = v10;
  3412.     }
  3413.     // 0x4bbc
  3414.     g134 = v4;
  3415.     g135 = v5;
  3416.     g136 = v6;
  3417.     g137 = v7;
  3418.     g138 = v8;
  3419.     g129 = v9;
  3420.     g130 = v11;
  3421.     return result;
  3422. }
  3423.  
  3424. // Address range: 0x4be0 - 0x4db7
  3425. int32_t parse_incbin(int32_t * a1, int32_t a2, int32_t a3) {
  3426.     int32_t v1 = g134; // 0x4be0
  3427.     int32_t v2 = g135; // 0x4be0
  3428.     int32_t v3 = g136; // 0x4be0
  3429.     int32_t v4 = g138; // 0x4be0
  3430.     int32_t v5 = g139; // 0x4be0
  3431.     int32_t v6 = g129; // 0x4be0
  3432.     int32_t v7 = g130; // bp-8
  3433.     g130 = &v7;
  3434.     g136 = (int32_t)a1;
  3435.     g139 = g133;
  3436.     g138 = a3;
  3437.     g134 = a2;
  3438.     g137 = 1;
  3439.     char * mem = malloc(1); // 0x4c04
  3440.     int32_t v8 = 0; // R2
  3441.     char * file_path = mem; // bp-40
  3442.     *mem = 0;
  3443.     int32_t v9 = v8; // bp-44
  3444.     int32_t v10 = g136 + 8; // bp-56
  3445.     concatenate((int32_t *)&file_path, &v9, (char *)a2, (int32_t)&g117);
  3446.     g134 = (int32_t)fopen(file_path, "rb");
  3447.     free(file_path);
  3448.     int32_t stream = g134; // 0x4c54
  3449.     if (stream == 0) {
  3450.         // 0x4d24
  3451.         puts("err: could not open file for reading");
  3452.         // branch -> 0x4d74
  3453.     } else {
  3454.         int32_t v11 = g136; // 0x4c5c
  3455.         int32_t offset = *(int32_t *)v11; // 0x4c5c
  3456.         int32_t v12; // 0x4ca0
  3457.         char * mem2; // 0x4cc0
  3458.         int32_t items_read; // 0x4ce8
  3459.         int32_t v13; // 0x4d88
  3460.         int32_t v14;
  3461.         int32_t v15; // 0x4cb0
  3462.         int32_t v16; // 0x4d04
  3463.         int32_t v17; // 0x4d08
  3464.         int32_t v18; // 0x4d0c
  3465.         int32_t size; // 0x4c90
  3466.         int32_t v19; // 0x4ce0
  3467.         int32_t v20; // 0x4cf4
  3468.         int32_t v21; // 0x4d04
  3469.         int32_t v22; // 0x4cb4
  3470.         if (offset != 0) {
  3471.             // 0x4c68
  3472.             if (fseek((struct _IO_FILE *)stream, offset, SEEK_SET) != 0) {
  3473.                 // 0x4c7c
  3474.                 fclose((struct _IO_FILE *)g134);
  3475.                 // branch -> 0x4d6c
  3476.                 // 0x4d6c
  3477.                 puts((char *)(int32_t)"err: could not seek on file");
  3478.                 g137 = 1;
  3479.                 // branch -> 0x4d74
  3480.                 // 0x4d74
  3481.                 g134 = v1;
  3482.                 g135 = v2;
  3483.                 g136 = v3;
  3484.                 g138 = v4;
  3485.                 g139 = v5;
  3486.                 g129 = v6;
  3487.                 g130 = v7;
  3488.                 return g137;
  3489.             }
  3490.             // 0x4c68
  3491.             // branch -> 0x4c90
  3492.             // 0x4c90
  3493.             size = *(int32_t *)(g136 + 4);
  3494.             g135 = size;
  3495.             if (size != 0) {
  3496.                 // 0x4cbc
  3497.                 mem2 = malloc(size);
  3498.                 g129 = (int32_t)mem2;
  3499.                 if (mem2 == NULL) {
  3500.                     // 0x4d34
  3501.                     fclose((struct _IO_FILE *)g134);
  3502.                     // branch -> 0x4d6c
  3503.                     // 0x4d6c
  3504.                     puts((char *)(int32_t)"err: out of memory");
  3505.                     g137 = 1;
  3506.                     // branch -> 0x4d74
  3507.                     // 0x4d74
  3508.                     g134 = v1;
  3509.                     g135 = v2;
  3510.                     g136 = v3;
  3511.                     g138 = v4;
  3512.                     g139 = v5;
  3513.                     g129 = v6;
  3514.                     g130 = v7;
  3515.                     return g137;
  3516.                 }
  3517.                 // 0x4cd0
  3518.                 v19 = g138;
  3519.                 g137 = 1;
  3520.                 items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
  3521.                 g135 = items_read;
  3522.                 v20 = *(int32_t *)(g136 + 4);
  3523.                 g138 = v20;
  3524.                 fclose((struct _IO_FILE *)g134);
  3525.                 if (items_read == v20) {
  3526.                     // 0x4d04
  3527.                     v16 = g139;
  3528.                     v21 = *(int32_t *)v16;
  3529.                     v17 = g136;
  3530.                     v18 = g129;
  3531.                     if (v21 == 0) {
  3532.                         // 0x4d80
  3533.                         v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
  3534.                         v14 = v13;
  3535.                         // branch -> 0x4d8c
  3536.                     } else {
  3537.                         // 0x4d18
  3538.                         v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
  3539.                         // branch -> 0x4d8c
  3540.                     }
  3541.                     // 0x4d8c
  3542.                     g137 = v14;
  3543.                     free((char *)g129);
  3544.                     // branch -> 0x4d74
  3545.                 } else {
  3546.                     // 0x4d48
  3547.                     printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
  3548.                     // branch -> 0x4d74
  3549.                 }
  3550.                 // 0x4d74
  3551.                 g134 = v1;
  3552.                 g135 = v2;
  3553.                 g136 = v3;
  3554.                 g138 = v4;
  3555.                 g139 = v5;
  3556.                 g129 = v6;
  3557.                 g130 = v7;
  3558.                 return g137;
  3559.             }
  3560.             // 0x4c9c
  3561.             v12 = get_file_length((struct _IO_FILE *)g134);
  3562.             v9 = v12;
  3563.             if (v12 == 0) {
  3564.                 // 0x4d5c
  3565.                 fclose((struct _IO_FILE *)g134);
  3566.                 // branch -> 0x4d6c
  3567.                 // 0x4d6c
  3568.                 puts((char *)(int32_t)"err: could not get file length for file");
  3569.                 g137 = 1;
  3570.                 // branch -> 0x4d74
  3571.                 // 0x4d74
  3572.                 g134 = v1;
  3573.                 g135 = v2;
  3574.                 g136 = v3;
  3575.                 g138 = v4;
  3576.                 g139 = v5;
  3577.                 g129 = v6;
  3578.                 g130 = v7;
  3579.                 return g137;
  3580.             }
  3581.             // 0x4cb0
  3582.             v15 = g136;
  3583.             v22 = v12 - *(int32_t *)v15;
  3584.             g135 = v22;
  3585.             *(int32_t *)(v15 + 4) = v22;
  3586.             // branch -> 0x4cbc
  3587.             // 0x4cbc
  3588.             mem2 = malloc(g135);
  3589.             g129 = (int32_t)mem2;
  3590.             if (mem2 == NULL) {
  3591.                 // 0x4d34
  3592.                 fclose((struct _IO_FILE *)g134);
  3593.                 // branch -> 0x4d6c
  3594.                 // 0x4d6c
  3595.                 puts((char *)(int32_t)"err: out of memory");
  3596.                 g137 = 1;
  3597.                 // branch -> 0x4d74
  3598.                 // 0x4d74
  3599.                 g134 = v1;
  3600.                 g135 = v2;
  3601.                 g136 = v3;
  3602.                 g138 = v4;
  3603.                 g139 = v5;
  3604.                 g129 = v6;
  3605.                 g130 = v7;
  3606.                 return g137;
  3607.             }
  3608.             // 0x4cd0
  3609.             v19 = g138;
  3610.             g137 = 1;
  3611.             items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
  3612.             g135 = items_read;
  3613.             v20 = *(int32_t *)(g136 + 4);
  3614.             g138 = v20;
  3615.             fclose((struct _IO_FILE *)g134);
  3616.             if (items_read == v20) {
  3617.                 // 0x4d04
  3618.                 v16 = g139;
  3619.                 v21 = *(int32_t *)v16;
  3620.                 v17 = g136;
  3621.                 v18 = g129;
  3622.                 if (v21 == 0) {
  3623.                     // 0x4d80
  3624.                     v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
  3625.                     v14 = v13;
  3626.                     // branch -> 0x4d8c
  3627.                 } else {
  3628.                     // 0x4d18
  3629.                     v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
  3630.                     // branch -> 0x4d8c
  3631.                 }
  3632.                 // 0x4d8c
  3633.                 g137 = v14;
  3634.                 free((char *)g129);
  3635.                 // branch -> 0x4d74
  3636.             } else {
  3637.                 // 0x4d48
  3638.                 printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
  3639.                 // branch -> 0x4d74
  3640.             }
  3641.             // 0x4d74
  3642.             g134 = v1;
  3643.             g135 = v2;
  3644.             g136 = v3;
  3645.             g138 = v4;
  3646.             g139 = v5;
  3647.             g129 = v6;
  3648.             g130 = v7;
  3649.             return g137;
  3650.         }
  3651.         // 0x4c90
  3652.         size = *(int32_t *)(v11 + 4);
  3653.         g135 = size;
  3654.         if (size == 0) {
  3655.             // 0x4c9c
  3656.             v12 = get_file_length((struct _IO_FILE *)g134);
  3657.             v9 = v12;
  3658.             if (v12 == 0) {
  3659.                 // 0x4d5c
  3660.                 fclose((struct _IO_FILE *)g134);
  3661.                 // branch -> 0x4d6c
  3662.                 // 0x4d6c
  3663.                 puts((char *)(int32_t)"err: could not get file length for file");
  3664.                 g137 = 1;
  3665.                 // branch -> 0x4d74
  3666.                 // 0x4d74
  3667.                 g134 = v1;
  3668.                 g135 = v2;
  3669.                 g136 = v3;
  3670.                 g138 = v4;
  3671.                 g139 = v5;
  3672.                 g129 = v6;
  3673.                 g130 = v7;
  3674.                 return g137;
  3675.             }
  3676.             // 0x4cb0
  3677.             v15 = g136;
  3678.             v22 = v12 - *(int32_t *)v15;
  3679.             g135 = v22;
  3680.             *(int32_t *)(v15 + 4) = v22;
  3681.             // branch -> 0x4cbc
  3682.             // 0x4cbc
  3683.             mem2 = malloc(g135);
  3684.             g129 = (int32_t)mem2;
  3685.             if (mem2 == NULL) {
  3686.                 // 0x4d34
  3687.                 fclose((struct _IO_FILE *)g134);
  3688.                 // branch -> 0x4d6c
  3689.                 // 0x4d6c
  3690.                 puts((char *)(int32_t)"err: out of memory");
  3691.                 g137 = 1;
  3692.                 // branch -> 0x4d74
  3693.                 // 0x4d74
  3694.                 g134 = v1;
  3695.                 g135 = v2;
  3696.                 g136 = v3;
  3697.                 g138 = v4;
  3698.                 g139 = v5;
  3699.                 g129 = v6;
  3700.                 g130 = v7;
  3701.                 return g137;
  3702.             }
  3703.             // 0x4cd0
  3704.             v19 = g138;
  3705.             g137 = 1;
  3706.             items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
  3707.             g135 = items_read;
  3708.             v20 = *(int32_t *)(g136 + 4);
  3709.             g138 = v20;
  3710.             fclose((struct _IO_FILE *)g134);
  3711.             if (items_read == v20) {
  3712.                 // 0x4d04
  3713.                 v16 = g139;
  3714.                 v21 = *(int32_t *)v16;
  3715.                 v17 = g136;
  3716.                 v18 = g129;
  3717.                 if (v21 == 0) {
  3718.                     // 0x4d80
  3719.                     v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
  3720.                     v14 = v13;
  3721.                     // branch -> 0x4d8c
  3722.                 } else {
  3723.                     // 0x4d18
  3724.                     v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
  3725.                     // branch -> 0x4d8c
  3726.                 }
  3727.                 // 0x4d8c
  3728.                 g137 = v14;
  3729.                 free((char *)g129);
  3730.                 // branch -> 0x4d74
  3731.             } else {
  3732.                 // 0x4d48
  3733.                 printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
  3734.                 // branch -> 0x4d74
  3735.             }
  3736.             // 0x4d74
  3737.             g134 = v1;
  3738.             g135 = v2;
  3739.             g136 = v3;
  3740.             g138 = v4;
  3741.             g139 = v5;
  3742.             g129 = v6;
  3743.             g130 = v7;
  3744.             return g137;
  3745.         }
  3746.         // 0x4cbc
  3747.         mem2 = malloc(size);
  3748.         g129 = (int32_t)mem2;
  3749.         if (mem2 == NULL) {
  3750.             // 0x4d34
  3751.             fclose((struct _IO_FILE *)g134);
  3752.             // branch -> 0x4d6c
  3753.             // 0x4d6c
  3754.             puts((char *)(int32_t)"err: out of memory");
  3755.             g137 = 1;
  3756.             // branch -> 0x4d74
  3757.             // 0x4d74
  3758.             g134 = v1;
  3759.             g135 = v2;
  3760.             g136 = v3;
  3761.             g138 = v4;
  3762.             g139 = v5;
  3763.             g129 = v6;
  3764.             g130 = v7;
  3765.             return g137;
  3766.         }
  3767.         // 0x4cd0
  3768.         v19 = g138;
  3769.         g137 = 1;
  3770.         items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
  3771.         g135 = items_read;
  3772.         v20 = *(int32_t *)(g136 + 4);
  3773.         g138 = v20;
  3774.         fclose((struct _IO_FILE *)g134);
  3775.         if (items_read == v20) {
  3776.             // 0x4d04
  3777.             v16 = g139;
  3778.             v21 = *(int32_t *)v16;
  3779.             v17 = g136;
  3780.             v18 = g129;
  3781.             if (v21 == 0) {
  3782.                 // 0x4d80
  3783.                 v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
  3784.                 v14 = v13;
  3785.                 // branch -> 0x4d8c
  3786.             } else {
  3787.                 // 0x4d18
  3788.                 v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
  3789.                 // branch -> 0x4d8c
  3790.             }
  3791.             // 0x4d8c
  3792.             g137 = v14;
  3793.             free((char *)g129);
  3794.             // branch -> 0x4d74
  3795.         } else {
  3796.             // 0x4d48
  3797.             printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
  3798.             // branch -> 0x4d74
  3799.         }
  3800.         // 0x4d74
  3801.         g134 = v1;
  3802.         g135 = v2;
  3803.         g136 = v3;
  3804.         g138 = v4;
  3805.         g139 = v5;
  3806.         g129 = v6;
  3807.         g130 = v7;
  3808.         return g137;
  3809.     }
  3810.     // 0x4d74
  3811.     g134 = v1;
  3812.     g135 = v2;
  3813.     g136 = v3;
  3814.     g138 = v4;
  3815.     g139 = v5;
  3816.     g129 = v6;
  3817.     g130 = v7;
  3818.     return g137;
  3819. }
  3820.  
  3821. // Address range: 0x4db8 - 0x4e9b
  3822. int32_t validate_pointers(int32_t a1, uint32_t a2, int32_t a3) {
  3823.     // 0x4db8
  3824.     g127 = a1;
  3825.     g128 = a2;
  3826.     int32_t v1 = g134; // bp-24
  3827.     int32_t v2 = g135; // 0x4db8
  3828.     int32_t v3 = g136; // 0x4db8
  3829.     int32_t v4 = g137; // 0x4db8
  3830.     int32_t v5 = g130; // bp-8
  3831.     g130 = &v5;
  3832.     g126 = 0;
  3833.     g131 = 0x203ffff;
  3834.     g133 = 4;
  3835.     int32_t v6 = 4; // 0x4dec
  3836.     // branch -> 0x4de0
  3837.     int32_t result; // 0x4e88
  3838.     while (true) {
  3839.         uint32_t v7 = v6 - 4; // 0x4de0
  3840.         g1 = v7 >= a2;
  3841.         g3 = v7 == a2;
  3842.         if (v7 < a2) {
  3843.             // 0x4e90
  3844.             g127 = g126;
  3845.             g134 = v1;
  3846.             g135 = v2;
  3847.             g136 = v3;
  3848.             g137 = v4;
  3849.             g130 = v5;
  3850.             return g126;
  3851.         }
  3852.         int32_t v8 = g127 + v6; // 0x4dec
  3853.         g132 = 0;
  3854.         unsigned char v9 = *(char *)(v8 - 1); // 0x4df4
  3855.         int32_t v10 = v9; // 0x4df4
  3856.         g135 = v10;
  3857.         g1 = v9 > 8;
  3858.         g2 = v9 < 9;
  3859.         g3 = v9 == 9;
  3860.         if (v9 > 9) {
  3861.             result = 0;
  3862.             // 0x4e88
  3863.             g127 = result;
  3864.             g134 = v1;
  3865.             g135 = v2;
  3866.             g136 = v3;
  3867.             g137 = v4;
  3868.             g130 = v5;
  3869.             return result;
  3870.         }
  3871.         int32_t v11 = (int32_t)*(char *)(v8 - 3); // 0x4e00
  3872.         g137 = v11;
  3873.         char v12 = *(char *)(v8 - 4); // 0x4e04
  3874.         char v13 = *(char *)(v8 - 2); // 0x4e08
  3875.         g136 = &g56;
  3876.         g134 = 256 * v11 | 0x1000000 * v10 | (int32_t)v12 | 0x10000 * (int32_t)v13;
  3877.         int32_t v14 = 4 * v10; // 0x4e1c
  3878.         g135 = v14;
  3879.         int32_t v15 = *(int32_t *)(v14 + (int32_t)&g56); // 0x4e20
  3880.         g135 = v15;
  3881.         ((int32_t (*)())(v15 + (int32_t)&g56))();
  3882.         if (g3) {
  3883.             // if_4e44_0_true
  3884.             g127 = 0;
  3885.             // branch -> after_if_4e44_0
  3886.         }
  3887.         int32_t v16 = g133 + 4; // 0x4e50
  3888.         g133 = v16;
  3889.         int32_t v17 = g134; // 0x4e54
  3890.         g1 = true;
  3891.         g3 = v17 == 0;
  3892.         if (v17 != 0) {
  3893.             // break -> after_if_4e44_0.dec_label_pc_4e88_crit_edge
  3894.             break;
  3895.         }
  3896.         v6 = v16;
  3897.         // continue -> 0x4de0
  3898.     }
  3899.     // after_if_4e44_0.dec_label_pc_4e88_crit_edge
  3900.     result = g132;
  3901.     // branch -> 0x4e88
  3902.     // 0x4e88
  3903.     g127 = result;
  3904.     g134 = v1;
  3905.     g135 = v2;
  3906.     g136 = v3;
  3907.     g137 = v4;
  3908.     g130 = v5;
  3909.     return result;
  3910. }
  3911.  
  3912. // Address range: 0x4e9c - 0x4ef3
  3913. int32_t output_pointers(int32_t result, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8) {
  3914.     int32_t v1 = g135; // 0x4e9c
  3915.     int32_t v2 = g130; // bp-8
  3916.     g130 = &v2;
  3917.     g135 = a2;
  3918.     g134 = a3;
  3919.     g136 = result;
  3920.     if (a2 == 0) {
  3921.         // if_4eb4_0_true
  3922.         g135 = v1;
  3923.         return result;
  3924.     }
  3925.     // after_if_4eb4_0
  3926.     g137 = 0;
  3927.     int32_t v3 = 0; // 0x4ec0
  3928.     // branch -> 0x4ebc
  3929.     while (true) {
  3930.         int32_t v4 = result + v3; // 0x4ec0
  3931.         char v5 = *(char *)v4; // 0x4ec0
  3932.         int32_t v6 = (int32_t)*(char *)(v4 + 1); // 0x4ec4
  3933.         g132 = v6;
  3934.         int32_t v7 = (int32_t)*(char *)(v4 + 2); // 0x4ec8
  3935.         g133 = v7;
  3936.         char v8 = *(char *)(v4 + 3); // 0x4ecc
  3937.         int32_t result2 = output_pointer(256 * v6 | (int32_t)v5 | 0x10000 * v7 | 0x1000000 * (int32_t)v8, (struct _IO_FILE *)a3); // 0x4ee0
  3938.         g127 = result2;
  3939.         int32_t v9 = g137 + 4; // 0x4ee4
  3940.         g137 = v9;
  3941.         uint32_t v10 = g135; // 0x4ee8
  3942.         g1 = v9 >= v10;
  3943.         g2 = v9 - v10 < 0;
  3944.         g3 = v9 == v10;
  3945.         if (v9 >= v10) {
  3946.             // 0x4ef0
  3947.             g134 = a5;
  3948.             g135 = a6;
  3949.             g136 = a7;
  3950.             g137 = a8;
  3951.             int32_t v11;
  3952.             g130 = v11;
  3953.             int32_t v12;
  3954.             ((int32_t (*)())v12)();
  3955.             return result2;
  3956.         }
  3957.         // 0x4ebc
  3958.         a3 = g134;
  3959.         v3 = v9;
  3960.         result = g136;
  3961.         // branch -> 0x4ebc
  3962.     }
  3963. }
  3964.  
  3965. // Address range: 0x4ef4 - 0x503b
  3966. int32_t output_pointer(int32_t a1, struct _IO_FILE * a2) {
  3967.     int32_t v1 = g134; // 0x4ef4
  3968.     int32_t v2 = g135; // 0x4ef4
  3969.     int32_t v3 = g136; // 0x4ef4
  3970.     int32_t v4 = g137; // 0x4ef4
  3971.     int32_t v5 = g130; // bp-8
  3972.     g130 = &v5;
  3973.     int32_t v6;
  3974.     g136 = &v6;
  3975.     int32_t v7;
  3976.     g137 = &v7;
  3977.     g134 = (int32_t)a2;
  3978.     g135 = a1;
  3979.     int32_t v8;
  3980.     generate_initial_indented_line(&v6, &v7, g132, g133, v8, 0, 0);
  3981.     concatenate(&v6, &v7, ".4byte ", 0);
  3982.     int32_t v9 = g135; // 0x4f34
  3983.     int32_t format;
  3984.     int32_t result; // 0x5008
  3985.     if (v9 == 0) {
  3986.         // 0x4fe4
  3987.         printf(">>>> %s0\n", (char *)v6);
  3988.         format = (int32_t)"%s0\n";
  3989.         // branch -> 0x5000
  3990.     } else {
  3991.         // 0x4f3c
  3992.         int32_t str;
  3993.         if (g24 != 0) {
  3994.             int32_t v10 = find_symbol_for_address(v9); // 0x4f54
  3995.             if (v10 == 0) {
  3996.                 // 0x4f50
  3997.                 // branch -> 0x4f98
  3998.                 // 0x4f98
  3999.                 g136 = &str;
  4000.                 sprintf((char *)&str, "0x%x", g135);
  4001.                 concatenate(&v6, &v7, (char *)&str, 0);
  4002.                 // branch -> 0x4fc4
  4003.             } else {
  4004.                 // 0x4f64
  4005.                 g137 = 0;
  4006.                 int32_t v11 = *(int32_t *)v10; // 0x4f6c
  4007.                 int32_t v12 = g135; // 0x4f78
  4008.                 g135 = v12 - v11;
  4009.                 int32_t v13 = &g120; // 0x4f8c
  4010.                 if (v12 != v11) {
  4011.                     // if_4f80_0_true
  4012.                     v13 = (int32_t)" + ";
  4013.                     // branch -> after_if_4f80_0
  4014.                 }
  4015.                 // after_if_4f80_0
  4016.                 concatenate(&v6, &v7, (char *)(v10 + 9), v13);
  4017.                 int32_t v14 = g135; // 0x4f90
  4018.                 if (v14 != 0) {
  4019.                     // 0x4f98
  4020.                     g136 = &str;
  4021.                     sprintf((char *)&str, "0x%x", v14);
  4022.                     concatenate(&v6, &v7, (char *)&str, 0);
  4023.                     // branch -> 0x4fc4
  4024.                 }
  4025.             }
  4026.             // 0x4fc4
  4027.             printf(">>>> %s\n", (char *)v6);
  4028.             format = (int32_t)"%s\n";
  4029.             // branch -> 0x5000
  4030.             // 0x5000
  4031.             g132 = v6;
  4032.             g128 = format;
  4033.             fprintf((struct _IO_FILE *)g134, (char *)format);
  4034.             result = v6;
  4035.             free((char *)result);
  4036.             g134 = v1;
  4037.             g135 = v2;
  4038.             g136 = v3;
  4039.             g137 = v4;
  4040.             g130 = v5;
  4041.             return result;
  4042.         }
  4043.         // 0x4f98
  4044.         g136 = &str;
  4045.         sprintf((char *)&str, "0x%x", v9);
  4046.         concatenate(&v6, &v7, (char *)&str, 0);
  4047.         // branch -> 0x4fc4
  4048.         // 0x4fc4
  4049.         printf(">>>> %s\n", (char *)v6);
  4050.         format = (int32_t)"%s\n";
  4051.         // branch -> 0x5000
  4052.     }
  4053.     // 0x5000
  4054.     g132 = v6;
  4055.     g128 = format;
  4056.     fprintf((struct _IO_FILE *)g134, (char *)format);
  4057.     result = v6;
  4058.     free((char *)result);
  4059.     g134 = v1;
  4060.     g135 = v2;
  4061.     g136 = v3;
  4062.     g137 = v4;
  4063.     g130 = v5;
  4064.     return result;
  4065. }
  4066.  
  4067. // Address range: 0x503c - 0x5343
  4068. int32_t handle_incbin_text(int32_t * a1, int32_t a2, struct _IO_FILE * a3, int32_t a4, int32_t a5, int32_t a6, char * format2, char * format, int32_t a9, int32_t a10) {
  4069.     int32_t v1 = (int32_t)a3;
  4070.     int32_t v2 = g135; // 0x503c
  4071.     int32_t v3 = g138; // 0x503c
  4072.     int32_t v4 = g130; // bp-8
  4073.     g130 = &v4;
  4074.     g135 = a2;
  4075.     g136 = (int32_t)a1;
  4076.     int32_t v5;
  4077.     int32_t v6;
  4078.     int32_t v7;
  4079.     int32_t v8;
  4080.     generate_initial_indented_line(&v5, NULL, v1, a4, v8, v7, v6);
  4081.     int32_t v9 = g136 + 8; // 0x5068
  4082.     int32_t v10 = g135; // 0x5074
  4083.     int32_t v11 = 1 - v10; // 0x5074
  4084.     g134 = 0;
  4085.     char * format3 = "%s.string \"%s\"\n"; // bp-88
  4086.     // branch -> 0x5234
  4087.     while (true) {
  4088.         int32_t v12 = v10; // 0x523c
  4089.         int32_t v13 = v11; // 0x5238
  4090.         int32_t v14 = 0; // 0x5238
  4091.         int32_t v15 = 0; // 0x5234
  4092.         int32_t v16 = 0; // 0x52b82
  4093.         // branch -> 0x5234
  4094.         while (true) {
  4095.           lab_0x5234_2:
  4096.             // 0x5234
  4097.             g137 = v13 - v14;
  4098.             g139 = v14 + v12;
  4099.             int32_t v17 = v15;
  4100.             // branch -> 0x50e0
  4101.             while (true) {
  4102.                 // 0x50e0
  4103.                 // branch -> 0x50e0
  4104.                 int32_t v18; // 0x5118
  4105.                 int32_t v19;
  4106.                 int32_t v20;
  4107.                 int32_t v21;
  4108.                 int32_t v22;
  4109.                 int32_t v23;
  4110.                 int32_t v24; // 0x52b81
  4111.                 int32_t v25; // 0x51c8
  4112.                 while (true) {
  4113.                     int32_t v26 = g136; // 0x50e0
  4114.                     uint32_t v27 = *(int32_t *)(v26 + 4); // 0x50e0
  4115.                     uint32_t v28 = g134; // 0x50e4
  4116.                     int32_t n = v27 - v28; // 0x50e4
  4117.                     if (v27 <= v28) {
  4118.                         // 0x52b8
  4119.                         write_incbin_for_segment(v9, *(int32_t *)v26 + v16, v27 - v16, a3);
  4120.                         free((char *)v5);
  4121.                         g135 = v2;
  4122.                         g138 = v3;
  4123.                         return 0;
  4124.                     }
  4125.                     // 0x50ec
  4126.                     g129 = n;
  4127.                     char * found_byte_pos = memchr((char *)g139, 255, n); // 0x50fc
  4128.                     int32_t v29 = (int32_t)found_byte_pos; // 0x50fc_6
  4129.                     int32_t v30; // 0x51c8
  4130.                     if (found_byte_pos == NULL) {
  4131.                         // after_if_5104_0thread-pre-split
  4132.                         v30 = g129;
  4133.                         // branch -> after_if_5104_0
  4134.                     } else {
  4135.                         int32_t v31 = g137 + v29; // 0x5104
  4136.                         g129 = v31;
  4137.                         v30 = v31;
  4138.                         // branch -> after_if_5104_0
  4139.                     }
  4140.                     // after_if_5104_0
  4141.                     if (v30 < 1000) {
  4142.                         // 0x51c0
  4143.                         g135 = v10;
  4144.                         v25 = g134 + v30;
  4145.                         g134 = v25;
  4146.                         v24 = v16;
  4147.                         // branch -> 0x50d0
  4148.                     } else {
  4149.                         // 0x5110
  4150.                         v18 = parse_buffer((char *)g139, v30, n, g133, a5, a6, (int32_t)format2, (int32_t)format, a9, a10, v19, v20, v21, v22, v23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0);
  4151.                         g138 = v18;
  4152.                         if (v18 != 0) {
  4153.                             // break -> 0x5128
  4154.                             break;
  4155.                         }
  4156.                         // continue -> 0x50e0
  4157.                         continue;
  4158.                     }
  4159.                   lab_0x50d0:
  4160.                     // 0x50d0
  4161.                     v12 = v10;
  4162.                     v13 = v11;
  4163.                     v14 = v25;
  4164.                     v15 = v17;
  4165.                     v16 = v24;
  4166.                     // branch -> 0x5234
  4167.                     goto lab_0x5234_2;
  4168.                 }
  4169.                 // 0x5128
  4170.                 if (v17 == 0) {
  4171.                     // 0x5134
  4172.                     printf("String found:\n%s\n", (char *)v18);
  4173.                     uint32_t v32 = get_command((int32_t)"Keep string? ", (int32_t)&g125 & 0xffff | 0x20000); // 0x5154
  4174.                     g1 = v32 > 16;
  4175.                     g2 = v32 < 17;
  4176.                     g3 = v32 == 17;
  4177.                     if (v32 > 17) {
  4178.                         // 0x50d8
  4179.                         v17 = 0;
  4180.                         // branch -> 0x50e0
  4181.                         continue;
  4182.                     } else {
  4183.                         // 0x5160
  4184.                         g128 = &g57;
  4185.                         int32_t v33 = *(int32_t *)(4 * v32 + (int32_t)&g57); // 0x5168
  4186.                         g127 = v33;
  4187.                         ((int32_t (*)(int32_t, int32_t))(v33 + (int32_t)&g57))(v33, (int32_t)&g57);
  4188.                         if (g3) {
  4189.                             // if_519c_0_true
  4190.                             // branch -> after_if_519c_0
  4191.                         }
  4192.                         // after_if_519c_0
  4193.                         g137 = 0;
  4194.                         int32_t v34 = *(int32_t *)g136; // 0x51d8
  4195.                         g135 = v22;
  4196.                         write_incbin_for_segment(v21, v34 + v23, g134 - v23, (struct _IO_FILE *)v22);
  4197.                         printf(format);
  4198.                         g133 = g138;
  4199.                         fprintf((struct _IO_FILE *)g135, format2);
  4200.                         free((char *)g138);
  4201.                         int32_t v35 = g129 + g134; // 0x5220
  4202.                         g134 = v35;
  4203.                         g135 = v19;
  4204.                         v23 = v35;
  4205.                         // branch -> 0x5234
  4206.                         while (true) {
  4207.                             // 0x5234
  4208.                             v12 = v19;
  4209.                             v13 = v20;
  4210.                             v14 = v35;
  4211.                             v15 = g137;
  4212.                             // branch -> 0x5234
  4213.                             goto lab_0x5234_2;
  4214.                         }
  4215.                     }
  4216.                 } else {
  4217.                     // 0x5258
  4218.                     g135 = v1;
  4219.                     write_incbin_for_segment(v9, *(int32_t *)g136 + v16, g134 - v16, a3);
  4220.                     printf(">>>> %s.string \"%s\"\n", (char *)v5, (char *)g138);
  4221.                     int32_t v36 = g138; // 0x5294
  4222.                     g133 = v36;
  4223.                     fprintf((struct _IO_FILE *)g135, format3, (char *)v5, (char *)v36);
  4224.                     free((char *)g138);
  4225.                     int32_t v37 = g129 + g134; // 0x52a4
  4226.                     g134 = v37;
  4227.                     g135 = v10;
  4228.                     v25 = v37;
  4229.                     v24 = v37;
  4230.                     // branch -> 0x50d0
  4231.                     goto lab_0x50d0;
  4232.                 }
  4233.                 while (true) {
  4234.                     // 0x5234
  4235.                     g137 = v13 - v14;
  4236.                     g139 = v14 + v12;
  4237.                     v17 = v15;
  4238.                     // branch -> 0x50e0
  4239.                     break;
  4240.                 }
  4241.             }
  4242.         }
  4243.     }
  4244. }
  4245.  
  4246. // Address range: 0x5344 - 0x542b
  4247. int main() {
  4248.     int32_t v1 = (int32_t)a2;
  4249.     int32_t v2 = g135; // 0x5344
  4250.     int32_t v3 = g130; // bp-8
  4251.     g130 = &v3;
  4252.     g134 = v1;
  4253.     if (a1 != 4) {
  4254.         // 0x53b8
  4255.         // branch -> 0x53fc
  4256.         // 0x53fc
  4257.         fprintf((struct _IO_FILE *)(g33 + 168), (char *)(int32_t)"usage: %s <infile> <outfile> <directory>\n");
  4258.         g135 = v2;
  4259.         return 1;
  4260.     }
  4261.     struct _IO_FILE * file = fopen((char *)*(int32_t *)(v1 + 4), "r"); // 0x5364
  4262.     g135 = (int32_t)file;
  4263.     int32_t format; // 0x5400
  4264.     if (file == NULL) {
  4265.         // 0x53d0
  4266.         format = (int32_t)"error: could not open file %s for reading\n";
  4267.         // branch -> 0x53fc
  4268.     } else {
  4269.         struct _IO_FILE * file2 = fopen((char *)*(int32_t *)(g134 + 8), "w"); // 0x5380
  4270.         g136 = (int32_t)file2;
  4271.         if (file2 != NULL) {
  4272.             // 0x5390
  4273.             dump_incbins((struct _IO_FILE *)g135, file2, *(int32_t *)(g134 + 12));
  4274.             fclose((struct _IO_FILE *)g135);
  4275.             fclose((struct _IO_FILE *)g136);
  4276.             g135 = v2;
  4277.             return 0;
  4278.         }
  4279.         // 0x53e8
  4280.         format = (int32_t)"error: could not open file %s for writing\n";
  4281.         // branch -> 0x53fc
  4282.     }
  4283.     // 0x53fc
  4284.     fprintf((struct _IO_FILE *)(g33 + 168), (char *)format);
  4285.     g135 = v2;
  4286.     return 1;
  4287. }
  4288.  
  4289. // Address range: 0x542c - 0x55db
  4290. int32_t dump_incbins(struct _IO_FILE * stream, struct _IO_FILE * a2, int32_t a3) {
  4291.     int32_t v1 = g135; // 0x542c
  4292.     int32_t v2 = g136; // 0x542c
  4293.     int32_t v3 = g138; // 0x542c
  4294.     int32_t v4 = g130; // bp-8
  4295.     g130 = &v4;
  4296.     g134 = 0;
  4297.     g135 = (int32_t)a2;
  4298.     g136 = (int32_t)stream;
  4299.     int32_t v5 = 0; // bp-40
  4300.     int32_t result; // 0x55b0
  4301.     if (feof(stream) == 0) {
  4302.         // 0x5458
  4303.         g137 = 0;
  4304.         char * format = "%s\n"; // bp-64
  4305.         g129 = (int32_t)"==== %s\n";
  4306.         g138 = (int32_t)"%s\n";
  4307.         // branch -> 0x5564
  4308.         while (true) {
  4309.             int32_t v6 = read_line((struct _IO_FILE *)g136); // 0x5568
  4310.             g139 = v6;
  4311.             int32_t v7 = v6; // 0x557c
  4312.             if (g137 == 0) {
  4313.                 // 0x54b0
  4314.                 if (is_incbin((char *)v6) == 0) {
  4315.                     // 0x54b0
  4316.                     // branch -> 0x5578
  4317.                     // 0x5578
  4318.                     printf((char *)g129, (char *)g139);
  4319.                     fprintf((struct _IO_FILE *)g135, (char *)g138, (char *)g139);
  4320.                     // branch -> 0x5594
  4321.                 } else {
  4322.                     // 0x54c0
  4323.                     printf("<<<< %s\n", (char *)g139);
  4324.                     g127 = g139;
  4325.                     char * v8 = get_incbin_data(); // 0x54d0
  4326.                     g134 = (int32_t)v8;
  4327.                     if (v8 == NULL) {
  4328.                         // 0x5514
  4329.                         printf(">>>> %s\n", (char *)g139);
  4330.                         fprintf((struct _IO_FILE *)g135, "%s\n", (char *)g139);
  4331.                         g137 = 0;
  4332.                         // branch -> 0x5594
  4333.                     } else {
  4334.                         // 0x54e0
  4335.                         g133 = &v5;
  4336.                         int32_t v9 = parse_incbin((int32_t *)v8, a3, g135); // 0x54f0
  4337.                         g137 = 0;
  4338.                         if (v9 != 1) {
  4339.                             // 0x5500
  4340.                             if (v9 == 2) {
  4341.                                 // 0x5538
  4342.                                 g137 = 1;
  4343.                                 // branch -> 0x553c
  4344.                                 // 0x553c
  4345.                                 printf(">>>> %s\n", (char *)g139);
  4346.                                 fprintf((struct _IO_FILE *)g135, format, (char *)g139);
  4347.                                 // branch -> 0x5558
  4348.                             } else {
  4349.                                 // 0x5508
  4350.                                 if (v9 == 3) {
  4351.                                     // if_550c_0_true
  4352.                                     g137 = 1;
  4353.                                     // branch -> 0x5558
  4354.                                 }
  4355.                             }
  4356.                           lab_0x5558:
  4357.                             // 0x5558
  4358.                             free((char *)g134);
  4359.                             // branch -> 0x5594
  4360.                             // 0x5594
  4361.                             free((char *)g139);
  4362.                             if (feof((struct _IO_FILE *)g136) != 0) {
  4363.                                 // break -> 0x55ac
  4364.                                 break;
  4365.                             }
  4366.                             // continue -> 0x5564
  4367.                             continue;
  4368.                         }
  4369.                         // 0x553c
  4370.                         printf(">>>> %s\n", (char *)g139);
  4371.                         fprintf((struct _IO_FILE *)g135, format, (char *)g139);
  4372.                         // branch -> 0x5558
  4373.                         goto lab_0x5558;
  4374.                     }
  4375.                     // 0x5594
  4376.                     free((char *)g139);
  4377.                     if (feof((struct _IO_FILE *)g136) != 0) {
  4378.                         // break -> 0x55ac
  4379.                         break;
  4380.                     }
  4381.                     // continue -> 0x5564
  4382.                     continue;
  4383.                 }
  4384.               lab_0x5594:
  4385.                 // 0x5594
  4386.                 free((char *)g139);
  4387.                 if (feof((struct _IO_FILE *)g136) != 0) {
  4388.                     // break -> 0x55ac
  4389.                     break;
  4390.                 }
  4391.                 // continue -> 0x5564
  4392.                 continue;
  4393.             }
  4394.             // 0x5578
  4395.             printf((char *)g129, (char *)v7);
  4396.             fprintf((struct _IO_FILE *)g135, (char *)g138, (char *)g139);
  4397.             // branch -> 0x5594
  4398.             goto lab_0x5594;
  4399.         }
  4400.         // 0x55ac
  4401.         result = v5;
  4402.         // branch -> 0x55b0
  4403.     } else {
  4404.         // 0x542c
  4405.         result = g134;
  4406.         // branch -> 0x55b0
  4407.     }
  4408.     // 0x55b0
  4409.     free((char *)result);
  4410.     g135 = v1;
  4411.     g136 = v2;
  4412.     g138 = v3;
  4413.     return result;
  4414. }
  4415.  
  4416. // Address range: 0x55dc - 0x5693
  4417. int32_t script_get_expression_value(char * a1, int32_t a2, int32_t * a3, int32_t a4) {
  4418.     int32_t v1 = (int32_t)a1;
  4419.     int32_t v2 = (int32_t)a3;
  4420.     g132 = v2;
  4421.     g133 = a4;
  4422.     int32_t v3 = g134; // bp-16
  4423.     int32_t v4 = g135; // 0x55dc
  4424.     int32_t v5 = g130; // bp-8
  4425.     int32_t v6 = g126; // 0x55dc
  4426.     g130 = &v5;
  4427.     g135 = v1;
  4428.     g134 = v2;
  4429.     if (*a1 != 36) {
  4430.         // 0x5634
  4431.         if ((int32_t)convert_string_to_number(a1, 1) != 0) {
  4432.             // 0x5648
  4433.             return convert_string_to_number((char *)g135, 0);
  4434.         }
  4435.         // 0x5668
  4436.         g127 = (int32_t)"syntax error";
  4437.         g134 = v3;
  4438.         g135 = v4;
  4439.         g130 = v5;
  4440.         g126 = v6;
  4441.         return duplicate_string();
  4442.     }
  4443.     int32_t v7 = v1 + 1; // 0x55f8
  4444.     g132 = v7;
  4445.     int32_t v8 = find_script_variable((int32_t *)a2, (char *)v7); // 0x5604
  4446.     if (v8 == 0) {
  4447.         // 0x5658
  4448.         g127 = (int32_t)"unknown variable";
  4449.         g134 = v3;
  4450.         g135 = v4;
  4451.         g130 = v5;
  4452.         g126 = v6;
  4453.         return duplicate_string();
  4454.     }
  4455.     uint32_t v9 = ((int32_t)*(char *)v8 + 255) % 256; // 0x5618
  4456.     g128 = v9;
  4457.     if (v9 < 3) {
  4458.         // 0x5678
  4459.         *(int32_t *)g134 = *(int32_t *)(v8 + 4);
  4460.         g134 = v3;
  4461.         g135 = v4;
  4462.         g130 = v5;
  4463.         return 0;
  4464.     }
  4465.     // 0x5624
  4466.     g127 = (int32_t)"variable does not contain an integer";
  4467.     g134 = v3;
  4468.     g135 = v4;
  4469.     g130 = v5;
  4470.     g126 = v6;
  4471.     return duplicate_string();
  4472. }
  4473.  
  4474. // Address range: 0x5694 - 0x56f3
  4475. int32_t get_line_type(void) {
  4476.     int32_t v1 = g130; // bp-8
  4477.     g130 = &v1;
  4478.     int32_t v2 = find_first_non_space((char *)g127); // 0x569c
  4479.     char v3 = *(char *)v2; // 0x56a0
  4480.     g128 = v3;
  4481.     g3 = v3 == 0;
  4482.     if (v3 == 0) {
  4483.         // 0x56c8
  4484.         g127 = 0;
  4485.         g130 = v1;
  4486.         return 0;
  4487.     }
  4488.     // 0x56ac
  4489.     if (v3 != 58) {
  4490.         // 0x56b4
  4491.         g3 = v3 == 36;
  4492.         int32_t result = v3 == 36 ? 1 : 4;
  4493.         g127 = result;
  4494.         g130 = v1;
  4495.         return result;
  4496.     }
  4497.     char v4 = *(char *)(v2 + 1); // 0x56d4
  4498.     g128 = v4;
  4499.     int32_t result2; // 0x56ec
  4500.     if (v4 == 36) {
  4501.         // after_if_56e0_0.thread
  4502.         g3 = false;
  4503.         result2 = 2;
  4504.         // branch -> after_if_56e8_0
  4505.     } else {
  4506.         // after_if_56e0_0
  4507.         g3 = v4 == 58;
  4508.         if (v4 == 58) {
  4509.             // if_56e8_0_true
  4510.             result2 = 3;
  4511.             // branch -> after_if_56e8_0
  4512.         } else {
  4513.             result2 = 0;
  4514.         }
  4515.     }
  4516.     // after_if_56e8_0
  4517.     g127 = result2;
  4518.     g130 = v1;
  4519.     return result2;
  4520. }
  4521.  
  4522. // Address range: 0x56f4 - 0x589b
  4523. int32_t run_script(int32_t a1, int32_t a2, struct _IO_FILE * a3, int32_t a4) {
  4524.     // 0x56f4
  4525.     int32_t v1;
  4526.     char * v2 = (char *)v1; // bp-40
  4527.     int32_t v3 = g134; // 0x56f4
  4528.     int32_t v4 = g135; // 0x56f4
  4529.     int32_t v5 = g138; // 0x56f4
  4530.     int32_t v6 = g130; // bp-8
  4531.     g130 = &v6;
  4532.     g138 = a1;
  4533.     g134 = (int32_t)a3;
  4534.     g139 = a2;
  4535.     printf("Script file: ");
  4536.     int32_t v7 = read_line((struct _IO_FILE *)g33); // 0x5720
  4537.     g137 = v7;
  4538.     char * file_path = (char *)v7; // 0x5728_0
  4539.     if (*file_path == 0) {
  4540.         // 0x57b8
  4541.         free(file_path);
  4542.         // branch -> 0x5870
  4543.         // 0x5870
  4544.         g135 = v4;
  4545.         g138 = v5;
  4546.         return 0;
  4547.     }
  4548.     // 0x5734
  4549.     g136 = (int32_t)fopen(file_path, "r");
  4550.     free((char *)g137);
  4551.     int32_t v8 = g136; // 0x5750
  4552.     if (v8 == 0) {
  4553.         // 0x57c8
  4554.         puts("err: could not open script file");
  4555.         // branch -> 0x5870
  4556.         // 0x5870
  4557.         g135 = v4;
  4558.         g138 = v5;
  4559.         return 0;
  4560.     }
  4561.     // 0x5758
  4562.     g135 = read_file_by_lines((struct _IO_FILE *)v8);
  4563.     fclose((struct _IO_FILE *)g136);
  4564.     int32_t v9;
  4565.     g133 = &v9;
  4566.     g137 = 0;
  4567.     int32_t v10 = g139; // 0x5778
  4568.     int32_t v11 = g135; // 0x577c
  4569.     v9 = 0;
  4570.     g139 = execute_script(g138, v10, v11);
  4571.     destroy_string_array((char *)g135, v10, v11, g133);
  4572.     int32_t v12 = v9; // 0x5794
  4573.     int32_t result; // 0x5870
  4574.     if (v12 == 0) {
  4575.         int32_t v13 = 0; // 0x5804
  4576.         if (0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2 != 0) {
  4577.             // 0x57f0
  4578.             write_header_comment((int32_t *)g138, (struct _IO_FILE *)g134);
  4579.             v13 = v9;
  4580.             // branch -> 0x57fc
  4581.         }
  4582.         // 0x57fc
  4583.         generate_initial_indented_line((int32_t *)&v2, NULL, v11, g133, (int32_t)v2, v13, v3);
  4584.         int32_t v14 = *(int32_t *)g139; // 0x5808
  4585.         int32_t v15 = v14; // R2
  4586.         int32_t v16 = (int32_t)v2;
  4587.         if (v14 != 0) {
  4588.             // 0x5818
  4589.             g135 = g139 + 4;
  4590.             // branch -> 0x582c
  4591.             while (true) {
  4592.                 // 0x582c
  4593.                 printf((char *)(int32_t)">>>> %s%s\n", (char *)v16, (char *)v14);
  4594.                 int32_t v17 = *(int32_t *)(g135 - 4); // 0x5834
  4595.                 g133 = v17;
  4596.                 fprintf((struct _IO_FILE *)g134, (char *)(int32_t)"%s%s\n", v2, (char *)v17);
  4597.                 int32_t v18 = g135; // 0x5848
  4598.                 int32_t v19 = *(int32_t *)v18; // 0x5848
  4599.                 v15 = v19;
  4600.                 g135 = v18 + 4;
  4601.                 int32_t v20 = (int32_t)v2;
  4602.                 if (v19 != 0) {
  4603.                     // 0x582c
  4604.                     v14 = v19;
  4605.                     v16 = v20;
  4606.                     // branch -> 0x582c
  4607.                     continue;
  4608.                 } else {
  4609.                     v16 = v20;
  4610.                 }
  4611.             }
  4612.         }
  4613.         // 0x585c
  4614.         free((char *)v16);
  4615.         destroy_string_array((char *)g139, v16, v15, g133);
  4616.         result = 1;
  4617.         // branch -> 0x5870
  4618.     } else {
  4619.         // 0x57a0
  4620.         printf("err: %s\n", (char *)v12);
  4621.         free((char *)v9);
  4622.         result = g137;
  4623.         // branch -> 0x5870
  4624.     }
  4625.     // 0x5870
  4626.     g135 = v4;
  4627.     g138 = v5;
  4628.     return result;
  4629. }
  4630.  
  4631. // Address range: 0x589c - 0x5997
  4632. int32_t execute_script(int32_t a1, int32_t a2, int32_t a3) {
  4633.     // 0x589c
  4634.     g132 = a3;
  4635.     int32_t v1 = g134; // 0x589c
  4636.     int32_t v2 = g135; // 0x589c
  4637.     int32_t v3 = g136; // 0x589c
  4638.     int32_t v4 = g137; // 0x589c
  4639.     int32_t v5 = g138; // 0x589c
  4640.     int32_t v6 = g139; // 0x589c
  4641.     int32_t v7 = g129; // 0x589c
  4642.     int32_t v8 = g130; // bp-8
  4643.     g130 = &v8;
  4644.     g137 = a1;
  4645.     g136 = a2;
  4646.     int32_t v9 = 0; // bp-40
  4647.     g128 = 1;
  4648.     g134 = g133;
  4649.     g139 = a3;
  4650.     char * mem = calloc(4, 1); // 0x58c8
  4651.     g129 = &v9;
  4652.     g138 = (int32_t)mem;
  4653.     int32_t v10 = 0;
  4654.     // branch -> 0x593c
  4655.     while (true) {
  4656.         // branch -> 0x593c
  4657.         int32_t v11;
  4658.         int32_t v12; // 0x596c
  4659.         int32_t v13;
  4660.         int32_t v14;
  4661.         int32_t v15; // 0x593c
  4662.         while (true) {
  4663.             // 0x593c
  4664.             v15 = g134;
  4665.             int32_t * v16 = (int32_t *)v15; // 0x593c_0
  4666.             int32_t result; // 0x598c
  4667.             if (*v16 != 0) {
  4668.                 // 0x5980
  4669.                 destroy_string_array((char *)g138, g128, g132, v11);
  4670.                 g138 = 0;
  4671.                 result = 0;
  4672.                 // branch -> 0x598c
  4673.                 // 0x598c
  4674.                 g127 = result;
  4675.                 g134 = v1;
  4676.                 g135 = v2;
  4677.                 g136 = v3;
  4678.                 g137 = v4;
  4679.                 g138 = v5;
  4680.                 g139 = v6;
  4681.                 g129 = v7;
  4682.                 g130 = v8;
  4683.                 return result;
  4684.             }
  4685.             int32_t v17 = g137; // 0x594c
  4686.             uint32_t v18 = *(int32_t *)(v17 + 4); // 0x594c
  4687.             g128 = v18;
  4688.             g1 = v9 >= v18;
  4689.             g3 = v9 == v18;
  4690.             if (v9 < v18) {
  4691.                 // 0x598c
  4692.                 result = g138;
  4693.                 // branch -> 0x598c
  4694.                 // 0x598c
  4695.                 g127 = result;
  4696.                 g134 = v1;
  4697.                 g135 = v2;
  4698.                 g136 = v3;
  4699.                 g137 = v4;
  4700.                 g138 = v5;
  4701.                 g139 = v6;
  4702.                 g129 = v7;
  4703.                 g130 = v8;
  4704.                 return result;
  4705.             }
  4706.             // 0x5958
  4707.             v12 = execute_script_once(v17, g136, g139, v16, (char *)g129, (char *)v14, v13, v10, (char *)v9, (char *)v1, v2, v3, v4, (int32_t *)v5, v6);
  4708.             g135 = v12;
  4709.             if (v12 != 0) {
  4710.                 // break -> 0x597c
  4711.                 break;
  4712.             }
  4713.             v11 = v15;
  4714.             // continue -> 0x593c
  4715.         }
  4716.         int32_t v19 = string_array_size((int32_t *)v12); // 0x58e4
  4717.         int32_t v20 = v19 + v10; // 0x58f0
  4718.         int32_t v21 = 4 * v20; // 0x58fc
  4719.         int32_t mem2 = (int32_t)realloc((char *)g138, v21 + 4); // 0x5904_5
  4720.         g138 = mem2;
  4721.         int32_t v22 = 4 * v19; // 0x5918
  4722.         g132 = v22;
  4723.         __aeabi_memcpy4(mem2 + 4 * v10, g135, v22);
  4724.         free((char *)g135);
  4725.         g128 = v20;
  4726.         *(int32_t *)(g138 + v21) = 0;
  4727.         v13 = v20;
  4728.         v10 = v20;
  4729.         v14 = v19;
  4730.         v11 = v15;
  4731.         // branch -> 0x593c
  4732.     }
  4733. }
  4734.  
  4735. // Address range: 0x5998 - 0x5aef
  4736. int32_t run_script_auto(int32_t a1, int32_t a2, char * file_path, struct _IO_FILE * a4) {
  4737.     // 0x5998
  4738.     int32_t v1;
  4739.     char * v2 = (char *)v1;
  4740.     g132 = (int32_t)file_path;
  4741.     int32_t v3 = (int32_t)a4;
  4742.     g133 = v3;
  4743.     int32_t v4 = g135; // 0x5998
  4744.     int32_t v5 = g138; // 0x5998
  4745.     int32_t v6 = g129; // 0x5998
  4746.     int32_t v7 = g130; // bp-8
  4747.     g130 = &v7;
  4748.     g139 = a1;
  4749.     g136 = a2;
  4750.     g129 = 0;
  4751.     g128 = (int32_t)"r";
  4752.     g135 = v3;
  4753.     int32_t v8 = 0; // bp-40
  4754.     struct _IO_FILE * file = fopen(file_path, "r"); // 0x59c4
  4755.     g137 = (int32_t)file;
  4756.     if (file != NULL) {
  4757.         // 0x59d4
  4758.         g129 = read_file_by_lines(file);
  4759.         fclose((struct _IO_FILE *)g137);
  4760.         g133 = &v8;
  4761.         g138 = execute_script(g139, g136, g129);
  4762.         if (v8 == 0) {
  4763.             int32_t v9 = 0; // 0x5a60
  4764.             if (0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2 != 0) {
  4765.                 // 0x5a48
  4766.                 write_header_comment((int32_t *)g139, (struct _IO_FILE *)g135);
  4767.                 v9 = v8;
  4768.                 // branch -> 0x5a54
  4769.             }
  4770.             // 0x5a54
  4771.             g139 = 0;
  4772.             int32_t v10;
  4773.             generate_initial_indented_line((int32_t *)&v2, NULL, g132, g133, v10, (int32_t)v2, v9);
  4774.             int32_t v11 = *(int32_t *)g138; // 0x5a64
  4775.             int32_t v12 = v11; // R2
  4776.             int32_t v13 = (int32_t)v2;
  4777.             if (v11 != 0) {
  4778.                 // 0x5a74
  4779.                 g134 = g138 + 4;
  4780.                 // branch -> 0x5a88
  4781.                 while (true) {
  4782.                     // 0x5a88
  4783.                     printf((char *)(int32_t)">>>> %s%s\n", (char *)v13, (char *)v11);
  4784.                     int32_t v14 = *(int32_t *)(g134 - 4); // 0x5a90
  4785.                     g133 = v14;
  4786.                     fprintf((struct _IO_FILE *)g135, (char *)(int32_t)"%s%s\n", v2, (char *)v14);
  4787.                     int32_t v15 = g134; // 0x5aa4
  4788.                     int32_t v16 = *(int32_t *)v15; // 0x5aa4
  4789.                     v12 = v16;
  4790.                     g134 = v15 + 4;
  4791.                     int32_t v17 = (int32_t)v2;
  4792.                     if (v16 != 0) {
  4793.                         // 0x5a88
  4794.                         v11 = v16;
  4795.                         v13 = v17;
  4796.                         // branch -> 0x5a88
  4797.                         continue;
  4798.                     } else {
  4799.                         v13 = v17;
  4800.                     }
  4801.                 }
  4802.             }
  4803.             // 0x5ab8
  4804.             free((char *)v13);
  4805.             destroy_string_array((char *)g138, v13, v12, g133);
  4806.             destroy_string_array((char *)g129, g128, g132, g133);
  4807.             // branch -> 0x5ad0
  4808.             // 0x5ad0
  4809.             g135 = v4;
  4810.             g138 = v5;
  4811.             g129 = v6;
  4812.             return g139;
  4813.         }
  4814.     }
  4815.     // 0x5a0c
  4816.     destroy_string_array((char *)g129, g128, g132, g133);
  4817.     printf("err: %s\n", (char *)v8);
  4818.     free((char *)v8);
  4819.     // branch -> 0x5ad0
  4820.     // 0x5ad0
  4821.     g135 = v4;
  4822.     g138 = v5;
  4823.     g129 = v6;
  4824.     return 1;
  4825. }
  4826.  
  4827. // Address range: 0x5af0 - 0x5fb3
  4828. int32_t execute_script_once(int32_t a1, int32_t a2, int32_t a3, int32_t * a4, char * a5, char * format, int32_t a7, int32_t a8, char * a9, char * format2, int32_t a11, int32_t a12, int32_t a13, int32_t * a14, int32_t a15) {
  4829.     int32_t v1 = (int32_t)a4;
  4830.     g133 = v1;
  4831.     int32_t v2 = (int32_t)a14;
  4832.     int32_t v3 = g134; // 0x5af0
  4833.     int32_t v4 = g135; // 0x5af0
  4834.     int32_t v5 = g136; // 0x5af0
  4835.     int32_t v6 = g137; // 0x5af0
  4836.     int32_t v7 = g138; // 0x5af0
  4837.     int32_t v8 = g139; // 0x5af0
  4838.     int32_t v9 = g129; // 0x5af0
  4839.     int32_t v10 = g130; // bp-8
  4840.     g130 = &v10;
  4841.     g129 = a3;
  4842.     g135 = a1;
  4843.     g138 = v1;
  4844.     g134 = a2;
  4845.     g136 = string_array_size((int32_t *)a3);
  4846.     init_script_variables(a1, a2, *(int32_t *)a5);
  4847.     int32_t v11 = *(int32_t *)g138; // 0x5b34
  4848.     g128 = v11;
  4849.     g134 = 0;
  4850.     int32_t v12 = g136; // 0x5b3c
  4851.     int32_t v13 = 0; // 0x5f34
  4852.     if (v11 == 0) {
  4853.         // if_5b44_0_true
  4854.         v13 = 1;
  4855.         // branch -> after_if_5b44_0
  4856.     }
  4857.     // after_if_5b44_0
  4858.     int32_t mem2; // 0x5f48_5
  4859.     int32_t v14; // 0x5f64
  4860.     int32_t v15; // 0x5f78
  4861.     int32_t v16; // 0x5f78
  4862.     int32_t v17; // 0x5f5c
  4863.     if (v12 == 0) {
  4864.         // 0x5f2c
  4865.         g128 = 0;
  4866.         // branch -> 0x5f34
  4867.     } else {
  4868.         // 0x5b50
  4869.         g132 = 0;
  4870.         if (v11 == 0) {
  4871.             // 0x5b60
  4872.             g137 = g129 - 4;
  4873.             g139 = 0;
  4874.             g136 = 0;
  4875.             int32_t v18 = (int32_t)format;
  4876.             int32_t v19 = (int32_t)format2;
  4877.             int32_t v20 = 0; // 0x5c50
  4878.             // branch -> 0x5c50
  4879.             while (true) {
  4880.               lab_0x5c50:
  4881.                 // 0x5c50
  4882.                 g135 = v20 + 1;
  4883.                 g127 = *(int32_t *)(4 * v20 + g129);
  4884.                 uint32_t v21 = get_line_type(); // 0x5c5c67
  4885.                 g1 = v21 > 3;
  4886.                 g2 = v21 < 4;
  4887.                 g3 = v21 == 4;
  4888.                 int32_t v22; // 0x5f20
  4889.                 int32_t v23; // 0x5e74
  4890.                 int32_t v24; // 0x5f00
  4891.                 if (v21 > 4) {
  4892.                     // 0x5e74
  4893.                     v23 = g136;
  4894.                     g134 = v23;
  4895.                     // branch -> 0x5f00
  4896.                 } else {
  4897.                     while (true) {
  4898.                         // 0x5c68
  4899.                         g128 = &g58;
  4900.                         int32_t v25 = *(int32_t *)(4 * v21 + (int32_t)&g58); // 0x5c70
  4901.                         g127 = v25;
  4902.                         ((int32_t (*)(int32_t, int32_t))(v25 + (int32_t)&g58))(v25, (int32_t)&g58);
  4903.                         if (g3) {
  4904.                             // after_if_5c84_0
  4905.                             // branch -> after_if_5c88_0
  4906.                         }
  4907.                         // after_if_5c88_0
  4908.                         *(int32_t *)(g130 - 32) = 0;
  4909.                         int32_t v26 = *(int32_t *)(4 * g136 + g129); // 0x5c94
  4910.                         int32_t v27 = find_script_variable((int32_t *)a15, (char *)(find_first_non_space((char *)v26) + 2)); // 0x5ca4
  4911.                         int32_t len2; // 0x5d9c
  4912.                         char * mem3; // 0x5da4
  4913.                         int32_t v28; // R10
  4914.                         int32_t str3; // 0x5d90
  4915.                         int32_t v29; // 0x5dcc
  4916.                         int32_t v30; // 0x5e58
  4917.                         if (v27 == 0) {
  4918.                             // 0x5d7c
  4919.                             g127 = a8;
  4920.                             g126 = 0x5d84;
  4921.                             int32_t v31 = duplicate_string(); // 0x5d80
  4922.                             g138 = v31;
  4923.                             *(int32_t *)(g130 - 32) = v31;
  4924.                             str3 = g138;
  4925.                             if (str3 == 0) {
  4926.                                 // 0x5d7c
  4927.                                 v29 = 0;
  4928.                                 // branch -> 0x5dcc
  4929.                               lab_0x5dcc:;
  4930.                                 // 0x5dcc
  4931.                                 int32_t v32; // 0x5f70
  4932.                                 if (v29 == 0) {
  4933.                                     // 0x5dd4
  4934.                                     g138 = v2;
  4935.                                     int32_t str; // 0x5e24
  4936.                                     int32_t len; // 0x5e2c
  4937.                                     char * mem; // 0x5e34
  4938.                                     int32_t v33;
  4939.                                     if (g135 < *(int32_t *)(g130 - 36)) {
  4940.                                         // 0x5e20
  4941.                                         g127 = a7;
  4942.                                         g126 = 0x5e28;
  4943.                                         str = duplicate_string();
  4944.                                         g134 = str;
  4945.                                         len = strlen((char *)str);
  4946.                                         mem = malloc(len + 20);
  4947.                                         v28 = (int32_t)mem;
  4948.                                         g128 = v18;
  4949.                                         g135 = v33;
  4950.                                         g133 = g134;
  4951.                                         g132 = v33;
  4952.                                         sprintf(mem, format);
  4953.                                         free((char *)g134);
  4954.                                         v30 = g138;
  4955.                                         // branch -> 0x5e58
  4956.                                       lab_0x5e58_3:
  4957.                                         // 0x5e58
  4958.                                         *(int32_t *)v30 = v28;
  4959.                                         int32_t v34 = *(int32_t *)(g130 - 40); // 0x5e60
  4960.                                         g129 = v34;
  4961.                                         if (v28 == 0) {
  4962.                                             // 0x5e58
  4963.                                             g127 = *(int32_t *)(4 * g136 + v34);
  4964.                                             uint32_t v35 = get_line_type(); // 0x5c5c
  4965.                                             g1 = v35 > 3;
  4966.                                             g2 = v35 < 4;
  4967.                                             g3 = v35 == 4;
  4968.                                             if (v35 > 4) {
  4969.                                                 // break -> 0x5e74
  4970.                                                 break;
  4971.                                             }
  4972.                                             v21 = v35;
  4973.                                             // continue -> 0x5c68
  4974.                                             continue;
  4975.                                         } else {
  4976.                                             // 0x5f60
  4977.                                             v14 = g139;
  4978.                                             // branch -> 0x5f60
  4979.                                         }
  4980.                                         // 0x5f60
  4981.                                         g135 = 0;
  4982.                                         if (v14 == 0) {
  4983.                                             // 0x5f80
  4984.                                             free((char *)0);
  4985.                                             g134 = v3;
  4986.                                             g135 = v4;
  4987.                                             g136 = v5;
  4988.                                             g137 = v6;
  4989.                                             g138 = v7;
  4990.                                             g139 = v8;
  4991.                                             g129 = v9;
  4992.                                             g130 = v10;
  4993.                                             return 0;
  4994.                                         }
  4995.                                         // 0x5f6c
  4996.                                         v32 = v14;
  4997.                                         // branch -> 0x5f70
  4998.                                         while (true) {
  4999.                                             // 0x5f70
  5000.                                             free((char *)*(int32_t *)(4 * v32 - 4));
  5001.                                             v15 = g139;
  5002.                                             v16 = v15 - 1;
  5003.                                             g139 = v16;
  5004.                                             if (v15 == 1) {
  5005.                                                 // 0x5f80
  5006.                                                 // branch -> 0x5f80
  5007.                                                 // 0x5f80
  5008.                                                 free((char *)g135);
  5009.                                                 g134 = v3;
  5010.                                                 g135 = v4;
  5011.                                                 g136 = v5;
  5012.                                                 g137 = v6;
  5013.                                                 g138 = v7;
  5014.                                                 g139 = v8;
  5015.                                                 g129 = v9;
  5016.                                                 g130 = v10;
  5017.                                                 return 0;
  5018.                                             }
  5019.                                           lab_0x5f70_3:
  5020.                                             // 0x5f70
  5021.                                             v32 = v16;
  5022.                                             // branch -> 0x5f70
  5023.                                         }
  5024.                                         // 0x5e74
  5025.                                         v23 = g136;
  5026.                                         g134 = v23;
  5027.                                         // branch -> 0x5f00
  5028.                                     } else {
  5029.                                         // 0x5de4
  5030.                                         g135 = v33;
  5031.                                         g134 = 1;
  5032.                                         int32_t v36 = v33; // 0x5dec
  5033.                                         // branch -> 0x5dec
  5034.                                         while (true) {
  5035.                                             // 0x5dec
  5036.                                             g127 = *(int32_t *)(4 * v36 + g129);
  5037.                                             int32_t v37 = get_line_type(); // 0x5df0
  5038.                                             if (v37 == 3) {
  5039.                                                 int32_t v38 = g134; // 0x5e08
  5040.                                                 g134 = v38 - 1;
  5041.                                                 if (v38 == 1) {
  5042.                                                     int32_t v39 = g135 + 1; // 0x5e6c
  5043.                                                     g134 = v39;
  5044.                                                     v23 = v39;
  5045.                                                     // branch -> 0x5f00
  5046.                                                     // 0x5f00
  5047.                                                     v24 = *(int32_t *)g138;
  5048.                                                     g128 = v24;
  5049.                                                     g132 = v12;
  5050.                                                     v22 = 0;
  5051.                                                     if (v24 == 0) {
  5052.                                                       lab_if_5f10_0_true_2:
  5053.                                                         // if_5f10_0_true
  5054.                                                         v22 = 1;
  5055.                                                         // branch -> after_if_5f10_0
  5056.                                                     }
  5057.                                                   lab_after_if_5f10_0_2:
  5058.                                                     // after_if_5f10_0
  5059.                                                     if (v23 < v12) {
  5060.                                                         // 0x5be0
  5061.                                                         g136 = v23;
  5062.                                                         if (v24 == 0) {
  5063.                                                             // 0x5be0
  5064.                                                             v20 = v23;
  5065.                                                             // branch -> 0x5c50
  5066.                                                             goto lab_0x5c50;
  5067.                                                         }
  5068.                                                     }
  5069.                                                     int32_t v40 = g139; // 0x5f1c
  5070.                                                     g134 = v40;
  5071.                                                     if (v22 != 0) {
  5072.                                                         // 0x5f3c
  5073.                                                         mem2 = (int32_t)realloc(NULL, 4 * v40 + 4);
  5074.                                                         g128 = 0;
  5075.                                                         *(int32_t *)(4 * g134 + mem2) = 0;
  5076.                                                         g134 = v3;
  5077.                                                         g135 = v4;
  5078.                                                         g136 = v5;
  5079.                                                         g137 = v6;
  5080.                                                         g138 = v7;
  5081.                                                         g139 = v8;
  5082.                                                         g129 = v9;
  5083.                                                         g130 = v10;
  5084.                                                         return mem2;
  5085.                                                     }
  5086.                                                     v17 = v40;
  5087.                                                     // 0x5f5c
  5088.                                                     g139 = v17;
  5089.                                                     v14 = v17;
  5090.                                                     // branch -> 0x5f60
  5091.                                                     // 0x5f60
  5092.                                                     g135 = 0;
  5093.                                                     if (v14 == 0) {
  5094.                                                         // 0x5f80
  5095.                                                         free((char *)0);
  5096.                                                         g134 = v3;
  5097.                                                         g135 = v4;
  5098.                                                         g136 = v5;
  5099.                                                         g137 = v6;
  5100.                                                         g138 = v7;
  5101.                                                         g139 = v8;
  5102.                                                         g129 = v9;
  5103.                                                         g130 = v10;
  5104.                                                         return 0;
  5105.                                                     }
  5106.                                                     // 0x5f6c
  5107.                                                     // branch -> 0x5f70
  5108.                                                     while (true) {
  5109.                                                         // 0x5f70
  5110.                                                         free((char *)*(int32_t *)(4 * v14 - 4));
  5111.                                                         v15 = g139;
  5112.                                                         v16 = v15 - 1;
  5113.                                                         g139 = v16;
  5114.                                                         if (v15 != 1) {
  5115.                                                             goto lab_0x5f70_3;
  5116.                                                         }
  5117.                                                         // 0x5f80
  5118.                                                         // branch -> 0x5f80
  5119.                                                         // 0x5f80
  5120.                                                         free((char *)g135);
  5121.                                                         g134 = v3;
  5122.                                                         g135 = v4;
  5123.                                                         g136 = v5;
  5124.                                                         g137 = v6;
  5125.                                                         g138 = v7;
  5126.                                                         g139 = v8;
  5127.                                                         g129 = v9;
  5128.                                                         g130 = v10;
  5129.                                                         return 0;
  5130.                                                     }
  5131.                                                 }
  5132.                                             } else {
  5133.                                                 // 0x5dfc
  5134.                                                 if (v37 == 2) {
  5135.                                                     // if_5e00_0_true
  5136.                                                     g134++;
  5137.                                                     // branch -> 0x5e10
  5138.                                                 }
  5139.                                             }
  5140.                                             int32_t v41 = g135 + 1; // 0x5e14
  5141.                                             g135 = v41;
  5142.                                             if (v41 >= *(int32_t *)(g130 - 36)) {
  5143.                                                 // break -> 0x5e20
  5144.                                                 break;
  5145.                                             }
  5146.                                             v36 = v41;
  5147.                                             // continue -> 0x5dec
  5148.                                         }
  5149.                                         // 0x5e20
  5150.                                         g127 = a7;
  5151.                                         g126 = 0x5e28;
  5152.                                         str = duplicate_string();
  5153.                                         g134 = str;
  5154.                                         len = strlen((char *)str);
  5155.                                         mem = malloc(len + 20);
  5156.                                         v28 = (int32_t)mem;
  5157.                                         g128 = v18;
  5158.                                         g135 = v33;
  5159.                                         g133 = g134;
  5160.                                         g132 = v33;
  5161.                                         sprintf(mem, format);
  5162.                                         free((char *)g134);
  5163.                                         v30 = g138;
  5164.                                         // branch -> 0x5e58
  5165.                                         goto lab_0x5e58_3;
  5166.                                     }
  5167.                                   lab_0x5f00:
  5168.                                     // 0x5f00
  5169.                                     v24 = *(int32_t *)g138;
  5170.                                     g128 = v24;
  5171.                                     g132 = v12;
  5172.                                     if (v24 == 0) {
  5173.                                         goto lab_if_5f10_0_true_2;
  5174.                                     }
  5175.                                     v22 = 0;
  5176.                                     goto lab_after_if_5f10_0_2;
  5177.                                 } else {
  5178.                                     int32_t v42 = g135; // 0x5c44
  5179.                                     g134 = v42;
  5180.                                     g138 = v2;
  5181.                                     v23 = v42;
  5182.                                     // branch -> 0x5f00
  5183.                                     goto lab_0x5f00;
  5184.                                 }
  5185.                                 // 0x5f60
  5186.                                 g135 = 0;
  5187.                                 int32_t v43; // 0x5f80
  5188.                                 int32_t v44; // 0x5f90
  5189.                                 if (v14 == 0) {
  5190.                                     v43 = 0;
  5191.                                     // 0x5f80
  5192.                                     free((char *)v43);
  5193.                                     g134 = v3;
  5194.                                     g135 = v4;
  5195.                                     g136 = v5;
  5196.                                     g137 = v6;
  5197.                                     g138 = v7;
  5198.                                     g139 = v8;
  5199.                                     g129 = v9;
  5200.                                     v44 = v10;
  5201.                                     g130 = v44;
  5202.                                     return 0;
  5203.                                 }
  5204.                                 // 0x5f6c
  5205.                                 v32 = v14;
  5206.                                 int32_t v45 = -4; // 0x5f70
  5207.                                 // branch -> 0x5f70
  5208.                                 while (true) {
  5209.                                     int32_t v46 = *(int32_t *)(4 * v32 + v45); // 0x5f70
  5210.                                     free((char *)v46);
  5211.                                     v15 = g139;
  5212.                                     v16 = v15 - 1;
  5213.                                     g139 = v16;
  5214.                                     if (v15 != 1) {
  5215.                                         goto lab_0x5f70_3;
  5216.                                     }
  5217.                                     int32_t v47 = g135;
  5218.                                     v43 = v47;
  5219.                                     // branch -> 0x5f80
  5220.                                     // 0x5f80
  5221.                                     free((char *)v43);
  5222.                                     g134 = v3;
  5223.                                     g135 = v4;
  5224.                                     g136 = v5;
  5225.                                     g137 = v6;
  5226.                                     g138 = v7;
  5227.                                     g139 = v8;
  5228.                                     g129 = v9;
  5229.                                     v44 = v10;
  5230.                                     g130 = v44;
  5231.                                     return 0;
  5232.                                 }
  5233.                             }
  5234.                         } else {
  5235.                             int32_t str2 = *(int32_t *)(g130 - 32); // 0x5cb0
  5236.                             g138 = str2;
  5237.                             int32_t v48 = *(int32_t *)(v27 + 4); // 0x5cb4
  5238.                             if (str2 == 0) {
  5239.                                 v29 = v48;
  5240.                                 goto lab_0x5dcc;
  5241.                             }
  5242.                             // 0x5d98
  5243.                             len2 = strlen((char *)str2);
  5244.                             mem3 = malloc(len2 + 20);
  5245.                             g128 = v19;
  5246.                             g132 = g135;
  5247.                             g133 = g138;
  5248.                             v28 = (int32_t)mem3;
  5249.                             sprintf(mem3, format2);
  5250.                             free((char *)g138);
  5251.                             g138 = v2;
  5252.                             v30 = v2;
  5253.                             // branch -> 0x5e58
  5254.                             goto lab_0x5e58_3;
  5255.                         }
  5256.                         // 0x5d98
  5257.                         len2 = strlen((char *)str3);
  5258.                         mem3 = malloc(len2 + 20);
  5259.                         g128 = v19;
  5260.                         g132 = g135;
  5261.                         g133 = g138;
  5262.                         v28 = (int32_t)mem3;
  5263.                         sprintf(mem3, format2);
  5264.                         free((char *)g138);
  5265.                         g138 = v2;
  5266.                         v30 = v2;
  5267.                         // branch -> 0x5e58
  5268.                         goto lab_0x5e58_3;
  5269.                     }
  5270.                 }
  5271.                 // 0x5f00
  5272.                 v24 = *(int32_t *)g138;
  5273.                 g128 = v24;
  5274.                 g132 = v12;
  5275.                 if (v24 == 0) {
  5276.                     goto lab_if_5f10_0_true_2;
  5277.                 }
  5278.                 v22 = 0;
  5279.                 goto lab_after_if_5f10_0_2;
  5280.             }
  5281.         }
  5282.     }
  5283.     // 0x5f34
  5284.     if (v13 != 0) {
  5285.         // 0x5f3c
  5286.         mem2 = (int32_t)realloc(NULL, 4);
  5287.         g128 = 0;
  5288.         *(int32_t *)(4 * g134 + mem2) = 0;
  5289.         g134 = v3;
  5290.         g135 = v4;
  5291.         g136 = v5;
  5292.         g137 = v6;
  5293.         g138 = v7;
  5294.         g139 = v8;
  5295.         g129 = v9;
  5296.         g130 = v10;
  5297.         return mem2;
  5298.     }
  5299.     v17 = 0;
  5300.     // 0x5f5c
  5301.     g139 = v17;
  5302.     v14 = v17;
  5303.     // branch -> 0x5f60
  5304.     // 0x5f60
  5305.     g135 = 0;
  5306.     if (v14 == 0) {
  5307.         // 0x5f80
  5308.         free((char *)0);
  5309.         g134 = v3;
  5310.         g135 = v4;
  5311.         g136 = v5;
  5312.         g137 = v6;
  5313.         g138 = v7;
  5314.         g139 = v8;
  5315.         g129 = v9;
  5316.         g130 = v10;
  5317.         return 0;
  5318.     }
  5319.     // 0x5f6c
  5320.     // branch -> 0x5f70
  5321.     while (true) {
  5322.         // 0x5f70
  5323.         free((char *)*(int32_t *)(4 * v14 - 4));
  5324.         v15 = g139;
  5325.         v16 = v15 - 1;
  5326.         g139 = v16;
  5327.         if (v15 != 1) {
  5328.             goto lab_0x5f70_3;
  5329.         }
  5330.         // 0x5f80
  5331.         // branch -> 0x5f80
  5332.         // 0x5f80
  5333.         free((char *)g135);
  5334.         g134 = v3;
  5335.         g135 = v4;
  5336.         g136 = v5;
  5337.         g137 = v6;
  5338.         g138 = v7;
  5339.         g139 = v8;
  5340.         g129 = v9;
  5341.         g130 = v10;
  5342.         return 0;
  5343.     }
  5344. }
  5345.  
  5346. // Address range: 0x5fb4 - 0x5fff
  5347. int32_t generate_script_error(char * str, int32_t a2) {
  5348.     int32_t v1 = g135; // 0x5fb4
  5349.     g135 = (int32_t)str;
  5350.     char * mem = malloc(strlen(str) + 20); // 0x5fcc
  5351.     sprintf(mem, "line %u: %s", a2, (char *)g135);
  5352.     free((char *)g135);
  5353.     g135 = v1;
  5354.     return (int32_t)mem;
  5355. }
  5356.  
  5357. // Address range: 0x6000 - 0x6047
  5358. int32_t script_loop_test(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5) {
  5359.     int32_t v1 = (int32_t)a3;
  5360.     g132 = v1;
  5361.     g133 = a4;
  5362.     int32_t v2 = g135; // 0x6000
  5363.     int32_t v3 = g130; // bp-8
  5364.     g130 = &v3;
  5365.     g134 = v1;
  5366.     g135 = a2;
  5367.     int32_t v4 = find_script_variable((int32_t *)a2, (char *)(find_first_non_space((char *)a1) + 2)); // 0x601c
  5368.     g1 = true;
  5369.     g2 = v4 < 0;
  5370.     g3 = v4 == 0;
  5371.     if (v4 != 0) {
  5372.         // if_6028_0_true
  5373.         g135 = v2;
  5374.         return *(int32_t *)(v4 + 4);
  5375.     }
  5376.     // after_if_6028_0
  5377.     g127 = (int32_t)"unknown variable";
  5378.     g126 = 0x6038;
  5379.     int32_t v5 = duplicate_string(); // 0x6034
  5380.     *(int32_t *)g134 = v5;
  5381.     g127 = 0;
  5382.     g134 = a5;
  5383.     int32_t v6;
  5384.     g135 = v6;
  5385.     int32_t v7;
  5386.     g130 = v7;
  5387.     int32_t v8;
  5388.     ((int32_t (*)(int32_t))v8)(0);
  5389.     return 0;
  5390. }
  5391.  
  5392. // Address range: 0x6048 - 0x61fb
  5393. // Used cryptographic patterns:
  5394. //  - rfc3548_Base_64_Encoding_with_URL_and_Filename_Safe_Alphabet (8-bit, little endian)
  5395. int32_t generate_script_output_line(char * a1, int32_t a2, int32_t * a3) {
  5396.     int32_t v1 = g134; // 0x6048
  5397.     int32_t v2 = g135; // 0x6048
  5398.     int32_t v3 = g138; // 0x6048
  5399.     int32_t v4 = g130; // bp-8
  5400.     g130 = &v4;
  5401.     g136 = (int32_t)a1;
  5402.     int32_t v5 = (int32_t)a3; // bp-48
  5403.     g139 = a2;
  5404.     char * mem = malloc(1); // 0x6064
  5405.     char * v6 = mem; // bp-40
  5406.     *mem = 0;
  5407.     int32_t v7 = 0; // bp-44
  5408.     int32_t str = g136; // 0x6078
  5409.     if (*(char *)str == 0) {
  5410.         // 0x61c0
  5411.         g135 = v2;
  5412.         g138 = v3;
  5413.         return (int32_t)v6;
  5414.     }
  5415.     // 0x6084
  5416.     g129 = (int32_t)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  5417.     // branch -> 0x608c
  5418.     while (true) {
  5419.         char * found_char_pos = strchr((char *)str, 36); // 0x6094
  5420.         int32_t v8 = (int32_t)found_char_pos; // 0x6094_4
  5421.         g134 = v8;
  5422.         if (found_char_pos == NULL) {
  5423.             // 0x61ac
  5424.             concatenate((int32_t *)&v6, &v7, (char *)g136, 0);
  5425.             // branch -> 0x61c0
  5426.             // 0x61c0
  5427.             g135 = v2;
  5428.             g138 = v3;
  5429.             return (int32_t)v6;
  5430.         }
  5431.         int32_t v9 = g136; // 0x60a4
  5432.         int32_t v10 = v8 - v9; // 0x60a4
  5433.         if (v8 == v9) {
  5434.             // branch -> 0x60f8
  5435.         } else {
  5436.             // 0x60ac
  5437.             g135 = v10;
  5438.             char * mem2 = realloc(v6, v10 + 1 + v7); // 0x60c0
  5439.             int32_t v11 = (int32_t)mem2; // 0x60c0_5
  5440.             int32_t v12 = v7; // 0x60c4
  5441.             g138 = v12;
  5442.             v6 = mem2;
  5443.             __aeabi_memcpy((char *)(v11 + v12), (char *)g136, g135);
  5444.             int32_t v13 = g138 + g135; // 0x60e0
  5445.             v7 = v13;
  5446.             *(char *)(v13 + v11) = 0;
  5447.             v8 = g134;
  5448.             // branch -> 0x60f8
  5449.         }
  5450.         int32_t v14 = v8 + 1; // 0x60fc
  5451.         g136 = v14;
  5452.         char v15 = *(char *)v14; // 0x60fc
  5453.         int32_t str2; // 0x611838
  5454.         if (v15 == 45) {
  5455.             // if_611c_0_true
  5456.             str2 = v8 + 2;
  5457.             g136 = str2;
  5458.             g137 = 1;
  5459.             // branch -> 0x6120
  5460.         } else {
  5461.             // after_if_6108_0
  5462.             g137 = 2;
  5463.             if (v15 == 43) {
  5464.                 // 0x6110
  5465.                 g137 = 0;
  5466.                 int32_t v16 = v8 + 2; // 0x6118
  5467.                 g136 = v16;
  5468.                 str2 = v16;
  5469.                 // branch -> 0x6120
  5470.             } else {
  5471.                 str2 = v14;
  5472.             }
  5473.         }
  5474.         int32_t ini_seg_bytes = strspn((char *)str2, (char *)g129); // 0x6128
  5475.         g134 = ini_seg_bytes;
  5476.         char * mem3 = malloc(ini_seg_bytes + 1); // 0x6134
  5477.         g135 = (int32_t)mem3;
  5478.         __aeabi_memcpy(mem3, (char *)g136, g134);
  5479.         int32_t v17 = g135; // 0x614c
  5480.         *(char *)(g134 + v17) = 0;
  5481.         g138 = find_script_variable((int32_t *)g139, (char *)v17);
  5482.         free((char *)g135);
  5483.         int32_t v18 = g138; // 0x6168
  5484.         if (v18 == 0) {
  5485.             // 0x61cc
  5486.             free(v6);
  5487.             g127 = (int32_t)"unknown variable";
  5488.             *(int32_t *)v5 = duplicate_string();
  5489.             g135 = v2;
  5490.             g138 = v3;
  5491.             return 0;
  5492.         }
  5493.         int32_t v19 = *(int32_t *)v18; // 0x6170
  5494.         int32_t v20 = *(int32_t *)(v18 + 4); // 0x6170
  5495.         int32_t v21 = *(int32_t *)(v18 + 8); // 0x6170
  5496.         int32_t v22 = print_script_variable_contents(v19, v20, (char *)v21, g137 % 256, v5, v7, (int32_t)v6, v1); // 0x6178
  5497.         g135 = v22;
  5498.         concatenate((int32_t *)&v6, &v7, (char *)v22, 0);
  5499.         free((char *)g135);
  5500.         int32_t v23 = g134 + g136; // 0x619c
  5501.         g136 = v23;
  5502.         if (*(char *)v23 == 0) {
  5503.             // break -> 0x61c0
  5504.             break;
  5505.         }
  5506.         str = v23;
  5507.         // continue -> 0x608c
  5508.     }
  5509.     // 0x61c0
  5510.     g135 = v2;
  5511.     g138 = v3;
  5512.     return (int32_t)v6;
  5513. }
  5514.  
  5515. // Address range: 0x61fc - 0x6873
  5516. int32_t print_script_variable_contents(uint32_t a1, int32_t a2, char * a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8) {
  5517.     int32_t v1 = (int32_t)a3;
  5518.     g132 = v1;
  5519.     g133 = a4;
  5520.     int32_t v2 = g134; // 0x61fc
  5521.     int32_t v3 = g135; // 0x61fc
  5522.     int32_t v4 = g136; // 0x61fc
  5523.     int32_t result = g138; // 0x61fc
  5524.     int32_t v5 = g130; // bp-8
  5525.     g130 = &v5;
  5526.     uint32_t v6 = a1 % 256; // 0x6208
  5527.     g136 = a4;
  5528.     g135 = v1;
  5529.     g134 = a2;
  5530.     g1 = v6 > 6;
  5531.     g2 = v6 < 7;
  5532.     g3 = v6 == 7;
  5533.     if (v6 > 7) {
  5534.         // 0x67d8
  5535.         g134 = v2;
  5536.         g135 = v3;
  5537.         g136 = v4;
  5538.         g138 = result;
  5539.         g130 = v5;
  5540.         return result;
  5541.     }
  5542.     // 0x6220
  5543.     g128 = &g59;
  5544.     int32_t v7 = *(int32_t *)(4 * v6 + (int32_t)&g59); // 0x6228
  5545.     g127 = v7;
  5546.     ((int32_t (*)(int32_t, int32_t))(v7 + (int32_t)&g59))(v7, (int32_t)&g59);
  5547.     if (g3) {
  5548.         // if_624c_0_true
  5549.         // branch -> after_if_624c_0
  5550.     }
  5551.     int32_t mem = (int32_t)malloc(2 * g134 | 1); // 0x6258_3
  5552.     g138 = mem;
  5553.     if (g134 == 0) {
  5554.         // 0x67d8
  5555.         g134 = v2;
  5556.         g135 = v3;
  5557.         g136 = v4;
  5558.         g138 = result;
  5559.         g130 = v5;
  5560.         return mem;
  5561.     }
  5562.     // branch -> 0x6278
  5563.     while (true) {
  5564.         int32_t v8 = g135; // 0x6278
  5565.         g135 = v8 + 1;
  5566.         char v9 = *(char *)v8; // 0x6278
  5567.         sprintf((char *)mem, (char *)(int32_t)"%02hhx", v9);
  5568.         int32_t v10 = g134; // 0x6288
  5569.         g134 = v10 - 1;
  5570.         if (v10 == 1) {
  5571.             int32_t result2 = g138;
  5572.             // branch -> 0x67d8
  5573.             // 0x67d8
  5574.             g134 = v2;
  5575.             g135 = v3;
  5576.             g136 = v4;
  5577.             g138 = result;
  5578.             g130 = v5;
  5579.             return result2;
  5580.         }
  5581.         // 0x6278
  5582.         mem += 2;
  5583.         // branch -> 0x6278
  5584.     }
  5585. }
  5586.  
  5587. // Address range: 0x6874 - 0x69ef
  5588. int32_t script_parse_assignment_line(int32_t a1) {
  5589.     g127 = a1;
  5590.     int32_t v1 = g134; // 0x6874
  5591.     int32_t v2 = g135; // 0x6874
  5592.     int32_t v3 = g138; // 0x6874
  5593.     int32_t v4 = g130; // bp-8
  5594.     g130 = &v4;
  5595.     g135 = g128;
  5596.     int32_t v5 = split_by_spaces(); // 0x6884
  5597.     g134 = v5;
  5598.     g3 = v5 == 0;
  5599.     if (v5 == 0) {
  5600.         // 0x695c
  5601.         g127 = (int32_t)"syntax error in assignment statement";
  5602.         g134 = v1;
  5603.         g135 = v2;
  5604.         g138 = v3;
  5605.         g130 = v4;
  5606.         return duplicate_string();
  5607.     }
  5608.     int32_t v6 = g134; // 0x68b8
  5609.     int32_t v7;
  5610.     if (string_array_size((int32_t *)v5) > 1) {
  5611.         int32_t v8 = *(int32_t *)v6; // 0x68b8
  5612.         char v9 = *(char *)v8; // 0x68bc
  5613.         int32_t v10 = v6; // 0x694c
  5614.         if (v9 == 36) {
  5615.             int32_t v11 = validate_variable_name((char *)(v8 + 1)); // 0x68cc
  5616.             int32_t v12 = g134;
  5617.             if (v11 != 0) {
  5618.                 int32_t v13 = v12 + 8; // 0x68dc
  5619.                 g136 = v13;
  5620.                 g139 = *(int32_t *)v12;
  5621.                 int32_t nmemb = string_array_size((int32_t *)v13); // 0x68e4
  5622.                 g138 = nmemb;
  5623.                 char * mem = calloc(nmemb, 8); // 0x68f0
  5624.                 g137 = (int32_t)mem;
  5625.                 int32_t v14 = script_get_transforms_for_line((int32_t *)g136, g135, (int32_t *)mem); // 0x6904
  5626.                 g136 = v14;
  5627.                 if (v14 == 0) {
  5628.                     int32_t v15 = *(int32_t *)(g134 + 4); // 0x6914
  5629.                     int32_t v16;
  5630.                     int32_t v17 = script_get_initializer_value((char *)v15, &v16, (int32_t *)g135); // 0x6920
  5631.                     g136 = v17;
  5632.                     if (v17 == 0) {
  5633.                         // 0x6968
  5634.                         int32_t v18;
  5635.                         int32_t v19;
  5636.                         g136 = execute_transforms(v16, v19, v18, g137, g138);
  5637.                         free((char *)g137);
  5638.                         g132 = v18;
  5639.                         destroy_script_value(v16);
  5640.                         int32_t v20;
  5641.                         int32_t v21;
  5642.                         if (g136 == 0) {
  5643.                             char * v22 = (char *)(g139 + 1); // 0x69b8_0
  5644.                             if (*v22 != 0) {
  5645.                                 // 0x69c4
  5646.                                 assign_script_value((int32_t *)g135, v22, v21, v20);
  5647.                                 // branch -> 0x69dc
  5648.                                 // 0x69dc
  5649.                                 destroy_string_array((char *)g134, g128, g132, g133);
  5650.                                 // branch -> 0x6940
  5651.                                 // 0x6940
  5652.                                 g134 = v1;
  5653.                                 g135 = v2;
  5654.                                 g138 = v3;
  5655.                                 return g136;
  5656.                             }
  5657.                         }
  5658.                         // 0x69a4
  5659.                         g128 = v20;
  5660.                         int32_t v23;
  5661.                         g132 = v23;
  5662.                         destroy_script_value(v21);
  5663.                         // branch -> 0x69dc
  5664.                         // 0x69dc
  5665.                         destroy_string_array((char *)g134, g128, g132, g133);
  5666.                         // branch -> 0x6940
  5667.                         // 0x6940
  5668.                         g134 = v1;
  5669.                         g135 = v2;
  5670.                         g138 = v3;
  5671.                         return g136;
  5672.                     }
  5673.                 }
  5674.                 // 0x6930
  5675.                 destroy_string_array((char *)g134, g128, g132, g133);
  5676.                 free((char *)g137);
  5677.                 // branch -> 0x6940
  5678.                 // 0x6940
  5679.                 g134 = v1;
  5680.                 g135 = v2;
  5681.                 g138 = v3;
  5682.                 return g136;
  5683.             }
  5684.             v10 = v12;
  5685.         }
  5686.         // 0x694c
  5687.         destroy_string_array((char *)v10, (int32_t)v9, g132, g133);
  5688.         v7 = (int32_t)"invalid variable for assignment";
  5689.         // branch -> 0x695c
  5690.     } else {
  5691.         // 0x68a4
  5692.         destroy_string_array((char *)v6, g128, g132, g133);
  5693.         v7 = (int32_t)"syntax error in assignment statement";
  5694.         // branch -> 0x695c
  5695.     }
  5696.     // 0x695c
  5697.     g127 = v7;
  5698.     g134 = v1;
  5699.     g135 = v2;
  5700.     g138 = v3;
  5701.     g130 = v4;
  5702.     return duplicate_string();
  5703. }
  5704.  
  5705. // Address range: 0x69f0 - 0x6b93
  5706. int32_t script_get_transforms_for_line(int32_t * a1, int32_t str4, int32_t * a3) {
  5707.     g128 = str4;
  5708.     int32_t v1 = (int32_t)a3;
  5709.     g132 = v1;
  5710.     int32_t v2 = g134; // 0x69f0
  5711.     int32_t v3 = g135; // 0x69f0
  5712.     int32_t v4 = g137; // 0x69f0
  5713.     int32_t v5 = g138; // 0x69f0
  5714.     int32_t v6 = g139; // 0x69f0
  5715.     int32_t v7 = g130; // bp-8
  5716.     g130 = &v7;
  5717.     int32_t v8 = (int32_t)a1; // R6
  5718.     g137 = v1;
  5719.     int32_t str = *a1; // 0x6a04
  5720.     g135 = str;
  5721.     g138 = 0;
  5722.     int32_t result; // 0x6b58
  5723.     if (str == 0) {
  5724.         // 0x6b58
  5725.         result = g138;
  5726.         g134 = v2;
  5727.         g135 = v3;
  5728.         g137 = v4;
  5729.         g138 = v5;
  5730.         g139 = v6;
  5731.         g130 = v7;
  5732.         return result;
  5733.     }
  5734.     // 0x6a18
  5735.     g139 = 1;
  5736.     int32_t v9 = *(int32_t *)&g46; // 0x6a20
  5737.     g134 = v9;
  5738.     // branch -> 0x6a34
  5739.   lab_0x6a34:
  5740.     while (true) {
  5741.         char * found_char_pos = strchr((char *)str, 58); // 0x6a3c
  5742.         int32_t v10 = (int32_t)found_char_pos; // 0x6a3c_4
  5743.         int32_t str6; // 0x6b14
  5744.         int32_t len; // 0x6b28
  5745.         char * mem; // 0x6b30
  5746.         int32_t v11; // 0x6b3c
  5747.         int32_t v12; // 0x6b40
  5748.         if (found_char_pos == NULL) {
  5749.             // 0x6b64
  5750.             g127 = (int32_t)"syntax error";
  5751.             // branch -> 0x6b14
  5752.             // 0x6b14
  5753.             g126 = 0x6b18;
  5754.             str6 = duplicate_string();
  5755.             g135 = str6;
  5756.             if (str6 != 0) {
  5757.                 // 0x6b24
  5758.                 int32_t str2; // 0x6b24
  5759.                 len = strlen((char *)str2);
  5760.                 mem = malloc(len + 24);
  5761.                 g138 = (int32_t)mem;
  5762.                 v11 = g139;
  5763.                 g132 = v11;
  5764.                 v12 = g135;
  5765.                 g133 = v12;
  5766.                 g128 = (int32_t)"transform %u: %s";
  5767.                 sprintf(mem, "transform %u: %s", v11, (char *)v12);
  5768.                 free((char *)g135);
  5769.                 // branch -> 0x6b58
  5770.             }
  5771.           lab_0x6b58:
  5772.             // 0x6b58
  5773.             result = g138;
  5774.             g134 = v2;
  5775.             g135 = v3;
  5776.             g137 = v4;
  5777.             g138 = v5;
  5778.             g139 = v6;
  5779.             g130 = v7;
  5780.             return result;
  5781.         }
  5782.         int32_t v13 = str4; // 0x6a48
  5783.         int32_t str3 = *(int32_t *)g134; // 0x6a4c
  5784.         str4 = str3;
  5785.         if (str3 == 0) {
  5786.             // 0x6b70
  5787.             g127 = (int32_t)"unknown transform";
  5788.             // branch -> 0x6b14
  5789.             // 0x6b14
  5790.             g126 = 0x6b18;
  5791.             str6 = duplicate_string();
  5792.             g135 = str6;
  5793.             if (str6 == 0) {
  5794.                 // 0x6b58
  5795.                 result = g138;
  5796.                 g134 = v2;
  5797.                 g135 = v3;
  5798.                 g137 = v4;
  5799.                 g138 = v5;
  5800.                 g139 = v6;
  5801.                 g130 = v7;
  5802.                 return result;
  5803.             }
  5804.         } else {
  5805.             // 0x6a58
  5806.             g138 = v10 - g135;
  5807.             g136 = v13;
  5808.             g134 = &g47;
  5809.             // branch -> 0x6a74
  5810.             while (true) {
  5811.                 int32_t len2 = strlen((char *)str3); // 0x6a78
  5812.                 if (len2 == g138) {
  5813.                     // 0x6a84
  5814.                     g132 = len2;
  5815.                     if (strncmp((char *)str4, (char *)g135, len2) == 0) {
  5816.                         int32_t v14 = g136; // 0x6ab8
  5817.                         str4 = v14;
  5818.                         int32_t v15;
  5819.                         int32_t str5 = script_get_expression_value((char *)(v10 + 1), v14, &v15, g133); // 0x6ac4
  5820.                         g135 = str5;
  5821.                         if (str5 != 0) {
  5822.                             // 0x6b24
  5823.                             len = strlen((char *)str5);
  5824.                             mem = malloc(len + 24);
  5825.                             g138 = (int32_t)mem;
  5826.                             v11 = g139;
  5827.                             g132 = v11;
  5828.                             v12 = g135;
  5829.                             g133 = v12;
  5830.                             g128 = (int32_t)"transform %u: %s";
  5831.                             sprintf(mem, "transform %u: %s", v11, (char *)v12);
  5832.                             free((char *)g135);
  5833.                             // branch -> 0x6b58
  5834.                             // 0x6b58
  5835.                             result = g138;
  5836.                             g134 = v2;
  5837.                             g135 = v3;
  5838.                             g137 = v4;
  5839.                             g138 = v5;
  5840.                             g139 = v6;
  5841.                             g130 = v7;
  5842.                             return result;
  5843.                         }
  5844.                         // 0x6ad4
  5845.                         g139++;
  5846.                         *(int32_t *)g137 = *(int32_t *)g134;
  5847.                         g138 = 0;
  5848.                         *(int32_t *)(g137 + 4) = v15;
  5849.                         g137 += 8;
  5850.                         g134 = (int32_t)(char (**)[4])v9;
  5851.                         int32_t v16 = v8 + 4; // 0x6af8
  5852.                         v8 = v16;
  5853.                         int32_t v17 = *(int32_t *)v16; // 0x6af8
  5854.                         g135 = v17;
  5855.                         if (v17 == 0) {
  5856.                             // break (via goto) -> 0x6b58
  5857.                             goto lab_0x6b58;
  5858.                         }
  5859.                         str = v17;
  5860.                         // continue (via goto) -> 0x6a34
  5861.                         goto lab_0x6a34;
  5862.                         // 0x6b58
  5863.                         result = g138;
  5864.                         g134 = v2;
  5865.                         g135 = v3;
  5866.                         g137 = v4;
  5867.                         g138 = v5;
  5868.                         g139 = v6;
  5869.                         int32_t v18 = v7; // 0x6b60
  5870.                         g130 = v18;
  5871.                         return result;
  5872.                     }
  5873.                 }
  5874.                 int32_t v19 = g134; // 0x6a9c
  5875.                 int32_t v20 = *(int32_t *)(v19 + 4); // 0x6a9c
  5876.                 str4 = v20;
  5877.                 g134 = v19 + 8;
  5878.                 if (v20 == 0) {
  5879.                     // break -> 0x6b08
  5880.                     break;
  5881.                 }
  5882.                 str3 = v20;
  5883.                 // continue -> 0x6a74
  5884.             }
  5885.             // 0x6b08
  5886.             g138 = 0;
  5887.             g127 = (int32_t)"unknown transform";
  5888.             // branch -> 0x6b14
  5889.             // 0x6b14
  5890.             g126 = 0x6b18;
  5891.             str6 = duplicate_string();
  5892.             g135 = str6;
  5893.             if (str6 == 0) {
  5894.                 // 0x6b58
  5895.                 result = g138;
  5896.                 g134 = v2;
  5897.                 g135 = v3;
  5898.                 g137 = v4;
  5899.                 g138 = v5;
  5900.                 g139 = v6;
  5901.                 g130 = v7;
  5902.                 return result;
  5903.             }
  5904.         }
  5905.         // 0x6b24
  5906.         len = strlen((char *)str6);
  5907.         mem = malloc(len + 24);
  5908.         g138 = (int32_t)mem;
  5909.         v11 = g139;
  5910.         g132 = v11;
  5911.         v12 = g135;
  5912.         g133 = v12;
  5913.         g128 = (int32_t)"transform %u: %s";
  5914.         sprintf(mem, "transform %u: %s", v11, (char *)v12);
  5915.         free((char *)g135);
  5916.         // branch -> 0x6b58
  5917.         // 0x6b58
  5918.         result = g138;
  5919.         g134 = v2;
  5920.         g135 = v3;
  5921.         g137 = v4;
  5922.         g138 = v5;
  5923.         g139 = v6;
  5924.         g130 = v7;
  5925.         return result;
  5926.     }
  5927. }
  5928.  
  5929. // Address range: 0x6b94 - 0x6db7
  5930. int32_t script_get_initializer_value(char * a1, int32_t * a2, int32_t * a3) {
  5931.     int32_t v1 = (int32_t)a1;
  5932.     int32_t v2 = (int32_t)a3;
  5933.     g132 = v2;
  5934.     int32_t v3 = g134; // 0x6b94
  5935.     int32_t v4 = g135; // 0x6b94
  5936.     int32_t v5 = g137; // 0x6b94
  5937.     int32_t v6 = g130; // bp-8
  5938.     g130 = &v6;
  5939.     g135 = v2;
  5940.     int32_t v7 = v1 + 1; // 0x6ba8
  5941.     g136 = v7;
  5942.     char v8 = *a1; // 0x6ba8
  5943.     g137 = v8;
  5944.     g134 = (int32_t)a2;
  5945.     if (v8 != 58) {
  5946.         // if_6bb4_0_true
  5947.         g136 = v1;
  5948.         v7 = v1;
  5949.         // branch -> after_if_6bb4_0
  5950.     }
  5951.     char * v9 = (char *)v7; // 0x6bb8_0
  5952.     char v10 = *v9; // 0x6bb8
  5953.     int32_t v11; // 0x6d64
  5954.     int32_t v12; // 0x6d30
  5955.     int32_t v13; // 0x6d54
  5956.     int32_t v14;
  5957.     int32_t v15;
  5958.     int32_t v16; // 0x6cb0
  5959.     int32_t result; // 0x6cf8
  5960.     int32_t v17; // 0x6c60_0
  5961.     int32_t v18; // 0x6d04
  5962.     int32_t v19; // 0x6d08
  5963.     int32_t v20; // 0x6d20
  5964.     int32_t v21; // 0x6d28
  5965.     int32_t v22; // 0x6d40
  5966.     int32_t v23; // 0x6d48
  5967.     int32_t v24; // 0x6d48
  5968.     if (v10 == 36) {
  5969.         int32_t v25 = find_script_variable(a3, (char *)(v7 + 1)); // 0x6bcc
  5970.         if (v25 == 0) {
  5971.             // 0x6c28
  5972.             g127 = (int32_t)"variable does not exist";
  5973.             // branch -> 0x6cf0
  5974.             // 0x6cf0
  5975.             g126 = 0x6cf4;
  5976.             result = duplicate_string();
  5977.             // branch -> 0x6cf8
  5978.             // 0x6cf8
  5979.             g134 = v3;
  5980.             g135 = v4;
  5981.             g137 = v5;
  5982.             g130 = v6;
  5983.             return result;
  5984.         }
  5985.         int32_t v26 = *(int32_t *)v25; // 0x6bd8
  5986.         int32_t v27 = *(int32_t *)(v25 + 4); // 0x6bd8
  5987.         int32_t v28 = *(int32_t *)(v25 + 8); // 0x6bd8
  5988.         int32_t v29;
  5989.         copy_script_value((char *)&v29, (char)v26, v27, (char *)v28);
  5990.         int32_t v30;
  5991.         if (g137 == 58) {
  5992.             // 0x6c60
  5993.             v17 = v15;
  5994.             if ((v17 + 255) % 256 < 3) {
  5995.                 // 0x6ca4
  5996.                 g137 = v14;
  5997.                 if (v14 < 0) {
  5998.                     // 0x6cdc
  5999.                     g127 = (int32_t)"negative read amount";
  6000.                     // branch -> 0x6cf0
  6001.                 } else {
  6002.                     // 0x6cb0
  6003.                     v16 = g135;
  6004.                     if (*(int32_t *)v16 != 0) {
  6005.                         // 0x6cbc
  6006.                         if (*(char *)*(int32_t *)*(int32_t *)(v16 + 4) == 0) {
  6007.                             // 0x6d04
  6008.                             v18 = *(int32_t *)(v16 + 8);
  6009.                             g132 = v18;
  6010.                             v19 = *(int32_t *)(v18 + 4);
  6011.                             if (v19 < v14) {
  6012.                                 // 0x6d14
  6013.                                 g127 = (int32_t)"not enough data to read";
  6014.                                 // branch -> 0x6cf0
  6015.                                 // 0x6cf0
  6016.                                 g126 = 0x6cf4;
  6017.                                 result = duplicate_string();
  6018.                                 // branch -> 0x6cf8
  6019.                             } else {
  6020.                                 // 0x6d20
  6021.                                 v20 = *(int32_t *)v18;
  6022.                                 v21 = *(int32_t *)(v18 + 8);
  6023.                                 v12 = script_transform_copy((char)v20, v19, (char *)v21, v14);
  6024.                                 g136 = v12;
  6025.                                 if (v12 == 0) {
  6026.                                     // 0x6d40
  6027.                                     v22 = *(int32_t *)(g135 + 8);
  6028.                                     v23 = *(int32_t *)(v22 + 4);
  6029.                                     v24 = *(int32_t *)(v22 + 8);
  6030.                                     v13 = script_transform_skip((char)*(int32_t *)v22, v23, v24, g137);
  6031.                                     g136 = v13;
  6032.                                     if (v13 == 0) {
  6033.                                         // 0x6d78
  6034.                                         assign_script_value((int32_t *)g135, (char *)&g120, v15, v14);
  6035.                                         // branch -> 0x6c9c
  6036.                                         // 0x6c9c
  6037.                                         result = 0;
  6038.                                         // branch -> 0x6cf8
  6039.                                     } else {
  6040.                                         // 0x6d64
  6041.                                         v11 = g134;
  6042.                                         g128 = *(int32_t *)(v11 + 4);
  6043.                                         g132 = *(int32_t *)(v11 + 8);
  6044.                                         destroy_script_value(*(int32_t *)v11);
  6045.                                         *(int32_t *)(g134 + 8) = 0;
  6046.                                         result = g136;
  6047.                                         // branch -> 0x6cf8
  6048.                                     }
  6049.                                     // 0x6cf8
  6050.                                     g134 = v3;
  6051.                                     g135 = v4;
  6052.                                     g137 = v5;
  6053.                                     g130 = v6;
  6054.                                     return result;
  6055.                                 }
  6056.                                 result = v12;
  6057.                             }
  6058.                             // 0x6cf8
  6059.                             g134 = v3;
  6060.                             g135 = v4;
  6061.                             g137 = v5;
  6062.                             g130 = v6;
  6063.                             return result;
  6064.                         }
  6065.                     }
  6066.                     // 0x6cd0
  6067.                     g127 = (int32_t)"internal state error: $ not found";
  6068.                     // branch -> 0x6cf0
  6069.                 }
  6070.                 // 0x6cf0
  6071.                 g126 = 0x6cf4;
  6072.                 result = duplicate_string();
  6073.                 // branch -> 0x6cf8
  6074.                 // 0x6cf8
  6075.                 g134 = v3;
  6076.                 g135 = v4;
  6077.                 g137 = v5;
  6078.                 g130 = v6;
  6079.                 return result;
  6080.             }
  6081.             // 0x6c74
  6082.             g132 = v30;
  6083.             destroy_script_value(v17);
  6084.             g127 = (int32_t)"type mismatch";
  6085.             // branch -> 0x6cf0
  6086.             // 0x6cf0
  6087.             g126 = 0x6cf4;
  6088.             result = duplicate_string();
  6089.             // branch -> 0x6cf8
  6090.         } else {
  6091.             // 0x6c8c
  6092.             *(int32_t *)(g134 + 8) = v30;
  6093.             // branch -> 0x6c9c
  6094.             // 0x6c9c
  6095.             result = 0;
  6096.             // branch -> 0x6cf8
  6097.         }
  6098.         // 0x6cf8
  6099.         g134 = v3;
  6100.         g135 = v4;
  6101.         g137 = v5;
  6102.         g130 = v6;
  6103.         return result;
  6104.     }
  6105.     // 0x6c00
  6106.     g128 = 3;
  6107.     if (v8 == 58) {
  6108.         // after_if_6c10_0
  6109.         v15 = 3;
  6110.         if (v10 == 0) {
  6111.             // 0x6c1c
  6112.             // branch -> 0x6c54
  6113.             v14 = *(int32_t *)(*(int32_t *)(v2 + 8) + 4);
  6114.             // 0x6c60
  6115.             v17 = v15;
  6116.             if ((v17 + 255) % 256 < 3) {
  6117.                 // 0x6ca4
  6118.                 g137 = v14;
  6119.                 if (v14 < 0) {
  6120.                     // 0x6cdc
  6121.                     g127 = (int32_t)"negative read amount";
  6122.                     // branch -> 0x6cf0
  6123.                 } else {
  6124.                     // 0x6cb0
  6125.                     v16 = g135;
  6126.                     if (*(int32_t *)v16 != 0) {
  6127.                         // 0x6cbc
  6128.                         if (*(char *)*(int32_t *)*(int32_t *)(v16 + 4) == 0) {
  6129.                             // 0x6d04
  6130.                             v18 = *(int32_t *)(v16 + 8);
  6131.                             g132 = v18;
  6132.                             v19 = *(int32_t *)(v18 + 4);
  6133.                             if (v19 < v14) {
  6134.                                 // 0x6d14
  6135.                                 g127 = (int32_t)"not enough data to read";
  6136.                                 // branch -> 0x6cf0
  6137.                                 // 0x6cf0
  6138.                                 g126 = 0x6cf4;
  6139.                                 result = duplicate_string();
  6140.                                 // branch -> 0x6cf8
  6141.                             } else {
  6142.                                 // 0x6d20
  6143.                                 v20 = *(int32_t *)v18;
  6144.                                 v21 = *(int32_t *)(v18 + 8);
  6145.                                 v12 = script_transform_copy((char)v20, v19, (char *)v21, v14);
  6146.                                 g136 = v12;
  6147.                                 if (v12 == 0) {
  6148.                                     // 0x6d40
  6149.                                     v22 = *(int32_t *)(g135 + 8);
  6150.                                     v23 = *(int32_t *)(v22 + 4);
  6151.                                     v24 = *(int32_t *)(v22 + 8);
  6152.                                     v13 = script_transform_skip((char)*(int32_t *)v22, v23, v24, g137);
  6153.                                     g136 = v13;
  6154.                                     if (v13 == 0) {
  6155.                                         // 0x6d78
  6156.                                         assign_script_value((int32_t *)g135, (char *)&g120, v15, v14);
  6157.                                         // branch -> 0x6c9c
  6158.                                         // 0x6c9c
  6159.                                         result = 0;
  6160.                                         // branch -> 0x6cf8
  6161.                                     } else {
  6162.                                         // 0x6d64
  6163.                                         v11 = g134;
  6164.                                         g128 = *(int32_t *)(v11 + 4);
  6165.                                         g132 = *(int32_t *)(v11 + 8);
  6166.                                         destroy_script_value(*(int32_t *)v11);
  6167.                                         *(int32_t *)(g134 + 8) = 0;
  6168.                                         result = g136;
  6169.                                         // branch -> 0x6cf8
  6170.                                     }
  6171.                                     // 0x6cf8
  6172.                                     g134 = v3;
  6173.                                     g135 = v4;
  6174.                                     g137 = v5;
  6175.                                     g130 = v6;
  6176.                                     return result;
  6177.                                 }
  6178.                                 result = v12;
  6179.                             }
  6180.                             // 0x6cf8
  6181.                             g134 = v3;
  6182.                             g135 = v4;
  6183.                             g137 = v5;
  6184.                             g130 = v6;
  6185.                             return result;
  6186.                         }
  6187.                     }
  6188.                     // 0x6cd0
  6189.                     g127 = (int32_t)"internal state error: $ not found";
  6190.                     // branch -> 0x6cf0
  6191.                 }
  6192.                 // 0x6cf0
  6193.                 g126 = 0x6cf4;
  6194.                 result = duplicate_string();
  6195.                 // branch -> 0x6cf8
  6196.                 // 0x6cf8
  6197.                 g134 = v3;
  6198.                 g135 = v4;
  6199.                 g137 = v5;
  6200.                 g130 = v6;
  6201.                 return result;
  6202.             }
  6203.             // 0x6c74
  6204.             g132 = 0;
  6205.             destroy_script_value(v17);
  6206.             g127 = (int32_t)"type mismatch";
  6207.             // branch -> 0x6cf0
  6208.             // 0x6cf0
  6209.             g126 = 0x6cf4;
  6210.             result = duplicate_string();
  6211.             // branch -> 0x6cf8
  6212.             // 0x6cf8
  6213.             g134 = v3;
  6214.             g135 = v4;
  6215.             g137 = v5;
  6216.             g130 = v6;
  6217.             return result;
  6218.         }
  6219.     } else {
  6220.         // after_if_6c10_0.thread
  6221.         v15 = 3;
  6222.         // branch -> 0x6c34
  6223.     }
  6224.     // 0x6c34
  6225.     if ((int32_t)convert_string_to_number(v9, 1) == 0) {
  6226.         // 0x6ce8
  6227.         g127 = (int32_t)"syntax error";
  6228.         // branch -> 0x6cf0
  6229.         // 0x6cf0
  6230.         g126 = 0x6cf4;
  6231.         result = duplicate_string();
  6232.         // branch -> 0x6cf8
  6233.         // 0x6cf8
  6234.         g134 = v3;
  6235.         g135 = v4;
  6236.         g137 = v5;
  6237.         g130 = v6;
  6238.         return result;
  6239.     }
  6240.     int32_t v31 = convert_string_to_number((char *)g136, 0); // 0x6c50_3
  6241.     // branch -> 0x6c54
  6242.     // 0x6c54
  6243.     if (g137 == 58) {
  6244.         v14 = v31;
  6245.         // 0x6c60
  6246.         v17 = v15;
  6247.         if ((v17 + 255) % 256 < 3) {
  6248.             // 0x6ca4
  6249.             g137 = v14;
  6250.             if (v14 < 0) {
  6251.                 // 0x6cdc
  6252.                 g127 = (int32_t)"negative read amount";
  6253.                 // branch -> 0x6cf0
  6254.             } else {
  6255.                 // 0x6cb0
  6256.                 v16 = g135;
  6257.                 if (*(int32_t *)v16 != 0) {
  6258.                     // 0x6cbc
  6259.                     if (*(char *)*(int32_t *)*(int32_t *)(v16 + 4) == 0) {
  6260.                         // 0x6d04
  6261.                         v18 = *(int32_t *)(v16 + 8);
  6262.                         g132 = v18;
  6263.                         v19 = *(int32_t *)(v18 + 4);
  6264.                         if (v19 < v14) {
  6265.                             // 0x6d14
  6266.                             g127 = (int32_t)"not enough data to read";
  6267.                             // branch -> 0x6cf0
  6268.                             // 0x6cf0
  6269.                             g126 = 0x6cf4;
  6270.                             result = duplicate_string();
  6271.                             // branch -> 0x6cf8
  6272.                         } else {
  6273.                             // 0x6d20
  6274.                             v20 = *(int32_t *)v18;
  6275.                             v21 = *(int32_t *)(v18 + 8);
  6276.                             v12 = script_transform_copy((char)v20, v19, (char *)v21, v14);
  6277.                             g136 = v12;
  6278.                             if (v12 == 0) {
  6279.                                 // 0x6d40
  6280.                                 v22 = *(int32_t *)(g135 + 8);
  6281.                                 v23 = *(int32_t *)(v22 + 4);
  6282.                                 v24 = *(int32_t *)(v22 + 8);
  6283.                                 v13 = script_transform_skip((char)*(int32_t *)v22, v23, v24, g137);
  6284.                                 g136 = v13;
  6285.                                 if (v13 == 0) {
  6286.                                     // 0x6d78
  6287.                                     assign_script_value((int32_t *)g135, (char *)&g120, v15, v14);
  6288.                                     // branch -> 0x6c9c
  6289.                                     // 0x6c9c
  6290.                                     result = 0;
  6291.                                     // branch -> 0x6cf8
  6292.                                 } else {
  6293.                                     // 0x6d64
  6294.                                     v11 = g134;
  6295.                                     g128 = *(int32_t *)(v11 + 4);
  6296.                                     g132 = *(int32_t *)(v11 + 8);
  6297.                                     destroy_script_value(*(int32_t *)v11);
  6298.                                     *(int32_t *)(g134 + 8) = 0;
  6299.                                     result = g136;
  6300.                                     // branch -> 0x6cf8
  6301.                                 }
  6302.                                 // 0x6cf8
  6303.                                 g134 = v3;
  6304.                                 g135 = v4;
  6305.                                 g137 = v5;
  6306.                                 g130 = v6;
  6307.                                 return result;
  6308.                             }
  6309.                             result = v12;
  6310.                         }
  6311.                         // 0x6cf8
  6312.                         g134 = v3;
  6313.                         g135 = v4;
  6314.                         g137 = v5;
  6315.                         g130 = v6;
  6316.                         return result;
  6317.                     }
  6318.                 }
  6319.                 // 0x6cd0
  6320.                 g127 = (int32_t)"internal state error: $ not found";
  6321.                 // branch -> 0x6cf0
  6322.             }
  6323.             // 0x6cf0
  6324.             g126 = 0x6cf4;
  6325.             result = duplicate_string();
  6326.             // branch -> 0x6cf8
  6327.             // 0x6cf8
  6328.             g134 = v3;
  6329.             g135 = v4;
  6330.             g137 = v5;
  6331.             g130 = v6;
  6332.             return result;
  6333.         }
  6334.         // 0x6c74
  6335.         g132 = 0;
  6336.         destroy_script_value(v17);
  6337.         g127 = (int32_t)"type mismatch";
  6338.         // branch -> 0x6cf0
  6339.         // 0x6cf0
  6340.         g126 = 0x6cf4;
  6341.         result = duplicate_string();
  6342.         // branch -> 0x6cf8
  6343.     } else {
  6344.         // 0x6c8c
  6345.         *(int32_t *)(g134 + 8) = 0;
  6346.         // branch -> 0x6c9c
  6347.         // 0x6c9c
  6348.         result = 0;
  6349.         // branch -> 0x6cf8
  6350.     }
  6351.     // 0x6cf8
  6352.     g134 = v3;
  6353.     g135 = v4;
  6354.     g137 = v5;
  6355.     g130 = v6;
  6356.     return result;
  6357. }
  6358.  
  6359. // Address range: 0x6db8 - 0x6e4b
  6360. int32_t init_script_variables(int32_t a1, int32_t a2, int32_t a3) {
  6361.     // 0x6db8
  6362.     g132 = a3;
  6363.     int32_t v1 = g135; // 0x6db8
  6364.     int32_t v2 = g138; // 0x6db8
  6365.     g135 = a3;
  6366.     g138 = a2;
  6367.     char * mem = malloc(12); // 0x6dd0
  6368.     int32_t result = (int32_t)mem; // R4
  6369.     *(int32_t *)mem = 1;
  6370.     int32_t mem2 = (int32_t)malloc(4); // 0x6de4_3
  6371.     *(int32_t *)(result + 4) = mem2;
  6372.     char * mem3 = malloc(1); // 0x6df4
  6373.     *(int32_t *)mem2 = (int32_t)mem3;
  6374.     *mem3 = 0;
  6375.     int32_t mem4 = (int32_t)calloc(1, 12); // 0x6e0c_5
  6376.     *(int32_t *)(result + 8) = mem4;
  6377.     uint32_t v3 = *(int32_t *)(a1 + 4); // 0x6e18
  6378.     uint32_t v4 = g135; // 0x6e1c
  6379.     int32_t v5 = v3 - v4; // 0x6e1c
  6380.     int32_t size = v3 < v4 ? v5 & -0x10000 : v5; // 0x6e1c
  6381.     g1 = true;
  6382.     g3 = size == 0;
  6383.     *(int32_t *)(mem4 + 4) = size;
  6384.     if (size != 0) {
  6385.         char * mem5 = malloc(size); // 0x6e30
  6386.         *(int32_t *)(mem4 + 8) = (int32_t)mem5;
  6387.         int32_t v6 = *(int32_t *)(mem4 + 4); // 0x6e3c
  6388.         g132 = v6;
  6389.         __aeabi_memcpy(mem5, (char *)(g138 + g135), v6);
  6390.         // branch -> 0x6e44
  6391.     }
  6392.     // 0x6e44
  6393.     g127 = result;
  6394.     g135 = v1;
  6395.     g138 = v2;
  6396.     return result;
  6397. }
  6398.  
  6399. // Address range: 0x6e4c - 0x6eab
  6400. int32_t find_script_variable(int32_t * a1, char * str) {
  6401.     int32_t v1 = (int32_t)a1;
  6402.     int32_t v2 = g134; // bp-32
  6403.     int32_t v3 = g135; // 0x6e4c
  6404.     int32_t v4 = g138; // 0x6e4c
  6405.     int32_t v5 = g130; // bp-8
  6406.     g138 = v1;
  6407.     int32_t v6 = *a1; // 0x6e5c
  6408.     if (v6 == 0) {
  6409.         // 0x6e98
  6410.         g135 = v3;
  6411.         g138 = v4;
  6412.         return 0;
  6413.     }
  6414.     int32_t v7 = 0; // R7
  6415.     g135 = 0;
  6416.     int32_t v8 = 0; // 0x6e74
  6417.     // branch -> 0x6e74
  6418.     while (true) {
  6419.         int32_t str2 = *(int32_t *)(4 * v8 + *(int32_t *)(v1 + 4)); // 0x6e74
  6420.         if (strcmp((char *)(int32_t)str, (char *)str2) == 0) {
  6421.             int32_t v9 = *(int32_t *)(g138 + 8); // 0x6ea0
  6422.             g134 = v2;
  6423.             g135 = v3;
  6424.             g138 = v4;
  6425.             g130 = v5;
  6426.             return v7 + v9;
  6427.         }
  6428.         int32_t v10 = g135 + 1; // 0x6e88
  6429.         g135 = v10;
  6430.         v7 += 12;
  6431.         if (v10 >= v6) {
  6432.             // 0x6e98
  6433.             // branch -> 0x6e98
  6434.             // 0x6e98
  6435.             g134 = v2;
  6436.             g135 = v3;
  6437.             g138 = v4;
  6438.             g130 = v5;
  6439.             return 0;
  6440.         }
  6441.         // 0x6e88
  6442.         v8 = v10;
  6443.         // branch -> 0x6e74
  6444.     }
  6445. }
  6446.  
  6447. // Address range: 0x6eac - 0x6eb3
  6448. void destroy_script_value(int32_t a1) {
  6449.     // 0x6eac
  6450.     return;
  6451. }
  6452.  
  6453. // Address range: 0x6eb4 - 0x6ebb
  6454. int32_t function_6eb4(int32_t a1) {
  6455.     // 0x6eb4
  6456.     free((char *)g132);
  6457.     return g132;
  6458. }
  6459.  
  6460. // Address range: 0x6ebc - 0x6fef
  6461. int32_t assign_script_value(int32_t * a1, char * a2, int32_t a3, int32_t result) {
  6462.     int32_t v1 = (int32_t)a1;
  6463.     int32_t str = (int32_t)a2;
  6464.     g132 = a3;
  6465.     g133 = result;
  6466.     int32_t v2 = g135; // 0x6ebc
  6467.     int32_t v3 = g138; // 0x6ebc
  6468.     int32_t v4 = g130; // 0x6ebc
  6469.     int32_t v5 = *a1; // 0x6ed0
  6470.     g135 = v5;
  6471.     g138 = result;
  6472.     int32_t mem; // 0x6f84_5
  6473.     int32_t mem3; // 0x6fc4_5
  6474.     int32_t len; // 0x6f94
  6475.     char * mem2; // 0x6f9c
  6476.     int32_t result2; // R0
  6477.     int32_t v6;
  6478.     int32_t v7; // 0x6f74
  6479.     int32_t v8; // 0x6fb4
  6480.     int32_t v9; // 0x6fb8
  6481.     int32_t v10; // 0x6fcc
  6482.     int32_t v11; // 0x6fd4
  6483.     if (v5 == 0) {
  6484.         // 0x6f24
  6485.         // branch -> 0x6f74
  6486.     } else {
  6487.         int32_t v12 = 4; // R9
  6488.         g138 = 0;
  6489.         int32_t v13 = *(int32_t *)(v1 + 4); // 0x6ef8
  6490.         int32_t v14 = 0; // 0x6efc
  6491.         // branch -> 0x6efc
  6492.         while (true) {
  6493.             int32_t str2 = *(int32_t *)(4 * v14 + v13); // 0x6efc
  6494.             g128 = str2;
  6495.             if (strcmp((char *)str, (char *)str2) == 0) {
  6496.                 int32_t v15 = *(int32_t *)(v1 + 8); // 0x6f2c
  6497.                 g138 = v15;
  6498.                 int32_t v16 = v12 + v15; // 0x6f30
  6499.                 if (v16 != 4) {
  6500.                     int32_t v17 = v16 + 4; // 0x6f40
  6501.                     int32_t v18 = *(int32_t *)v17; // 0x6f40
  6502.                     if (v18 != 0) {
  6503.                         // 0x6f4c
  6504.                         free((char *)v18);
  6505.                         // branch -> 0x6f50
  6506.                     }
  6507.                     // 0x6f50
  6508.                     *(int32_t *)(v16 - 4) = a3;
  6509.                     *(int32_t *)(v12 + g138) = result;
  6510.                     // branch -> 0x6fe4
  6511.                     // 0x6fe4
  6512.                     *(int32_t *)v17 = v6;
  6513.                     g135 = v2;
  6514.                     g138 = v3;
  6515.                     g130 = v4;
  6516.                     return result;
  6517.                 }
  6518.                 // 0x6f68
  6519.                 // branch -> 0x6f6c
  6520.                 // 0x6f6c
  6521.                 g138 = result;
  6522.                 // branch -> 0x6f74
  6523.                 // 0x6f74
  6524.                 v7 = g135 + 1;
  6525.                 *(int32_t *)v1 = v7;
  6526.                 mem = (int32_t)realloc((char *)v13, 4 * v7);
  6527.                 *(int32_t *)(v1 + 4) = mem;
  6528.                 len = strlen((char *)str);
  6529.                 mem2 = malloc(len + 1);
  6530.                 *(int32_t *)(4 * *(int32_t *)v1 - 4 + mem) = (int32_t)mem2;
  6531.                 strcpy(mem2, (char *)str);
  6532.                 v8 = v1;
  6533.                 v9 = *(int32_t *)(v8 + 8);
  6534.                 mem3 = (int32_t)realloc((char *)v9, 12 * *(int32_t *)v8);
  6535.                 *(int32_t *)(v1 + 8) = mem3;
  6536.                 v10 = *(int32_t *)v1;
  6537.                 g128 = 3 * v10;
  6538.                 v11 = 12 * v10 + mem3;
  6539.                 result2 = v11;
  6540.                 *(int32_t *)(v11 - 12) = a3;
  6541.                 *(int32_t *)(result2 - 8) = g138;
  6542.                 // branch -> 0x6fe4
  6543.                 // 0x6fe4
  6544.                 *(int32_t *)(v11 - 4) = v6;
  6545.                 g135 = v2;
  6546.                 g138 = v3;
  6547.                 g130 = v4;
  6548.                 return result2;
  6549.             }
  6550.             int32_t v19 = g138 + 1; // 0x6f10
  6551.             g138 = v19;
  6552.             v12 += 12;
  6553.             int32_t v20 = g135; // 0x6f18
  6554.             if (v19 >= v20) {
  6555.                 // 0x6f6c
  6556.                 // branch -> 0x6f6c
  6557.                 // 0x6f6c
  6558.                 g138 = result;
  6559.                 // branch -> 0x6f74
  6560.                 // 0x6f74
  6561.                 v7 = v20 + 1;
  6562.                 *(int32_t *)v1 = v7;
  6563.                 mem = (int32_t)realloc((char *)v13, 4 * v7);
  6564.                 *(int32_t *)(v1 + 4) = mem;
  6565.                 len = strlen((char *)str);
  6566.                 mem2 = malloc(len + 1);
  6567.                 *(int32_t *)(4 * *(int32_t *)v1 - 4 + mem) = (int32_t)mem2;
  6568.                 strcpy(mem2, (char *)str);
  6569.                 v8 = v1;
  6570.                 v9 = *(int32_t *)(v8 + 8);
  6571.                 mem3 = (int32_t)realloc((char *)v9, 12 * *(int32_t *)v8);
  6572.                 *(int32_t *)(v1 + 8) = mem3;
  6573.                 v10 = *(int32_t *)v1;
  6574.                 g128 = 3 * v10;
  6575.                 v11 = 12 * v10 + mem3;
  6576.                 result2 = v11;
  6577.                 *(int32_t *)(v11 - 12) = a3;
  6578.                 *(int32_t *)(result2 - 8) = g138;
  6579.                 // branch -> 0x6fe4
  6580.                 // 0x6fe4
  6581.                 *(int32_t *)(v11 - 4) = v6;
  6582.                 g135 = v2;
  6583.                 g138 = v3;
  6584.                 g130 = v4;
  6585.                 return result2;
  6586.             }
  6587.             // 0x6f10
  6588.             v14 = v19;
  6589.             // branch -> 0x6efc
  6590.         }
  6591.     }
  6592.     // 0x6f74
  6593.     v7 = 1;
  6594.     *(int32_t *)v1 = v7;
  6595.     int32_t v21 = *(int32_t *)(v1 + 4); // 0x6f80
  6596.     mem = (int32_t)realloc((char *)v21, 4 * v7);
  6597.     *(int32_t *)(v1 + 4) = mem;
  6598.     len = strlen((char *)str);
  6599.     mem2 = malloc(len + 1);
  6600.     *(int32_t *)(4 * *(int32_t *)v1 - 4 + mem) = (int32_t)mem2;
  6601.     strcpy(mem2, (char *)str);
  6602.     v8 = v1;
  6603.     v9 = *(int32_t *)(v8 + 8);
  6604.     mem3 = (int32_t)realloc((char *)v9, 12 * *(int32_t *)v8);
  6605.     *(int32_t *)(v1 + 8) = mem3;
  6606.     v10 = *(int32_t *)v1;
  6607.     g128 = 3 * v10;
  6608.     v11 = 12 * v10 + mem3;
  6609.     result2 = v11;
  6610.     *(int32_t *)(v11 - 12) = a3;
  6611.     *(int32_t *)(result2 - 8) = g138;
  6612.     // branch -> 0x6fe4
  6613.     // 0x6fe4
  6614.     *(int32_t *)(v11 - 4) = v6;
  6615.     g135 = v2;
  6616.     g138 = v3;
  6617.     g130 = v4;
  6618.     return result2;
  6619. }
  6620.  
  6621. // Address range: 0x6ff0 - 0x705f
  6622. int32_t destroy_script_variables(char * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6) {
  6623.     int32_t v1 = (int32_t)a1;
  6624.     int32_t v2 = g135; // 0x6ff0
  6625.     int32_t v3 = v1; // R4
  6626.     int32_t result; // 0x7054
  6627.     if (*(int32_t *)a1 == 0) {
  6628.         // 0x7044
  6629.         free((char *)*(int32_t *)(v1 + 4));
  6630.         free((char *)*(int32_t *)(v3 + 8));
  6631.         result = v3;
  6632.         g135 = v2;
  6633.         free((char *)result);
  6634.         return result;
  6635.     }
  6636.     // 0x7008
  6637.     g135 = 0;
  6638.     int32_t v4 = 8; // R6
  6639.     int32_t v5 = 0; // 0x7014
  6640.     // branch -> 0x7010
  6641.     int32_t v6; // 0x7030
  6642.     while (true) {
  6643.         // 0x7010
  6644.         free((char *)*(int32_t *)(*(int32_t *)(v1 + 4) + 4 * v5));
  6645.         int32_t v7 = *(int32_t *)(v4 + *(int32_t *)(v3 + 8)); // 0x7020
  6646.         v6 = v3;
  6647.         if (v7 != 0) {
  6648.             // 0x702c
  6649.             free((char *)v7);
  6650.             v6 = v3;
  6651.             // branch -> 0x7030
  6652.         }
  6653.         int32_t v8 = g135 + 1; // 0x7034
  6654.         g135 = v8;
  6655.         v4 += 12;
  6656.         if (v8 >= *(int32_t *)v6) {
  6657.             // break -> 0x7044
  6658.             break;
  6659.         }
  6660.         v5 = v8;
  6661.         v1 = v6;
  6662.         // continue -> 0x7010
  6663.     }
  6664.     // 0x7044
  6665.     free((char *)*(int32_t *)(v6 + 4));
  6666.     free((char *)*(int32_t *)(v3 + 8));
  6667.     result = v3;
  6668.     g135 = v2;
  6669.     free((char *)result);
  6670.     return result;
  6671. }
  6672.  
  6673. // Address range: 0x7060 - 0x7113
  6674. int32_t copy_script_value(char * a1, char a2, int32_t a3, char * a4) {
  6675.     int32_t v1 = a2;
  6676.     int32_t v2 = (int32_t)a4;
  6677.     g133 = v2;
  6678.     int32_t v3 = g135; // 0x7060
  6679.     int32_t v4 = g136; // 0x7060
  6680.     int32_t v5 = g137; // 0x7060
  6681.     int32_t v6 = g138; // 0x7060
  6682.     int32_t v7 = g139; // 0x7060
  6683.     int32_t v8 = g130; // bp-8
  6684.     g130 = &v8;
  6685.     g136 = v1;
  6686.     g139 = a3;
  6687.     uint32_t v9 = v1 % 256; // 0x7074
  6688.     g132 = v9;
  6689.     g138 = v2;
  6690.     g135 = (int32_t)a1;
  6691.     g137 = 0;
  6692.     g1 = v9 > 6;
  6693.     g2 = v9 < 7;
  6694.     g3 = v9 == 7;
  6695.     int32_t v10;
  6696.     uint32_t v11;
  6697.     int32_t result; // 0x70f0
  6698.     if (v9 > 7) {
  6699.         // 0x70f0
  6700.         result = 0x1000000 * v10 / 0x1000000;
  6701.         g128 = v11 % 0x10000;
  6702.         *(char *)g135 = (char)g136;
  6703.         *(char *)(g135 + 3) = (char)result;
  6704.         *(int16_t *)(g135 + 1) = (int16_t)v11;
  6705.         *(int32_t *)(g135 + 4) = g139;
  6706.         *(int32_t *)(g135 + 8) = g137;
  6707.         g135 = v3;
  6708.         g136 = v4;
  6709.         g137 = v5;
  6710.         g138 = v6;
  6711.         g139 = v7;
  6712.         g130 = v8;
  6713.         return result;
  6714.     }
  6715.     // 0x708c
  6716.     g133 = &g60;
  6717.     g128 = 1;
  6718.     g127 = 2;
  6719.     int32_t v12 = *(int32_t *)(4 * v9 + (int32_t)&g60); // 0x709c
  6720.     g132 = v12;
  6721.     ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))(v12 + (int32_t)&g60))(2, 1, v12, (int32_t)&g60);
  6722.     if (g3) {
  6723.         // after_if_70b8_0
  6724.         // branch -> after_if_70c0_0
  6725.     }
  6726.     int32_t size = 4 * g139; // 0x70cc
  6727.     if (size != 0) {
  6728.         char * mem = malloc(size); // 0x70dc
  6729.         g132 = size;
  6730.         g137 = (int32_t)mem;
  6731.         __aeabi_memcpy(mem, (char *)g138, size);
  6732.         // branch -> 0x70f0
  6733.     }
  6734.     // 0x70f0
  6735.     result = 0x1000000 * v10 / 0x1000000;
  6736.     g128 = v11 % 0x10000;
  6737.     *(char *)g135 = (char)g136;
  6738.     *(char *)(g135 + 3) = (char)result;
  6739.     *(int16_t *)(g135 + 1) = (int16_t)v11;
  6740.     *(int32_t *)(g135 + 4) = g139;
  6741.     *(int32_t *)(g135 + 8) = g137;
  6742.     g135 = v3;
  6743.     g136 = v4;
  6744.     g137 = v5;
  6745.     g138 = v6;
  6746.     g139 = v7;
  6747.     g130 = v8;
  6748.     return result;
  6749. }
  6750.  
  6751. // Address range: 0x7114 - 0x7153
  6752. // Used cryptographic patterns:
  6753. //  - rfc3548_Base_64_Encoding_with_URL_and_Filename_Safe_Alphabet (8-bit, little endian)
  6754. int32_t validate_variable_name(char * str) {
  6755.     int32_t v1 = g135; // 0x7114
  6756.     int32_t ini_seg_bytes = strspn(str, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); // 0x712c
  6757.     g135 = ini_seg_bytes;
  6758.     int32_t result = 0; // 0x7148
  6759.     if (ini_seg_bytes == strlen((char *)(int32_t)str)) {
  6760.         // if_7144_0_true
  6761.         result = 1;
  6762.         // branch -> after_if_7144_0
  6763.     }
  6764.     // after_if_7144_0
  6765.     g135 = v1;
  6766.     return result;
  6767. }
  6768.  
  6769. // Address range: 0x7154 - 0x741f
  6770. int32_t settings_mode(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, char * a6, char * a7, int32_t a8, int32_t a9, char * a10, char * a11, int32_t a12, int32_t a13, char * a14, int32_t a15, int32_t a16, int32_t a17) {
  6771.     int32_t v1 = g130; // bp-8
  6772.     g130 = &v1;
  6773.     puts("Enter a setting to view its value, or a setting and a value to change it.");
  6774.     puts("Enter ? for help, or a blank line to exit configuration mode.");
  6775.     printf("config> ");
  6776.     int32_t result = read_line((struct _IO_FILE *)g33); // 0x718c
  6777.     char * str = (char *)result; // 0x7194_0
  6778.     if (*str != 0) {
  6779.         // 0x71a0
  6780.         return strcmp(str, "?");
  6781.     }
  6782.     // 0x73c0
  6783.     free(str);
  6784.     return result;
  6785. }
  6786.  
  6787. // Address range: 0x7420 - 0x749b
  6788. int32_t settings_help(int32_t a1, int32_t a2, int32_t a3, int32_t a4) {
  6789.     int32_t v1 = g134; // 0x7420
  6790.     int32_t v2 = g135; // 0x7420
  6791.     int32_t v3 = g130; // 0x7420
  6792.     int32_t v4 = *(int32_t *)&g9; // 0x742c
  6793.     g3 = v4 == 0;
  6794.     int32_t puts_rc; // 0x7484
  6795.     if (v4 == 0) {
  6796.         // 0x746c
  6797.         puts("Enter a setting to view its value, or a setting and a value to change it.");
  6798.         g134 = v1;
  6799.         g135 = v2;
  6800.         g130 = v3;
  6801.         puts_rc = puts("Enter ? for help, or a blank line to exit configuration mode.");
  6802.         g127 = puts_rc;
  6803.         return puts_rc;
  6804.     }
  6805.     // 0x743c
  6806.     g135 = &g11;
  6807.     int32_t v5 = &g11; // 0x7450
  6808.     // branch -> 0x7450
  6809.     while (true) {
  6810.         int32_t v6 = *(int32_t *)v5; // 0x7450
  6811.         printf((char *)(int32_t)"%-10s - %s\n", (char *)v4, (char *)v6);
  6812.         int32_t v7 = g135; // 0x745c
  6813.         int32_t v8 = *(int32_t *)(v7 + 4); // 0x745c
  6814.         int32_t v9 = v7 + 12; // 0x7460
  6815.         g135 = v9;
  6816.         g3 = v8 == 0;
  6817.         if (v8 == 0) {
  6818.             // 0x746c
  6819.             puts("Enter a setting to view its value, or a setting and a value to change it.");
  6820.             g134 = v1;
  6821.             g135 = v2;
  6822.             g130 = v3;
  6823.             puts_rc = puts("Enter ? for help, or a blank line to exit configuration mode.");
  6824.             g127 = puts_rc;
  6825.             return puts_rc;
  6826.         }
  6827.         // 0x7450
  6828.         v4 = v8;
  6829.         v5 = v9;
  6830.         // branch -> 0x7450
  6831.     }
  6832. }
  6833.  
  6834. // Address range: 0x749c - 0x754f
  6835. int32_t headers_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4) {
  6836.     int32_t v1 = g134; // 0x749c
  6837.     int32_t v2 = g130; // 0x749c
  6838.     int32_t v3; // 0x7520
  6839.     int32_t v4; // 0x7514
  6840.     if (str == NULL) {
  6841.         // 0x74ec
  6842.         v3 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2;
  6843.         // branch -> 0x7504
  6844.         // 0x7504
  6845.         v4 = *(int32_t *)&g44;
  6846.         *(char *)v4 = (char)(v4 & 254 | v3);
  6847.         g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
  6848.         g134 = v1;
  6849.         g130 = v2;
  6850.         return duplicate_string();
  6851.     }
  6852.     // 0x74b0
  6853.     if (strcmp(str, "off") == 0) {
  6854.         // 0x7500
  6855.         v3 = 0;
  6856.         // branch -> 0x7504
  6857.     } else {
  6858.         // 0x74c8
  6859.         if (strcmp((char *)(int32_t)str, "on") != 0) {
  6860.             // if_74e0_0_true
  6861.             return 0;
  6862.         }
  6863.         // after_if_74e0_0
  6864.         v3 = 1;
  6865.         // branch -> 0x7504
  6866.     }
  6867.     // 0x7504
  6868.     v4 = *(int32_t *)&g44;
  6869.     *(char *)v4 = (char)(v4 & 254 | v3);
  6870.     g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
  6871.     g134 = v1;
  6872.     g130 = v2;
  6873.     return duplicate_string();
  6874. }
  6875.  
  6876. // Address range: 0x7550 - 0x7657
  6877. int32_t indent_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4) {
  6878.     int32_t v1 = g134; // 0x7550
  6879.     int32_t v2 = g135; // 0x7550
  6880.     int32_t v3 = g130; // 0x7550
  6881.     int32_t str2 = (int32_t)str; // R4
  6882.     int32_t v4; // 0x75c8
  6883.     int32_t v5; // 0x75e4
  6884.     if (str == NULL) {
  6885.         // 0x75bc
  6886.         v4 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 / 2 % 16;
  6887.         g135 = v4;
  6888.         // branch -> 0x75dc
  6889.         // 0x75dc
  6890.         v5 = *(int32_t *)&g44;
  6891.         *(char *)v5 = (char)(2 * v4 & 30 | v5 & 225);
  6892.         if (v4 > 9) {
  6893.             // 0x75fc
  6894.             g127 = (int32_t)"tab";
  6895.             g134 = v1;
  6896.             g135 = v2;
  6897.             g130 = v3;
  6898.             return duplicate_string();
  6899.         }
  6900.         // 0x760c
  6901.         if (g135 != 0) {
  6902.             // 0x7614
  6903.             return (int32_t)malloc(2);
  6904.         }
  6905.         // 0x7630
  6906.         g127 = (int32_t)"none";
  6907.         g134 = v1;
  6908.         g135 = v2;
  6909.         g130 = v3;
  6910.         return duplicate_string();
  6911.     }
  6912.     // 0x7564
  6913.     if (strcmp(str, "none") == 0) {
  6914.         // 0x75d0
  6915.         g135 = 0;
  6916.         v4 = 0;
  6917.         // branch -> 0x75dc
  6918.         // 0x75dc
  6919.         v5 = *(int32_t *)&g44;
  6920.         *(char *)v5 = (char)(2 * v4 & 30 | v5 & 225);
  6921.         if (v4 > 9) {
  6922.             // 0x75fc
  6923.             g127 = (int32_t)"tab";
  6924.             g134 = v1;
  6925.             g135 = v2;
  6926.             g130 = v3;
  6927.             return duplicate_string();
  6928.         }
  6929.         // 0x760c
  6930.         if (g135 != 0) {
  6931.             // 0x7614
  6932.             return (int32_t)malloc(2);
  6933.         }
  6934.         // 0x7630
  6935.         g127 = (int32_t)"none";
  6936.         g134 = v1;
  6937.         g135 = v2;
  6938.         g130 = v3;
  6939.         return duplicate_string();
  6940.     }
  6941.     // 0x757c
  6942.     if (strcmp((char *)str2, "tab") == 0) {
  6943.         // 0x75d8
  6944.         g135 = 15;
  6945.         v4 = 15;
  6946.         // branch -> 0x75dc
  6947.     } else {
  6948.         int32_t v6 = (int32_t)*(char *)str2 - 48; // 0x7598
  6949.         g135 = v6;
  6950.         if (v6 % 256 > 9 || *(char *)(str2 + 1) != 0) {
  6951.             // 0x762c
  6952.             g135 = v2;
  6953.             return 0;
  6954.         }
  6955.         v4 = v6;
  6956.     }
  6957.     // 0x75dc
  6958.     v5 = *(int32_t *)&g44;
  6959.     *(char *)v5 = (char)(2 * v4 & 30 | v5 & 225);
  6960.     if (v4 > 9) {
  6961.         // 0x75fc
  6962.         g127 = (int32_t)"tab";
  6963.         g134 = v1;
  6964.         g135 = v2;
  6965.         g130 = v3;
  6966.         return duplicate_string();
  6967.     }
  6968.     // 0x760c
  6969.     if (g135 != 0) {
  6970.         // 0x7614
  6971.         return (int32_t)malloc(2);
  6972.     }
  6973.     // 0x7630
  6974.     g127 = (int32_t)"none";
  6975.     g134 = v1;
  6976.     g135 = v2;
  6977.     g130 = v3;
  6978.     return duplicate_string();
  6979. }
  6980.  
  6981. // Address range: 0x7658 - 0x770b
  6982. int32_t code_labels_setting_handler(char * str, int32_t a2, int32_t a3) {
  6983.     int32_t v1 = g134; // 0x7658
  6984.     int32_t v2 = g130; // 0x7658
  6985.     int32_t v3; // 0x76dc
  6986.     int32_t v4; // 0x76d0
  6987.     if (str == NULL) {
  6988.         // 0x76a8
  6989.         v3 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 / 32 % 2;
  6990.         // branch -> 0x76c0
  6991.         // 0x76c0
  6992.         v4 = *(int32_t *)&g44;
  6993.         *(char *)v4 = (char)(v4 & 223 | -v3 & 32);
  6994.         g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
  6995.         g134 = v1;
  6996.         g130 = v2;
  6997.         return duplicate_string();
  6998.     }
  6999.     // 0x766c
  7000.     if (strcmp(str, "off") == 0) {
  7001.         // 0x76bc
  7002.         v3 = 0;
  7003.         // branch -> 0x76c0
  7004.     } else {
  7005.         // 0x7684
  7006.         if (strcmp((char *)(int32_t)str, "on") != 0) {
  7007.             // if_769c_0_true
  7008.             return 0;
  7009.         }
  7010.         // after_if_769c_0
  7011.         v3 = 1;
  7012.         // branch -> 0x76c0
  7013.     }
  7014.     // 0x76c0
  7015.     v4 = *(int32_t *)&g44;
  7016.     *(char *)v4 = (char)(v4 & 223 | -v3 & 32);
  7017.     g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
  7018.     g134 = v1;
  7019.     g130 = v2;
  7020.     return duplicate_string();
  7021. }
  7022.  
  7023. // Address range: 0x770c - 0x77f3
  7024. int32_t data_labels_setting_handler(char * str, int32_t a2, int32_t a3) {
  7025.     int32_t v1 = g134; // 0x770c
  7026.     int32_t v2 = g130; // 0x770c
  7027.     int32_t str2 = (int32_t)str; // R4
  7028.     int32_t v3; // 0x77b4
  7029.     uint32_t v4; // 0x77a4
  7030.     if (str == NULL) {
  7031.         int32_t v5 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 / 64; // 0x7780
  7032.         v3 = v5;
  7033.         // branch -> 0x7794
  7034.         // 0x7794
  7035.         v4 = *(int32_t *)&g44;
  7036.         *(char *)v4 = (char)(v4 % 64 | 64 * v3);
  7037.         g127 = v3 == 1 ? (int32_t)"exact" : (int32_t)"on";
  7038.         if (v5 == 0) {
  7039.             // if_77c8_0_true
  7040.             g127 = (int32_t)"off";
  7041.             // branch -> after_if_77c8_0
  7042.         }
  7043.         // after_if_77c8_0
  7044.         g134 = v1;
  7045.         g130 = v2;
  7046.         return duplicate_string();
  7047.     }
  7048.     // 0x7720
  7049.     if (strcmp(str, "off") == 0) {
  7050.         // 0x7788
  7051.         v3 = 0;
  7052.         // branch -> 0x7794
  7053.         // 0x7794
  7054.         v4 = *(int32_t *)&g44;
  7055.         *(char *)v4 = (char)(v4 % 64 | 64 * v3);
  7056.         g127 = v3 == 1 ? (int32_t)"exact" : (int32_t)"on";
  7057.         // if_77c8_0_true
  7058.         g127 = (int32_t)"off";
  7059.         // branch -> after_if_77c8_0
  7060.         // after_if_77c8_0
  7061.         g134 = v1;
  7062.         g130 = v2;
  7063.         return duplicate_string();
  7064.     }
  7065.     // 0x7738
  7066.     int32_t v6; // R1
  7067.     if (strcmp((char *)str2, "exact") == 0) {
  7068.         // 0x7790
  7069.         v6 = 1;
  7070.         v3 = 1;
  7071.         // branch -> 0x7794
  7072.     } else {
  7073.         // 0x7750
  7074.         if (strcmp((char *)str2, "on") != 0) {
  7075.             // if_7768_0_true
  7076.             return 0;
  7077.         }
  7078.         // after_if_7768_0
  7079.         v6 = 2;
  7080.         v3 = 2;
  7081.         // branch -> 0x7794
  7082.     }
  7083.     // 0x7794
  7084.     v4 = *(int32_t *)&g44;
  7085.     *(char *)v4 = (char)(v4 % 64 | 64 * v3);
  7086.     g127 = v3 == 1 ? (int32_t)"exact" : (int32_t)"on";
  7087.     if (v6 == 0) {
  7088.         // if_77c8_0_true
  7089.         g127 = (int32_t)"off";
  7090.         // branch -> after_if_77c8_0
  7091.     }
  7092.     // after_if_77c8_0
  7093.     g134 = v1;
  7094.     g130 = v2;
  7095.     return duplicate_string();
  7096. }
  7097.  
  7098. // Address range: 0x77f4 - 0x788f
  7099. int32_t get_value_from_string(char * a1, int32_t a2) {
  7100.     int32_t v1 = g135; // 0x77f4
  7101.     int32_t v2 = g130; // 0x77f4
  7102.     g135 = (int32_t)a1;
  7103.     int32_t v3 = a2; // R4
  7104.     if (a1 == NULL || a2 == 0 || *a1 == 0) {
  7105.         // 0x7888
  7106.         g135 = v1;
  7107.         g130 = v2;
  7108.         return -1;
  7109.     }
  7110.     char * mem = malloc(a2 + 1); // 0x7828
  7111.     int32_t str = (int32_t)mem; // R6
  7112.     __aeabi_memcpy(mem, (char *)g135, v3);
  7113.     *(char *)(v3 + str) = 0;
  7114.     int32_t endptr;
  7115.     int64_t str_as_ull = strtoull((char *)str, (char **)&endptr, 0); // 0x7850
  7116.     v3 = str_as_ull;
  7117.     g135 = &endptr;
  7118.     free((char *)str);
  7119.     int32_t result = v3; // 0x788c_22
  7120.     if (*(char *)endptr != 0) {
  7121.         // if_7878_0_true
  7122.         result = -1;
  7123.         // branch -> after_if_7878_0
  7124.     }
  7125.     if (((int32_t)(v3 != -1) ^ 1) > -g135) {
  7126.         // if_7884_0_true
  7127.         result = -1;
  7128.         // branch -> 0x7888
  7129.     }
  7130.     // 0x7888
  7131.     g135 = v1;
  7132.     g130 = v2;
  7133.     return result;
  7134. }
  7135.  
  7136. // Address range: 0x7890 - 0x7903
  7137. int64_t convert_string_to_number(char * str, int32_t a2) {
  7138.     g128 = a2;
  7139.     int32_t v1 = g135; // 0x7890
  7140.     int32_t v2 = g130; // 0x7890
  7141.     g135 = a2;
  7142.     if (str == NULL) {
  7143.         // 0x78f4
  7144.         // branch -> 0x78f8
  7145.         // 0x78f8
  7146.         g135 = v1;
  7147.         g130 = v2;
  7148.         return 0;
  7149.     }
  7150.     int32_t v3 = 0; // R4
  7151.     int32_t endptr;
  7152.     int32_t str_as_ll = strtoll(str, (char **)&endptr, 0); // 0x78b4_6
  7153.     int32_t v4 = -str_as_ll; // 0x78b8
  7154.     uint32_t v5 = 2 * ((int32_t)(str_as_ll > v4) | (int32_t)&endptr) | (int32_t)(v4 < 0); // 0x78c4
  7155.     g132 = 2 - v5;
  7156.     uint32_t v6 = (int32_t)(&endptr < NULL); // 0x78cc
  7157.     g128 = v3 - v6 - ((int32_t)(v5 < 3) ^ 1);
  7158.     int32_t result; // 0x78f8
  7159.     if (v3 >= v6) {
  7160.         char v7 = *(char *)endptr; // 0x78d8
  7161.         g128 = v7;
  7162.         if (v7 == 0) {
  7163.             // 0x78e4
  7164.             int32_t v8; // 0x78ec
  7165.             if (g135 != 0) {
  7166.                 // if_78e8_0_true
  7167.                 v8 = str_as_ll & -0x10000 | 1;
  7168.                 // branch -> after_if_78e8_0
  7169.             } else {
  7170.                 v8 = str_as_ll;
  7171.             }
  7172.             // after_if_78e8_0
  7173.             result = v8;
  7174.             // branch -> 0x78f8
  7175.         } else {
  7176.             result = v3;
  7177.         }
  7178.     } else {
  7179.         result = v3;
  7180.     }
  7181.     // 0x78f8
  7182.     g135 = v1;
  7183.     g130 = v2;
  7184.     return result;
  7185. }
  7186.  
  7187. // Address range: 0x7904 - 0x79bf
  7188. int32_t concatenate(int32_t * a1, int32_t * a2, char * a3, int32_t a4) {
  7189.     int32_t v1 = (int32_t)a1;
  7190.     int32_t v2 = (int32_t)a2;
  7191.     int32_t str = (int32_t)a3;
  7192.     g133 = a4;
  7193.     int32_t v3 = g135; // 0x7908
  7194.     int32_t v4 = g138; // 0x7908
  7195.     int32_t v5 = g130; // 0x7908
  7196.     g138 = v1;
  7197.     g1 = true;
  7198.     g3 = a3 == NULL;
  7199.     int32_t result; // 0x79a0
  7200.     int32_t v6; // 0x79a8
  7201.     if (a3 == NULL) {
  7202.         // 0x79a0
  7203.         result = *(int32_t *)v2;
  7204.         g132 = 0;
  7205.         v6 = *(int32_t *)v1;
  7206.         g128 = v6;
  7207.         *(char *)(v6 + result) = 0;
  7208.         g135 = v3;
  7209.         g138 = v4;
  7210.         g130 = v5;
  7211.         return result;
  7212.     }
  7213.     // 0x7940
  7214.     g135 = *a2;
  7215.     int32_t v7 = &a4;
  7216.     int32_t len = strlen((char *)str); // 0x794c
  7217.     int32_t v8 = len; // R4
  7218.     int32_t mem = (int32_t)realloc((char *)*a1, len + 1 + g135); // 0x7960_5
  7219.     int32_t v9 = mem; // R7
  7220.     *(int32_t *)g138 = mem;
  7221.     int32_t v10 = *(int32_t *)v2; // 0x7974
  7222.     g135 = v10;
  7223.     __aeabi_memcpy((char *)(v9 + v10), (char *)str, v8);
  7224.     int32_t v11 = g135 + v8; // 0x7980
  7225.     g135 = v11;
  7226.     *(int32_t *)v2 = v11;
  7227.     int32_t v12 = *(int32_t *)v7; // 0x7994
  7228.     g1 = true;
  7229.     g3 = v12 == 0;
  7230.     // branch -> 0x7948
  7231.     while (v12 != 0) {
  7232.         // 0x7948
  7233.         str = v12;
  7234.         v7 += 4;
  7235.         len = strlen((char *)str);
  7236.         v8 = len;
  7237.         mem = (int32_t)realloc((char *)v9, len + 1 + g135);
  7238.         v9 = mem;
  7239.         *(int32_t *)g138 = mem;
  7240.         v10 = *(int32_t *)v2;
  7241.         g135 = v10;
  7242.         __aeabi_memcpy((char *)(v9 + v10), (char *)str, v8);
  7243.         v11 = g135 + v8;
  7244.         g135 = v11;
  7245.         *(int32_t *)v2 = v11;
  7246.         v12 = *(int32_t *)v7;
  7247.         g1 = true;
  7248.         g3 = v12 == 0;
  7249.         // continue -> 0x7948
  7250.     }
  7251.     // 0x79a0
  7252.     // branch -> 0x79a0
  7253.     // 0x79a0
  7254.     result = *(int32_t *)v2;
  7255.     g132 = 0;
  7256.     v6 = *(int32_t *)g138;
  7257.     g128 = v6;
  7258.     *(char *)(v6 + result) = 0;
  7259.     g135 = v3;
  7260.     g138 = v4;
  7261.     g130 = v5;
  7262.     return result;
  7263. }
  7264.  
  7265. // Address range: 0x79c0 - 0x79eb
  7266. int32_t duplicate_string(void) {
  7267.     int32_t v1 = g135; // 0x79c0
  7268.     char * str = (char *)g127; // 0x79cc_2
  7269.     char * mem = malloc(strlen(str) + 1); // 0x79d4
  7270.     int32_t result = (int32_t)mem; // 0x79d4_3
  7271.     g128 = g127;
  7272.     g135 = result;
  7273.     strcpy(mem, str);
  7274.     g127 = result;
  7275.     g135 = v1;
  7276.     return result;
  7277. }
  7278.  
  7279. // Address range: 0x79ec - 0x7ad7
  7280. int32_t split_by_spaces(void) {
  7281.     int32_t v1 = g135; // 0x79ec
  7282.     int32_t v2 = g138; // 0x79ec
  7283.     int32_t v3 = g130; // 0x79ec
  7284.     g3 = g127 == 0;
  7285.     if (g127 == 0) {
  7286.         // 0x7a9c
  7287.         g127 = 0;
  7288.         g135 = v1;
  7289.         g138 = v2;
  7290.         g130 = v3;
  7291.         return 0;
  7292.     }
  7293.     int32_t str = g127 + strspn((char *)g127, " \t"); // 0x7a14
  7294.     int32_t str2 = str; // R4
  7295.     char v4 = *(char *)str; // 0x7a14
  7296.     g3 = v4 == 0;
  7297.     int32_t mem2; // 0x7abc_5
  7298.     if (v4 == 0) {
  7299.         // 0x7aa8
  7300.         g135 = 0;
  7301.         // branch -> 0x7ab0
  7302.     } else {
  7303.         int32_t v5 = 0; // R9
  7304.         g135 = 0;
  7305.         g138 = (int32_t)" \t";
  7306.         int32_t reject = (int32_t)" \t"; // 0x7a34
  7307.         // branch -> 0x7a30
  7308.         while (true) {
  7309.             int32_t v6 = v5 + 1; // 0x7a3c
  7310.             int32_t v7 = v6; // R10
  7311.             int32_t ini_seg_bytes = strcspn((char *)str, (char *)reject); // R7
  7312.             g135 = (int32_t)realloc((char *)g135, 4 * v6);
  7313.             char * mem = malloc(ini_seg_bytes + 1); // 0x7a58
  7314.             int32_t v8 = (int32_t)mem; // 0x7a58_3
  7315.             g132 = ini_seg_bytes;
  7316.             *(int32_t *)(4 * v5 + g135) = v8;
  7317.             __aeabi_memcpy(mem, (char *)str2, ini_seg_bytes);
  7318.             str2 += ini_seg_bytes;
  7319.             *(char *)(v8 + ini_seg_bytes) = 0;
  7320.             int32_t v9 = str2 + strspn((char *)str2, (char *)g138); // 0x7a88
  7321.             str2 = v9;
  7322.             char v10 = *(char *)v9; // 0x7a88
  7323.             int32_t v11 = v7; // 0x7a8c
  7324.             v5 = v11;
  7325.             g3 = v10 == 0;
  7326.             if (v10 == 0) {
  7327.                 // 0x7ab0
  7328.                 // branch -> 0x7ab0
  7329.                 // 0x7ab0
  7330.                 mem2 = (int32_t)realloc((char *)g135, 4 * v11 + 4);
  7331.                 g127 = mem2;
  7332.                 g128 = 0;
  7333.                 *(int32_t *)(4 * v7 + mem2) = 0;
  7334.                 g135 = v1;
  7335.                 g138 = v2;
  7336.                 g130 = v3;
  7337.                 return mem2;
  7338.             }
  7339.             // 0x7a30
  7340.             reject = g138;
  7341.             str = v9;
  7342.             // branch -> 0x7a30
  7343.         }
  7344.     }
  7345.     // 0x7ab0
  7346.     mem2 = (int32_t)realloc((char *)0, 4);
  7347.     g127 = mem2;
  7348.     g128 = 0;
  7349.     *(int32_t *)mem2 = 0;
  7350.     g135 = v1;
  7351.     g138 = v2;
  7352.     g130 = v3;
  7353.     return mem2;
  7354. }
  7355.  
  7356. // Address range: 0x7ad8 - 0x7ae7
  7357. int32_t string_array_size(int32_t * a1) {
  7358.     int32_t v1 = *a1; // 0x7ad8
  7359.     g128 = v1;
  7360.     if (v1 == 0) {
  7361.         // if_7ae0_0_true
  7362.         return 0;
  7363.     }
  7364.     // after_ret_cond_7ae4_0
  7365.     return (int32_t)a1;
  7366. }
  7367.  
  7368. // Address range: 0x7ae8 - 0x7b03
  7369. int32_t function_7ae8(int32_t a1) {
  7370.     int32_t v1 = 0; // 0x7af0
  7371.     int32_t result = v1 + 1; // 0x7af4
  7372.     // branch -> 0x7af0
  7373.     while (*(int32_t *)(4 * v1 + a1 + 4) != 0) {
  7374.         // 0x7af0
  7375.         v1 = result;
  7376.         result = v1 + 1;
  7377.         // continue -> 0x7af0
  7378.     }
  7379.     // 0x7b00
  7380.     g3 = true;
  7381.     return result;
  7382. }
  7383.  
  7384. // Address range: 0x7b04 - 0x7b43
  7385. int32_t destroy_string_array(char * a1, int32_t a2, int32_t a3, int32_t a4) {
  7386.     int32_t result = (int32_t)a1;
  7387.     g128 = a2;
  7388.     g132 = a3;
  7389.     g133 = a4;
  7390.     int32_t v1 = g134; // 0x7b04
  7391.     int32_t v2 = g135; // 0x7b04
  7392.     int32_t v3 = g130; // 0x7b04
  7393.     int32_t v4 = v3; // bp-8
  7394.     g130 = &v4;
  7395.     g134 = result;
  7396.     g1 = true;
  7397.     g3 = a1 == NULL;
  7398.     if (a1 == NULL) {
  7399.         // if_7b14_0_true
  7400.         g134 = v1;
  7401.         g135 = v2;
  7402.         g130 = v3;
  7403.         return result;
  7404.     }
  7405.     int32_t result2 = *(int32_t *)a1; // 0x7b18
  7406.     g1 = true;
  7407.     g3 = result2 == 0;
  7408.     if (result2 != 0) {
  7409.         // 0x7b24
  7410.         g135 = result + 4;
  7411.         free((char *)result2);
  7412.         return result2;
  7413.     }
  7414.     // 0x7b38
  7415.     int32_t v5;
  7416.     g134 = v5;
  7417.     int32_t v6;
  7418.     g135 = v6;
  7419.     int32_t v7;
  7420.     g130 = v7;
  7421.     int32_t v8;
  7422.     g126 = v8;
  7423.     free(a1);
  7424.     return result;
  7425. }
  7426.  
  7427. // Address range: 0x7b44 - 0x7b6b
  7428. int32_t find_first_non_space(char * str) {
  7429.     // 0x7b44
  7430.     return (int32_t)str + strspn(str, " \t");
  7431. }
  7432.  
  7433. // Address range: 0x7b6c - 0x7c33
  7434. int32_t generate_initial_indented_line(int32_t * a1, int32_t * a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7) {
  7435.     // 0x7b6c
  7436.     g132 = a3;
  7437.     g133 = a4;
  7438.     int32_t v1 = g134; // bp-24
  7439.     int32_t v2 = g135; // 0x7b6c
  7440.     int32_t v3 = g136; // 0x7b6c
  7441.     int32_t v4 = g137; // 0x7b6c
  7442.     int32_t v5 = g130; // bp-8
  7443.     g135 = (int32_t)a1;
  7444.     g137 = (int32_t)a2;
  7445.     uint32_t v6 = *(int32_t *)&g44 / 2 % 16; // 0x7b88
  7446.     int32_t v7 = v6; // 0x7bbc
  7447.     if (v6 >= 10) {
  7448.         int32_t mem = (int32_t)malloc(2); // 0x7b98_3
  7449.         g127 = mem;
  7450.         int32_t v8 = g137; // 0x7b9c
  7451.         g1 = true;
  7452.         g2 = v8 < 0;
  7453.         g3 = v8 == 0;
  7454.         g128 = 9;
  7455.         *(int32_t *)g135 = mem;
  7456.         *(int16_t *)g127 = 9;
  7457.         if (v8 != 0) {
  7458.             // if_7bb4_0_true
  7459.             *(int32_t *)g137 = 1;
  7460.             g134 = v1;
  7461.             g135 = v2;
  7462.             g136 = v3;
  7463.             g137 = v4;
  7464.             g130 = v5;
  7465.             return 1;
  7466.         }
  7467.         // after_if_7bb4_0
  7468.         g134 = a5;
  7469.         g135 = a6;
  7470.         g136 = a7;
  7471.         int32_t v9;
  7472.         g137 = v9;
  7473.         int32_t v10;
  7474.         g130 = v10;
  7475.         int32_t v11;
  7476.         ((int32_t (*)())v11)();
  7477.         v7 = g127;
  7478.         // branch -> 0x7bbc
  7479.     }
  7480.     int32_t mem2 = (int32_t)malloc((v7 + 1) % 256); // 0x7bc4_3
  7481.     g131 = 0;
  7482.     *(int32_t *)g135 = mem2;
  7483.     int32_t v12 = 0; // R2
  7484.     if ((0x1000000 * *(int32_t *)&g44 / 0x1000000 & 30) == 0) {
  7485.         // 0x7bbc
  7486.         // branch -> 0x7c18
  7487.     } else {
  7488.         // 0x7be8
  7489.         g133 = 32;
  7490.         char v13 = 32;
  7491.         int32_t v14 = mem2; // 0x7bf4
  7492.         // branch -> 0x7bf4
  7493.         while (true) {
  7494.             // 0x7bf4
  7495.             *(char *)v14 = v13;
  7496.             int32_t v15 = v12 + 1; // 0x7bf8
  7497.             v12 = v15;
  7498.             int32_t result = *(int32_t *)g135 + v15; // 0x7c08
  7499.             if (v15 >= (int32_t)*(char *)&g44 / 2 % 16) {
  7500.                 // 0x7c14
  7501.                 // branch -> 0x7c18
  7502.                 // 0x7c18
  7503.                 *(char *)result = (char)g131;
  7504.                 if (g137 != 0) {
  7505.                     // if_7c20_0_true
  7506.                     *(int32_t *)g137 = v12;
  7507.                     // branch -> after_if_7c20_0
  7508.                 }
  7509.                 // after_if_7c20_0
  7510.                 g134 = v1;
  7511.                 g135 = v2;
  7512.                 g136 = v3;
  7513.                 g137 = v4;
  7514.                 g130 = v5;
  7515.                 return result;
  7516.             }
  7517.             // 0x7bf4
  7518.             v13 = g133;
  7519.             v14 = result;
  7520.             // branch -> 0x7bf4
  7521.         }
  7522.     }
  7523.     // 0x7c18
  7524.     *(char *)mem2 = (char)g131;
  7525.     if (g137 != 0) {
  7526.         // if_7c20_0_true
  7527.         *(int32_t *)g137 = v12;
  7528.         // branch -> after_if_7c20_0
  7529.     }
  7530.     // after_if_7c20_0
  7531.     g134 = v1;
  7532.     g135 = v2;
  7533.     g136 = v3;
  7534.     g137 = v4;
  7535.     g130 = v5;
  7536.     return mem2;
  7537. }
  7538.  
  7539. // Address range: 0x7c34 - 0x7d1f
  7540. int32_t load_symbols(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
  7541.     int32_t v1 = g135; // 0x7c34
  7542.     int32_t v2 = g130; // bp-8
  7543.     g130 = &v2;
  7544.     printf("ELF file: ");
  7545.     int32_t result2 = read_line((struct _IO_FILE *)g33); // 0x7c54
  7546.     g135 = result2;
  7547.     char * v3 = (char *)result2; // 0x7c5c_0
  7548.     if (*v3 != 0) {
  7549.         // 0x7c68
  7550.         int32_t v4;
  7551.         g132 = &v4;
  7552.         int32_t v5;
  7553.         g128 = &v5;
  7554.         g127 = result2;
  7555.         int32_t result = (int32_t)read_symbols_from_ELF(); // 0x7c74_1
  7556.         g127 = result;
  7557.         return result;
  7558.     }
  7559.     // 0x7c9c
  7560.     g127 = result2;
  7561.     g135 = v1;
  7562.     g130 = v2;
  7563.     free(v3);
  7564.     return result2;
  7565. }
  7566.  
  7567. // Address range: 0x7d20 - 0x7d33
  7568. int32_t unload_symbols(void) {
  7569.     // 0x7d20
  7570.     g127 = g24;
  7571.     g3 = g24 == 0;
  7572.     return g24;
  7573. }
  7574.  
  7575. // Address range: 0x7d34 - 0x7d73
  7576. int32_t function_7d34(int32_t a1) {
  7577.     int32_t v1 = g134; // 0x7d34
  7578.     int32_t v2 = g130; // bp-8
  7579.     g130 = &v2;
  7580.     int32_t v3 = *(int32_t *)&g31; // 0x7d40
  7581.     g134 = v3;
  7582.     destroy_ELF_symbols((char *)a1, v3);
  7583.     *(int32_t *)g134 = 0;
  7584.     *(int32_t *)g24 = 0;
  7585.     g134 = v1;
  7586.     return g24;
  7587. }
  7588.  
  7589. // Address range: 0x7d74 - 0x7eff
  7590. int32_t find_symbol_for_address(uint32_t a1) {
  7591.     int32_t v1 = g135; // 0x7d74
  7592.     int32_t v2 = g130; // 0x7d74
  7593.     uint32_t v3 = *(int32_t *)&g31; // 0x7d80
  7594.     g131 = v3;
  7595.     g3 = v3 == 0;
  7596.     if (v3 == 0) {
  7597.         // 0x7df0
  7598.         g135 = v1;
  7599.         g130 = v2;
  7600.         return 0;
  7601.     }
  7602.     int32_t v4 = g24;
  7603.     g126 = v4;
  7604.     unsigned char v5;
  7605.     int32_t v6; // 0x7e40
  7606.     int32_t v7; // 0x7e50
  7607.     int32_t v8; // 0x7e5c
  7608.     int32_t v9; // 0x7ed0
  7609.     int32_t result; // 0x7ed4
  7610.     int32_t result3; // 0x7ee4
  7611.     int32_t v10; // 0x7e44
  7612.     char v11; // 0x7e7c
  7613.     unsigned char v12; // 0x7e80
  7614.     char v13; // 0x7e9c
  7615.     uint32_t v14; // 0x7ec0
  7616.     int32_t result2; // 0x7e90
  7617.     uint32_t v15; // 0x7ec4
  7618.     int32_t result4; // 0x7e40
  7619.     if (v3 == 1) {
  7620.         v6 = 0;
  7621.         // 0x7e40
  7622.         result4 = *(int32_t *)(4 * v6 + v4);
  7623.         v10 = *(int32_t *)result4;
  7624.         if (v10 != a1) {
  7625.             // 0x7e9c
  7626.             v13 = *(char *)(result4 + 8);
  7627.             g3 = v13 == 1;
  7628.             result = 0;
  7629.             if (v13 == 1) {
  7630.                 // 0x7eac
  7631.                 v5 = (char)*(int32_t *)&g44;
  7632.                 g3 = v5 == 0;
  7633.                 if (v5 <= 255) {
  7634.                     // 0x7ec0
  7635.                     v14 = *(int32_t *)(result4 + 4);
  7636.                     v15 = a1 - v10;
  7637.                     g3 = v15 == v14;
  7638.                     v9 = result4;
  7639.                     if (v15 < v14) {
  7640.                         // if_7ecc_0_true
  7641.                         v9 = 0;
  7642.                         // branch -> after_if_7ecc_0
  7643.                     }
  7644.                     // after_if_7ecc_0
  7645.                     result = v9;
  7646.                     // branch -> 0x7ed4
  7647.                 } else {
  7648.                     result = 0;
  7649.                 }
  7650.             }
  7651.             // 0x7ed4
  7652.             g135 = v1;
  7653.             g130 = v2;
  7654.             return result;
  7655.         }
  7656.         v8 = v6;
  7657.         v7 = result4;
  7658.         while (true) {
  7659.             // 0x7e50
  7660.             result2 = v7;
  7661.             if (v8 >= v3) {
  7662.               lab_0x7e5c_2:;
  7663.                 int32_t v16 = *(int32_t *)(4 * v8 + v4 + 4); // 0x7e64
  7664.                 if (*(int32_t *)v16 != a1) {
  7665.                     result2 = v7;
  7666.                     // break -> 0x7e7c
  7667.                     break;
  7668.                 }
  7669.                 v8++;
  7670.                 v7 = v16;
  7671.                 // continue -> 0x7e50
  7672.                 continue;
  7673.             }
  7674.             // 0x7e7c
  7675.             v11 = *(char *)(result2 + 8);
  7676.             v12 = *(char *)*(int32_t *)&g44;
  7677.             g3 = v11 == 2;
  7678.             if (v11 == 2) {
  7679.                 // 0x7e8c
  7680.                 g135 = v1;
  7681.                 g130 = v2;
  7682.                 return 0x4000000 * (int32_t)v12 >> 31 & result2;
  7683.             }
  7684.             // 0x7edc
  7685.             g3 = v12 == 63;
  7686.             if (v12 < 64) {
  7687.                 // if_7ee0_0_true
  7688.                 // branch -> after_if_7ee0_0
  7689.                 // after_if_7ee0_0
  7690.                 g135 = v1;
  7691.                 g130 = v2;
  7692.                 return 0;
  7693.             }
  7694.             // after_if_7ee0_0
  7695.             g135 = v1;
  7696.             g130 = v2;
  7697.             return result2;
  7698.         }
  7699.         // 0x7e7c
  7700.         v11 = *(char *)(result2 + 8);
  7701.         v12 = *(char *)*(int32_t *)&g44;
  7702.         g3 = v11 == 2;
  7703.         if (v11 == 2) {
  7704.             // 0x7e8c
  7705.             g135 = v1;
  7706.             g130 = v2;
  7707.             return 0x4000000 * (int32_t)v12 >> 31 & result2;
  7708.         }
  7709.         // 0x7edc
  7710.         g3 = v12 == 63;
  7711.         result3 = result2;
  7712.         if (v12 < 64) {
  7713.             // if_7ee0_0_true
  7714.             result3 = 0;
  7715.             // branch -> after_if_7ee0_0
  7716.         }
  7717.         // after_if_7ee0_0
  7718.         g135 = v1;
  7719.         g130 = v2;
  7720.         return result3;
  7721.     }
  7722.     int32_t v17 = &g30; // 0x7db032
  7723.     int32_t v18 = 0; // 0x7dfc
  7724.   lab_0x7da8:
  7725.     while (true) {
  7726.         int32_t v19 = v17; // 0x7dfc
  7727.         // branch -> 0x7db0
  7728.         while (true) {
  7729.             uint32_t v20 = (v19 + v18 + 1) / 2; // 0x7db4
  7730.             int32_t v21 = *(int32_t *)(4 * v20 + v4); // 0x7db8
  7731.             g135 = v21;
  7732.             uint32_t v22 = *(int32_t *)v21; // 0x7dbc
  7733.             if (v22 == a1) {
  7734.                 int32_t v23 = v20 + 1; // 0x7e1c
  7735.                 // branch -> 0x7e0c
  7736.                 while (true) {
  7737.                     // 0x7e0c
  7738.                     if (v23 - 1 >= v3) {
  7739.                         int32_t v24 = *(int32_t *)(4 * v23 + v4); // 0x7e1c
  7740.                         g135 = v24;
  7741.                         if (*(int32_t *)v24 != a1) {
  7742.                             result2 = v21;
  7743.                             // break -> 0x7e7c
  7744.                             break;
  7745.                         }
  7746.                         v21 = v24;
  7747.                         v23++;
  7748.                         // continue -> 0x7e0c
  7749.                         continue;
  7750.                     } else {
  7751.                         result2 = v21;
  7752.                     }
  7753.                 }
  7754.                 // 0x7e7c
  7755.                 v11 = *(char *)(result2 + 8);
  7756.                 v12 = *(char *)*(int32_t *)&g44;
  7757.                 g3 = v11 == 2;
  7758.                 if (v11 == 2) {
  7759.                     // 0x7e8c
  7760.                     g135 = v1;
  7761.                     g130 = v2;
  7762.                     return 0x4000000 * (int32_t)v12 >> 31 & result2;
  7763.                 }
  7764.                 // 0x7edc
  7765.                 g3 = v12 == 63;
  7766.                 if (v12 < 64) {
  7767.                     // if_7ee0_0_true
  7768.                     // branch -> after_if_7ee0_0
  7769.                     // after_if_7ee0_0
  7770.                     g135 = v1;
  7771.                     g130 = v2;
  7772.                     return 0;
  7773.                 }
  7774.                 // after_if_7ee0_0
  7775.                 g135 = v1;
  7776.                 g130 = v2;
  7777.                 return result2;
  7778.             }
  7779.             // 0x7dc8
  7780.             if (v22 > a1) {
  7781.                 // 0x7dcc
  7782.                 if (v20 <= v18) {
  7783.                     // 0x7df0
  7784.                     g3 = v20 == v18;
  7785.                     // branch -> 0x7df0
  7786.                     // 0x7df0
  7787.                     g135 = v1;
  7788.                     g130 = v2;
  7789.                     return 0;
  7790.                 }
  7791.                 int32_t v25 = v20 - 1; // 0x7dd4
  7792.                 if (v18 >= v25) {
  7793.                     // break -> 0x7e3c
  7794.                     break;
  7795.                 }
  7796.                 v19 = v25;
  7797.                 // continue -> 0x7db0
  7798.                 continue;
  7799.             } else {
  7800.                 // 0x7de4
  7801.                 if (v20 >= v19) {
  7802.                     v6 = v20;
  7803.                     // break (via goto) -> 0x7e40
  7804.                     goto lab_0x7e40;
  7805.                 }
  7806.                 v17 = v19;
  7807.                 v18 = v20;
  7808.                 // continue (via goto) -> 0x7da8
  7809.                 goto lab_0x7da8;
  7810.             }
  7811.           lab_0x7e40:
  7812.             // 0x7e40
  7813.             result4 = *(int32_t *)(4 * v6 + v4);
  7814.             v10 = *(int32_t *)result4;
  7815.             if (v10 != a1) {
  7816.                 // 0x7e9c
  7817.                 v13 = *(char *)(result4 + 8);
  7818.                 g3 = v13 == 1;
  7819.                 if (v13 == 1) {
  7820.                     // 0x7eac
  7821.                     v5 = (char)*(int32_t *)&g44;
  7822.                     g3 = v5 == 0;
  7823.                     if (v5 <= 255) {
  7824.                         // 0x7ec0
  7825.                         v14 = *(int32_t *)(result4 + 4);
  7826.                         v15 = a1 - v10;
  7827.                         g3 = v15 == v14;
  7828.                         if (v15 < v14) {
  7829.                             // if_7ecc_0_true
  7830.                             // branch -> after_if_7ecc_0
  7831.                             // after_if_7ecc_0
  7832.                             // branch -> 0x7ed4
  7833.                             // 0x7ed4
  7834.                             g135 = v1;
  7835.                             g130 = v2;
  7836.                             return 0;
  7837.                         }
  7838.                         // after_if_7ecc_0
  7839.                         // branch -> 0x7ed4
  7840.                         // 0x7ed4
  7841.                         g135 = v1;
  7842.                         g130 = v2;
  7843.                         return result4;
  7844.                     }
  7845.                 }
  7846.                 // 0x7ed4
  7847.                 g135 = v1;
  7848.                 g130 = v2;
  7849.                 return 0;
  7850.             }
  7851.             v8 = v6;
  7852.             v7 = result4;
  7853.             while (true) {
  7854.                 // 0x7e50
  7855.                 if (v8 >= v3) {
  7856.                     goto lab_0x7e5c_2;
  7857.                 }
  7858.                 result2 = v7;
  7859.                 // 0x7e7c
  7860.                 v11 = *(char *)(result2 + 8);
  7861.                 v12 = *(char *)*(int32_t *)&g44;
  7862.                 g3 = v11 == 2;
  7863.                 if (v11 == 2) {
  7864.                     // 0x7e8c
  7865.                     g135 = v1;
  7866.                     g130 = v2;
  7867.                     return 0x4000000 * (int32_t)v12 >> 31 & result2;
  7868.                 }
  7869.                 // 0x7edc
  7870.                 g3 = v12 == 63;
  7871.                 if (v12 < 64) {
  7872.                     // if_7ee0_0_true
  7873.                     // branch -> after_if_7ee0_0
  7874.                     // after_if_7ee0_0
  7875.                     g135 = v1;
  7876.                     g130 = v2;
  7877.                     return 0;
  7878.                 }
  7879.                 // after_if_7ee0_0
  7880.                 g135 = v1;
  7881.                 g130 = v2;
  7882.                 return result2;
  7883.             }
  7884.             // 0x7e40
  7885.             result4 = *(int32_t *)(4 * v6 + v4);
  7886.             v10 = *(int32_t *)result4;
  7887.             if (v10 != a1) {
  7888.                 // 0x7e9c
  7889.                 v13 = *(char *)(result4 + 8);
  7890.                 g3 = v13 == 1;
  7891.                 result = 0;
  7892.                 if (v13 == 1) {
  7893.                     int32_t v26 = *(int32_t *)&g44; // 0x7eb0
  7894.                     v5 = (char)v26;
  7895.                     g3 = v5 == 0;
  7896.                     if (v5 <= 255) {
  7897.                         // 0x7ec0
  7898.                         v14 = *(int32_t *)(result4 + 4);
  7899.                         v15 = a1 - v10;
  7900.                         g3 = v15 == v14;
  7901.                         v9 = result4;
  7902.                         if (v15 >= v14) {
  7903.                             // after_if_7ecc_0
  7904.                             result = v9;
  7905.                             // branch -> 0x7ed4
  7906.                             // 0x7ed4
  7907.                             g135 = v1;
  7908.                             g130 = v2;
  7909.                             return result;
  7910.                         }
  7911.                         // if_7ecc_0_true
  7912.                         v9 = 0;
  7913.                         // branch -> after_if_7ecc_0
  7914.                         // after_if_7ecc_0
  7915.                         result = v9;
  7916.                         // branch -> 0x7ed4
  7917.                         // 0x7ed4
  7918.                         g135 = v1;
  7919.                         g130 = v2;
  7920.                         return result;
  7921.                     }
  7922.                     result = 0;
  7923.                 }
  7924.                 // 0x7ed4
  7925.                 g135 = v1;
  7926.                 g130 = v2;
  7927.                 return result;
  7928.             }
  7929.             v8 = v6;
  7930.             v7 = result4;
  7931.             int32_t v27;
  7932.             int32_t v28; // 0x7e80
  7933.             while (true) {
  7934.                 // 0x7e50
  7935.                 if (v8 >= v3) {
  7936.                     goto lab_0x7e5c_2;
  7937.                 }
  7938.                 result2 = v7;
  7939.                 // 0x7e7c
  7940.                 v27 = *(int32_t *)&g44;
  7941.                 v11 = *(char *)(result2 + 8);
  7942.                 v12 = *(char *)v27;
  7943.                 v28 = v12;
  7944.                 g3 = v11 == 2;
  7945.                 if (v11 == 2) {
  7946.                     // 0x7e8c
  7947.                     g135 = v1;
  7948.                     g130 = v2;
  7949.                     return 0x4000000 * v28 >> 31 & result2;
  7950.                 }
  7951.                 // 0x7edc
  7952.                 g3 = v12 == 63;
  7953.                 result3 = result2;
  7954.                 if (v12 >= 64) {
  7955.                     // after_if_7ee0_0
  7956.                     g135 = v1;
  7957.                     g130 = v2;
  7958.                     return result3;
  7959.                 }
  7960.                 // if_7ee0_0_true
  7961.                 result3 = 0;
  7962.                 // branch -> after_if_7ee0_0
  7963.                 // after_if_7ee0_0
  7964.                 g135 = v1;
  7965.                 g130 = v2;
  7966.                 return result3;
  7967.             }
  7968.             // 0x7e7c
  7969.             v27 = *(int32_t *)&g44;
  7970.             v11 = *(char *)(result2 + 8);
  7971.             v12 = *(char *)v27;
  7972.             v28 = v12;
  7973.             g3 = v11 == 2;
  7974.             if (v11 == 2) {
  7975.                 // 0x7e8c
  7976.                 g135 = v1;
  7977.                 g130 = v2;
  7978.                 return 0x4000000 * v28 >> 31 & result2;
  7979.             }
  7980.             // 0x7edc
  7981.             g3 = v12 == 63;
  7982.             result3 = result2;
  7983.             if (v12 >= 64) {
  7984.                 // after_if_7ee0_0
  7985.                 g135 = v1;
  7986.                 g130 = v2;
  7987.                 return result3;
  7988.             }
  7989.             // if_7ee0_0_true
  7990.             result3 = 0;
  7991.             // branch -> after_if_7ee0_0
  7992.             // after_if_7ee0_0
  7993.             g135 = v1;
  7994.             g130 = v2;
  7995.             return result3;
  7996.         }
  7997.     }
  7998. }
  7999.  
  8000. // Address range: 0x7f00 - 0x7f83
  8001. int32_t check_exact_symbol_match(int32_t a1, int32_t a2, int32_t a3) {
  8002.     // 0x7f00
  8003.     int32_t v1;
  8004.     int32_t (*v2)() = (int32_t (*)())v1;
  8005.     int32_t v3 = g130; // 0x7f00
  8006.     int32_t v4 = g24;
  8007.     int32_t v5 = *(int32_t *)&g31; // 0x7f18
  8008.     g133 = v5;
  8009.     g126 = v4;
  8010.     g131 = v5;
  8011.     // branch -> 0x7f24
  8012.     int32_t v6;
  8013.     int32_t v7;
  8014.     int32_t v8; // 0x7f80
  8015.     uint32_t v9; // 0x7f7c
  8016.     unsigned char v10; // 0x7f50
  8017.     int32_t v11; // 0x7f5c
  8018.     int32_t v12; // 0x7f24
  8019.     int32_t v13; // 0x7f54
  8020.     int32_t result; // 0x7f64
  8021.     while (true) {
  8022.         int32_t v14 = 4 * a1 + v4; // 0x7f24
  8023.         v12 = *(int32_t *)v14;
  8024.         g127 = v12;
  8025.         if (a1 >= v5) {
  8026.             int32_t v15 = *(int32_t *)*(int32_t *)(v14 + 4); // 0x7f40
  8027.             g133 = v15;
  8028.             if (*(int32_t *)v12 != v15) {
  8029.                 // break -> 0x7f4c
  8030.                 break;
  8031.             }
  8032.             a1++;
  8033.             // continue -> 0x7f24
  8034.             continue;
  8035.         }
  8036.         // 0x7f4c
  8037.         v10 = *(char *)(v12 + 8);
  8038.         g132 = v10;
  8039.         v13 = *(int32_t *)&g44;
  8040.         g1 = v10 > 1;
  8041.         g3 = v10 == 2;
  8042.         v6 = 0x1000000 * v13;
  8043.         v11 = v6 / 0x1000000;
  8044.         g128 = v11;
  8045.         if (v10 == 2) {
  8046.             // if_7f68_0_true
  8047.             result = 0x4000000 * v13 >> 31 & v12;
  8048.             g127 = result;
  8049.             g130 = v3;
  8050.             return result;
  8051.         }
  8052.         // after_if_7f68_0
  8053.         g1 = v11 > 62;
  8054.         g2 = v6 < 0x3f000000;
  8055.         g3 = v6 == 0x3f000000;
  8056.         if (v11 < 64) {
  8057.             // if_7f70_0_true
  8058.             g127 = 0;
  8059.             // branch -> after_if_7f70_0
  8060.         }
  8061.         // after_if_7f70_0
  8062.         g130 = v7;
  8063.         v2();
  8064.         v9 = g132 % 256;
  8065.         if (g3) {
  8066.             // if_7f80_0_true
  8067.             v8 = g138;
  8068.             g136 = (v9 == 0 ? v8 : v9 < 32 ? v8 << v9 : 0) & g128;
  8069.             // branch -> after_if_7f80_0
  8070.             // after_if_7f80_0
  8071.             return g127;
  8072.         }
  8073.         // after_if_7f80_0
  8074.         return g127;
  8075.     }
  8076.     // 0x7f4c
  8077.     v10 = *(char *)(v12 + 8);
  8078.     g132 = v10;
  8079.     v13 = *(int32_t *)&g44;
  8080.     g1 = v10 > 1;
  8081.     g3 = v10 == 2;
  8082.     v6 = 0x1000000 * v13;
  8083.     v11 = v6 / 0x1000000;
  8084.     g128 = v11;
  8085.     if (v10 == 2) {
  8086.         // if_7f68_0_true
  8087.         result = 0x4000000 * v13 >> 31 & v12;
  8088.         g127 = result;
  8089.         g130 = v3;
  8090.         return result;
  8091.     }
  8092.     // after_if_7f68_0
  8093.     g1 = v11 > 62;
  8094.     g2 = v6 < 0x3f000000;
  8095.     g3 = v6 == 0x3f000000;
  8096.     if (v11 < 64) {
  8097.         // if_7f70_0_true
  8098.         g127 = 0;
  8099.         // branch -> after_if_7f70_0
  8100.     }
  8101.     // after_if_7f70_0
  8102.     g130 = v7;
  8103.     v2();
  8104.     v9 = g132 % 256;
  8105.     if (g3) {
  8106.         // if_7f80_0_true
  8107.         v8 = g138;
  8108.         g136 = (v9 == 0 ? v8 : v9 < 32 ? v8 << v9 : 0) & g128;
  8109.         // branch -> after_if_7f80_0
  8110.     }
  8111.     // after_if_7f80_0
  8112.     return g127;
  8113. }
  8114.  
  8115. // Address range: 0x7f84 - 0x8047
  8116. int32_t script_transform_append(char a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t (*a12)(int32_t), int32_t a13, int32_t a14, int32_t a15, int32_t a16, int32_t a17, int32_t a18) {
  8117.     int32_t v1 = g135; // 0x7f84
  8118.     int32_t v2 = g138; // 0x7f84
  8119.     int32_t v3 = (int32_t)a5; // R4
  8120.     g135 = a2;
  8121.     int32_t size = a2 + 1; // 0x7f98
  8122.     g138 = a4;
  8123.     *a5 = a1;
  8124.     int32_t v4 = (int32_t)a1 % 256; // 0x7fac
  8125.     *(int32_t *)(v3 + 4) = size;
  8126.     *(int32_t *)(v3 + 8) = 0;
  8127.     if (v4 == 7) {
  8128.         // 0x7fe8
  8129.         return (int32_t)malloc(4 * size);
  8130.     }
  8131.     // 0x7fbc
  8132.     if (v4 == 6) {
  8133.         // 0x8008
  8134.         return (int32_t)malloc(2 * size);
  8135.     }
  8136.     // 0x7fc4
  8137.     if (v4 == 5) {
  8138.         // 0x7fcc
  8139.         return (int32_t)malloc(size);
  8140.     }
  8141.     // 0x8034
  8142.     g127 = (int32_t)"type mismatch";
  8143.     g135 = v1;
  8144.     g138 = v2;
  8145.     return duplicate_string();
  8146. }
  8147.  
  8148. // Address range: 0x8048 - 0x8113
  8149. int32_t script_transform_prepend(char a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t (*a12)(int32_t), int32_t a13, int32_t a14, int32_t a15, int32_t a16, int32_t a17, int32_t a18) {
  8150.     int32_t v1 = g135; // 0x8048
  8151.     int32_t v2 = g138; // 0x8048
  8152.     int32_t v3 = (int32_t)a5; // R4
  8153.     int32_t size = a2 + 1; // 0x805c
  8154.     g135 = a3;
  8155.     g138 = a4;
  8156.     *a5 = a1;
  8157.     int32_t v4 = (int32_t)a1 % 256; // 0x8070
  8158.     *(int32_t *)(v3 + 4) = size;
  8159.     *(int32_t *)(v3 + 8) = 0;
  8160.     if (v4 == 7) {
  8161.         // 0x80b0
  8162.         return (int32_t)malloc(4 * size);
  8163.     }
  8164.     // 0x8080
  8165.     if (v4 == 6) {
  8166.         // 0x80d4
  8167.         return (int32_t)malloc(2 * size);
  8168.     }
  8169.     // 0x8088
  8170.     if (v4 == 5) {
  8171.         // 0x8090
  8172.         return (int32_t)malloc(size);
  8173.     }
  8174.     // 0x8100
  8175.     g127 = (int32_t)"type mismatch";
  8176.     g135 = v1;
  8177.     g138 = v2;
  8178.     return duplicate_string();
  8179. }
  8180.  
  8181. // Address range: 0x8114 - 0x81c7
  8182. int32_t script_transform_rotate(char a1, int32_t a2, char * a3, uint32_t a4) {
  8183.     int32_t v1 = g135; // 0x8114
  8184.     int32_t v2 = g138; // 0x8114
  8185.     g135 = a2;
  8186.     g138 = (int32_t)a3;
  8187.     int32_t v3;
  8188.     *(char *)v3 = a1;
  8189.     *(int32_t *)(v3 + 4) = g135;
  8190.     *(int32_t *)(v3 + 8) = 0;
  8191.     uint32_t v4 = (int32_t)a1 % 256; // 0x8140
  8192.     if (v4 <= 4) {
  8193.         // 0x814c
  8194.         g127 = (int32_t)"type mismatch";
  8195.         g135 = v1;
  8196.         g138 = v2;
  8197.         return duplicate_string();
  8198.     }
  8199.     uint32_t v5 = g135; // 0x8160
  8200.     int32_t v6 = a4 % v5;
  8201.     int32_t v7 = 1; // R6
  8202.     int32_t v8 = v6; // R7
  8203.     int32_t v9; // 0x8188
  8204.     if (v4 == 6) {
  8205.         // after_if_8178_0.thread
  8206.         v7 = 2;
  8207.         v9 = 2;
  8208.         // branch -> after_if_8180_0
  8209.     } else {
  8210.         // after_if_8178_0
  8211.         if (v4 == 7) {
  8212.             // if_8180_0_true
  8213.             v7 = 4;
  8214.             v9 = 4;
  8215.             // branch -> after_if_8180_0
  8216.         } else {
  8217.             v9 = 1;
  8218.         }
  8219.     }
  8220.     // after_if_8180_0
  8221.     if (v6 < 0) {
  8222.         // if_818c_0_true
  8223.         v8 = v6 + v5;
  8224.         // branch -> after_if_818c_0
  8225.     }
  8226.     char * mem = malloc(v9 * v5); // 0x8190
  8227.     int32_t v10 = g135 - v8; // 0x8194
  8228.     g135 = v10;
  8229.     int32_t v11 = (int32_t)mem; // R9
  8230.     __aeabi_memcpy(mem, (char *)(g138 + v7 * v8), v7 * v10);
  8231.     __aeabi_memcpy((char *)(v11 + g135 * v7), (char *)g138, v7 * v8);
  8232.     *(int32_t *)(v3 + 8) = v11;
  8233.     g135 = v1;
  8234.     g138 = v2;
  8235.     return 0;
  8236. }
  8237.  
  8238. // Address range: 0x81c8 - 0x827b
  8239. int32_t script_transform_rotateback(char a1, int32_t a2, char * a3, int32_t a4) {
  8240.     int32_t v1 = g135; // 0x81c8
  8241.     int32_t v2 = g138; // 0x81c8
  8242.     g135 = a2;
  8243.     g138 = (int32_t)a3;
  8244.     int32_t v3;
  8245.     *(char *)v3 = a1;
  8246.     *(int32_t *)(v3 + 4) = g135;
  8247.     *(int32_t *)(v3 + 8) = 0;
  8248.     uint32_t v4 = (int32_t)a1 % 256; // 0x81f4
  8249.     if (v4 <= 4) {
  8250.         // 0x8200
  8251.         g127 = (int32_t)"type mismatch";
  8252.         g135 = v1;
  8253.         g138 = v2;
  8254.         return duplicate_string();
  8255.     }
  8256.     uint32_t v5 = g135; // 0x8214
  8257.     int32_t v6 = -a4 % v5;
  8258.     int32_t v7 = 1; // R6
  8259.     int32_t v8 = v6; // R7
  8260.     int32_t v9; // 0x823c
  8261.     if (v4 == 6) {
  8262.         // after_if_822c_0.thread
  8263.         v7 = 2;
  8264.         v9 = 2;
  8265.         // branch -> after_if_8234_0
  8266.     } else {
  8267.         // after_if_822c_0
  8268.         if (v4 == 7) {
  8269.             // if_8234_0_true
  8270.             v7 = 4;
  8271.             v9 = 4;
  8272.             // branch -> after_if_8234_0
  8273.         } else {
  8274.             v9 = 1;
  8275.         }
  8276.     }
  8277.     // after_if_8234_0
  8278.     if (v6 < 0) {
  8279.         // if_8240_0_true
  8280.         v8 = v6 + v5;
  8281.         // branch -> after_if_8240_0
  8282.     }
  8283.     char * mem = malloc(v9 * v5); // 0x8244
  8284.     int32_t v10 = g135 - v8; // 0x8248
  8285.     g135 = v10;
  8286.     int32_t v11 = (int32_t)mem; // R9
  8287.     __aeabi_memcpy(mem, (char *)(g138 + v7 * v8), v7 * v10);
  8288.     __aeabi_memcpy((char *)(v11 + g135 * v7), (char *)g138, v7 * v8);
  8289.     *(int32_t *)(v3 + 8) = v11;
  8290.     g135 = v1;
  8291.     g138 = v2;
  8292.     return 0;
  8293. }
  8294.  
  8295. // Address range: 0x827c - 0x828b
  8296. int32_t function_add(int32_t a1, int32_t a2, int32_t * a3) {
  8297.     // 0x827c
  8298.     *a3 = 0;
  8299.     return a2 + a1;
  8300. }
  8301.  
  8302. // Address range: 0x828c - 0x82bb
  8303. int32_t script_transform_add(int32_t a1, int32_t a2, int32_t a3) {
  8304.     int32_t v1 = g130; // bp-8
  8305.     g130 = &v1;
  8306.     int32_t v2;
  8307.     g126 = v2;
  8308.     g131 = &g61;
  8309.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x82ac
  8310.     g127 = result;
  8311.     g130 = v1;
  8312.     return result;
  8313. }
  8314.  
  8315. // Address range: 0x82bc - 0x82cb
  8316. int32_t function_subtract(int32_t a1, int32_t a2, int32_t * a3) {
  8317.     // 0x82bc
  8318.     *a3 = 0;
  8319.     return a1 - a2;
  8320. }
  8321.  
  8322. // Address range: 0x82cc - 0x82fb
  8323. int32_t script_transform_subtract(int32_t a1, int32_t a2) {
  8324.     int32_t v1 = g130; // bp-8
  8325.     g130 = &v1;
  8326.     int32_t v2;
  8327.     g126 = v2;
  8328.     g131 = g4;
  8329.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x82ec
  8330.     g127 = result;
  8331.     g130 = v1;
  8332.     return result;
  8333. }
  8334.  
  8335. // Address range: 0x82fc - 0x830b
  8336. int32_t function_multiply(int32_t a1, int32_t a2, int32_t * a3) {
  8337.     // 0x82fc
  8338.     *a3 = 0;
  8339.     return a2 * a1;
  8340. }
  8341.  
  8342. // Address range: 0x830c - 0x833b
  8343. int32_t script_transform_multiply(int32_t a1, int32_t a2) {
  8344.     int32_t v1 = g130; // bp-8
  8345.     g130 = &v1;
  8346.     int32_t v2;
  8347.     g126 = v2;
  8348.     g131 = g34;
  8349.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x832c
  8350.     g127 = result;
  8351.     g130 = v1;
  8352.     return result;
  8353. }
  8354.  
  8355. // Address range: 0x833c - 0x8347
  8356. int32_t function_divide(int32_t a1, int32_t a2) {
  8357.     // 0x833c
  8358.     *(int32_t *)g132 = 0;
  8359.     g127 = a1 / a2;
  8360.     return 0;
  8361. }
  8362.  
  8363. // Address range: 0x8348 - 0x8377
  8364. int32_t script_transform_divide(int32_t a1, int32_t a2) {
  8365.     int32_t v1 = g130; // bp-8
  8366.     g130 = &v1;
  8367.     int32_t v2;
  8368.     g126 = v2;
  8369.     g131 = g5;
  8370.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8368
  8371.     g127 = result;
  8372.     g130 = v1;
  8373.     return result;
  8374. }
  8375.  
  8376. // Address range: 0x8378 - 0x8393
  8377. int32_t function_modulo(uint32_t a1, uint32_t a2) {
  8378.     // 0x8378
  8379.     *(int32_t *)g132 = 0;
  8380.     int32_t result = a1 % a2;
  8381.     g127 = result;
  8382.     return result;
  8383. }
  8384.  
  8385. // Address range: 0x8394 - 0x83c3
  8386. int32_t script_transform_modulo(int32_t a1, int32_t a2) {
  8387.     int32_t v1 = g130; // bp-8
  8388.     g130 = &v1;
  8389.     int32_t v2;
  8390.     g126 = v2;
  8391.     g131 = g40;
  8392.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x83b4
  8393.     g127 = result;
  8394.     g130 = v1;
  8395.     return result;
  8396. }
  8397.  
  8398. // Address range: 0x83c4 - 0x83d3
  8399. int32_t function_rsub(int32_t a1, int32_t a2, int32_t * a3) {
  8400.     // 0x83c4
  8401.     *a3 = 0;
  8402.     return a2 - a1;
  8403. }
  8404.  
  8405. // Address range: 0x83d4 - 0x8403
  8406. int32_t script_transform_rsub(int32_t a1, int32_t a2, int32_t a3) {
  8407.     int32_t v1 = g130; // bp-8
  8408.     g130 = &v1;
  8409.     int32_t v2;
  8410.     g126 = v2;
  8411.     g131 = g18;
  8412.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x83f4
  8413.     g127 = result;
  8414.     g130 = v1;
  8415.     return result;
  8416. }
  8417.  
  8418. // Address range: 0x8404 - 0x841b
  8419. // From class:    PLAYER
  8420. // Type:          virtual member function
  8421. int32_t function_rdiv(int32_t a1, int32_t a2, int32_t * a3) {
  8422.     // 0x8404
  8423.     *a3 = 0;
  8424.     return a2 / a1;
  8425. }
  8426.  
  8427. // Address range: 0x841c - 0x844b
  8428. int32_t script_transform_rdiv(int32_t a1, int32_t a2, int32_t a3) {
  8429.     int32_t v1 = g130; // bp-8
  8430.     g130 = &v1;
  8431.     int32_t v2;
  8432.     g126 = v2;
  8433.     g131 = (int32_t)g13.e0;
  8434.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x843c
  8435.     g127 = result;
  8436.     g130 = v1;
  8437.     return result;
  8438. }
  8439.  
  8440. // Address range: 0x844c - 0x8473
  8441. int32_t function_rmod(uint32_t a1, uint32_t a2, int32_t * a3) {
  8442.     // 0x844c
  8443.     *a3 = 0;
  8444.     return a2 % a1;
  8445. }
  8446.  
  8447. // Address range: 0x8474 - 0x84a3
  8448. int32_t script_transform_rmod(int32_t a1, int32_t a2, int32_t a3) {
  8449.     int32_t v1 = g130; // bp-8
  8450.     g130 = &v1;
  8451.     int32_t v2;
  8452.     g126 = v2;
  8453.     g131 = g14;
  8454.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x8494
  8455.     g127 = result;
  8456.     g130 = v1;
  8457.     return result;
  8458. }
  8459.  
  8460. // Address range: 0x84a4 - 0x84b3
  8461. int32_t function_and(int32_t a1, int32_t a2, int32_t * a3) {
  8462.     // 0x84a4
  8463.     *a3 = 0;
  8464.     return a2 & a1;
  8465. }
  8466.  
  8467. // Address range: 0x84b4 - 0x84e3
  8468. int32_t script_transform_and(int32_t a1, int32_t a2, int32_t a3) {
  8469.     int32_t v1 = g130; // bp-8
  8470.     g130 = &v1;
  8471.     int32_t v2;
  8472.     g126 = v2;
  8473.     g131 = g37;
  8474.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x84d4
  8475.     g127 = result;
  8476.     g130 = v1;
  8477.     return result;
  8478. }
  8479.  
  8480. // Address range: 0x84e4 - 0x84f3
  8481. int32_t function_or(int32_t a1, int32_t a2, int32_t * a3) {
  8482.     // 0x84e4
  8483.     *a3 = 0;
  8484.     return a2 | a1;
  8485. }
  8486.  
  8487. // Address range: 0x84f4 - 0x8523
  8488. int32_t script_transform_or(int32_t a1, int32_t a2) {
  8489.     int32_t v1 = g130; // bp-8
  8490.     g130 = &v1;
  8491.     int32_t v2;
  8492.     g126 = v2;
  8493.     g131 = g43;
  8494.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8514
  8495.     g127 = result;
  8496.     g130 = v1;
  8497.     return result;
  8498. }
  8499.  
  8500. // Address range: 0x8524 - 0x8533
  8501. int32_t function_xor(int32_t a1, int32_t a2, int32_t * a3) {
  8502.     // 0x8524
  8503.     *a3 = 0;
  8504.     return a2 ^ a1;
  8505. }
  8506.  
  8507. // Address range: 0x8534 - 0x8563
  8508. int32_t script_transform_xor(void) {
  8509.     int32_t v1 = g130; // bp-8
  8510.     g130 = &v1;
  8511.     int32_t v2;
  8512.     g126 = v2;
  8513.     g131 = g21;
  8514.     int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8554
  8515.     g127 = result;
  8516.     g130 = v1;
  8517.     return result;
  8518. }
  8519.  
  8520. // Address range: 0x8564 - 0x8573
  8521. int32_t function_shl(int32_t a1, uint32_t a2, int32_t * a3) {
  8522.     uint32_t v1 = a2 % 256; // 0x8568
  8523.     *a3 = 0;
  8524.     return v1 == 0 ? a1 : v1 < 32 ? a1 << v1 : 0;
  8525. }
  8526.  
  8527. // Address range: 0x8574 - 0x85a3
  8528. int32_t script_transform_shl(void) {
  8529.     int32_t v1 = g130; // bp-8
  8530.     g130 = &v1;
  8531.     int32_t v2;
  8532.     g126 = v2;
  8533.     g131 = g41;
  8534.     int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8594
  8535.     g127 = result;
  8536.     g130 = v1;
  8537.     return result;
  8538. }
  8539.  
  8540. // Address range: 0x85a4 - 0x85b3
  8541. int32_t function_shr(uint32_t a1, uint32_t a2, int32_t * a3) {
  8542.     uint32_t v1 = a2 % 256; // 0x85a8
  8543.     *a3 = 0;
  8544.     return a1 >> (v1 > 32 ? 32 : v1);
  8545. }
  8546.  
  8547. // Address range: 0x85b4 - 0x85e3
  8548. int32_t script_transform_shr(int32_t a1, int32_t a2, int32_t a3) {
  8549.     int32_t v1 = g130; // bp-8
  8550.     g130 = &v1;
  8551.     int32_t v2;
  8552.     g126 = v2;
  8553.     g131 = g23;
  8554.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x85d4
  8555.     g127 = result;
  8556.     g130 = v1;
  8557.     return result;
  8558. }
  8559.  
  8560. // Address range: 0x85e4 - 0x85f3
  8561. int32_t function_asr(int32_t a1, uint32_t a2, int32_t * a3) {
  8562.     uint32_t v1 = a2 % 256; // 0x85e8
  8563.     *a3 = 0;
  8564.     return a1 >> (v1 == 0 ? 0 : v1 > 31 ? 31 : v1);
  8565. }
  8566.  
  8567. // Address range: 0x85f4 - 0x8623
  8568. int32_t script_transform_asr(int32_t a1, int32_t a2) {
  8569.     int32_t v1 = g130; // bp-8
  8570.     g130 = &v1;
  8571.     int32_t v2;
  8572.     g126 = v2;
  8573.     g131 = g27;
  8574.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8614
  8575.     g127 = result;
  8576.     g130 = v1;
  8577.     return result;
  8578. }
  8579.  
  8580. // Address range: 0x8624 - 0x8637
  8581. int32_t function_forceminu(uint32_t a1, uint32_t a2, int32_t * a3) {
  8582.     int32_t result = a1; // R0
  8583.     if (a1 < a2) {
  8584.         // if_862c_0_true
  8585.         result = a2;
  8586.         // branch -> after_if_862c_0
  8587.     }
  8588.     // after_if_862c_0
  8589.     *a3 = 0;
  8590.     return result;
  8591. }
  8592.  
  8593. // Address range: 0x8638 - 0x8667
  8594. int32_t script_transform_forceminu(int32_t a1, int32_t a2) {
  8595.     int32_t v1 = g130; // bp-8
  8596.     g130 = &v1;
  8597.     int32_t v2;
  8598.     g126 = v2;
  8599.     g131 = g25;
  8600.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8658
  8601.     g127 = result;
  8602.     g130 = v1;
  8603.     return result;
  8604. }
  8605.  
  8606. // Address range: 0x8668 - 0x867b
  8607. int32_t function_forcemaxu(uint32_t a1, uint32_t a2, int32_t * a3) {
  8608.     int32_t result = a1; // R0
  8609.     if (a1 > a2) {
  8610.         // if_8670_0_true
  8611.         result = a2;
  8612.         // branch -> after_if_8670_0
  8613.     }
  8614.     // after_if_8670_0
  8615.     *a3 = 0;
  8616.     return result;
  8617. }
  8618.  
  8619. // Address range: 0x867c - 0x86ab
  8620. int32_t script_transform_forcemaxu(int32_t a1, int32_t a2, int32_t a3) {
  8621.     int32_t v1 = g130; // bp-8
  8622.     g130 = &v1;
  8623.     int32_t v2;
  8624.     g126 = v2;
  8625.     g131 = g35;
  8626.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x869c
  8627.     g127 = result;
  8628.     g130 = v1;
  8629.     return result;
  8630. }
  8631.  
  8632. // Address range: 0x86ac - 0x86bf
  8633. int32_t function_forcemin(int32_t a1, int32_t a2, int32_t * a3) {
  8634.     int32_t result = a1; // R0
  8635.     if (a1 < a2) {
  8636.         // if_86b4_0_true
  8637.         result = a2;
  8638.         // branch -> after_if_86b4_0
  8639.     }
  8640.     // after_if_86b4_0
  8641.     *a3 = 0;
  8642.     return result;
  8643. }
  8644.  
  8645. // Address range: 0x86c0 - 0x86ef
  8646. int32_t script_transform_forcemin(int32_t a1, int32_t a2, int32_t a3) {
  8647.     int32_t v1 = g130; // bp-8
  8648.     g130 = &v1;
  8649.     int32_t v2;
  8650.     g126 = v2;
  8651.     g131 = g42;
  8652.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x86e0
  8653.     g127 = result;
  8654.     g130 = v1;
  8655.     return result;
  8656. }
  8657.  
  8658. // Address range: 0x86f0 - 0x8703
  8659. int32_t function_forcemax(int32_t a1, int32_t a2, int32_t * a3) {
  8660.     int32_t result = a1; // R0
  8661.     if (a1 > a2) {
  8662.         // if_86f8_0_true
  8663.         result = a2;
  8664.         // branch -> after_if_86f8_0
  8665.     }
  8666.     // after_if_86f8_0
  8667.     *a3 = 0;
  8668.     return result;
  8669. }
  8670.  
  8671. // Address range: 0x8704 - 0x8733
  8672. int32_t script_transform_forcemax(int32_t a1, int32_t a2, int32_t a3) {
  8673.     int32_t v1 = g130; // bp-8
  8674.     g130 = &v1;
  8675.     int32_t v2;
  8676.     g126 = v2;
  8677.     g131 = g32;
  8678.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x8724
  8679.     g127 = result;
  8680.     g130 = v1;
  8681.     return result;
  8682. }
  8683.  
  8684. // Address range: 0x8734 - 0x8753
  8685. int32_t function_compare(int32_t a1, int32_t a2, int32_t * a3) {
  8686.     // 0x8734
  8687.     *a3 = 0;
  8688.     int32_t v1 = a1 < a2 ? -1 : 1;
  8689.     return a1 == a2 ? v1 & -0x10000 : v1;
  8690. }
  8691.  
  8692. // Address range: 0x8754 - 0x8783
  8693. int32_t script_transform_compare(int32_t a1, int32_t a2) {
  8694.     int32_t v1 = g130; // bp-8
  8695.     g130 = &v1;
  8696.     int32_t v2;
  8697.     g126 = v2;
  8698.     g131 = g47;
  8699.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8774
  8700.     g127 = result;
  8701.     g130 = v1;
  8702.     return result;
  8703. }
  8704.  
  8705. // Address range: 0x8784 - 0x87a3
  8706. int32_t function_compareu(uint32_t a1, uint32_t a2, int32_t * a3) {
  8707.     // 0x8784
  8708.     *a3 = 0;
  8709.     int32_t v1 = a1 < a2 ? -1 : 1;
  8710.     return a1 == a2 ? v1 & -0x10000 : v1;
  8711. }
  8712.  
  8713. // Address range: 0x87a4 - 0x87d3
  8714. int32_t script_transform_compareu(int32_t a1, int32_t a2, int32_t a3) {
  8715.     int32_t v1 = g130; // bp-8
  8716.     g130 = &v1;
  8717.     int32_t v2;
  8718.     g126 = v2;
  8719.     g131 = g20;
  8720.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x87c4
  8721.     g127 = result;
  8722.     g130 = v1;
  8723.     return result;
  8724. }
  8725.  
  8726. // Address range: 0x87d4 - 0x880b
  8727. int32_t function_checkminu(uint32_t a1, uint32_t a2, int32_t * a3) {
  8728.     int32_t v1 = (int32_t)a3;
  8729.     int32_t v2 = g135; // 0x87d4
  8730.     int32_t v3 = g130; // bp-8
  8731.     g130 = &v3;
  8732.     g135 = a1;
  8733.     g134 = v1;
  8734.     int32_t v4; // 0x87fc
  8735.     int32_t v5; // 0x87fc
  8736.     if (a1 >= a2) {
  8737.         // 0x87f0
  8738.         g127 = (int32_t)"value not in required range";
  8739.         v5 = duplicate_string();
  8740.         v4 = g134;
  8741.         // branch -> 0x87fc
  8742.     } else {
  8743.         v5 = 0;
  8744.         v4 = v1;
  8745.     }
  8746.     // 0x87fc
  8747.     *(int32_t *)v4 = v5;
  8748.     int32_t result = g135; // 0x8800
  8749.     g135 = v2;
  8750.     return result;
  8751. }
  8752.  
  8753. // Address range: 0x880c - 0x883b
  8754. int32_t script_transform_checkminu(void) {
  8755.     int32_t v1 = g130; // bp-8
  8756.     g130 = &v1;
  8757.     int32_t v2;
  8758.     g126 = v2;
  8759.     g131 = g19;
  8760.     int32_t result = script_transform_basic((char)g127, g128, g132); // 0x882c
  8761.     g127 = result;
  8762.     g130 = v1;
  8763.     return result;
  8764. }
  8765.  
  8766. // Address range: 0x883c - 0x8873
  8767. int32_t function_checkmaxu(uint32_t a1, uint32_t a2, int32_t * a3) {
  8768.     int32_t v1 = (int32_t)a3;
  8769.     int32_t v2 = g135; // 0x883c
  8770.     int32_t v3 = g130; // bp-8
  8771.     g130 = &v3;
  8772.     g135 = a1;
  8773.     g134 = v1;
  8774.     int32_t v4 = 0; // 0x8864
  8775.     if (a1 > a2) {
  8776.         // 0x8858
  8777.         g127 = (int32_t)"value not in required range";
  8778.         v4 = duplicate_string();
  8779.         v1 = g134;
  8780.         // branch -> 0x8864
  8781.     }
  8782.     // 0x8864
  8783.     *(int32_t *)v1 = v4;
  8784.     int32_t result = g135; // 0x8868
  8785.     g135 = v2;
  8786.     return result;
  8787. }
  8788.  
  8789. // Address range: 0x8874 - 0x88a3
  8790. int32_t script_transform_checkmaxu(void) {
  8791.     int32_t v1 = g130; // bp-8
  8792.     g130 = &v1;
  8793.     int32_t v2;
  8794.     g126 = v2;
  8795.     g131 = g29;
  8796.     int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8894
  8797.     g127 = result;
  8798.     g130 = v1;
  8799.     return result;
  8800. }
  8801.  
  8802. // Address range: 0x88a4 - 0x88db
  8803. int32_t function_checkmin(int32_t a1, int32_t a2, int32_t * a3) {
  8804.     int32_t v1 = (int32_t)a3;
  8805.     int32_t v2 = g135; // 0x88a4
  8806.     int32_t v3 = g130; // bp-8
  8807.     g130 = &v3;
  8808.     g135 = a1;
  8809.     g134 = v1;
  8810.     int32_t v4 = 0; // 0x88cc
  8811.     if (a1 < a2) {
  8812.         // 0x88c0
  8813.         g127 = (int32_t)"value not in required range";
  8814.         v4 = duplicate_string();
  8815.         v1 = g134;
  8816.         // branch -> 0x88cc
  8817.     }
  8818.     // 0x88cc
  8819.     *(int32_t *)v1 = v4;
  8820.     int32_t result = g135; // 0x88d0
  8821.     g135 = v2;
  8822.     return result;
  8823. }
  8824.  
  8825. // Address range: 0x88dc - 0x890b
  8826. int32_t script_transform_checkmin(int32_t a1, int32_t a2) {
  8827.     int32_t v1 = g130; // bp-8
  8828.     g130 = &v1;
  8829.     int32_t v2;
  8830.     g126 = v2;
  8831.     g131 = g22;
  8832.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x88fc
  8833.     g127 = result;
  8834.     g130 = v1;
  8835.     return result;
  8836. }
  8837.  
  8838. // Address range: 0x890c - 0x8943
  8839. int32_t function_checkmax(int32_t a1, int32_t a2, int32_t * a3, int32_t a4) {
  8840.     int32_t v1 = (int32_t)a3;
  8841.     int32_t v2 = g135; // 0x890c
  8842.     int32_t v3 = g130; // bp-8
  8843.     g130 = &v3;
  8844.     g135 = a1;
  8845.     g134 = v1;
  8846.     int32_t v4 = 0; // 0x8934
  8847.     if (a1 > a2) {
  8848.         // 0x8928
  8849.         g127 = (int32_t)"value not in required range";
  8850.         v4 = duplicate_string();
  8851.         v1 = g134;
  8852.         // branch -> 0x8934
  8853.     }
  8854.     // 0x8934
  8855.     *(int32_t *)v1 = v4;
  8856.     int32_t result = g135; // 0x8938
  8857.     g135 = v2;
  8858.     return result;
  8859. }
  8860.  
  8861. // Address range: 0x8944 - 0x8973
  8862. int32_t script_transform_checkmax(int32_t a1, int32_t a2) {
  8863.     int32_t v1 = g130; // bp-8
  8864.     g130 = &v1;
  8865.     int32_t v2;
  8866.     g126 = v2;
  8867.     g131 = g16;
  8868.     int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8964
  8869.     g127 = result;
  8870.     g130 = v1;
  8871.     return result;
  8872. }
  8873.  
  8874. // Address range: 0x8974 - 0x89cf
  8875. int32_t function_checkptr(int32_t a1, int32_t a2, int32_t * a3, int32_t a4) {
  8876.     int32_t v1 = (int32_t)a3;
  8877.     int32_t v2 = g135; // 0x8974
  8878.     int32_t v3 = g130; // bp-8
  8879.     g130 = &v3;
  8880.     g135 = a1;
  8881.     g134 = v1;
  8882.     int32_t result; // 0x89c4
  8883.     if (a2 == a1) {
  8884.         // after_if_898c_0.thread
  8885.         if ((a2 || a1) == 0) {
  8886.             // 0x89c0
  8887.             *(int32_t *)v1 = 0;
  8888.             result = g135;
  8889.             g135 = v2;
  8890.             return result;
  8891.         }
  8892.     }
  8893.     // 0x899c
  8894.     int32_t v4; // 0x89c0
  8895.     int32_t v5; // 0x89c0
  8896.     if ((a1 & -0x2000000) != 0x8000000) {
  8897.         // 0x89b4
  8898.         g127 = (int32_t)"value not in required range";
  8899.         v5 = duplicate_string();
  8900.         v4 = g134;
  8901.         // branch -> 0x89c0
  8902.     } else {
  8903.         v5 = 0;
  8904.         v4 = v1;
  8905.     }
  8906.     // 0x89c0
  8907.     *(int32_t *)v4 = v5;
  8908.     result = g135;
  8909.     g135 = v2;
  8910.     return result;
  8911. }
  8912.  
  8913. // Address range: 0x89d0 - 0x89ff
  8914. int32_t script_transform_checkptr(void) {
  8915.     int32_t v1 = g130; // bp-8
  8916.     g130 = &v1;
  8917.     int32_t v2;
  8918.     g126 = v2;
  8919.     g131 = g8;
  8920.     int32_t result = script_transform_basic((char)g127, g128, g132); // 0x89f0
  8921.     g127 = result;
  8922.     g130 = v1;
  8923.     return result;
  8924. }
  8925.  
  8926. // Address range: 0x8a00 - 0x8a37
  8927. int32_t function_require(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5) {
  8928.     int32_t v1 = (int32_t)a3;
  8929.     int32_t v2 = g135; // 0x8a00
  8930.     int32_t v3 = g130; // bp-8
  8931.     g130 = &v3;
  8932.     g135 = a1;
  8933.     g134 = v1;
  8934.     int32_t v4; // 0x8a28
  8935.     int32_t v5; // 0x8a28
  8936.     if (a1 != a2) {
  8937.         // 0x8a1c
  8938.         g127 = (int32_t)"value not in required range";
  8939.         v5 = duplicate_string();
  8940.         v4 = g134;
  8941.         // branch -> 0x8a28
  8942.     } else {
  8943.         v5 = 0;
  8944.         v4 = v1;
  8945.     }
  8946.     // 0x8a28
  8947.     *(int32_t *)v4 = v5;
  8948.     int32_t result = g135; // 0x8a2c
  8949.     g135 = v2;
  8950.     return result;
  8951. }
  8952.  
  8953. // Address range: 0x8a38 - 0x8a67
  8954. int32_t script_transform_require(void) {
  8955.     int32_t v1 = g130; // bp-8
  8956.     g130 = &v1;
  8957.     int32_t v2;
  8958.     g126 = v2;
  8959.     g131 = g28;
  8960.     int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8a58
  8961.     g127 = result;
  8962.     g130 = v1;
  8963.     return result;
  8964. }
  8965.  
  8966. // Address range: 0x8a68 - 0x8a9f
  8967. int32_t function_requirenot(int32_t a1, int32_t a2, int32_t * a3) {
  8968.     int32_t v1 = (int32_t)a3;
  8969.     int32_t v2 = g135; // 0x8a68
  8970.     int32_t v3 = g130; // bp-8
  8971.     g130 = &v3;
  8972.     g135 = a1;
  8973.     g134 = v1;
  8974.     int32_t v4 = 0; // 0x8a90
  8975.     if (a1 == a2) {
  8976.         // 0x8a84
  8977.         g127 = (int32_t)"value not in required range";
  8978.         v4 = duplicate_string();
  8979.         v1 = g134;
  8980.         // branch -> 0x8a90
  8981.     }
  8982.     // 0x8a90
  8983.     *(int32_t *)v1 = v4;
  8984.     int32_t result = g135; // 0x8a94
  8985.     g135 = v2;
  8986.     return result;
  8987. }
  8988.  
  8989. // Address range: 0x8aa0 - 0x8acf
  8990. int32_t script_transform_requirenot(int32_t a1, int32_t a2, int32_t a3) {
  8991.     int32_t v1 = g130; // bp-8
  8992.     g130 = &v1;
  8993.     int32_t v2;
  8994.     g126 = v2;
  8995.     g131 = g26;
  8996.     int32_t result = script_transform_basic((char)a1, a2, a3); // 0x8ac0
  8997.     g127 = result;
  8998.     g130 = v1;
  8999.     return result;
  9000. }
  9001.  
  9002. // Address range: 0x8ad0 - 0x8b77
  9003. int32_t script_transform_byte_count(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5) {
  9004.     int32_t v1 = g134; // bp-16
  9005.     int32_t v2 = g135; // 0x8ad0
  9006.     int32_t v3 = g130; // bp-8
  9007.     int32_t v4 = (int32_t)a5; // R12
  9008.     *a5 = 3;
  9009.     *(int32_t *)(v4 + 8) = 0;
  9010.     if (a4 >= 256) {
  9011.         // 0x8afc
  9012.         g127 = (int32_t)"parameter is not a byte";
  9013.         g134 = v1;
  9014.         g135 = v2;
  9015.         g130 = v3;
  9016.         return duplicate_string();
  9017.     }
  9018.     // 0x8b0c
  9019.     if (a1 % 256 != 0) {
  9020.         // 0x8b14
  9021.         g127 = (int32_t)"type mismatch";
  9022.         g134 = v1;
  9023.         g135 = v2;
  9024.         g130 = v3;
  9025.         return duplicate_string();
  9026.     }
  9027.     // 0x8b24
  9028.     if (a2 == 0) {
  9029.         // 0x8b64
  9030.         *(int32_t *)(v4 + 4) = 0;
  9031.         g135 = v2;
  9032.         return 0;
  9033.     }
  9034.     int32_t v5 = 0; // 0x8b58
  9035.     // branch -> 0x8b30
  9036.     int32_t v6; // 0x8b58
  9037.     while (true) {
  9038.         // 0x8b30
  9039.         int32_t v7;
  9040.         g135 = v7 == 0;
  9041.         if (v7 == 0 == (int32_t)*(char *)(v5 + a3) == a4 % 256) {
  9042.             // 0x8b64
  9043.             *(int32_t *)(v4 + 4) = v5;
  9044.             g135 = v2;
  9045.             return 0;
  9046.         }
  9047.         // 0x8b58
  9048.         v6 = v5 + 1;
  9049.         if (v6 >= a2) {
  9050.             // break -> 0x8b64
  9051.             break;
  9052.         }
  9053.         v5 = v6;
  9054.         // continue -> 0x8b30
  9055.     }
  9056.     // 0x8b64
  9057.     *(int32_t *)(v4 + 4) = v6;
  9058.     g135 = v2;
  9059.     return 0;
  9060. }
  9061.  
  9062. // Address range: 0x8b78 - 0x8c03
  9063. int32_t script_transform_byteswhile(uint32_t a1, uint32_t a2, int32_t a3) {
  9064.     int32_t v1 = g134; // bp-16
  9065.     int32_t v2 = g130; // bp-8
  9066.     int32_t v3 = g126; // 0x8b78
  9067.     int32_t v4;
  9068.     *(char *)v4 = 3;
  9069.     *(int32_t *)(v4 + 8) = 0;
  9070.     uint32_t v5 = g133 + 128; // 0x8b94
  9071.     g126 = v5;
  9072.     g1 = v5 > 383;
  9073.     g3 = v5 == 384;
  9074.     if (v5 >= 384) {
  9075.         // 0x8ba0
  9076.         g127 = (int32_t)"parameter is not a byte";
  9077.         g134 = v1;
  9078.         g130 = v2;
  9079.         g126 = v3;
  9080.         int32_t result = duplicate_string(); // 0x8bac
  9081.         g127 = result;
  9082.         return result;
  9083.     }
  9084.     // 0x8bb0
  9085.     g3 = a1 % 256 == 0;
  9086.     if (a1 % 256 != 0) {
  9087.         // 0x8bb8
  9088.         g127 = (int32_t)"type mismatch";
  9089.         g134 = v1;
  9090.         g130 = v2;
  9091.         g126 = v3;
  9092.         int32_t result2 = duplicate_string(); // 0x8bc4
  9093.         g127 = result2;
  9094.         return result2;
  9095.     }
  9096.     // 0x8bc8
  9097.     g1 = true;
  9098.     g3 = a2 == 0;
  9099.     if (a2 == 0) {
  9100.         // 0x8bf0
  9101.         *(int32_t *)(v4 + 4) = 0;
  9102.         g127 = 0;
  9103.         g134 = v1;
  9104.         g130 = v2;
  9105.         return 0;
  9106.     }
  9107.     uint32_t v6 = g133 % 256; // 0x8bd8
  9108.     int32_t v7 = 0; // 0x8be4
  9109.     // branch -> 0x8bd4
  9110.     int32_t v8; // 0x8be4
  9111.     while (true) {
  9112.         int32_t v9 = (int32_t)*(char *)(v7 + a3); // 0x8bd4
  9113.         g126 = v9;
  9114.         g1 = v9 >= v6;
  9115.         g3 = v9 == v6;
  9116.         int32_t v10 = v7; // 0x8bf0
  9117.         if (v9 == v6) {
  9118.             // 0x8be4
  9119.             v8 = v7 + 1;
  9120.             g1 = v8 >= a2;
  9121.             g3 = v8 == a2;
  9122.             if (v8 >= a2) {
  9123.                 // break -> 0x8bf0
  9124.                 break;
  9125.             }
  9126.             v7 = v8;
  9127.             // continue -> 0x8bd4
  9128.             continue;
  9129.         }
  9130.         // 0x8bf0
  9131.         *(int32_t *)(v4 + 4) = v10;
  9132.         g127 = 0;
  9133.         g134 = v1;
  9134.         g130 = v2;
  9135.         return 0;
  9136.     }
  9137.     // 0x8bf0
  9138.     *(int32_t *)(v4 + 4) = v8;
  9139.     g127 = 0;
  9140.     g134 = v1;
  9141.     g130 = v2;
  9142.     return 0;
  9143. }
  9144.  
  9145. // Address range: 0x8c04 - 0x8c8f
  9146. int32_t script_transform_bytesuntil(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4) {
  9147.     int32_t v1 = g134; // bp-16
  9148.     int32_t v2 = g130; // bp-8
  9149.     int32_t v3;
  9150.     *(char *)v3 = 3;
  9151.     *(int32_t *)(v3 + 8) = 0;
  9152.     uint32_t v4 = a4 + 128; // 0x8c20
  9153.     g3 = v4 == 384;
  9154.     if (v4 >= 384) {
  9155.         // 0x8c2c
  9156.         g127 = (int32_t)"parameter is not a byte";
  9157.         g134 = v1;
  9158.         g130 = v2;
  9159.         int32_t result = duplicate_string(); // 0x8c38
  9160.         g127 = result;
  9161.         return result;
  9162.     }
  9163.     // 0x8c3c
  9164.     g3 = a1 % 256 == 0;
  9165.     if (a1 % 256 != 0) {
  9166.         // 0x8c44
  9167.         g127 = (int32_t)"type mismatch";
  9168.         g134 = v1;
  9169.         g130 = v2;
  9170.         int32_t result2 = duplicate_string(); // 0x8c50
  9171.         g127 = result2;
  9172.         return result2;
  9173.     }
  9174.     // 0x8c54
  9175.     g3 = a2 == 0;
  9176.     if (a2 == 0) {
  9177.         // 0x8c7c
  9178.         *(int32_t *)(v3 + 4) = 0;
  9179.         g127 = 0;
  9180.         g134 = v1;
  9181.         g130 = v2;
  9182.         return 0;
  9183.     }
  9184.     uint32_t v5 = a4 % 256; // 0x8c64
  9185.     int32_t v6 = 0; // 0x8c70
  9186.     // branch -> 0x8c60
  9187.     int32_t v7; // 0x8c70
  9188.     while (true) {
  9189.         char v8 = *(char *)(v6 + a3); // 0x8c60
  9190.         g3 = (int32_t)v8 == v5;
  9191.         if ((int32_t)v8 == v5) {
  9192.             // 0x8c7c
  9193.             *(int32_t *)(v3 + 4) = v6;
  9194.             g127 = 0;
  9195.             g134 = v1;
  9196.             g130 = v2;
  9197.             return 0;
  9198.         }
  9199.         // 0x8c70
  9200.         v7 = v6 + 1;
  9201.         g3 = v7 == a2;
  9202.         if (v7 >= a2) {
  9203.             // break -> 0x8c7c
  9204.             break;
  9205.         }
  9206.         v6 = v7;
  9207.         // continue -> 0x8c60
  9208.     }
  9209.     // 0x8c7c
  9210.     *(int32_t *)(v3 + 4) = v7;
  9211.     g127 = 0;
  9212.     g134 = v1;
  9213.     g130 = v2;
  9214.     return 0;
  9215. }
  9216.  
  9217. // Address range: 0x8c90 - 0x8d97
  9218. int32_t execute_transforms(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
  9219.     int32_t v1;
  9220.     char * v2 = (char *)v1; // bp-52
  9221.     int32_t v3 = g134; // 0x8c90
  9222.     int32_t v4 = g135; // 0x8c90
  9223.     int32_t v5 = g136; // 0x8c90
  9224.     int32_t v6 = g137; // 0x8c90
  9225.     int32_t v7 = g138; // 0x8c90
  9226.     int32_t v8 = g139; // 0x8c90
  9227.     int32_t v9 = g129; // 0x8c90
  9228.     int32_t v10 = g130; // bp-8
  9229.     g130 = &v10;
  9230.     g138 = a4;
  9231.     int32_t v11;
  9232.     copy_script_value((char *)&v11, (char)a1, a2, (char *)a3);
  9233.     int32_t v12;
  9234.     g129 = v12;
  9235.     g1 = true;
  9236.     g2 = a5 < 0;
  9237.     g3 = a5 == 0;
  9238.     int32_t v13;
  9239.     *(int32_t *)(v12 + 8) = v13;
  9240.     if (a5 == 0) {
  9241.         // 0x8d88
  9242.         g127 = 0;
  9243.         g134 = v3;
  9244.         g135 = v4;
  9245.         g136 = v5;
  9246.         g137 = v6;
  9247.         g138 = v7;
  9248.         g139 = v8;
  9249.         g129 = v9;
  9250.         g130 = v10;
  9251.         return 0;
  9252.     }
  9253.     // 0x8cd4
  9254.     g135 = 0;
  9255.     int32_t v14 = 0; // 0x8ce0
  9256.     // branch -> 0x8cd8
  9257.     char * mem; // 0x8d44
  9258.     int32_t chars_printed;
  9259.     int32_t result;
  9260.     int32_t v15; // 0x8d18
  9261.     while (true) {
  9262.         int32_t v16 = g129; // 0x8cdc
  9263.         int32_t v17 = *(int32_t *)v16; // 0x8cdc
  9264.         g137 = v17;
  9265.         int32_t v18 = 8 * v14 + g138; // 0x8ce0
  9266.         int32_t v19 = *(int32_t *)v18; // 0x8ce0
  9267.         g131 = v19;
  9268.         int32_t v20 = *(int32_t *)(v16 + 4); // 0x8ce4
  9269.         g134 = v20;
  9270.         int32_t v21 = *(int32_t *)(v16 + 8); // 0x8ce4
  9271.         g136 = v21;
  9272.         int32_t v22 = *(int32_t *)(v18 + 4); // 0x8ce8
  9273.         g133 = v22;
  9274.         g127 = v17;
  9275.         g128 = v20;
  9276.         g132 = v21;
  9277.         g126 = 0x8d00;
  9278.         ((int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t))v19)(v17, v20, v21, v22, v16);
  9279.         g139 = g127;
  9280.         g132 = g136;
  9281.         destroy_script_value(g137);
  9282.         v15 = g139;
  9283.         int32_t v23 = g135 + 1; // 0x8d20
  9284.         g135 = v23;
  9285.         int32_t v24 = 0; // 0x8d30
  9286.         if (v15 == 0) {
  9287.             // if_8d24_0_true
  9288.             v24 = 1;
  9289.             // branch -> after_if_8d24_0
  9290.         }
  9291.         // after_if_8d24_0
  9292.         if (v23 >= a5) {
  9293.             // 0x8d30
  9294.             g1 = true;
  9295.             g2 = false;
  9296.             g3 = v24 == 0;
  9297.             if (v24 == 0) {
  9298.                 // break -> 0x8d38
  9299.                 break;
  9300.             }
  9301.             v14 = v23;
  9302.             // continue -> 0x8cd8
  9303.             continue;
  9304.         }
  9305.         // 0x8d38
  9306.         if (v15 == 0) {
  9307.             // 0x8d88
  9308.             g127 = 0;
  9309.             g134 = v3;
  9310.             g135 = v4;
  9311.             g136 = v5;
  9312.             g137 = v6;
  9313.             g138 = v7;
  9314.             g139 = v8;
  9315.             g129 = v9;
  9316.             g130 = v10;
  9317.             return 0;
  9318.         }
  9319.         // 0x8d40
  9320.         mem = malloc(32);
  9321.         v2 = mem;
  9322.         chars_printed = sprintf(mem, "transform %u: ", g135);
  9323.         concatenate((int32_t *)&v2, &chars_printed, (char *)g139, 0);
  9324.         free((char *)g139);
  9325.         result = (int32_t)v2;
  9326.         g127 = result;
  9327.         g134 = v3;
  9328.         g135 = v4;
  9329.         g136 = v5;
  9330.         g137 = v6;
  9331.         g138 = v7;
  9332.         g139 = v8;
  9333.         g129 = v9;
  9334.         g130 = v10;
  9335.         return result;
  9336.     }
  9337.     // 0x8d38
  9338.     if (v15 == 0) {
  9339.         // 0x8d88
  9340.         g127 = 0;
  9341.         g134 = v3;
  9342.         g135 = v4;
  9343.         g136 = v5;
  9344.         g137 = v6;
  9345.         g138 = v7;
  9346.         g139 = v8;
  9347.         g129 = v9;
  9348.         g130 = v10;
  9349.         return 0;
  9350.     }
  9351.     // 0x8d40
  9352.     mem = malloc(32);
  9353.     v2 = mem;
  9354.     chars_printed = sprintf(mem, "transform %u: ", g135);
  9355.     concatenate((int32_t *)&v2, &chars_printed, (char *)g139, 0);
  9356.     free((char *)g139);
  9357.     result = (int32_t)v2;
  9358.     g127 = result;
  9359.     g134 = v3;
  9360.     g135 = v4;
  9361.     g136 = v5;
  9362.     g137 = v6;
  9363.     g138 = v7;
  9364.     g139 = v8;
  9365.     g129 = v9;
  9366.     g130 = v10;
  9367.     return result;
  9368. }
  9369.  
  9370. // Address range: 0x8d98 - 0x8db7
  9371. int32_t enforce_value_size(int32_t a1, uint32_t a2) {
  9372.     // 0x8d98
  9373.     g128 = a2;
  9374.     g1 = a2 > 1;
  9375.     g2 = a2 < 2;
  9376.     g3 = a2 == 2;
  9377.     if (a2 == 2) {
  9378.         int32_t result = 0x10000 * a1 / 0x10000; // 0x8db0
  9379.         g127 = result;
  9380.         return result;
  9381.     }
  9382.     // 0x8da0
  9383.     g1 = a2 != 0;
  9384.     g2 = a2 < 1;
  9385.     g3 = a2 == 1;
  9386.     int32_t result2 = 0x1000000 * a1 / 0x1000000; // 0x8da4
  9387.     g127 = result2;
  9388.     return result2;
  9389. }
  9390.  
  9391. // Address range: 0x8db8 - 0x8fc7
  9392. int32_t script_transform_basic(char a1, int32_t a2, int32_t a3) {
  9393.     g132 = a3;
  9394.     int32_t v1 = g134; // 0x8db8
  9395.     int32_t v2 = g135; // 0x8db8
  9396.     int32_t v3 = g136; // 0x8db8
  9397.     int32_t v4 = g137; // 0x8db8
  9398.     int32_t v5 = g138; // 0x8db8
  9399.     int32_t v6 = g139; // 0x8db8
  9400.     int32_t v7 = g129; // 0x8db8
  9401.     int32_t v8 = g130; // bp-8
  9402.     g130 = &v8;
  9403.     int32_t v9;
  9404.     g139 = v9;
  9405.     g137 = a1;
  9406.     g135 = g133;
  9407.     g136 = a3;
  9408.     *(char *)v9 = a1;
  9409.     g134 = a2;
  9410.     *(int32_t *)(g139 + 8) = 0;
  9411.     uint32_t v10 = g137 % 256; // 0x8dec
  9412.     uint32_t v11 = v10 - 1; // 0x8dec
  9413.     g1 = v11 > 5;
  9414.     g2 = v10 < 7;
  9415.     g3 = v11 == 6;
  9416.     if (v11 > 6) {
  9417.         // 0x8e50
  9418.         g127 = (int32_t)"type mismatch";
  9419.         g126 = 0x8e5c;
  9420.         int32_t result = duplicate_string(); // 0x8e58
  9421.         g134 = v1;
  9422.         g135 = v2;
  9423.         g136 = v3;
  9424.         g137 = v4;
  9425.         g138 = v5;
  9426.         g139 = v6;
  9427.         g129 = v7;
  9428.         return result;
  9429.     }
  9430.     // 0x8df8
  9431.     g128 = &g62;
  9432.     int32_t v12;
  9433.     g129 = v12;
  9434.     int32_t v13 = *(int32_t *)(4 * v11 + (int32_t)&g62); // 0x8e04
  9435.     g127 = v13;
  9436.     ((int32_t (*)(int32_t, int32_t))(v13 + (int32_t)&g62))(v13, (int32_t)&g62);
  9437.     if (g3) {
  9438.         // after_if_8e20_0
  9439.         abort();
  9440.         // UNREACHABLE
  9441.     }
  9442.     // after_if_8e24_0
  9443.     int32_t result2;
  9444.     int32_t v14 = &result2; // 0x8e28_0
  9445.     g132 = v14;
  9446.     int32_t v15 = g134; // 0x8e2c
  9447.     g127 = v15;
  9448.     int32_t v16 = g135; // 0x8e30
  9449.     g128 = v16;
  9450.     g126 = 0x8e38;
  9451.     ((int32_t (*)(int32_t, int32_t, int32_t))g129)(v15, v16, v14);
  9452.     uint32_t v17 = g137 % 256; // 0x8e38
  9453.     g128 = v17;
  9454.     g1 = v17 > 1;
  9455.     g2 = v17 < 2;
  9456.     g3 = v17 == 2;
  9457.     int32_t v18;
  9458.     if (v17 == 2) {
  9459.         // 0x8f9c
  9460.         v18 = 0x10000 * g127 / 0x10000;
  9461.         // branch -> 0x8fa0
  9462.     } else {
  9463.         // 0x8e44
  9464.         g1 = v17 != 0;
  9465.         g2 = v17 == 0;
  9466.         g3 = v17 == 1;
  9467.         v18 = 0x1000000 * g127 / 0x1000000;
  9468.         // branch -> 0x8fa0
  9469.     }
  9470.     // 0x8fa0
  9471.     *(int32_t *)(g139 + 4) = v18;
  9472.     g127 = result2;
  9473.     int32_t v19 = g130; // 0x8fbc
  9474.     g134 = *(int32_t *)(v19 - 28);
  9475.     g135 = *(int32_t *)(v19 - 24);
  9476.     g136 = *(int32_t *)(v19 - 20);
  9477.     g137 = *(int32_t *)(v19 - 16);
  9478.     g138 = *(int32_t *)(v19 - 12);
  9479.     g139 = *(int32_t *)(v19 - 8);
  9480.     g129 = *(int32_t *)(v19 - 4);
  9481.     g130 = *(int32_t *)v19;
  9482.     ((int32_t (*)(int32_t))*(int32_t *)(v19 + 4))(result2);
  9483.     if (g3) {
  9484.         // if_8fc4_0_true
  9485.         g134 = g134 / 256 & result2;
  9486.         // branch -> after_if_8fc4_0
  9487.     }
  9488.     // after_if_8fc4_0
  9489.     return result2;
  9490. }
  9491.  
  9492. // Address range: 0x8fc8 - 0x8fdb
  9493. int32_t read_16(char * a1) {
  9494.     char v1 = *(char *)((int32_t)a1 + 1); // 0x8fcc
  9495.     return 256 * (int32_t)v1 | (int32_t)*a1;
  9496. }
  9497.  
  9498. // Address range: 0x8fdc - 0x8ffb
  9499. int32_t read_32(char * a1) {
  9500.     int32_t v1 = (int32_t)a1;
  9501.     char v2 = *(char *)(v1 + 1); // 0x8fdc
  9502.     char v3 = *a1; // 0x8fe0
  9503.     char v4 = *(char *)(v1 + 2); // 0x8fe4
  9504.     char v5 = *(char *)(v1 + 3); // 0x8fe8
  9505.     return (int32_t)v3 | 256 * (int32_t)v2 | 0x10000 * (int32_t)v4 | 0x1000000 * (int32_t)v5;
  9506. }
  9507.  
  9508. // Address range: 0x8ffc - 0x90e3
  9509. int32_t script_transform_skip(unsigned char a1, int32_t a2, int32_t a3, int32_t a4) {
  9510.     int32_t v1 = g134; // bp-32
  9511.     int32_t v2 = g135; // 0x8ffc
  9512.     int32_t v3 = g138; // 0x8ffc
  9513.     int32_t v4 = g130; // bp-8
  9514.     int32_t v5 = g126; // 0x8ffc
  9515.     g135 = a3;
  9516.     int32_t v6 = a2 - a4; // R2
  9517.     g133 = 0;
  9518.     int32_t v7;
  9519.     *(char *)v7 = a1;
  9520.     *(int32_t *)(v7 + 4) = v6;
  9521.     *(int32_t *)(v7 + 8) = 0;
  9522.     if (a4 < 0) {
  9523.         // 0x9048
  9524.         g127 = (int32_t)"negative skip count";
  9525.         g134 = v1;
  9526.         g135 = v2;
  9527.         g138 = v3;
  9528.         g130 = v4;
  9529.         g126 = v5;
  9530.         return duplicate_string();
  9531.     }
  9532.     int32_t v8 = a1;
  9533.     int32_t v9 = v8 - 1; // 0x902c
  9534.     g133 = v9;
  9535.     if (v9 <= 2) {
  9536.         // 0x9038
  9537.         g127 = (int32_t)"type mismatch";
  9538.         g134 = v1;
  9539.         g135 = v2;
  9540.         g138 = v3;
  9541.         g130 = v4;
  9542.         g126 = v5;
  9543.         return duplicate_string();
  9544.     }
  9545.     // 0x9058
  9546.     if (a4 > a2) {
  9547.         // 0x9060
  9548.         g127 = (int32_t)"skip count is greater than length";
  9549.         g134 = v1;
  9550.         g135 = v2;
  9551.         g138 = v3;
  9552.         g130 = v4;
  9553.         g126 = v5;
  9554.         return duplicate_string();
  9555.     }
  9556.     // 0x9070
  9557.     if (a1 < 8) {
  9558.         // 0x908c
  9559.         g127 = (int32_t)"internal error";
  9560.         g134 = v1;
  9561.         g135 = v2;
  9562.         g138 = v3;
  9563.         g130 = v4;
  9564.         g126 = v5;
  9565.         return duplicate_string();
  9566.     }
  9567.     // 0x907c
  9568.     g133 = 241;
  9569.     int32_t v10 = *(int32_t *)(0x1000000 * v8 / 0x400000 + (int32_t)&g121); // 0x90a8
  9570.     int32_t size = v6 * v10; // 0x90ac
  9571.     g138 = size;
  9572.     char * mem = malloc(size); // 0x90b4
  9573.     *(int32_t *)(v7 + 8) = (int32_t)mem;
  9574.     __aeabi_memcpy(mem, (char *)(g135 + a4 * v10), g138);
  9575.     g134 = v1;
  9576.     g135 = v2;
  9577.     g138 = v3;
  9578.     g130 = v4;
  9579.     return 0;
  9580. }
  9581.  
  9582. // Address range: 0x90e4 - 0x91ab
  9583. int32_t script_transform_item(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5) {
  9584.     int32_t v1 = g130; // bp-8
  9585.     int32_t v2 = (int32_t)a5; // R12
  9586.     *a5 = (char)(a1 + 252);
  9587.     *(int32_t *)(v2 + 8) = 0;
  9588.     if (a4 < 0) {
  9589.         // 0x9124
  9590.         g127 = (int32_t)"negative index";
  9591.         g130 = v1;
  9592.         return duplicate_string();
  9593.     }
  9594.     uint32_t v3 = a1 % 256; // 0x9108
  9595.     if (v3 <= 4) {
  9596.         // 0x9114
  9597.         g127 = (int32_t)"type mismatch";
  9598.         g130 = v1;
  9599.         return duplicate_string();
  9600.     }
  9601.     // 0x9134
  9602.     if (a2 <= a4) {
  9603.         // 0x9160
  9604.         g127 = (int32_t)"index out of bounds";
  9605.         g130 = v1;
  9606.         return duplicate_string();
  9607.     }
  9608.     // 0x913c
  9609.     if (v3 == 7) {
  9610.         // 0x9170
  9611.         // branch -> 0x9180
  9612.         // 0x9180
  9613.         *(int32_t *)(v2 + 4) = *(int32_t *)(4 * a4 + a3);
  9614.         return 0;
  9615.     }
  9616.     // 0x9144
  9617.     int32_t v4; // 0x9180
  9618.     if (v3 == 6) {
  9619.         // 0x9178
  9620.         v4 = (int32_t)*(int16_t *)(2 * a4 + a3);
  9621.         // branch -> 0x9180
  9622.     } else {
  9623.         // 0x914c
  9624.         if (v3 != 5) {
  9625.             // 0x918c
  9626.             g127 = (int32_t)"internal error";
  9627.             g130 = v1;
  9628.             return duplicate_string();
  9629.         }
  9630.         // 0x9154
  9631.         v4 = (int32_t)*(char *)(a4 + a3);
  9632.         // branch -> 0x9180
  9633.     }
  9634.     // 0x9180
  9635.     *(int32_t *)(v2 + 4) = v4;
  9636.     return 0;
  9637. }
  9638.  
  9639. // Address range: 0x91ac - 0x928f
  9640. int32_t script_transform_copy(unsigned char a1, int32_t a2, char * a3, int32_t a4) {
  9641.     // 0x91ac
  9642.     g133 = a4;
  9643.     int32_t v1 = g134; // bp-24
  9644.     int32_t v2 = g135; // 0x91ac
  9645.     int32_t v3 = g130; // bp-8
  9646.     int32_t v4 = g126; // 0x91ac
  9647.     int32_t v5 = (int32_t)a3; // R4
  9648.     g132 = 0;
  9649.     int32_t v6;
  9650.     *(char *)v6 = a1;
  9651.     *(int32_t *)(v6 + 4) = a4;
  9652.     *(int32_t *)(v6 + 8) = 0;
  9653.     if (a4 < 0) {
  9654.         // 0x91f4
  9655.         g127 = (int32_t)"negative length";
  9656.         g134 = v1;
  9657.         g135 = v2;
  9658.         g130 = v3;
  9659.         g126 = v4;
  9660.         return duplicate_string();
  9661.     }
  9662.     int32_t v7 = a1;
  9663.     int32_t v8 = v7 - 1; // 0x91d8
  9664.     g132 = v8;
  9665.     if (v8 <= 2) {
  9666.         // 0x91e4
  9667.         g127 = (int32_t)"type mismatch";
  9668.         g134 = v1;
  9669.         g135 = v2;
  9670.         g130 = v3;
  9671.         g126 = v4;
  9672.         return duplicate_string();
  9673.     }
  9674.     // 0x9204
  9675.     if (a2 < a4) {
  9676.         // 0x920c
  9677.         g127 = (int32_t)"length is greater than data size";
  9678.         g134 = v1;
  9679.         g135 = v2;
  9680.         g130 = v3;
  9681.         g126 = v4;
  9682.         return duplicate_string();
  9683.     }
  9684.     // 0x921c
  9685.     if (a1 < 8) {
  9686.         // 0x9238
  9687.         g127 = (int32_t)"internal error";
  9688.         g134 = v1;
  9689.         g135 = v2;
  9690.         g130 = v3;
  9691.         g126 = v4;
  9692.         return duplicate_string();
  9693.     }
  9694.     // 0x9228
  9695.     g135 = 1;
  9696.     int32_t v9 = *(int32_t *)(0x1000000 * v7 / 0x400000 + (int32_t)&g121); // 0x9254
  9697.     int32_t size = v9 * a4; // 0x9258
  9698.     g135 = size;
  9699.     char * mem = malloc(size); // 0x9260
  9700.     g128 = v5;
  9701.     int32_t v10 = g135; // 0x9268
  9702.     g132 = v10;
  9703.     *(int32_t *)(v6 + 8) = (int32_t)mem;
  9704.     __aeabi_memcpy(mem, (char *)v5, v10);
  9705.     g134 = v1;
  9706.     g135 = v2;
  9707.     g130 = v3;
  9708.     return 0;
  9709. }
  9710.  
  9711. // Address range: 0x9290 - 0x956f
  9712. int32_t script_transform_count_values(int32_t a1, int32_t a2, int32_t * a3, int32_t a4) {
  9713.     // 0x9290
  9714.     g128 = a2;
  9715.     int32_t v1 = (int32_t)a3;
  9716.     g132 = v1;
  9717.     g133 = a4;
  9718.     int32_t v2 = g134; // 0x9290
  9719.     int32_t v3 = g135; // 0x9290
  9720.     int32_t v4 = g136; // 0x9290
  9721.     int32_t v5 = g137; // 0x9290
  9722.     int32_t v6 = g138; // 0x9290
  9723.     int32_t v7 = g129; // 0x9290
  9724.     int32_t v8 = g130; // bp-8
  9725.     int32_t v9 = g126; // 0x9290
  9726.     g130 = &v8;
  9727.     int32_t v10;
  9728.     g129 = v10;
  9729.     g137 = a1;
  9730.     int32_t v11;
  9731.     g138 = v11;
  9732.     g135 = a4;
  9733.     g139 = v1;
  9734.     *(char *)v10 = 3;
  9735.     *(int32_t *)(g129 + 8) = 0;
  9736.     uint32_t v12 = g137 % 256 - 1; // 0x92c4
  9737.     g134 = a2;
  9738.     g3 = v12 == 2;
  9739.     if (v12 <= 2) {
  9740.         // 0x92d4
  9741.         g127 = (int32_t)"type mismatch";
  9742.         g134 = v2;
  9743.         g135 = v3;
  9744.         g136 = v4;
  9745.         g137 = v5;
  9746.         g138 = v6;
  9747.         g129 = v7;
  9748.         g130 = v8;
  9749.         g126 = v9;
  9750.         g127 = duplicate_string();
  9751.         return g131;
  9752.     }
  9753.     int32_t size = 4 * a2; // 0x92e8
  9754.     g136 = size;
  9755.     g126 = (int32_t)malloc(size);
  9756.     uint32_t v13 = g137 % 256; // 0x92f8
  9757.     g1 = v13 > 6;
  9758.     g2 = v13 < 7;
  9759.     g3 = v13 == 7;
  9760.     int32_t v14; // R6
  9761.     uint32_t v15; // 0x948c
  9762.     int32_t v16; // 0x94d0
  9763.     int32_t v17; // 0x9514
  9764.     int32_t v18; // 0x951432
  9765.     int32_t v19; // 0x9518
  9766.     int32_t v20; // 0x9528
  9767.     int32_t v21; // 0x9540
  9768.     int32_t v22; // 0x950c
  9769.     int32_t v23; // 0x9550
  9770.     int32_t v24; // 0x94c8
  9771.     int32_t v25; // 0x9504
  9772.     int32_t v26; // 0x950c
  9773.     int32_t v27; // 0x9508
  9774.     int32_t v28; // 0x950c
  9775.     int32_t v29; // 0x9550
  9776.     if (v13 <= 7) {
  9777.         // 0x9304
  9778.         g128 = &g63;
  9779.         int32_t v30 = *(int32_t *)(4 * v13 + (int32_t)&g63); // 0x930c
  9780.         g127 = v30;
  9781.         ((int32_t (*)(int32_t, int32_t))(v30 + (int32_t)&g63))(v30, (int32_t)&g63);
  9782.         if (g3) {
  9783.             // if_9330_0_true
  9784.             // branch -> after_if_9330_0
  9785.         }
  9786.         // after_if_9330_0
  9787.         if (g134 != 0) {
  9788.             // 0x933c
  9789.             int32_t v31; // 0x93b8
  9790.             int32_t v32; // 0x93b4
  9791.             int32_t v33; // 0x93bc
  9792.             int32_t v34; // 0x93b0
  9793.             int32_t v35; // 0x9558
  9794.             int32_t v36; // 0x955c
  9795.             int32_t v37; // 0x93b4
  9796.             if (g134 < 4) {
  9797.                 // 0x933c
  9798.                 v34 = 0;
  9799.                 // branch -> 0x93a8
  9800.             } else {
  9801.                 // 0x9348
  9802.                 if (g126 < g139 + g134) {
  9803.                     // after_if_9364_0
  9804.                     if (g139 < g126 + 4 * g134) {
  9805.                         v34 = 0;
  9806.                         // 0x93a8
  9807.                         v33 = 4 * v34 + g126;
  9808.                         v31 = g134 - v34;
  9809.                         v32 = v34 + g139;
  9810.                         // branch -> 0x93b4
  9811.                         while (true) {
  9812.                             // 0x93b4
  9813.                             g128 = v32 + 1;
  9814.                             v37 = (int32_t)*(char *)v32;
  9815.                             g133 = v37;
  9816.                             g132 = v33 + 4;
  9817.                             *(int32_t *)v33 = v37;
  9818.                             if (v31 == 1) {
  9819.                                 // 0x93c4
  9820.                                 // branch -> 0x9488
  9821.                                 // 0x9488
  9822.                                 v14 = 0;
  9823.                                 v15 = g134;
  9824.                                 int32_t v38; // 0x9520
  9825.                                 if (v15 == 0) {
  9826.                                     // 0x9488
  9827.                                     v38 = g126;
  9828.                                     // branch -> 0x9520
  9829.                                 } else {
  9830.                                     // 0x9494
  9831.                                     if (v15 < 4) {
  9832.                                         // 0x94a4
  9833.                                         v24 = g126;
  9834.                                         g132 = v24;
  9835.                                         v16 = &g65;
  9836.                                         // branch -> 0x94cc
  9837.                                         while (v16 != 4) {
  9838.                                             // 0x94cc
  9839.                                             v16 -= 4;
  9840.                                             // continue -> 0x94cc
  9841.                                         }
  9842.                                         // 0x94e4
  9843.                                         g128 = &g65;
  9844.                                         if (v15 == (int32_t)&g65) {
  9845.                                             // 0x9520
  9846.                                             free((char *)v24);
  9847.                                             v20 = g138;
  9848.                                             g3 = v20 == 0;
  9849.                                             if (v20 == 0) {
  9850.                                                 // 0x9520
  9851.                                                 // branch -> 0x955c
  9852.                                                 // 0x955c
  9853.                                                 *(int32_t *)(g129 + 4) = v14;
  9854.                                                 // branch -> 0x9560
  9855.                                                 // 0x9560
  9856.                                                 g127 = 0;
  9857.                                                 g134 = v2;
  9858.                                                 g135 = v3;
  9859.                                                 g136 = v4;
  9860.                                                 g137 = v5;
  9861.                                                 g138 = v6;
  9862.                                                 g129 = v7;
  9863.                                                 return 0;
  9864.                                             }
  9865.                                             // 0x9530
  9866.                                             if (v20 == 2) {
  9867.                                                 // 0x954c
  9868.                                                 v23 = g134;
  9869.                                                 v29 = v14;
  9870.                                                 g3 = v29 == v23;
  9871.                                                 if (v29 == v23) {
  9872.                                                     // if_9554_0_true
  9873.                                                     // branch -> after_if_9554_0
  9874.                                                     // after_if_9554_0
  9875.                                                     // branch -> 0x955c
  9876.                                                     // 0x955c
  9877.                                                     *(int32_t *)(g129 + 4) = 1;
  9878.                                                     // branch -> 0x9560
  9879.                                                     // 0x9560
  9880.                                                     g127 = 0;
  9881.                                                     g134 = v2;
  9882.                                                     g135 = v3;
  9883.                                                     g136 = v4;
  9884.                                                     g137 = v5;
  9885.                                                     g138 = v6;
  9886.                                                     g129 = v7;
  9887.                                                     return 0;
  9888.                                                 }
  9889.                                                 // after_if_9554_0
  9890.                                                 // branch -> 0x955c
  9891.                                                 // 0x955c
  9892.                                                 *(int32_t *)(g129 + 4) = 0;
  9893.                                                 // branch -> 0x9560
  9894.                                                 // 0x9560
  9895.                                                 g127 = 0;
  9896.                                                 g134 = v2;
  9897.                                                 g135 = v3;
  9898.                                                 g136 = v4;
  9899.                                                 g137 = v5;
  9900.                                                 g138 = v6;
  9901.                                                 g129 = v7;
  9902.                                                 return 0;
  9903.                                             }
  9904.                                             // 0x9538
  9905.                                             g3 = v20 == 1;
  9906.                                             if (v20 != 1) {
  9907.                                                 // 0x9560
  9908.                                                 g127 = 0;
  9909.                                                 g134 = v2;
  9910.                                                 g135 = v3;
  9911.                                                 g136 = v4;
  9912.                                                 g137 = v5;
  9913.                                                 g138 = v6;
  9914.                                                 g129 = v7;
  9915.                                                 return 0;
  9916.                                             }
  9917.                                             // 0x9540
  9918.                                             v21 = v14;
  9919.                                             g3 = v21 == 0;
  9920.                                             if (v21 != 0) {
  9921.                                                 // if_9544_0_true
  9922.                                                 v36 = v21 & -0x10000 | 1;
  9923.                                                 // branch -> 0x955c
  9924.                                             } else {
  9925.                                                 v36 = 0;
  9926.                                             }
  9927.                                             // 0x955c
  9928.                                             *(int32_t *)(g129 + 4) = v36;
  9929.                                             // branch -> 0x9560
  9930.                                             // 0x9560
  9931.                                             g127 = 0;
  9932.                                             g134 = v2;
  9933.                                             g135 = v3;
  9934.                                             g136 = v4;
  9935.                                             g137 = v5;
  9936.                                             g138 = v6;
  9937.                                             g129 = v7;
  9938.                                             return 0;
  9939.                                         }
  9940.                                         v27 = v24;
  9941.                                         v25 = &g65;
  9942.                                     } else {
  9943.                                         // 0x949c
  9944.                                         v27 = g126;
  9945.                                         v25 = 0;
  9946.                                         // branch -> 0x9504
  9947.                                     }
  9948.                                     // 0x9504
  9949.                                     v19 = v15 - v25;
  9950.                                     v17 = 0;
  9951.                                     v22 = 4 * v25 + v27;
  9952.                                     // branch -> 0x950c
  9953.                                     while (true) {
  9954.                                         // 0x950c
  9955.                                         v26 = v22 + 4;
  9956.                                         g128 = v26;
  9957.                                         v28 = *(int32_t *)v22;
  9958.                                         g132 = v28;
  9959.                                         v18 = v17;
  9960.                                         if (v28 == g135) {
  9961.                                           lab_if_9514_0_true_3:;
  9962.                                             int32_t v39 = v17 + 1; // 0x9514
  9963.                                             v14 = v39;
  9964.                                             v18 = v39;
  9965.                                             // branch -> after_if_9514_0
  9966.                                         }
  9967.                                       lab_after_if_9514_0_3:
  9968.                                         // after_if_9514_0
  9969.                                         if (v19 == 1) {
  9970.                                             // break -> 0x9520
  9971.                                             break;
  9972.                                         }
  9973.                                         v19--;
  9974.                                         v17 = v18;
  9975.                                         v22 = v26;
  9976.                                         // continue -> 0x950c
  9977.                                     }
  9978.                                     // 0x9520
  9979.                                     v38 = v27;
  9980.                                     // branch -> 0x9520
  9981.                                 }
  9982.                                 // 0x9520
  9983.                                 free((char *)v38);
  9984.                                 v20 = g138;
  9985.                                 g3 = v20 == 0;
  9986.                                 if (v20 == 0) {
  9987.                                     // 0x9520
  9988.                                     // branch -> 0x955c
  9989.                                     // 0x955c
  9990.                                     *(int32_t *)(g129 + 4) = v14;
  9991.                                     // branch -> 0x9560
  9992.                                     // 0x9560
  9993.                                     g127 = 0;
  9994.                                     g134 = v2;
  9995.                                     g135 = v3;
  9996.                                     g136 = v4;
  9997.                                     g137 = v5;
  9998.                                     g138 = v6;
  9999.                                     g129 = v7;
  10000.                                     return 0;
  10001.                                 }
  10002.                                 // 0x9530
  10003.                                 if (v20 == 2) {
  10004.                                     // 0x954c
  10005.                                     v23 = g134;
  10006.                                     v29 = v14;
  10007.                                     g3 = v29 == v23;
  10008.                                     if (v29 == v23) {
  10009.                                         // if_9554_0_true
  10010.                                         // branch -> after_if_9554_0
  10011.                                         // after_if_9554_0
  10012.                                         // branch -> 0x955c
  10013.                                         // 0x955c
  10014.                                         *(int32_t *)(g129 + 4) = 1;
  10015.                                         // branch -> 0x9560
  10016.                                         // 0x9560
  10017.                                         g127 = 0;
  10018.                                         g134 = v2;
  10019.                                         g135 = v3;
  10020.                                         g136 = v4;
  10021.                                         g137 = v5;
  10022.                                         g138 = v6;
  10023.                                         g129 = v7;
  10024.                                         return 0;
  10025.                                     }
  10026.                                     // after_if_9554_0
  10027.                                     // branch -> 0x955c
  10028.                                     // 0x955c
  10029.                                     *(int32_t *)(g129 + 4) = 0;
  10030.                                     // branch -> 0x9560
  10031.                                     // 0x9560
  10032.                                     g127 = 0;
  10033.                                     g134 = v2;
  10034.                                     g135 = v3;
  10035.                                     g136 = v4;
  10036.                                     g137 = v5;
  10037.                                     g138 = v6;
  10038.                                     g129 = v7;
  10039.                                     return 0;
  10040.                                 }
  10041.                                 // 0x9538
  10042.                                 g3 = v20 == 1;
  10043.                                 if (v20 != 1) {
  10044.                                     // 0x9560
  10045.                                     g127 = 0;
  10046.                                     g134 = v2;
  10047.                                     g135 = v3;
  10048.                                     g136 = v4;
  10049.                                     g137 = v5;
  10050.                                     g138 = v6;
  10051.                                     g129 = v7;
  10052.                                     return 0;
  10053.                                 }
  10054.                                 // 0x9540
  10055.                                 v21 = v14;
  10056.                                 g3 = v21 == 0;
  10057.                                 if (v21 != 0) {
  10058.                                     // if_9544_0_true
  10059.                                     v36 = v21 & -0x10000 | 1;
  10060.                                     // branch -> 0x955c
  10061.                                 } else {
  10062.                                     v36 = 0;
  10063.                                 }
  10064.                                 // 0x955c
  10065.                                 *(int32_t *)(g129 + 4) = v36;
  10066.                                 // branch -> 0x9560
  10067.                                 // 0x9560
  10068.                                 g127 = 0;
  10069.                                 g134 = v2;
  10070.                                 g135 = v3;
  10071.                                 g136 = v4;
  10072.                                 g137 = v5;
  10073.                                 g138 = v6;
  10074.                                 g129 = v7;
  10075.                                 return 0;
  10076.                             }
  10077.                           lab_0x93b4:
  10078.                             // 0x93b4
  10079.                             v33 = g132;
  10080.                             v31--;
  10081.                             v32 = g128;
  10082.                             // branch -> 0x93b4
  10083.                         }
  10084.                     }
  10085.                 }
  10086.                 // 0x936c
  10087.                 g133 = g126;
  10088.                 int32_t v40 = g139; // 0x937c
  10089.                 int32_t v41 = &g64; // 0x9380
  10090.                 int32_t v42 = v41 - 4; // 0x9380
  10091.                 g132 = v42;
  10092.                 // branch -> 0x937c
  10093.                 while (v41 != 4) {
  10094.                     // 0x937c
  10095.                     v40 += 4;
  10096.                     v41 = v42;
  10097.                     v42 = v41 - 4;
  10098.                     g132 = v42;
  10099.                     // continue -> 0x937c
  10100.                 }
  10101.                 // 0x939c
  10102.                 g128 = &g64;
  10103.                 if (g134 == (int32_t)&g64) {
  10104.                     // 0x93c4
  10105.                     // branch -> 0x9488
  10106.                     // 0x9488
  10107.                     v14 = 0;
  10108.                     v15 = g134;
  10109.                     if (v15 == 0) {
  10110.                         // 0x9488
  10111.                         // branch -> 0x9520
  10112.                     } else {
  10113.                         // 0x9494
  10114.                         if (v15 < 4) {
  10115.                             // 0x94a4
  10116.                             v24 = g126;
  10117.                             g132 = v24;
  10118.                             v16 = &g65;
  10119.                             // branch -> 0x94cc
  10120.                             while (v16 != 4) {
  10121.                                 // 0x94cc
  10122.                                 v16 -= 4;
  10123.                                 // continue -> 0x94cc
  10124.                             }
  10125.                             // 0x94e4
  10126.                             g128 = &g65;
  10127.                             if (v15 == (int32_t)&g65) {
  10128.                                 // 0x9520
  10129.                                 free((char *)v24);
  10130.                                 v20 = g138;
  10131.                                 g3 = v20 == 0;
  10132.                                 if (v20 == 0) {
  10133.                                     // 0x9520
  10134.                                     // branch -> 0x955c
  10135.                                     // 0x955c
  10136.                                     *(int32_t *)(g129 + 4) = v14;
  10137.                                     // branch -> 0x9560
  10138.                                 } else {
  10139.                                     // 0x9530
  10140.                                     if (v20 != 2) {
  10141.                                         // 0x9538
  10142.                                         g3 = v20 == 1;
  10143.                                         if (v20 == 1) {
  10144.                                             // 0x9540
  10145.                                             v21 = v14;
  10146.                                             g3 = v21 == 0;
  10147.                                             if (v21 != 0) {
  10148.                                                 // if_9544_0_true
  10149.                                                 v36 = v21 & -0x10000 | 1;
  10150.                                                 // branch -> 0x955c
  10151.                                             } else {
  10152.                                                 v36 = 0;
  10153.                                             }
  10154.                                             // 0x955c
  10155.                                             *(int32_t *)(g129 + 4) = v36;
  10156.                                             // branch -> 0x9560
  10157.                                         }
  10158.                                         // 0x9560
  10159.                                         g127 = 0;
  10160.                                         g134 = v2;
  10161.                                         g135 = v3;
  10162.                                         g136 = v4;
  10163.                                         g137 = v5;
  10164.                                         g138 = v6;
  10165.                                         g129 = v7;
  10166.                                         return 0;
  10167.                                     }
  10168.                                     // 0x954c
  10169.                                     v23 = g134;
  10170.                                     v29 = v14;
  10171.                                     g3 = v29 == v23;
  10172.                                     v35 = 0;
  10173.                                     if (v29 == v23) {
  10174.                                         // if_9554_0_true
  10175.                                         v35 = 1;
  10176.                                         // branch -> after_if_9554_0
  10177.                                     }
  10178.                                     // after_if_9554_0
  10179.                                     // branch -> 0x955c
  10180.                                     // 0x955c
  10181.                                     *(int32_t *)(g129 + 4) = v35;
  10182.                                     // branch -> 0x9560
  10183.                                 }
  10184.                                 // 0x9560
  10185.                                 g127 = 0;
  10186.                                 g134 = v2;
  10187.                                 g135 = v3;
  10188.                                 g136 = v4;
  10189.                                 g137 = v5;
  10190.                                 g138 = v6;
  10191.                                 g129 = v7;
  10192.                                 return 0;
  10193.                             }
  10194.                             v27 = v24;
  10195.                             v25 = &g65;
  10196.                         } else {
  10197.                             // 0x949c
  10198.                             v27 = g126;
  10199.                             v25 = 0;
  10200.                             // branch -> 0x9504
  10201.                         }
  10202.                         // 0x9504
  10203.                         v19 = v15 - v25;
  10204.                         v17 = 0;
  10205.                         v22 = 4 * v25 + v27;
  10206.                         // branch -> 0x950c
  10207.                         while (true) {
  10208.                             // 0x950c
  10209.                             v26 = v22 + 4;
  10210.                             g128 = v26;
  10211.                             v28 = *(int32_t *)v22;
  10212.                             g132 = v28;
  10213.                             if (v28 == g135) {
  10214.                                 goto lab_if_9514_0_true_3;
  10215.                             }
  10216.                             v18 = v17;
  10217.                             goto lab_after_if_9514_0_3;
  10218.                         }
  10219.                     }
  10220.                     // 0x9520
  10221.                     free((char *)g126);
  10222.                     v20 = g138;
  10223.                     g3 = v20 == 0;
  10224.                     if (v20 == 0) {
  10225.                         // 0x9520
  10226.                         // branch -> 0x955c
  10227.                         // 0x955c
  10228.                         *(int32_t *)(g129 + 4) = v14;
  10229.                         // branch -> 0x9560
  10230.                     } else {
  10231.                         // 0x9530
  10232.                         if (v20 != 2) {
  10233.                             // 0x9538
  10234.                             g3 = v20 == 1;
  10235.                             if (v20 == 1) {
  10236.                                 // 0x9540
  10237.                                 v21 = v14;
  10238.                                 g3 = v21 == 0;
  10239.                                 if (v21 != 0) {
  10240.                                     // if_9544_0_true
  10241.                                     v36 = v21 & -0x10000 | 1;
  10242.                                     // branch -> 0x955c
  10243.                                 } else {
  10244.                                     v36 = 0;
  10245.                                 }
  10246.                                 // 0x955c
  10247.                                 *(int32_t *)(g129 + 4) = v36;
  10248.                                 // branch -> 0x9560
  10249.                             }
  10250.                             // 0x9560
  10251.                             g127 = 0;
  10252.                             g134 = v2;
  10253.                             g135 = v3;
  10254.                             g136 = v4;
  10255.                             g137 = v5;
  10256.                             g138 = v6;
  10257.                             g129 = v7;
  10258.                             return 0;
  10259.                         }
  10260.                         // 0x954c
  10261.                         v23 = g134;
  10262.                         v29 = v14;
  10263.                         g3 = v29 == v23;
  10264.                         v35 = 0;
  10265.                         if (v29 == v23) {
  10266.                             // if_9554_0_true
  10267.                             v35 = 1;
  10268.                             // branch -> after_if_9554_0
  10269.                         }
  10270.                         // after_if_9554_0
  10271.                         // branch -> 0x955c
  10272.                         // 0x955c
  10273.                         *(int32_t *)(g129 + 4) = v35;
  10274.                         // branch -> 0x9560
  10275.                     }
  10276.                     // 0x9560
  10277.                     g127 = 0;
  10278.                     g134 = v2;
  10279.                     g135 = v3;
  10280.                     g136 = v4;
  10281.                     g137 = v5;
  10282.                     g138 = v6;
  10283.                     g129 = v7;
  10284.                     return 0;
  10285.                 }
  10286.                 v34 = &g64;
  10287.             }
  10288.             // 0x93a8
  10289.             v33 = 4 * v34 + g126;
  10290.             v31 = g134 - v34;
  10291.             v32 = v34 + g139;
  10292.             // branch -> 0x93b4
  10293.             while (true) {
  10294.                 // 0x93b4
  10295.                 g128 = v32 + 1;
  10296.                 v37 = (int32_t)*(char *)v32;
  10297.                 g133 = v37;
  10298.                 g132 = v33 + 4;
  10299.                 *(int32_t *)v33 = v37;
  10300.                 if (v31 != 1) {
  10301.                     goto lab_0x93b4;
  10302.                 }
  10303.                 // 0x93c4
  10304.                 // branch -> 0x9488
  10305.                 // 0x9488
  10306.                 v14 = 0;
  10307.                 v15 = g134;
  10308.                 if (v15 == 0) {
  10309.                     // 0x9488
  10310.                     // branch -> 0x9520
  10311.                 } else {
  10312.                     // 0x9494
  10313.                     if (v15 < 4) {
  10314.                         // 0x94a4
  10315.                         v24 = g126;
  10316.                         g132 = v24;
  10317.                         v16 = &g65;
  10318.                         // branch -> 0x94cc
  10319.                         while (v16 != 4) {
  10320.                             // 0x94cc
  10321.                             v16 -= 4;
  10322.                             // continue -> 0x94cc
  10323.                         }
  10324.                         // 0x94e4
  10325.                         g128 = &g65;
  10326.                         if (v15 == (int32_t)&g65) {
  10327.                             // 0x9520
  10328.                             free((char *)v24);
  10329.                             v20 = g138;
  10330.                             g3 = v20 == 0;
  10331.                             if (v20 == 0) {
  10332.                                 // 0x9520
  10333.                                 // branch -> 0x955c
  10334.                                 // 0x955c
  10335.                                 *(int32_t *)(g129 + 4) = v14;
  10336.                                 // branch -> 0x9560
  10337.                                 // 0x9560
  10338.                                 g127 = 0;
  10339.                                 g134 = v2;
  10340.                                 g135 = v3;
  10341.                                 g136 = v4;
  10342.                                 g137 = v5;
  10343.                                 g138 = v6;
  10344.                                 g129 = v7;
  10345.                                 return 0;
  10346.                             }
  10347.                             // 0x9530
  10348.                             if (v20 == 2) {
  10349.                                 // 0x954c
  10350.                                 v23 = g134;
  10351.                                 v29 = v14;
  10352.                                 g3 = v29 == v23;
  10353.                                 if (v29 == v23) {
  10354.                                     // if_9554_0_true
  10355.                                     // branch -> after_if_9554_0
  10356.                                     // after_if_9554_0
  10357.                                     // branch -> 0x955c
  10358.                                     // 0x955c
  10359.                                     *(int32_t *)(g129 + 4) = 1;
  10360.                                     // branch -> 0x9560
  10361.                                     // 0x9560
  10362.                                     g127 = 0;
  10363.                                     g134 = v2;
  10364.                                     g135 = v3;
  10365.                                     g136 = v4;
  10366.                                     g137 = v5;
  10367.                                     g138 = v6;
  10368.                                     g129 = v7;
  10369.                                     return 0;
  10370.                                 }
  10371.                                 // after_if_9554_0
  10372.                                 // branch -> 0x955c
  10373.                                 // 0x955c
  10374.                                 *(int32_t *)(g129 + 4) = 0;
  10375.                                 // branch -> 0x9560
  10376.                                 // 0x9560
  10377.                                 g127 = 0;
  10378.                                 g134 = v2;
  10379.                                 g135 = v3;
  10380.                                 g136 = v4;
  10381.                                 g137 = v5;
  10382.                                 g138 = v6;
  10383.                                 g129 = v7;
  10384.                                 return 0;
  10385.                             }
  10386.                             // 0x9538
  10387.                             g3 = v20 == 1;
  10388.                             if (v20 != 1) {
  10389.                                 // 0x9560
  10390.                                 g127 = 0;
  10391.                                 g134 = v2;
  10392.                                 g135 = v3;
  10393.                                 g136 = v4;
  10394.                                 g137 = v5;
  10395.                                 g138 = v6;
  10396.                                 g129 = v7;
  10397.                                 return 0;
  10398.                             }
  10399.                             // 0x9540
  10400.                             v21 = v14;
  10401.                             g3 = v21 == 0;
  10402.                             if (v21 != 0) {
  10403.                                 // if_9544_0_true
  10404.                                 v36 = v21 & -0x10000 | 1;
  10405.                                 // branch -> 0x955c
  10406.                             } else {
  10407.                                 v36 = 0;
  10408.                             }
  10409.                             // 0x955c
  10410.                             *(int32_t *)(g129 + 4) = v36;
  10411.                             // branch -> 0x9560
  10412.                             // 0x9560
  10413.                             g127 = 0;
  10414.                             g134 = v2;
  10415.                             g135 = v3;
  10416.                             g136 = v4;
  10417.                             g137 = v5;
  10418.                             g138 = v6;
  10419.                             g129 = v7;
  10420.                             return 0;
  10421.                         }
  10422.                         v27 = v24;
  10423.                         v25 = &g65;
  10424.                     } else {
  10425.                         // 0x949c
  10426.                         v27 = g126;
  10427.                         v25 = 0;
  10428.                         // branch -> 0x9504
  10429.                     }
  10430.                     // 0x9504
  10431.                     v19 = v15 - v25;
  10432.                     v17 = 0;
  10433.                     v22 = 4 * v25 + v27;
  10434.                     // branch -> 0x950c
  10435.                     while (true) {
  10436.                         // 0x950c
  10437.                         v26 = v22 + 4;
  10438.                         g128 = v26;
  10439.                         v28 = *(int32_t *)v22;
  10440.                         g132 = v28;
  10441.                         if (v28 == g135) {
  10442.                             goto lab_if_9514_0_true_3;
  10443.                         }
  10444.                         v18 = v17;
  10445.                         goto lab_after_if_9514_0_3;
  10446.                     }
  10447.                 }
  10448.                 // 0x9520
  10449.                 free((char *)g126);
  10450.                 v20 = g138;
  10451.                 g3 = v20 == 0;
  10452.                 if (v20 == 0) {
  10453.                     // 0x9520
  10454.                     // branch -> 0x955c
  10455.                     // 0x955c
  10456.                     *(int32_t *)(g129 + 4) = v14;
  10457.                     // branch -> 0x9560
  10458.                     // Detected a possible infinite recursion (goto support failed); quitting...
  10459.                 } else {
  10460.                     // 0x9530
  10461.                     if (v20 == 2) {
  10462.                         // 0x954c
  10463.                         v23 = g134;
  10464.                         v29 = v14;
  10465.                         g3 = v29 == v23;
  10466.                         v35 = 0;
  10467.                         if (v29 == v23) {
  10468.                             // if_9554_0_true
  10469.                             v35 = 1;
  10470.                             // branch -> after_if_9554_0
  10471.                             // after_if_9554_0
  10472.                             // branch -> 0x955c
  10473.                             // 0x955c
  10474.                             *(int32_t *)(g129 + 4) = v35;
  10475.                             // branch -> 0x9560
  10476.                             // Detected a possible infinite recursion (goto support failed); quitting...
  10477.                         }
  10478.                         // after_if_9554_0
  10479.                         // branch -> 0x955c
  10480.                         // 0x955c
  10481.                         *(int32_t *)(g129 + 4) = v35;
  10482.                         // branch -> 0x9560
  10483.                         // Detected a possible infinite recursion (goto support failed); quitting...
  10484.                     } else {
  10485.                         // 0x9538
  10486.                         g3 = v20 == 1;
  10487.                         if (v20 == 1) {
  10488.                             // 0x9540
  10489.                             v21 = v14;
  10490.                             g3 = v21 == 0;
  10491.                             if (v21 != 0) {
  10492.                                 // if_9544_0_true
  10493.                                 v36 = v21 & -0x10000 | 1;
  10494.                                 // branch -> 0x955c
  10495.                             } else {
  10496.                                 v36 = 0;
  10497.                             }
  10498.                             // 0x955c
  10499.                             *(int32_t *)(g129 + 4) = v36;
  10500.                             // branch -> 0x9560
  10501.                             // Detected a possible infinite recursion (goto support failed); quitting...
  10502.                         }
  10503.                         // Detected a possible infinite recursion (goto support failed); quitting...
  10504.                     }
  10505.                     // Detected a possible infinite recursion (goto support failed); quitting...
  10506.                 }
  10507.                 // Detected a possible infinite recursion (goto support failed); quitting...
  10508.             }
  10509.         }
  10510.         // 0x93c4
  10511.         // branch -> 0x9488
  10512.     }
  10513.     // 0x9488
  10514.     v14 = 0;
  10515.     v15 = g134;
  10516.     if (v15 == 0) {
  10517.         // 0x9488
  10518.         // branch -> 0x9520
  10519.     } else {
  10520.         // 0x9494
  10521.         if (v15 < 4) {
  10522.             // 0x94a4
  10523.             v24 = g126;
  10524.             g132 = v24;
  10525.             v16 = &g65;
  10526.             // branch -> 0x94cc
  10527.             while (v16 != 4) {
  10528.                 // 0x94cc
  10529.                 v16 -= 4;
  10530.                 // continue -> 0x94cc
  10531.             }
  10532.             // 0x94e4
  10533.             g128 = &g65;
  10534.             if (v15 == (int32_t)&g65) {
  10535.                 // 0x9520
  10536.                 free((char *)v24);
  10537.                 v20 = g138;
  10538.                 g3 = v20 == 0;
  10539.                 if (v20 == 0) {
  10540.                     // 0x9520
  10541.                     // branch -> 0x955c
  10542.                     // Detected a possible infinite recursion (goto support failed); quitting...
  10543.                 } else {
  10544.                     // 0x9530
  10545.                     if (v20 == 2) {
  10546.                         // 0x954c
  10547.                         v23 = g134;
  10548.                         v29 = v14;
  10549.                         g3 = v29 == v23;
  10550.                         if (v29 == v23) {
  10551.                             // if_9554_0_true
  10552.                             // branch -> after_if_9554_0
  10553.                         }
  10554.                         // after_if_9554_0
  10555.                         // branch -> 0x955c
  10556.                     } else {
  10557.                         // 0x9538
  10558.                         g3 = v20 == 1;
  10559.                         if (v20 == 1) {
  10560.                             // 0x9540
  10561.                             v21 = v14;
  10562.                             g3 = v21 == 0;
  10563.                             if (v21 != 0) {
  10564.                                 // if_9544_0_true
  10565.                                 // branch -> 0x955c
  10566.                             }
  10567.                             // Detected a possible infinite recursion (goto support failed); quitting...
  10568.                         }
  10569.                         // Detected a possible infinite recursion (goto support failed); quitting...
  10570.                     }
  10571.                     // Detected a possible infinite recursion (goto support failed); quitting...
  10572.                 }
  10573.                 // Detected a possible infinite recursion (goto support failed); quitting...
  10574.             } else {
  10575.                 v27 = v24;
  10576.                 v25 = &g65;
  10577.             }
  10578.         } else {
  10579.             // 0x949c
  10580.             v27 = g126;
  10581.             v25 = 0;
  10582.             // branch -> 0x9504
  10583.         }
  10584.         // 0x9504
  10585.         v19 = v15 - v25;
  10586.         v17 = 0;
  10587.         v22 = 4 * v25 + v27;
  10588.         // branch -> 0x950c
  10589.         while (true) {
  10590.             // 0x950c
  10591.             v26 = v22 + 4;
  10592.             g128 = v26;
  10593.             v28 = *(int32_t *)v22;
  10594.             g132 = v28;
  10595.             if (v28 == g135) {
  10596.                 goto lab_if_9514_0_true_3;
  10597.             }
  10598.             v18 = v17;
  10599.             goto lab_after_if_9514_0_3;
  10600.         }
  10601.     }
  10602.     // 0x9520
  10603.     free((char *)g126);
  10604.     v20 = g138;
  10605.     g3 = v20 == 0;
  10606.     if (v20 == 0) {
  10607.         // 0x9520
  10608.         // branch -> 0x955c
  10609.         // Detected a possible infinite recursion (goto support failed); quitting...
  10610.     } else {
  10611.         // 0x9530
  10612.         if (v20 == 2) {
  10613.             // 0x954c
  10614.             v23 = g134;
  10615.             v29 = v14;
  10616.             g3 = v29 == v23;
  10617.             if (v29 == v23) {
  10618.                 // if_9554_0_true
  10619.                 // branch -> after_if_9554_0
  10620.             }
  10621.             // after_if_9554_0
  10622.             // branch -> 0x955c
  10623.         } else {
  10624.             // 0x9538
  10625.             g3 = v20 == 1;
  10626.             if (v20 == 1) {
  10627.                 // 0x9540
  10628.                 v21 = v14;
  10629.                 g3 = v21 == 0;
  10630.                 if (v21 != 0) {
  10631.                     // if_9544_0_true
  10632.                     // branch -> 0x955c
  10633.                 }
  10634.                 // Detected a possible infinite recursion (goto support failed); quitting...
  10635.             }
  10636.             // Detected a possible infinite recursion (goto support failed); quitting...
  10637.         }
  10638.         // Detected a possible infinite recursion (goto support failed); quitting...
  10639.     }
  10640.     // Detected a possible infinite recursion (goto support failed); quitting...
  10641. }
  10642.  
  10643. // Address range: 0x9570 - 0x9593
  10644. int32_t script_transform_count(void) {
  10645.     int32_t v1 = g130; // bp-8
  10646.     g130 = &v1;
  10647.     int32_t v2;
  10648.     g131 = v2;
  10649.     g126 = 0;
  10650.     int32_t result = script_transform_count_values(g127, g128, (int32_t *)g132, g133); // 0x9588
  10651.     g130 = v1;
  10652.     return result;
  10653. }
  10654.  
  10655. // Address range: 0x9594 - 0x95b7
  10656. int32_t script_transform_any(void) {
  10657.     int32_t v1 = g130; // bp-8
  10658.     g130 = &v1;
  10659.     int32_t v2;
  10660.     g131 = v2;
  10661.     g126 = 1;
  10662.     int32_t result = script_transform_count_values(g127, g128, (int32_t *)g132, g133); // 0x95ac
  10663.     g130 = v1;
  10664.     return result;
  10665. }
  10666.  
  10667. // Address range: 0x95b8 - 0x95db
  10668. int32_t script_transform_all(void) {
  10669.     int32_t v1 = g130; // bp-8
  10670.     g130 = &v1;
  10671.     int32_t v2;
  10672.     g131 = v2;
  10673.     g126 = 2;
  10674.     int32_t result = script_transform_count_values(g127, g128, (int32_t *)g132, g133); // 0x95d0
  10675.     g130 = v1;
  10676.     return result;
  10677. }
  10678.  
  10679. // Address range: 0x95dc - 0x99db
  10680. int32_t script_transform_int(uint32_t a1, int32_t a2, int32_t a3, char a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13, int32_t a14, int32_t a15, int32_t a16) {
  10681.     // 0x95dc
  10682.     g132 = a3;
  10683.     int32_t v1 = a4;
  10684.     g133 = v1;
  10685.     int32_t v2 = g134; // 0x95dc
  10686.     int32_t v3 = g135; // 0x95dc
  10687.     int32_t v4 = g138; // 0x95dc
  10688.     int32_t v5 = g130; // bp-8
  10689.     g130 = &v5;
  10690.     int32_t v6 = (int32_t)a5;
  10691.     g137 = v6;
  10692.     g134 = a2;
  10693.     g138 = a3;
  10694.     *(int32_t *)(v6 + 8) = 0;
  10695.     int32_t v7; // 0x9948
  10696.     uint32_t v8; // 0x9658
  10697.     int32_t v9; // 0x9630
  10698.     uint32_t v10; // 0x961c
  10699.     if (v1 >= 3) {
  10700.         // 0x9608
  10701.         g129 = v1;
  10702.         // branch -> 0x961c
  10703.         // 0x961c
  10704.         v10 = a1 % 256;
  10705.         g1 = v10 > 6;
  10706.         g2 = v10 < 7;
  10707.         g3 = v10 == 7;
  10708.         if (v10 > 7) {
  10709.             // 0x967c
  10710.             g127 = (int32_t)"internal error";
  10711.             // branch -> 0x9960
  10712.         } else {
  10713.             // 0x9628
  10714.             g128 = &g66;
  10715.             v9 = *(int32_t *)(4 * v10 + (int32_t)&g66);
  10716.             g127 = v9;
  10717.             ((int32_t (*)(int32_t, int32_t))(v9 + (int32_t)&g66))(v9, (int32_t)&g66);
  10718.             if (g3) {
  10719.                 // if_9650_0_true
  10720.                 // branch -> after_if_9650_0
  10721.             }
  10722.             // after_if_9650_0
  10723.             v8 = g129;
  10724.             *(char *)g137 = (char)v8;
  10725.             *(int32_t *)(g137 + 4) = enforce_value_size(g134, v8 % 256);
  10726.             g127 = 0;
  10727.             v7 = g130;
  10728.             g134 = *(int32_t *)(v7 - 28);
  10729.             g135 = *(int32_t *)(v7 - 24);
  10730.             g136 = *(int32_t *)(v7 - 20);
  10731.             g137 = *(int32_t *)(v7 - 16);
  10732.             g138 = *(int32_t *)(v7 - 12);
  10733.             g139 = *(int32_t *)(v7 - 8);
  10734.             g129 = *(int32_t *)(v7 - 4);
  10735.             g130 = *(int32_t *)v7;
  10736.             ((int32_t (*)(int32_t))*(int32_t *)(v7 + 4))(0);
  10737.             free((char *)g135);
  10738.             g127 = (int32_t)"internal error";
  10739.             // branch -> 0x9960
  10740.         }
  10741.         // 0x9960
  10742.         g134 = v2;
  10743.         g135 = v3;
  10744.         g138 = v4;
  10745.         g130 = v5;
  10746.         return duplicate_string();
  10747.     }
  10748.     // 0x9610
  10749.     g129 = 3;
  10750.     if (a4 != 4) {
  10751.         // 0x9670
  10752.         g127 = (int32_t)"integer size must be 1, 2 or 4";
  10753.         // branch -> 0x9960
  10754.         // 0x9960
  10755.         g134 = v2;
  10756.         g135 = v3;
  10757.         g138 = v4;
  10758.         g130 = v5;
  10759.         return duplicate_string();
  10760.     }
  10761.     // 0x961c
  10762.     v10 = a1 % 256;
  10763.     g1 = v10 > 6;
  10764.     g2 = v10 < 7;
  10765.     g3 = v10 == 7;
  10766.     if (v10 > 7) {
  10767.         // 0x967c
  10768.         g127 = (int32_t)"internal error";
  10769.         // branch -> 0x9960
  10770.     } else {
  10771.         // 0x9628
  10772.         g128 = &g66;
  10773.         v9 = *(int32_t *)(4 * v10 + (int32_t)&g66);
  10774.         g127 = v9;
  10775.         ((int32_t (*)(int32_t, int32_t))(v9 + (int32_t)&g66))(v9, (int32_t)&g66);
  10776.         if (g3) {
  10777.             // if_9650_0_true
  10778.             // branch -> after_if_9650_0
  10779.         }
  10780.         // after_if_9650_0
  10781.         v8 = g129;
  10782.         *(char *)g137 = (char)v8;
  10783.         *(int32_t *)(g137 + 4) = enforce_value_size(g134, v8 % 256);
  10784.         g127 = 0;
  10785.         v7 = g130;
  10786.         g134 = *(int32_t *)(v7 - 28);
  10787.         g135 = *(int32_t *)(v7 - 24);
  10788.         g136 = *(int32_t *)(v7 - 20);
  10789.         g137 = *(int32_t *)(v7 - 16);
  10790.         g138 = *(int32_t *)(v7 - 12);
  10791.         g139 = *(int32_t *)(v7 - 8);
  10792.         g129 = *(int32_t *)(v7 - 4);
  10793.         g130 = *(int32_t *)v7;
  10794.         ((int32_t (*)(int32_t))*(int32_t *)(v7 + 4))(0);
  10795.         free((char *)g135);
  10796.         g127 = (int32_t)"internal error";
  10797.         // branch -> 0x9960
  10798.     }
  10799.     // 0x9960
  10800.     g134 = v2;
  10801.     g135 = v3;
  10802.     g138 = v4;
  10803.     g130 = v5;
  10804.     return duplicate_string();
  10805. }
  10806.  
  10807. // Address range: 0x99dc - 0x9ae7
  10808. int32_t script_transform_length(uint32_t a1, int32_t a2, int32_t a3, uint32_t a4, char * a5) {
  10809.     int32_t v1 = g134; // bp-16
  10810.     int32_t v2 = g135; // 0x99dc
  10811.     int32_t v3 = g130; // bp-8
  10812.     g130 = &v3;
  10813.     int32_t v4 = (int32_t)a5;
  10814.     g135 = v4;
  10815.     *(int32_t *)(v4 + 8) = 0;
  10816.     *(char *)g135 = 3;
  10817.     if (a4 < 3) {
  10818.         // 0x9a6c
  10819.         g127 = (int32_t)"length type must be 0, 1, 2 or 4";
  10820.         g134 = v1;
  10821.         g135 = v2;
  10822.         g130 = v3;
  10823.         return duplicate_string();
  10824.     }
  10825.     // 0x9a10
  10826.     g134 = a4;
  10827.     uint32_t v5 = a1 % 256; // 0x9a14
  10828.     uint32_t v6 = v5 - 1; // 0x9a14
  10829.     if (v6 <= 2) {
  10830.         // 0x9a20
  10831.         g127 = (int32_t)"type mismatch";
  10832.         g134 = v1;
  10833.         g135 = v2;
  10834.         g130 = v3;
  10835.         return duplicate_string();
  10836.     }
  10837.     // 0x9a30
  10838.     if (a4 % 256 == 0) {
  10839.         // 0x9a7c
  10840.         if (v5 != 4) {
  10841.             // 0x9ac0
  10842.             *(int32_t *)(g135 + 4) = a2;
  10843.             g135 = v2;
  10844.             return 0;
  10845.         }
  10846.         int32_t str = parse_buffer((char *)a3, a2, a3, v6, v1, v2, v3, g126, (int32_t)a5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0); // 0x9a88
  10847.         if (str == 0) {
  10848.             // 0x9ad0
  10849.             *(int32_t *)(g135 + 4) = 0;
  10850.             g135 = v2;
  10851.             return 0;
  10852.         }
  10853.         // 0x9a98
  10854.         *(int32_t *)(g135 + 4) = strlen((char *)str);
  10855.         free((char *)str);
  10856.         g135 = v2;
  10857.         return 0;
  10858.     }
  10859.     int32_t v7 = v5 - 5; // 0x9ab4
  10860.     if (v5 < 6) {
  10861.         // if_9a4c_0_true
  10862.         v7 = 0;
  10863.         // branch -> after_if_9a4c_0
  10864.     }
  10865.     uint32_t v8 = (a4 + 255) % 256; // 0x9a50
  10866.     uint32_t v9 = v7 % 256; // 0x9a54
  10867.     uint32_t v10 = v9 == 0 ? a2 : v9 < 32 ? a2 << v9 : 0; // 0x9a54
  10868.     if (1 << v9 != a2) {
  10869.         // 0x9a5c
  10870.         g127 = (int32_t)"data length is not aligned";
  10871.         g134 = v1;
  10872.         g135 = v2;
  10873.         g130 = v3;
  10874.         return duplicate_string();
  10875.     }
  10876.     // 0x9ab4
  10877.     // branch -> 0x9ad0
  10878.     // 0x9ad0
  10879.     *(int32_t *)(g135 + 4) = v10 >> (v8 > 32 ? 32 : v8);
  10880.     g135 = v2;
  10881.     return 0;
  10882. }
  10883.  
  10884. // Address range: 0x9ae8 - 0x9c5f
  10885. int32_t script_transform_multiXX(uint32_t a1, int32_t a2, int32_t a3, int32_t size, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t (*a12)(int32_t), int32_t a13, int32_t a14, int32_t a15, int32_t a16) {
  10886.     int32_t v1 = g134; // bp-32
  10887.     int32_t v2 = g135; // 0x9ae8
  10888.     int32_t v3 = g138; // 0x9ae8
  10889.     int32_t v4 = g139; // 0x9ae8
  10890.     int32_t v5 = g130; // bp-8
  10891.     g138 = a5;
  10892.     g135 = a3;
  10893.     g3 = size == 0;
  10894.     *(int32_t *)(a5 + 4) = size;
  10895.     *(int32_t *)(g138 + 8) = 0;
  10896.     if (size < 0) {
  10897.         // 0x9b30
  10898.         g127 = (int32_t)"negative item count";
  10899.         g134 = v1;
  10900.         g135 = v2;
  10901.         g138 = v3;
  10902.         g139 = v4;
  10903.         g130 = v5;
  10904.         return duplicate_string();
  10905.     }
  10906.     // 0x9b18
  10907.     g3 = a1 % 256 == 0;
  10908.     if (a1 % 256 != 0) {
  10909.         // 0x9b20
  10910.         g127 = (int32_t)"type mismatch";
  10911.         g134 = v1;
  10912.         g135 = v2;
  10913.         g138 = v3;
  10914.         g139 = v4;
  10915.         g130 = v5;
  10916.         return duplicate_string();
  10917.     }
  10918.     // 0x9b40
  10919.     g3 = a2 % a6 == 0;
  10920.     if (a2 % a6 != 0) {
  10921.         // 0x9b54
  10922.         g127 = (int32_t)"data length is not aligned";
  10923.         g134 = v1;
  10924.         g135 = v2;
  10925.         g138 = v3;
  10926.         g139 = v4;
  10927.         g130 = v5;
  10928.         return duplicate_string();
  10929.     }
  10930.     int32_t v6 = size * a6; // 0x9b64
  10931.     g3 = a2 == v6;
  10932.     if (a2 < v6) {
  10933.         // 0x9b70
  10934.         g127 = (int32_t)"data is too short";
  10935.         g134 = v1;
  10936.         g135 = v2;
  10937.         g138 = v3;
  10938.         g139 = v4;
  10939.         g130 = v5;
  10940.         return duplicate_string();
  10941.     }
  10942.     // 0x9b80
  10943.     g3 = a6 == 4;
  10944.     if (a6 == 4) {
  10945.         // 0x9bb8
  10946.         return (int32_t)malloc(4 * size);
  10947.     }
  10948.     // 0x9b88
  10949.     g3 = a6 == 2;
  10950.     if (a6 == 2) {
  10951.         // 0x9bf4
  10952.         return (int32_t)malloc(2 * size);
  10953.     }
  10954.     // 0x9b90
  10955.     g3 = a6 == 1;
  10956.     if (a6 == 1) {
  10957.         // 0x9b98
  10958.         return (int32_t)malloc(size);
  10959.     }
  10960.     // 0x9c3c
  10961.     g127 = (int32_t)"internal error";
  10962.     g134 = v1;
  10963.     g135 = v2;
  10964.     g138 = v3;
  10965.     g139 = v4;
  10966.     g130 = v5;
  10967.     return duplicate_string();
  10968. }
  10969.  
  10970. // Address range: 0x9c60 - 0x9d73
  10971. int32_t script_transform_multi8(uint32_t a1, int32_t a2, char * a3, int32_t size, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9) {
  10972.     int32_t v1 = g134; // bp-24
  10973.     int32_t v2 = g135; // 0x9c60
  10974.     int32_t v3 = g130; // bp-8
  10975.     g135 = a2;
  10976.     int32_t v4 = (int32_t)a5;
  10977.     if (a1 % 256 <= 3) {
  10978.         // 0x9c88
  10979.         *a5 = 5;
  10980.         *(int32_t *)(v4 + 4) = size;
  10981.         *(int32_t *)(v4 + 8) = 0;
  10982.         if (size >= 0) {
  10983.             // 0x9ca4
  10984.             return (int32_t)malloc(size);
  10985.         }
  10986.         // 0x9d00
  10987.         g127 = (int32_t)"negative item count";
  10988.         g134 = v1;
  10989.         g135 = v2;
  10990.         g130 = v3;
  10991.         return duplicate_string();
  10992.     }
  10993.     // 0x9cd4
  10994.     *(int32_t *)(v4 + 4) = size;
  10995.     *(int32_t *)(v4 + 8) = 0;
  10996.     if (size < 0) {
  10997.         // 0x9d10
  10998.         g127 = (int32_t)"negative item count";
  10999.         g134 = v1;
  11000.         g135 = v2;
  11001.         g130 = v3;
  11002.         return duplicate_string();
  11003.     }
  11004.     // 0x9ce8
  11005.     if ((int32_t)a1 % 256 != 0) {
  11006.         // 0x9cf0
  11007.         g127 = (int32_t)"type mismatch";
  11008.         g134 = v1;
  11009.         g135 = v2;
  11010.         g130 = v3;
  11011.         return duplicate_string();
  11012.     }
  11013.     // 0x9d20
  11014.     if (g135 < size) {
  11015.         // 0x9d28
  11016.         g127 = (int32_t)"data is too short";
  11017.         g134 = v1;
  11018.         g135 = v2;
  11019.         g130 = v3;
  11020.         return duplicate_string();
  11021.     }
  11022.     char * mem = malloc(size); // 0x9d3c
  11023.     int32_t v5 = (int32_t)mem; // 0x9d3c_3
  11024.     g135 = v5;
  11025.     __aeabi_memcpy(mem, (char *)(int32_t)a3, size);
  11026.     *(int32_t *)(v4 + 8) = v5;
  11027.     *(char *)v4 = 5;
  11028.     g135 = v2;
  11029.     return 0;
  11030. }
  11031.  
  11032. // Address range: 0x9d74 - 0x9e63
  11033. int32_t script_transform_multi16(uint32_t a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8) {
  11034.     int32_t v1 = g134; // 0x9d74
  11035.     int32_t v2 = g135; // 0x9d74
  11036.     int32_t v3 = g136; // 0x9d74
  11037.     int32_t v4 = g130; // 0x9d74
  11038.     int32_t v5 = v4; // bp-8
  11039.     g130 = &v5;
  11040.     g134 = a2;
  11041.     int32_t v6 = (int32_t)a5;
  11042.     g136 = v6;
  11043.     g135 = a4;
  11044.     if (a1 % 256 > 3) {
  11045.         // 0x9e2c
  11046.         return script_transform_multiXX(a1, a2, a3, a4, v6, 2, v1, v2, v3, g129, v4, (int32_t (*)(int32_t))g126, v6, a6, a7, a8);
  11047.     }
  11048.     // 0x9d9c
  11049.     *a5 = 6;
  11050.     *(int32_t *)(g136 + 4) = g135;
  11051.     *(int32_t *)(g136 + 8) = 0;
  11052.     if (a4 >= 0) {
  11053.         // 0x9db8
  11054.         return (int32_t)malloc(2 * g135);
  11055.     }
  11056.     // 0x9e4c
  11057.     g127 = (int32_t)"negative item count";
  11058.     g134 = v1;
  11059.     g135 = v2;
  11060.     g130 = v5;
  11061.     return duplicate_string();
  11062. }
  11063.  
  11064. // Address range: 0x9e64 - 0x9f53
  11065. int32_t script_transform_multi32(uint32_t a1, int32_t a2, int32_t a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8) {
  11066.     int32_t v1 = g134; // 0x9e64
  11067.     int32_t v2 = g135; // 0x9e64
  11068.     int32_t v3 = g136; // 0x9e64
  11069.     int32_t v4 = g130; // 0x9e64
  11070.     int32_t v5 = v4; // bp-8
  11071.     g130 = &v5;
  11072.     g134 = a2;
  11073.     int32_t v6 = (int32_t)a5;
  11074.     g136 = v6;
  11075.     g135 = a4;
  11076.     if (a1 % 256 > 3) {
  11077.         // 0x9f1c
  11078.         return script_transform_multiXX(a1, a2, a3, a4, v6, 4, v1, v2, v3, g129, v4, (int32_t (*)(int32_t))g126, v6, a6, a7, a8);
  11079.     }
  11080.     // 0x9e8c
  11081.     *a5 = 7;
  11082.     *(int32_t *)(g136 + 4) = g135;
  11083.     *(int32_t *)(g136 + 8) = 0;
  11084.     if (a4 >= 0) {
  11085.         // 0x9ea8
  11086.         return (int32_t)malloc(4 * g135);
  11087.     }
  11088.     // 0x9f3c
  11089.     g127 = (int32_t)"negative item count";
  11090.     g134 = v1;
  11091.     g135 = v2;
  11092.     g130 = v5;
  11093.     return duplicate_string();
  11094. }
  11095.  
  11096. // Address range: 0x9f54 - 0xa013
  11097. int32_t script_transform_multi(uint32_t a1, int32_t a2, int32_t a3, int32_t a4) {
  11098.     int32_t v1 = g134; // 0x9f54
  11099.     int32_t v2 = g135; // 0x9f54
  11100.     int32_t v3 = g136; // 0x9f54
  11101.     int32_t v4 = g137; // 0x9f54
  11102.     int32_t v5 = g138; // 0x9f54
  11103.     int32_t v6 = g129; // 0x9f54
  11104.     int32_t v7 = g130; // bp-8
  11105.     g130 = &v7;
  11106.     int32_t v8;
  11107.     g134 = v8;
  11108.     g136 = a1;
  11109.     g137 = a4;
  11110.     g138 = a3;
  11111.     g135 = a2;
  11112.     g3 = a1 % 256 == 0;
  11113.     *(int32_t *)(v8 + 8) = 0;
  11114.     int32_t result2; // 0xa004
  11115.     if (a1 % 256 == 0) {
  11116.         // 0x9f90
  11117.         g3 = g137 == 4;
  11118.         if (g137 <= 4) {
  11119.             uint32_t v9 = g137 % 256; // 0x9fa0
  11120.             g3 = v9 == 0 | (1 << v9 & 22) == 0 | v9 >= 32;
  11121.             if (v9 != 0) {
  11122.                 int32_t v10 = g137 - 1; // 0x9fa8
  11123.                 int32_t v11 = g135; // 0x9fac
  11124.                 g3 = (v11 & v10) == 0;
  11125.                 if (v10 == v11) {
  11126.                     int32_t result = script_transform_multiXX(g136, v10, g138, v10 / g137, g134, v9, v1, v2, v3, v4, v5, (int32_t (*)(int32_t))v6, v7, g126, v8, 0); // 0x9fe8
  11127.                     g127 = result;
  11128.                     g134 = v1;
  11129.                     g135 = v2;
  11130.                     g136 = v3;
  11131.                     g137 = v4;
  11132.                     g138 = v5;
  11133.                     g129 = v6;
  11134.                     g130 = v7;
  11135.                     return result;
  11136.                 }
  11137.                 // 0x9fb4
  11138.                 g127 = (int32_t)"data length is not aligned";
  11139.                 // branch -> 0x9ffc
  11140.                 // 0x9ffc
  11141.                 g134 = v1;
  11142.                 g135 = v2;
  11143.                 g136 = v3;
  11144.                 g137 = v4;
  11145.                 g138 = v5;
  11146.                 g129 = v6;
  11147.                 g130 = v7;
  11148.                 result2 = duplicate_string();
  11149.                 g127 = result2;
  11150.                 return result2;
  11151.             }
  11152.         }
  11153.         // 0x9ff4
  11154.         g127 = (int32_t)"parameter must be 1, 2 or 4";
  11155.         // branch -> 0x9ffc
  11156.     } else {
  11157.         // 0x9f84
  11158.         g127 = (int32_t)"type mismatch";
  11159.         // branch -> 0x9ffc
  11160.     }
  11161.     // 0x9ffc
  11162.     g134 = v1;
  11163.     g135 = v2;
  11164.     g136 = v3;
  11165.     g137 = v4;
  11166.     g138 = v5;
  11167.     g129 = v6;
  11168.     g130 = v7;
  11169.     result2 = duplicate_string();
  11170.     g127 = result2;
  11171.     return result2;
  11172. }
  11173.  
  11174. // Address range: 0xa014 - 0xa0e7
  11175. int32_t script_transform_text(uint32_t a1, int32_t a2, char * a3, int32_t a4, char * a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12) {
  11176.     int32_t v1 = g134; // bp-24
  11177.     int32_t v2 = g135; // 0xa014
  11178.     int32_t v3 = g136; // 0xa014
  11179.     int32_t v4 = g137; // 0xa014
  11180.     int32_t v5 = g130; // bp-8
  11181.     g130 = &v5;
  11182.     g137 = (int32_t)a5;
  11183.     g135 = (int32_t)a3;
  11184.     g134 = a4;
  11185.     *a5 = 4;
  11186.     *(int32_t *)(g137 + 4) = g134;
  11187.     *(int32_t *)(g137 + 8) = 0;
  11188.     if (a4 < 0) {
  11189.         // 0xa05c
  11190.         g127 = (int32_t)"negative length";
  11191.         g134 = v1;
  11192.         g135 = v2;
  11193.         g130 = v5;
  11194.         return duplicate_string();
  11195.     }
  11196.     // 0xa044
  11197.     if (a1 % 256 != 0) {
  11198.         // 0xa04c
  11199.         g127 = (int32_t)"type mismatch";
  11200.         g134 = v1;
  11201.         g135 = v2;
  11202.         g130 = v5;
  11203.         return duplicate_string();
  11204.     }
  11205.     int32_t size = g134; // 0xa06c
  11206.     if (size > a2) {
  11207.         // 0xa074
  11208.         g127 = (int32_t)"length is greater than data size";
  11209.         g134 = v1;
  11210.         g135 = v2;
  11211.         g130 = v5;
  11212.         return duplicate_string();
  11213.     }
  11214.     char * mem = malloc(size); // 0xa088
  11215.     int32_t v6 = g134; // 0xa090
  11216.     g136 = (int32_t)mem;
  11217.     __aeabi_memcpy(mem, (char *)g135, v6);
  11218.     int32_t v7 = parse_buffer((char *)g136, g134, v6, a4, v1, v2, v3, v4, v5, g126, (int32_t)a5, a6, a7, a8, a9, a10, a11, a12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0); // 0xa0a4
  11219.     free((char *)v7);
  11220.     if (v7 != 0) {
  11221.         // if_a0bc_0_true
  11222.         *(int32_t *)(g137 + 8) = g136;
  11223.         g135 = v2;
  11224.         return 0;
  11225.     }
  11226.     // after_if_a0bc_0
  11227.     free((char *)g136);
  11228.     g127 = (int32_t)"data does not contain text";
  11229.     g134 = (int32_t)a5;
  11230.     g135 = a6;
  11231.     g130 = a9;
  11232.     return duplicate_string();
  11233. }
  11234.  
  11235. // Address range: 0xa0e8 - 0xa827
  11236. int32_t parse_buffer(char * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13, int32_t a14, int32_t a15, int32_t a16, int32_t a17, int32_t a18, int32_t a19, int32_t a20, int32_t a21, int32_t a22, int32_t a23, int32_t a24, int32_t a25, int32_t a26, int32_t a27, int32_t a28, char * a29, int32_t a30, int32_t a31, char * a32, int32_t a33, int32_t a34, char * a35, int32_t a36, int32_t a37, int32_t a38, int32_t a39, int32_t a40) {
  11237.     int32_t v1 = 0; // SP
  11238.     g133 = a4;
  11239.     int32_t v2 = g134; // 0xa0e8
  11240.     int32_t v3 = g135; // 0xa0e8
  11241.     int32_t v4 = g136; // 0xa0e8
  11242.     int32_t v5 = g137; // 0xa0e8
  11243.     int32_t (*v6)() = (int32_t (*)())g138;
  11244.     int32_t v7 = g130; // bp-8
  11245.     g130 = &v7;
  11246.     g135 = (int32_t)a1;
  11247.     g134 = a2;
  11248.     char * mem = malloc(1); // 0xa10c
  11249.     int32_t v8 = g134; // 0xa114
  11250.     g1 = true;
  11251.     g2 = v8 < 0;
  11252.     g3 = v8 == 0;
  11253.     g110 = mem;
  11254.     *mem = 0;
  11255.     g109 = 0;
  11256.     int32_t v9; // 0xa758_5
  11257.     char * mem2; // 0xa758
  11258.     int32_t v10;
  11259.     int32_t v11;
  11260.     int32_t v12;
  11261.     int32_t v13;
  11262.     int32_t v14; // 0xa7a8
  11263.     uint32_t v15; // 0xa790
  11264.     int32_t result; // 0xa780
  11265.     int32_t v16; // 0xa7a8
  11266.     if (v8 == 0) {
  11267.         // 0xa0e8
  11268.         // branch -> 0xa750
  11269.     } else {
  11270.         // 0xa128
  11271.         g129 = v1 + 216;
  11272.         g133 = 0x3517;
  11273.         g136 = (int32_t)&g110;
  11274.         g72 = "%hhu";
  11275.         g137 = v1 + 224;
  11276.         g139 = 0;
  11277.         g70 = "{UNKNOWN ";
  11278.         g69 = "{NAME_END}";
  11279.         g71 = &g123;
  11280.         g73 = "{PAUSE_UNTIL_PRESS}";
  11281.         g77 = &g123;
  11282.         g78 = *(int32_t *)&g12;
  11283.         g84 = &g123;
  11284.         g76 = &g122;
  11285.         g85 = "%hhu";
  11286.         g83 = "{STRING ";
  11287.         int32_t v17 = g36; // 0xa1f8
  11288.         g82 = v17;
  11289.         g106 = "%hhu";
  11290.         g105 = "COLOR";
  11291.         g104 = "HIGHLIGHT";
  11292.         g103 = "SHADOW";
  11293.         g100 = &g122;
  11294.         g101 = &g119;
  11295.         char ** v18 = (char **)*(int32_t *)&g6;
  11296.         g99 = v18;
  11297.         g97 = &g119;
  11298.         g96 = "{COLOR_HIGHLIGHT_SHADOW ";
  11299.         g81 = v18;
  11300.         g93 = &g123;
  11301.         g80 = v18;
  11302.         g102 = &g123;
  11303.         g95 = "{SMALL}";
  11304.         g94 = "%hhu";
  11305.         g132 = &g123;
  11306.         g90 = &g123;
  11307.         g92 = "{PAUSE ";
  11308.         g98 = &g123;
  11309.         g128 = &g123;
  11310.         g79 = v17;
  11311.         g87 = &g123;
  11312.         g75 = &g115;
  11313.         g74 = &g116;
  11314.         g91 = "%hhu";
  11315.         g89 = "{SHIFT_TEXT ";
  11316.         g88 = "%02hhX%02hhX";
  11317.         g86 = "{PLAY_MUSIC 0x";
  11318.         g107 = "{PLAY_MUSIC 0x";
  11319.         int32_t v19;
  11320.         int32_t v20 = &v19; // 0xa460_0
  11321.         int32_t v21 = 0; // 0xa3e4
  11322.         // branch -> 0xa3e4
  11323.         while (true) {
  11324.             uint32_t v22 = v21 % 256; // 0xa3e4
  11325.             g1 = v22 > 16;
  11326.             g2 = v22 < 17;
  11327.             g3 = v22 == 17;
  11328.             int32_t v23; // 0xa728
  11329.             int32_t v24; // 0xa4dc
  11330.             if (v22 > 17) {
  11331.                 // 0xa4bc
  11332.                 int32_t v25; // 0xa730
  11333.                 uint32_t v26; // 0xa73c
  11334.                 if (v22 == 252) {
  11335.                     unsigned char v27 = *(char *)g135; // 0xa664
  11336.                     int32_t v28 = v27; // 0xa664
  11337.                     g139 = v28;
  11338.                     g1 = v27 > 23;
  11339.                     g2 = v27 < 24;
  11340.                     g3 = v27 == 24;
  11341.                     int32_t v29; // 0xa3d0
  11342.                     int32_t v30; // 0xa3d0
  11343.                     if (v27 > 24) {
  11344.                         // 0xa3a0
  11345.                         sprintf((char *)&g108, "\xe0\x10\x8d\xe5\x89\x01", v27);
  11346.                         g67 = -0x1a3ff000;
  11347.                         g68 = 0;
  11348.                         v30 = g129;
  11349.                         v29 = (int32_t)"\xe4";
  11350.                         // branch -> 0xa3d0
  11351.                     } else {
  11352.                         // 0xa670
  11353.                         g128 = &g112;
  11354.                         int32_t v31 = 4 * v28; // 0xa674
  11355.                         g127 = v31;
  11356.                         int32_t v32 = *(int32_t *)(v31 + (int32_t)&g112); // 0xa678
  11357.                         g132 = v32;
  11358.                         ((int32_t (*)(int32_t, int32_t, int32_t))(v32 + (int32_t)&g112))(v31, (int32_t)&g112, v32);
  11359.                         if (g3) {
  11360.                             // if_a6e0_0_true
  11361.                             // branch -> after_if_a6e0_0
  11362.                         }
  11363.                         // after_if_a6e0_0
  11364.                         v30 = 0;
  11365.                         v29 = a28;
  11366.                         // branch -> 0xa3d0
  11367.                     }
  11368.                     // 0xa3d0
  11369.                     concatenate((int32_t *)g136, (int32_t *)g137, (char *)v29, v30);
  11370.                     g139 = 0;
  11371.                     // branch -> 0xa72c
  11372.                 } else {
  11373.                     // 0xa4c4
  11374.                     if (v22 == 253) {
  11375.                         unsigned char v33 = *(char *)g135; // 0xa4cc
  11376.                         int32_t v34 = v33; // 0xa4cc
  11377.                         if (v33 <= 15) {
  11378.                             // 0xa4d8
  11379.                             v24 = *(int32_t *)(4 * v34 - 0x1f710000);
  11380.                             if (v24 != 0) {
  11381.                                 // 0xa4e8
  11382.                                 g139 = 0;
  11383.                                 g67 = -0x1d729f1c;
  11384.                                 g68 = 0;
  11385.                                 v23 = -0x1a60c998;
  11386.                                 // branch -> 0xa728
  11387.                               lab_0xa728_2:
  11388.                                 // 0xa728
  11389.                                 concatenate((int32_t *)g136, (int32_t *)g137, (char *)v23, v24);
  11390.                                 // branch -> 0xa72c
  11391.                                 // 0xa72c
  11392.                                 g135++;
  11393.                                 v25 = g134;
  11394.                                 g1 = v25 != 0;
  11395.                                 g134 = v25 - 1;
  11396.                                 if (v25 == 1) {
  11397.                                     // 0xa738
  11398.                                     v26 = g139;
  11399.                                     g2 = false;
  11400.                                     g3 = v26 % 256 == 0;
  11401.                                     if (v26 % 256 == 0) {
  11402.                                         // 0xa750
  11403.                                         mem2 = realloc((char *)(int32_t)"T", -0x1f70ffff);
  11404.                                         v9 = (int32_t)mem2;
  11405.                                         g127 = v9;
  11406.                                         g128 = -0x1f710000;
  11407.                                         g132 = 0;
  11408.                                         g110 = mem2;
  11409.                                         *(char *)(v9 - 0x1f710000) = 0;
  11410.                                         // branch -> 0xa76c
  11411.                                     } else {
  11412.                                         // 0xa744
  11413.                                         free("T");
  11414.                                         g127 = 0;
  11415.                                         // branch -> 0xa76c
  11416.                                     }
  11417.                                     // 0xa76c
  11418.                                     g134 = v13;
  11419.                                     g135 = v12;
  11420.                                     g136 = v11;
  11421.                                     g137 = v10;
  11422.                                     g138 = v2;
  11423.                                     g139 = v3;
  11424.                                     g129 = v4;
  11425.                                     g130 = v5;
  11426.                                     v6();
  11427.                                     result = g127;
  11428.                                     if (g3) {
  11429.                                         // if_a824_0_true
  11430.                                         v15 = g135 % 256;
  11431.                                         v14 = g130;
  11432.                                         v16 = v15 == 0 ? v14 : v15 < 32 ? v14 << v15 : 0;
  11433.                                         *(int16_t *)result = (int16_t)(v16 & result);
  11434.                                         g133 = 0;
  11435.                                         // branch -> after_if_a824_0
  11436.                                         // after_if_a824_0
  11437.                                         return result - g129;
  11438.                                     }
  11439.                                     // after_if_a824_0
  11440.                                     return result;
  11441.                                 }
  11442.                               lab_0xa72c_2:
  11443.                                 // 0xa72c
  11444.                                 v21 = g139;
  11445.                                 // branch -> 0xa3e4
  11446.                                 continue;
  11447.                             }
  11448.                         }
  11449.                         // 0xa700
  11450.                         sprintf((char *)&g108, "\x18", v33);
  11451.                         g139 = 0;
  11452.                         g67 = -0x1f710000;
  11453.                         g68 = 0;
  11454.                         v24 = g129;
  11455.                         v23 = (int32_t)g83;
  11456.                         // branch -> 0xa728
  11457.                         goto lab_0xa728_2;
  11458.                     }
  11459.                 }
  11460.                 // 0xa72c
  11461.                 g135++;
  11462.                 v25 = g134;
  11463.                 g1 = v25 != 0;
  11464.                 g134 = v25 - 1;
  11465.                 if (v25 != 1) {
  11466.                     goto lab_0xa72c_2;
  11467.                 }
  11468.                 // 0xa738
  11469.                 v26 = g139;
  11470.                 g2 = false;
  11471.                 g3 = v26 % 256 == 0;
  11472.                 if (v26 % 256 == 0) {
  11473.                     // 0xa750
  11474.                     mem2 = realloc((char *)(int32_t)"T", -0x1f70ffff);
  11475.                     v9 = (int32_t)mem2;
  11476.                     g127 = v9;
  11477.                     g128 = -0x1f710000;
  11478.                     g132 = 0;
  11479.                     g110 = mem2;
  11480.                     *(char *)(v9 - 0x1f710000) = 0;
  11481.                     // branch -> 0xa76c
  11482.                 } else {
  11483.                     // 0xa744
  11484.                     free("T");
  11485.                     g127 = 0;
  11486.                     // branch -> 0xa76c
  11487.                 }
  11488.                 // 0xa76c
  11489.                 g134 = v13;
  11490.                 g135 = v12;
  11491.                 g136 = v11;
  11492.                 g137 = v10;
  11493.                 g138 = v2;
  11494.                 g139 = v3;
  11495.                 g129 = v4;
  11496.                 g130 = v5;
  11497.                 v6();
  11498.                 result = g127;
  11499.                 if (g3) {
  11500.                     // if_a824_0_true
  11501.                     v15 = g135 % 256;
  11502.                     v14 = g130;
  11503.                     v16 = v15 == 0 ? v14 : v15 < 32 ? v14 << v15 : 0;
  11504.                     *(int16_t *)result = (int16_t)(v16 & result);
  11505.                     g133 = 0;
  11506.                     // branch -> after_if_a824_0
  11507.                     // after_if_a824_0
  11508.                     return result - g129;
  11509.                 }
  11510.                 // after_if_a824_0
  11511.                 return result;
  11512.             }
  11513.             // 0xa3f0
  11514.             g128 = &g111;
  11515.             int32_t v35 = *(int32_t *)(4 * v22 + (int32_t)&g111); // 0xa3f8
  11516.             g127 = v35;
  11517.             ((int32_t (*)(int32_t, int32_t))(v35 + (int32_t)&g111))(v35, (int32_t)&g111);
  11518.             if (g3) {
  11519.                 // if_a444_0_true
  11520.                 // branch -> after_if_a444_0
  11521.             }
  11522.             // after_if_a444_0
  11523.             int32_t str;
  11524.             g138 = &str;
  11525.             int32_t format;
  11526.             sprintf((char *)&str, (char *)format);
  11527.             int32_t v36;
  11528.             v19 = v36;
  11529.             int32_t v37 = g139; // 0xa478
  11530.             g139 = 0;
  11531.             unsigned char v38 = *(char *)g135; // 0xa488
  11532.             int32_t v39 = v38; // 0xa488
  11533.             if (v38 < 16) {
  11534.                 // if_a490_0_true
  11535.                 g138 = *(int32_t *)(4 * v39 + a40);
  11536.                 // branch -> after_if_a494_0
  11537.             }
  11538.             // after_if_a494_0
  11539.             v24 = *(int32_t *)(4 * ((v37 + 255) % 256) + v20);
  11540.             int32_t v40;
  11541.             v23 = v40;
  11542.             // branch -> 0xa728
  11543.             goto lab_0xa728_2;
  11544.         }
  11545.     }
  11546.     // 0xa750
  11547.     mem2 = realloc((char *)(int32_t)mem, -0x1f70ffff);
  11548.     v9 = (int32_t)mem2;
  11549.     g127 = v9;
  11550.     g128 = -0x1f710000;
  11551.     g132 = 0;
  11552.     g110 = mem2;
  11553.     *(char *)(v9 - 0x1f710000) = 0;
  11554.     // branch -> 0xa76c
  11555.     // 0xa76c
  11556.     g134 = v13;
  11557.     g135 = v12;
  11558.     g136 = v11;
  11559.     g137 = v10;
  11560.     g138 = v2;
  11561.     g139 = v3;
  11562.     g129 = v4;
  11563.     g130 = v5;
  11564.     v6();
  11565.     result = g127;
  11566.     int32_t result2 = result; // 0xa824_2
  11567.     if (g3) {
  11568.         // if_a824_0_true
  11569.         v15 = g135 % 256;
  11570.         v14 = g130;
  11571.         v16 = v15 == 0 ? v14 : v15 < 32 ? v14 << v15 : 0;
  11572.         *(int16_t *)result = (int16_t)(v16 & result);
  11573.         g133 = 0;
  11574.         result2 = result - g129;
  11575.         // branch -> after_if_a824_0
  11576.     }
  11577.     // after_if_a824_0
  11578.     return result2;
  11579. }
  11580.  
  11581. // Address range: 0xa828 - 0xa82f
  11582. int32_t __udivsi3(int32_t result) {
  11583.     // 0xa828
  11584.     g3 = g128 == 1;
  11585.     return result;
  11586. }
  11587.  
  11588. // Address range: 0xa830 - 0xa8cf
  11589. int32_t function_a830(uint32_t a1, uint32_t a2, int32_t a3) {
  11590.     // 0xa830
  11591.     if (!g1) {
  11592.         // 0xa8c4
  11593.         g1 = true;
  11594.         g3 = a1 == 0;
  11595.         int32_t v1;
  11596.         if (a1 != 0) {
  11597.             // if_a8c8_0_true
  11598.             v1 = -1;
  11599.             // branch -> after_if_a8c8_0
  11600.         } else {
  11601.             v1 = 0;
  11602.         }
  11603.         int32_t result = v1 / a2;
  11604.         g127 = result;
  11605.         return result;
  11606.     }
  11607.     // 0xa834
  11608.     g1 = a1 >= a2;
  11609.     g3 = a1 == a2;
  11610.     if (a1 <= a2) {
  11611.         int32_t result2 = a1 == a2;
  11612.         g127 = result2;
  11613.         return result2;
  11614.     }
  11615.     // 0xa83c
  11616.     g3 = (a3 & a2) == 0;
  11617.     int32_t v2 = llvm_ctlz_i32(a2, false); // 0xa8b4
  11618.     if (a2 == a3) {
  11619.         uint32_t v3 = (31 - v2) % 256; // 0xa8bc
  11620.         int32_t result3 = a1 >> (v3 > 32 ? 32 : v3); // 0xa8bc
  11621.         g127 = result3;
  11622.         return result3;
  11623.     }
  11624.     uint32_t v4 = (v2 - llvm_ctlz_i32(a1, false)) % 256; // 0xa854
  11625.     int32_t v5 = 0; // 0xa868
  11626.     uint32_t v6 = v4 == 0 ? 1 : v4 < 32 ? 1 << v4 : 0; // 0xa894
  11627.     int32_t v7 = a1; // 0xa864
  11628.     uint32_t v8 = v4 == 0 ? a2 : v4 < 32 ? a2 << v4 : 0; // 0xa898
  11629.     // branch -> 0xa860
  11630.     while (true) {
  11631.         int32_t v9 = v7; // 0xa870
  11632.         int32_t v10 = v5; // 0xa874
  11633.         if (v7 < v8) {
  11634.             // if_a864_0_true
  11635.             v9 = v7 - v8;
  11636.             v10 = v6 | v5;
  11637.             // branch -> after_if_a868_0
  11638.         }
  11639.         uint32_t v11 = v8 / 2; // 0xa86c
  11640.         int32_t v12 = v9; // 0xa87c
  11641.         int32_t v13 = v10; // 0xa880
  11642.         if (v9 < v11) {
  11643.             // if_a870_0_true
  11644.             v12 = v9 - v11;
  11645.             v13 = v10 | v6 / 2;
  11646.             // branch -> after_if_a874_0
  11647.         }
  11648.         uint32_t v14 = v8 / 4; // 0xa878
  11649.         int32_t v15 = v12; // 0xa888
  11650.         int32_t v16 = v13; // 0xa88c
  11651.         if (v12 < v14) {
  11652.             // if_a87c_0_true
  11653.             v15 = v12 - v14;
  11654.             v16 = v13 | v6 / 4;
  11655.             // branch -> after_if_a880_0
  11656.         }
  11657.         uint32_t v17 = v8 / 8; // 0xa884
  11658.         int32_t v18 = v15; // 0xa890
  11659.         int32_t result4 = v16; // 0xa8a0
  11660.         if (v15 < v17) {
  11661.             // if_a888_0_true
  11662.             v18 = v15 - v17;
  11663.             result4 = v16 | v6 / 8;
  11664.             // branch -> after_if_a88c_0
  11665.         }
  11666.         // after_if_a88c_0
  11667.         if (v18 == 0) {
  11668.             // 0xa8a0
  11669.             g1 = true;
  11670.             g3 = true;
  11671.             g127 = result4;
  11672.             return result4;
  11673.         }
  11674.         // after_if_a894_0
  11675.         if (v6 < 16) {
  11676.             // 0xa8a0
  11677.             g1 = false;
  11678.             g3 = true;
  11679.             g127 = result4;
  11680.             return result4;
  11681.         }
  11682.         // after_if_a898_0
  11683.         v5 = result4;
  11684.         v6 /= 16;
  11685.         v7 = v18;
  11686.         v8 /= 16;
  11687.         // branch -> 0xa860
  11688.     }
  11689. }
  11690.  
  11691. // Address range: 0xa8d0 - 0xa8ef
  11692. int32_t __aeabi_uidivmod(uint32_t a1, uint32_t a2) {
  11693.     // 0xa8d0
  11694.     g3 = a2 == 0;
  11695.     int32_t v1 = a1 / a2;
  11696.     g127 = v1;
  11697.     return a1 - v1 * a2;
  11698. }
  11699.  
  11700. // Address range: 0xa8f0 - 0xa8f7
  11701. void __aeabi_idiv(void) {
  11702.     // 0xa8f0
  11703.     return;
  11704. }
  11705.  
  11706. // Address range: 0xa8f8 - 0xa9bb
  11707. int32_t function_a8f8(int32_t a1) {
  11708.     int32_t v1 = g128 ^ a1; // 0xa8f8
  11709.     g131 = v1;
  11710.     int32_t v2; // 0xa8fc
  11711.     if (g2) {
  11712.         // if_a8fc_0_true
  11713.         v2 = -g128;
  11714.         // branch -> after_if_a8fc_0
  11715.     }
  11716.     // after_if_a8fc_0
  11717.     int32_t result; // 0xa984_1
  11718.     if (v2 == 1) {
  11719.         // 0xa988
  11720.         g3 = g128 == 0;
  11721.         if (v1 < 0) {
  11722.             // if_a98c_0_true
  11723.             result = -a1;
  11724.             // branch -> after_if_a980_0
  11725.         } else {
  11726.             result = a1;
  11727.         }
  11728.         // after_if_a980_0
  11729.         return result;
  11730.     }
  11731.     uint32_t v3 = a1 < 0 ? -a1 : a1;
  11732.     g3 = v3 == v2;
  11733.     if (v3 > v2) {
  11734.         int32_t v4 = llvm_ctlz_i32(v2, false); // 0xa9a4
  11735.         uint32_t v5 = (v4 - llvm_ctlz_i32(v3, false)) % 256; // 0xa930
  11736.         int32_t v6 = 0; // 0xa944
  11737.         uint32_t v7 = v5 == 0 ? 1 : v5 < 32 ? 1 << v5 : 0; // 0xa970
  11738.         int32_t v8 = v3; // 0xa940
  11739.         uint32_t v9 = v5 == 0 ? v2 : v5 < 32 ? v2 << v5 : 0; // 0xa974
  11740.         // branch -> 0xa93c
  11741.         while (true) {
  11742.             int32_t v10 = v8; // 0xa94c
  11743.             int32_t v11 = v6; // 0xa950
  11744.             if (v8 >= v9) {
  11745.                 // if_a944_0_true
  11746.                 v10 = v8 - v9;
  11747.                 v11 = v7 | v6;
  11748.                 // branch -> after_if_a944_0
  11749.             }
  11750.             uint32_t v12 = v9 / 2; // 0xa948
  11751.             int32_t v13 = v10; // 0xa958
  11752.             int32_t v14 = v11; // 0xa95c
  11753.             if (v10 < v12) {
  11754.                 // if_a94c_0_true
  11755.                 v13 = v10 - v12;
  11756.                 v14 = v11 | v7 / 2;
  11757.                 // branch -> after_if_a950_0
  11758.             }
  11759.             uint32_t v15 = v9 / 4; // 0xa954
  11760.             int32_t v16 = v13; // 0xa964
  11761.             int32_t v17 = v14; // 0xa968
  11762.             if (v13 < v15) {
  11763.                 // if_a958_0_true
  11764.                 v16 = v13 - v15;
  11765.                 v17 = v14 | v7 / 4;
  11766.                 // branch -> after_if_a95c_0
  11767.             }
  11768.             uint32_t v18 = v9 / 8; // 0xa960
  11769.             int32_t v19 = v16; // 0xa96c
  11770.             int32_t v20 = v17; // 0xa980
  11771.             if (v16 < v18) {
  11772.                 // if_a964_0_true
  11773.                 v19 = v16 - v18;
  11774.                 v20 = v17 | v7 / 8;
  11775.                 // branch -> after_if_a968_0
  11776.             }
  11777.             // after_if_a968_0
  11778.             if (v19 != 0) {
  11779.                 // after_if_a970_0
  11780.                 if (v7 >= 16) {
  11781.                     // after_if_a974_0
  11782.                     v6 = v20;
  11783.                     v7 /= 16;
  11784.                     v8 = v19;
  11785.                     v9 /= 16;
  11786.                     // branch -> 0xa93c
  11787.                     continue;
  11788.                 }
  11789.             }
  11790.             // 0xa97c
  11791.             g3 = g128 == a1;
  11792.             if (v1 < 0) {
  11793.                 // if_a980_0_true
  11794.                 // branch -> after_if_a980_0
  11795.                 // after_if_a980_0
  11796.                 return -v20;
  11797.             }
  11798.         }
  11799.     } else {
  11800.         if (v3 < v2) {
  11801.             // if_a994_0_true
  11802.             a1 = 0;
  11803.             // branch -> after_if_a994_0
  11804.         }
  11805.         // after_if_a994_0
  11806.         if (v3 == v2) {
  11807.             // if_a99c_0_true
  11808.             result = v1 >> 31 | 1;
  11809.             // branch -> after_if_a980_0
  11810.         } else {
  11811.             result = a1;
  11812.         }
  11813.     }
  11814.     // after_if_a980_0
  11815.     return result;
  11816. }
  11817.  
  11818. // Address range: 0xa9bc - 0xa9cb
  11819. void function_a9bc(int32_t a1) {
  11820.     // 0xa9bc
  11821.     if (a1 > 0) {
  11822.         // if_a9c0_0_true
  11823.         // branch -> after_if_a9c0_0
  11824.     }
  11825.     // after_if_a9c0_0
  11826.     if (a1 < 0) {
  11827.         // if_a9c4_0_true
  11828.         // branch -> after_if_a9c4_0
  11829.     }
  11830. }
  11831.  
  11832. // Address range: 0xa9cc - 0xa9eb
  11833. int32_t __aeabi_idivmod(int32_t a1, int32_t a2) {
  11834.     // 0xa9cc
  11835.     g128 = a2;
  11836.     g2 = a2 < 0;
  11837.     int32_t result = function_a8f8(a1); // 0xa9d8
  11838.     g127 = result;
  11839.     return result;
  11840. }
  11841.  
  11842. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
  11843. // Address range: 0xa9fc - 0xaa13
  11844. // Line range:    454 - 466
  11845. int32_t selfrel_offset31(int32_t * p) {
  11846.     int32_t v1 = *p; // 0xa9fc
  11847.     int32_t v2 = (v1 & 0x40000000) == 0 ? (int32_t)fabsf((float32_t)v1) : v1 | -0x80000000;
  11848.     return v2 + (int32_t)p;
  11849. }
  11850.  
  11851. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  11852. // Address range: 0xaa14 - 0xaab7
  11853. // Line range:    157 - 189
  11854. struct __EIT_entry * search_EIT_table(struct __EIT_entry * table, int32_t nrec, int32_t return_address) {
  11855.     int32_t v1 = (int32_t)table; // 0xaa14_0
  11856.     int32_t v2 = g135; // 0xaa14
  11857.     int32_t v3 = g138; // 0xaa14
  11858.     g135 = nrec;
  11859.     if (nrec == 0) {
  11860.         // 0xaaac
  11861.         g135 = v2;
  11862.         g138 = v3;
  11863.         return (struct __EIT_entry *)0;
  11864.     }
  11865.     int32_t v4 = nrec - 1; // 0xaa24
  11866.     g138 = v4;
  11867.     int32_t v5 = 0; // R11
  11868.     int32_t v6 = 0; // 0xaa38
  11869.     // branch -> 0xaa38
  11870.     while (true) {
  11871.         int32_t v7 = v4 + v6; // 0xaa38
  11872.         int32_t v8 = ((int32_t)(v7 < 0) + v7) / 2; // 0xaa40
  11873.         int32_t v9 = v8; // R4
  11874.         int32_t v10 = 8 * v8; // 0xaa44
  11875.         int32_t v11 = v10; // R10
  11876.         int32_t v12 = v10 + v1; // 0xaa48
  11877.         g135 = v12;
  11878.         uint32_t v13 = selfrel_offset31((int32_t *)v12); // 0xaa50
  11879.         int32_t v14 = g138; // 0xaa54
  11880.         int32_t v15; // 0xaa80
  11881.         int32_t v16; // 0xaa78
  11882.         int32_t v17;
  11883.         if (v9 == v14) {
  11884.             // 0xaaa4
  11885.             if (return_address < v13) {
  11886.               lab_0xaa78:
  11887.                 // 0xaa78
  11888.                 v16 = v5;
  11889.                 if (v14 == v16) {
  11890.                     // 0xaa9c
  11891.                     g135 = 0;
  11892.                     // branch -> 0xaaac
  11893.                     // 0xaaac
  11894.                     g135 = v2;
  11895.                     g138 = v3;
  11896.                     return (struct __EIT_entry *)0;
  11897.                 }
  11898.                 // 0xaa80
  11899.                 v15 = v14 - 1;
  11900.                 // branch -> 0xaa38
  11901.               lab_0xaa38:
  11902.                 // 0xaa38
  11903.                 v6 = v16;
  11904.                 v4 = v15;
  11905.                 // branch -> 0xaa38
  11906.                 continue;
  11907.             }
  11908.         } else {
  11909.             int32_t v18 = selfrel_offset31((int32_t *)(v11 + 8 + v1)); // 0xaa68
  11910.             if (return_address < v13) {
  11911.                 // 0xaa88
  11912.                 if (return_address <= v18 - 1) {
  11913.                     // 0xaaac
  11914.                     v17 = g135;
  11915.                     // branch -> 0xaaac
  11916.                     // 0xaaac
  11917.                     g135 = v2;
  11918.                     g138 = v3;
  11919.                     return (struct __EIT_entry *)v17;
  11920.                 }
  11921.                 int32_t v19 = v9 + 1; // 0xaa94
  11922.                 v5 = v19;
  11923.                 v15 = v4;
  11924.                 v16 = v19;
  11925.                 // branch -> 0xaa38
  11926.                 goto lab_0xaa38;
  11927.             } else {
  11928.                 // 0xaa5c
  11929.                 v14 = v9;
  11930.                 // branch -> 0xaa78
  11931.                 goto lab_0xaa78;
  11932.             }
  11933.         }
  11934.         // 0xaaac
  11935.         v17 = g135;
  11936.         // branch -> 0xaaac
  11937.         // 0xaaac
  11938.         g135 = v2;
  11939.         g138 = v3;
  11940.         return (struct __EIT_entry *)v17;
  11941.     }
  11942. }
  11943.  
  11944. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
  11945. // Address range: 0xaab8 - 0xab07
  11946. // Line range:    469 - 485
  11947. int32_t __gnu_unwind_get_pr_addr(int32_t idx) {
  11948.     // 0xaab8
  11949.     g3 = idx == 1;
  11950.     if (idx == 1) {
  11951.         // 0xaadc
  11952.         return g45;
  11953.     }
  11954.     // 0xaac0
  11955.     g3 = idx == 2;
  11956.     if (idx == 2) {
  11957.         // 0xaae8
  11958.         return g15;
  11959.     }
  11960.     // 0xaac8
  11961.     g3 = idx == 0;
  11962.     if (idx == 0) {
  11963.         // 0xaad0
  11964.         return g10;
  11965.     }
  11966.     // 0xaaf4
  11967.     return 0;
  11968. }
  11969.  
  11970. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  11971. // Address range: 0xab08 - 0xac07
  11972. // Line range:    196 - 275
  11973. int32_t get_eit_entry(struct _Unwind_Control_Block * ucbp, int32_t return_address) {
  11974.     // 0xab08
  11975.     int32_t v1;
  11976.     int32_t nrec = v1; // bp-20
  11977.     nrec = return_address;
  11978.     int32_t v2 = g134; // 0xab0c
  11979.     int32_t v3 = g135; // 0xab0c
  11980.     g134 = (int32_t)ucbp;
  11981.     int32_t v4 = return_address - 2; // 0xab18
  11982.     g135 = v4;
  11983.     int32_t * v5; // 0xabc0_0
  11984.     struct __EIT_entry * v6; // 0xab6c
  11985.     int32_t v7; // 0xab78
  11986.     int32_t v8; // 0xabd0
  11987.     int32_t result; // 0xabf8_2
  11988.     int32_t v9; // 0xab9c
  11989.     int32_t v10; // 0xabb8
  11990.     int32_t v11; // 0xab7c
  11991.     int32_t v12; // 0xabbc
  11992.     uint32_t v13; // 0xabc0
  11993.     if (g38 == 0) {
  11994.         int32_t v14 = *(int32_t *)&g17; // 0xab54
  11995.         int32_t v15 = (g7 - v14) / 8; // 0xab5c
  11996.         nrec = v15;
  11997.         // branch -> 0xab64
  11998.         // 0xab64
  11999.         v6 = search_EIT_table((struct __EIT_entry *)v14, v15, v4);
  12000.         g135 = (int32_t)v6;
  12001.         if (v6 == NULL) {
  12002.             // 0xab38
  12003.             *(int32_t *)(g134 + 16) = 0;
  12004.             // branch -> 0xabf4
  12005.             // 0xabf4
  12006.             g134 = v2;
  12007.             g135 = v3;
  12008.             return 9;
  12009.         }
  12010.         // 0xab78
  12011.         v7 = selfrel_offset31(&v6->e0);
  12012.         v11 = *(int32_t *)(g135 + 4);
  12013.         if (v11 == 1) {
  12014.             // if_ab84_0_true
  12015.             *(int32_t *)(g134 + 16) = 0;
  12016.             *(int32_t *)(g134 + 72) = v7;
  12017.             // branch -> 0xabf4
  12018.             // 0xabf4
  12019.             g134 = v2;
  12020.             g135 = v3;
  12021.             return 5;
  12022.         }
  12023.         // 0xab98
  12024.         *(int32_t *)(g134 + 72) = v7;
  12025.         v9 = g135 + 4;
  12026.         if (v11 < 0) {
  12027.             // if_aba0_0_true
  12028.             *(int32_t *)(g134 + 76) = v9;
  12029.             v12 = 1;
  12030.             // branch -> 0xabb8
  12031.         } else {
  12032.             // 0xabac
  12033.             *(int32_t *)(g134 + 76) = selfrel_offset31((int32_t *)v9);
  12034.             v12 = 0;
  12035.             // branch -> 0xabb8
  12036.         }
  12037.         // 0xabb8
  12038.         v10 = g134;
  12039.         *(int32_t *)(v10 + 80) = v12;
  12040.         v5 = (int32_t *)*(int32_t *)(v10 + 76);
  12041.         v13 = *v5;
  12042.         if (v13 > -1) {
  12043.             // 0xabe8
  12044.             *(int32_t *)(g134 + 16) = selfrel_offset31(v5);
  12045.             // branch -> 0xabf4
  12046.             // 0xabf4
  12047.             g134 = v2;
  12048.             g135 = v3;
  12049.             return 0;
  12050.         }
  12051.         // 0xabcc
  12052.         v8 = __gnu_unwind_get_pr_addr(v13 / 0x1000000 % 16);
  12053.         *(int32_t *)(g134 + 16) = v8;
  12054.         if (v8 == 0) {
  12055.             // if_abdc_0_true
  12056.             result = 9;
  12057.             // branch -> 0xabf4
  12058.         } else {
  12059.             // if_abe0_0_true
  12060.             result = 0;
  12061.             // branch -> 0xabf4
  12062.         }
  12063.         // 0xabf4
  12064.         g134 = v2;
  12065.         g135 = v3;
  12066.         return result;
  12067.     }
  12068.     int32_t v16 = __gnu_Unwind_Find_exidx(v4, &nrec); // 0xab2c
  12069.     if (v16 == 0) {
  12070.         // 0xab38
  12071.         *(int32_t *)(g134 + 16) = 0;
  12072.         // branch -> 0xabf4
  12073.         // 0xabf4
  12074.         g134 = v2;
  12075.         g135 = v3;
  12076.         return 9;
  12077.     }
  12078.     // 0xab24
  12079.     // branch -> 0xab64
  12080.     // 0xab64
  12081.     v6 = search_EIT_table((struct __EIT_entry *)v16, nrec, g135);
  12082.     g135 = (int32_t)v6;
  12083.     if (v6 == NULL) {
  12084.         // 0xab38
  12085.         *(int32_t *)(g134 + 16) = 0;
  12086.         // branch -> 0xabf4
  12087.         // 0xabf4
  12088.         g134 = v2;
  12089.         g135 = v3;
  12090.         return 9;
  12091.     }
  12092.     // 0xab78
  12093.     v7 = selfrel_offset31(&v6->e0);
  12094.     v11 = *(int32_t *)(g135 + 4);
  12095.     if (v11 == 1) {
  12096.         // if_ab84_0_true
  12097.         *(int32_t *)(g134 + 16) = 0;
  12098.         *(int32_t *)(g134 + 72) = v7;
  12099.         // branch -> 0xabf4
  12100.         // 0xabf4
  12101.         g134 = v2;
  12102.         g135 = v3;
  12103.         return 5;
  12104.     }
  12105.     // 0xab98
  12106.     *(int32_t *)(g134 + 72) = v7;
  12107.     v9 = g135 + 4;
  12108.     if (v11 < 0) {
  12109.         // if_aba0_0_true
  12110.         *(int32_t *)(g134 + 76) = v9;
  12111.         v12 = 1;
  12112.         // branch -> 0xabb8
  12113.     } else {
  12114.         // 0xabac
  12115.         *(int32_t *)(g134 + 76) = selfrel_offset31((int32_t *)v9);
  12116.         v12 = 0;
  12117.         // branch -> 0xabb8
  12118.     }
  12119.     // 0xabb8
  12120.     v10 = g134;
  12121.     *(int32_t *)(v10 + 80) = v12;
  12122.     v5 = (int32_t *)*(int32_t *)(v10 + 76);
  12123.     v13 = *v5;
  12124.     if (v13 > -1) {
  12125.         // 0xabe8
  12126.         *(int32_t *)(g134 + 16) = selfrel_offset31(v5);
  12127.         // branch -> 0xabf4
  12128.         // 0xabf4
  12129.         g134 = v2;
  12130.         g135 = v3;
  12131.         return 0;
  12132.     }
  12133.     // 0xabcc
  12134.     v8 = __gnu_unwind_get_pr_addr(v13 / 0x1000000 % 16);
  12135.     *(int32_t *)(g134 + 16) = v8;
  12136.     if (v8 == 0) {
  12137.         // if_abdc_0_true
  12138.         result = 9;
  12139.         // branch -> 0xabf4
  12140.     } else {
  12141.         // if_abe0_0_true
  12142.         result = 0;
  12143.         // branch -> 0xabf4
  12144.     }
  12145.     // 0xabf4
  12146.     g134 = v2;
  12147.     g135 = v3;
  12148.     return result;
  12149. }
  12150.  
  12151. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
  12152. // Address range: 0xac08 - 0xac73
  12153. // Line range:    124 - 140
  12154. void restore_non_core_regs(struct anon_struct_5 * vrs) {
  12155.     uint32_t v1 = vrs->e0; // 0xac08
  12156.     int32_t v2 = g134; // 0xac0c
  12157.     int32_t v3 = (int32_t)vrs; // R4
  12158.     int32_t v4;
  12159.     int32_t v5; // 0xac54
  12160.     int32_t v6; // 0xac68
  12161.     int32_t v7; // 0xac34
  12162.     if (v1 % 2 != 0) {
  12163.         // 0xac34
  12164.         v7 = v3;
  12165.         v5 = v7;
  12166.         if ((*(int32_t *)v7 & 4) == 0) {
  12167.             // 0xac40
  12168.             __gnu_Unwind_Restore_VFP_D_16_to_31();
  12169.             v5 = v3;
  12170.             // branch -> 0xac48
  12171.         }
  12172.         // 0xac48
  12173.         v6 = v5;
  12174.         if ((*(int32_t *)v5 & 8) == 0) {
  12175.             // 0xac54
  12176.             __gnu_Unwind_Restore_WMMXD();
  12177.             v6 = v3;
  12178.             // branch -> 0xac5c
  12179.         }
  12180.         // 0xac5c
  12181.         if ((*(int32_t *)v6 & 16) != 0) {
  12182.             // if_ac64_0_true
  12183.             g134 = v2;
  12184.             return;
  12185.         }
  12186.         // after_if_ac64_0
  12187.         g134 = v4;
  12188.         __gnu_Unwind_Restore_WMMXC();
  12189.         return;
  12190.     }
  12191.     // 0xac1c
  12192.     if ((v1 & 2) == 0) {
  12193.         // 0xac30
  12194.         __gnu_Unwind_Restore_VFP();
  12195.         // branch -> 0xac34
  12196.     } else {
  12197.         // 0xac28
  12198.         __gnu_Unwind_Restore_VFP_D();
  12199.         // branch -> 0xac34
  12200.     }
  12201.     // 0xac34
  12202.     v7 = v3;
  12203.     v5 = v7;
  12204.     if ((*(int32_t *)v7 & 4) == 0) {
  12205.         // 0xac40
  12206.         __gnu_Unwind_Restore_VFP_D_16_to_31();
  12207.         v5 = v3;
  12208.         // branch -> 0xac48
  12209.     }
  12210.     // 0xac48
  12211.     v6 = v5;
  12212.     if ((*(int32_t *)v5 & 8) == 0) {
  12213.         // 0xac54
  12214.         __gnu_Unwind_Restore_WMMXD();
  12215.         v6 = v3;
  12216.         // branch -> 0xac5c
  12217.     }
  12218.     // 0xac5c
  12219.     if ((*(int32_t *)v6 & 16) != 0) {
  12220.         // if_ac64_0_true
  12221.         g134 = v2;
  12222.         return;
  12223.     }
  12224.     // after_if_ac64_0
  12225.     g134 = v4;
  12226.     __gnu_Unwind_Restore_WMMXC();
  12227. }
  12228.  
  12229. // From module:   ./unwind.h
  12230. // Address range: 0xac74 - 0xac87
  12231. // Line range:    41 - 65
  12232. void _Unwind_decode_typeinfo_ptr(int32_t base, int32_t ptr) {
  12233.     // 0xac74
  12234.     if (*(int32_t *)base != 0) {
  12235.         // if_ac7c_0_true
  12236.         // branch -> after_if_ac80_0
  12237.     }
  12238. }
  12239.  
  12240. // From module:   ./unwind.h
  12241. // Address range: 0xac88 - 0xac8f
  12242. // Line range:    68 - 73
  12243. void __gnu_unwind_24bit(struct _Unwind_Context * context, int32_t data, int32_t compact) {
  12244.     // 0xac88
  12245.     g127 = 9;
  12246. }
  12247.  
  12248. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12249. // Address range: 0xac90 - 0xac93
  12250. // Line range:    124 - 132
  12251. void _Unwind_DebugHook(char * cfa, char * handler) {
  12252.     // 0xac90
  12253.     return;
  12254. }
  12255.  
  12256. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12257. // Address range: 0xac94 - 0xacf7
  12258. // Line range:    281 - 302
  12259. void unwind_phase2(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * vrs) {
  12260.     int32_t v1 = (int32_t)ucbp; // 0xac94_0
  12261.     int32_t v2 = (int32_t)vrs; // 0xac94_1
  12262.     g135 = v1;
  12263.     g134 = v2;
  12264.     // branch -> 0xaca0
  12265.     while (true) {
  12266.         int32_t v3 = get_eit_entry((struct _Unwind_Control_Block *)v1, *(int32_t *)(v2 + 64)); // 0xaca8
  12267.         g1 = true;
  12268.         g2 = v3 < 0;
  12269.         g3 = v3 == 0;
  12270.         g136 = v3;
  12271.         if (v3 == 0) {
  12272.             int32_t v4 = g134; // 0xacb8
  12273.             g127 = 1;
  12274.             int32_t v5 = g135; // 0xacc0
  12275.             g128 = v5;
  12276.             g132 = v4;
  12277.             *(int32_t *)(v5 + 20) = *(int32_t *)(v4 + 64);
  12278.             int32_t v6 = *(int32_t *)(g135 + 16); // 0xaccc
  12279.             g133 = v6;
  12280.             g126 = &g113;
  12281.             ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v6)(g127, v5, v4, v6);
  12282.             uint32_t v7 = g127; // 0xacd4
  12283.             if (v7 != 8) {
  12284.                 // 0xacdc
  12285.                 g1 = v7 > 6;
  12286.                 g2 = v7 < 7;
  12287.                 g3 = v7 == 7;
  12288.                 if (v7 != 7) {
  12289.                     // 0xacb4
  12290.                     abort();
  12291.                     // UNREACHABLE
  12292.                 }
  12293.                 // 0xace4
  12294.                 _Unwind_DebugHook((char *)g136, (char *)*(int32_t *)(g134 + 64));
  12295.                 g127 = g134 + 4;
  12296.                 restore_core_regs();
  12297.                 return;
  12298.             }
  12299.             // 0xacb8
  12300.             v2 = g134;
  12301.             v1 = g135;
  12302.             // branch -> 0xaca0
  12303.             continue;
  12304.         }
  12305.         // 0xacb4
  12306.         abort();
  12307.         // UNREACHABLE
  12308.     }
  12309. }
  12310.  
  12311. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12312. // Address range: 0xacf8 - 0xae1f
  12313. // Line range:    308 - 388
  12314. int32_t unwind_phase2_forced(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs, int32_t resuming) {
  12315.     struct anon_struct_5 v1;
  12316.     struct anon_struct_5 v2;
  12317.     struct anon_struct_5 v3;
  12318.     struct anon_struct_5 v4;
  12319.     int32_t v5 = (int32_t)ucbp; // 0xacf8_0
  12320.     int32_t v6 = (int32_t)entry_vrs; // 0xacf8_1
  12321.     int32_t v7 = g135; // 0xacf8
  12322.     int32_t v8 = g138; // 0xacf8
  12323.     g138 = *(int32_t *)(v5 + 12);
  12324.     g134 = v5;
  12325.     g139 = *(int32_t *)(v5 + 24);
  12326.     g129 = resuming;
  12327.     g130 = (int32_t)&v2;
  12328.     int32_t v9 = (int32_t)&v1; // 0xad20_0
  12329.     g137 = v9;
  12330.     g136 = 0;
  12331.     v2.e1.e0[0] = *(int32_t *)(v6 + 4);
  12332.     v2.e1.e0[1] = *(int32_t *)(v6 + 8);
  12333.     v2.e1.e0[2] = *(int32_t *)(v6 + 12);
  12334.     v2.e1.e0[3] = *(int32_t *)(v6 + 16);
  12335.     int32_t v10 = (int32_t)&v3; // 0xad28_0
  12336.     v2.e1.e0[4] = *(int32_t *)(v6 + 20);
  12337.     v2.e1.e0[5] = *(int32_t *)(v6 + 24);
  12338.     v2.e1.e0[6] = *(int32_t *)(v6 + 28);
  12339.     v2.e1.e0[7] = *(int32_t *)(v6 + 32);
  12340.     *(int32_t *)(v10 + 16) = *(int32_t *)(v6 + 36);
  12341.     *(int32_t *)(v10 + 20) = *(int32_t *)(v6 + 40);
  12342.     *(int32_t *)(v10 + 24) = *(int32_t *)(v6 + 44);
  12343.     *(int32_t *)(v10 + 28) = *(int32_t *)(v6 + 48);
  12344.     int32_t v11 = v10 + 32; // 0xad38
  12345.     g131 = v11;
  12346.     *(int32_t *)v11 = *(int32_t *)(v6 + 52);
  12347.     *(int32_t *)(v10 + 36) = *(int32_t *)(v6 + 56);
  12348.     *(int32_t *)(v10 + 40) = *(int32_t *)(v6 + 60);
  12349.     *(int32_t *)(v10 + 44) = *(int32_t *)(v6 + 64);
  12350.     v2.e0 = g136;
  12351.     // branch -> 0xad48
  12352.     uint32_t v12; // 0xade8
  12353.     while (true) {
  12354.         int32_t v13 = get_eit_entry((struct _Unwind_Control_Block *)g134, v2.e1.e0[15]); // 0xad50
  12355.         int32_t v14 = g129; // 0xad54
  12356.         int32_t v15 = v14 == 0 ? 25 : 26;
  12357.         g129 = v14 == 0 ? 9 : 10;
  12358.         g1 = true;
  12359.         g2 = v13 < 0;
  12360.         g3 = v13 == 0;
  12361.         g135 = v13;
  12362.         int32_t v16; // 0xadb0
  12363.         int32_t v17; // 0xada4
  12364.         if (v13 == 0) {
  12365.             // 0xad70
  12366.             *(int32_t *)(g134 + 20) = v2.e1.e0[15];
  12367.             memcpy((char *)&v1, (char *)&v2, 480);
  12368.             int32_t v18 = g134; // 0xad88
  12369.             int32_t v19 = *(int32_t *)(v18 + 16); // 0xad88
  12370.             g133 = v19;
  12371.             int32_t v20 = g129; // 0xad8c
  12372.             g127 = v20;
  12373.             g128 = v18;
  12374.             g132 = v9;
  12375.             g126 = 0xad9c;
  12376.             ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v19)(v20, v18, v9, v19);
  12377.             g136 = g127;
  12378.             v16 = g129;
  12379.             v17 = v1.e1.e0[13];
  12380.             // branch -> 0xada4
  12381.         } else {
  12382.             // if_ad64_0_true
  12383.             g129 = v15;
  12384.             v16 = v15;
  12385.             v17 = v2.e1.e0[13];
  12386.             // branch -> 0xada4
  12387.         }
  12388.         // 0xada4
  12389.         v2.e2 = v17;
  12390.         g127 = 1;
  12391.         g128 = v16;
  12392.         int32_t v21 = g134; // 0xadb8
  12393.         g132 = v21;
  12394.         g133 = v21;
  12395.         g126 = 0xadc4;
  12396.         ((int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t))g138)(1, v16, v21, v21, g130, g139);
  12397.         int32_t result = 9;
  12398.         if (g127 == 0) {
  12399.             int32_t v22 = g135; // 0xadcc
  12400.             if (v22 == 0) {
  12401.                 // 0xadd4
  12402.                 g129 = 0;
  12403.                 memcpy((char *)&v2, (char *)&v1, 480);
  12404.                 v12 = g136;
  12405.                 if (v12 != 8) {
  12406.                     // break -> 0xadf0
  12407.                     break;
  12408.                 }
  12409.                 // continue -> 0xad48
  12410.                 continue;
  12411.             } else {
  12412.                 result = v22;
  12413.             }
  12414.         }
  12415.         // 0xae18
  12416.         g135 = v7;
  12417.         g138 = v8;
  12418.         return result;
  12419.     }
  12420.     // 0xadf0
  12421.     g1 = v12 > 6;
  12422.     g2 = v12 < 7;
  12423.     g3 = v12 == 7;
  12424.     if (v12 == 7) {
  12425.         // 0xadf8
  12426.         _Unwind_DebugHook((char *)g135, (char *)v2.e1.e0[15]);
  12427.         g127 = (int32_t)&v4;
  12428.         restore_core_regs();
  12429.         // branch -> 0xae18
  12430.     }
  12431.     // 0xae18
  12432.     g135 = v7;
  12433.     g138 = v8;
  12434.     return 9;
  12435. }
  12436.  
  12437. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  12438. // Address range: 0xae20 - 0xae27
  12439. // Line range:    210 - 401
  12440. int32_t _Unwind_GetCFA(struct _Unwind_Context * context) {
  12441.     // 0xae20
  12442.     return *(int32_t *)((int32_t)context + 68);
  12443. }
  12444.  
  12445. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12446. // Address range: 0xae28 - 0xaecb
  12447. // Line range:    410 - 448
  12448. int32_t __gnu_Unwind_RaiseException(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs) {
  12449.     struct anon_struct_5 v1;
  12450.     struct anon_struct_5 v2;
  12451.     int32_t v3 = (int32_t)entry_vrs; // 0xae28_1
  12452.     int32_t * v4 = (int32_t *)(v3 + 60); // 0xae28_2
  12453.     int32_t v5 = g135; // 0xae2c
  12454.     int32_t * v6 = (int32_t *)(v3 + 64); // 0xae34_0
  12455.     *v6 = *v4;
  12456.     g135 = (int32_t)ucbp;
  12457.     g134 = v3;
  12458.     int32_t v7 = (int32_t)&v1; // 0xae40_0
  12459.     v1.e1.e0[0] = *(int32_t *)(v3 + 4);
  12460.     v1.e1.e0[1] = *(int32_t *)(v3 + 8);
  12461.     v1.e1.e0[2] = *(int32_t *)(v3 + 12);
  12462.     v1.e1.e0[3] = *(int32_t *)(v3 + 16);
  12463.     int32_t v8 = (int32_t)&v2; // 0xae50_0
  12464.     v1.e1.e0[4] = *(int32_t *)(v3 + 20);
  12465.     v1.e1.e0[5] = *(int32_t *)(v3 + 24);
  12466.     v1.e1.e0[6] = *(int32_t *)(v3 + 28);
  12467.     v1.e1.e0[7] = *(int32_t *)(v3 + 32);
  12468.     *(int32_t *)(v8 + 16) = *(int32_t *)(v3 + 36);
  12469.     *(int32_t *)(v8 + 20) = *(int32_t *)(v3 + 40);
  12470.     *(int32_t *)(v8 + 24) = *(int32_t *)(v3 + 44);
  12471.     *(int32_t *)(v8 + 28) = *(int32_t *)(v3 + 48);
  12472.     int32_t v9 = v8 + 32; // 0xae60
  12473.     g131 = v9;
  12474.     *(int32_t *)v9 = *(int32_t *)(v3 + 52);
  12475.     *(int32_t *)(v8 + 36) = *(int32_t *)(v3 + 56);
  12476.     *(int32_t *)(v8 + 40) = *v4;
  12477.     *(int32_t *)(v8 + 44) = *v6;
  12478.     g136 = v7;
  12479.     v1.e0 = -1;
  12480.     int32_t v10 = get_eit_entry((struct _Unwind_Control_Block *)g135, v1.e1.e0[15]); // 0xae7c
  12481.     g127 = v10;
  12482.     g1 = true;
  12483.     g2 = v10 < 0;
  12484.     g3 = v10 == 0;
  12485.     if (v10 == 0) {
  12486.         int32_t v11 = g135; // 0xae88
  12487.         int32_t v12 = *(int32_t *)(v11 + 16); // 0xae88
  12488.         g133 = v12;
  12489.         g128 = v11;
  12490.         g132 = v7;
  12491.         g126 = &g114;
  12492.         ((int32_t (*)(int32_t, int32_t, int32_t))v12)(v11, v7, v12);
  12493.         g137 = 0;
  12494.         restore_non_core_regs(&v1);
  12495.         if (g137 == 6) {
  12496.             // 0xaeb4
  12497.             unwind_phase2((struct _Unwind_Control_Block *)g135, (struct anon_struct_6 *)g134);
  12498.             // branch -> 0xaec0
  12499.         }
  12500.     }
  12501.     // 0xaec0
  12502.     g135 = v5;
  12503.     return 9;
  12504. }
  12505.  
  12506. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12507. // Address range: 0xaecc - 0xaee7
  12508. // Line range:    458 - 468
  12509. int32_t __gnu_Unwind_ForcedUnwind(struct _Unwind_Control_Block * ucbp, int32_t (*stop_fn)(int32_t, int32_t, char *, struct _Unwind_Control_Block *, struct _Unwind_Context *, char *), char * stop_arg, struct anon_struct_6 * entry_vrs) {
  12510.     int32_t v1 = (int32_t)ucbp; // 0xaecc_0
  12511.     int32_t v2 = (int32_t)entry_vrs; // 0xaecc_3
  12512.     *(int32_t *)(v1 + 24) = (int32_t)stop_arg;
  12513.     *(int32_t *)(v1 + 12) = (int32_t)stop_fn;
  12514.     *(int32_t *)(v2 + 64) = *(int32_t *)(v2 + 60);
  12515.     return unwind_phase2_forced(ucbp, entry_vrs, 0);
  12516. }
  12517.  
  12518. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12519. // Address range: 0xaee8 - 0xaf5b
  12520. // Line range:    475 - 505
  12521. int32_t __gnu_Unwind_Resume(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs) {
  12522.     int32_t v1 = (int32_t)ucbp; // 0xaee8_0
  12523.     int32_t v2 = (int32_t)entry_vrs; // 0xaee8_1
  12524.     g135 = v1;
  12525.     int32_t v3 = *(int32_t *)(v1 + 12); // 0xaef0
  12526.     g136 = v3;
  12527.     g134 = v2;
  12528.     g1 = true;
  12529.     g2 = v3 < 0;
  12530.     g3 = v3 == 0;
  12531.     *(int32_t *)(v2 + 64) = *(int32_t *)(v1 + 20);
  12532.     if (v3 != 0) {
  12533.         // 0xaf08
  12534.         unwind_phase2_forced(ucbp, entry_vrs, 1);
  12535.         // branch -> 0xaf58
  12536.         // 0xaf58
  12537.         abort();
  12538.         // UNREACHABLE
  12539.     }
  12540.     int32_t v4 = *(int32_t *)(v1 + 16); // 0xaf14
  12541.     g133 = v4;
  12542.     int32_t v5 = g135; // 0xaf18
  12543.     g128 = v5;
  12544.     g127 = 2;
  12545.     int32_t v6 = g134; // 0xaf20
  12546.     g132 = v6;
  12547.     g126 = 0xaf28;
  12548.     ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v4)(2, v5, v6, v4);
  12549.     uint32_t v7 = g127; // 0xaf28
  12550.     g1 = v7 > 6;
  12551.     g2 = v7 < 7;
  12552.     g3 = v7 == 7;
  12553.     if (v7 == 7) {
  12554.         // 0xaf44
  12555.         _Unwind_DebugHook((char *)g136, (char *)*(int32_t *)(g134 + 64));
  12556.         g127 = g134 + 4;
  12557.         restore_core_regs();
  12558.         // branch -> 0xaf58
  12559.     } else {
  12560.         // 0xaf30
  12561.         if (v7 == 8) {
  12562.             // 0xaf38
  12563.             unwind_phase2((struct _Unwind_Control_Block *)g135, (struct anon_struct_6 *)g134);
  12564.             // branch -> 0xaf44
  12565.             // 0xaf44
  12566.             _Unwind_DebugHook((char *)g136, (char *)*(int32_t *)(g134 + 64));
  12567.             g127 = g134 + 4;
  12568.             restore_core_regs();
  12569.             // branch -> 0xaf58
  12570.         }
  12571.     }
  12572.     // 0xaf58
  12573.     abort();
  12574.     // UNREACHABLE
  12575. }
  12576.  
  12577. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12578. // Address range: 0xaf5c - 0xaf7b
  12579. // Line range:    513 - 522
  12580. int32_t __gnu_Unwind_Resume_or_Rethrow(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs) {
  12581.     int32_t v1 = (int32_t)entry_vrs; // 0xaf5c_1
  12582.     if (*(int32_t *)((int32_t)ucbp + 12) == 0) {
  12583.         // 0xaf68
  12584.         __gnu_Unwind_RaiseException(ucbp, entry_vrs);
  12585.         return 9;
  12586.     }
  12587.     // 0xaf6c
  12588.     *(int32_t *)(v1 + 64) = *(int32_t *)(v1 + 60);
  12589.     return unwind_phase2_forced(ucbp, entry_vrs, 0);
  12590. }
  12591.  
  12592. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  12593. // Address range: 0xaf7c - 0xaf7f
  12594. // Line range:    211 - 528
  12595. void _Unwind_Complete(struct _Unwind_Control_Block * ucbp) {
  12596.     // 0xaf7c
  12597.     return;
  12598. }
  12599.  
  12600. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  12601. // Address range: 0xaf80 - 0xaf8f
  12602. // Line range:    212 - 538
  12603. void _Unwind_DeleteException(struct _Unwind_Control_Block * exc) {
  12604.     // 0xaf80
  12605.     return;
  12606. }
  12607.  
  12608. // Address range: 0xaf90 - 0xaf97
  12609. int32_t function_af90(int32_t a1) {
  12610.     // 0xaf90
  12611.     g127 = 1;
  12612.     ((int32_t (*)(int32_t))g133)(1);
  12613.     return 1;
  12614. }
  12615.  
  12616. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  12617. // Address range: 0xaf98 - 0xaff3
  12618. // Line range:    174 - 180
  12619. int32_t _Unwind_VRS_Get(struct _Unwind_Context * context, int32_t regclass, int32_t regno, int32_t representation, char * valuep) {
  12620.     // 0xaf98
  12621.     g128 = regclass;
  12622.     g132 = regno;
  12623.     g133 = representation;
  12624.     return 2;
  12625. }
  12626.  
  12627. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  12628. // Address range: 0xaff4 - 0xb01b
  12629. // Line range:    220 - 225
  12630. int32_t _Unwind_GetGR(struct _Unwind_Context * context, int32_t regno) {
  12631.     // 0xaff4
  12632.     int32_t v1;
  12633.     int32_t val = v1; // bp-12
  12634.     val = g133;
  12635.     _Unwind_VRS_Get(context, 0, regno, 0, (char *)&val);
  12636.     return val;
  12637. }
  12638.  
  12639. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  12640. // Address range: 0xb01c - 0xb077
  12641. // Line range:    170 - 211
  12642. int32_t _Unwind_VRS_Set(struct _Unwind_Context * context, uint32_t regclass, int32_t regno, int32_t representation, char * valuep) {
  12643.     // 0xb01c
  12644.     g132 = regno;
  12645.     g133 = representation;
  12646.     g1 = regclass > 3;
  12647.     g2 = regclass < 4;
  12648.     g3 = regclass == 4;
  12649.     return 2;
  12650. }
  12651.  
  12652. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  12653. // Address range: 0xb078 - 0xb0a3
  12654. // Line range:    231 - 234
  12655. void _Unwind_SetGR(struct _Unwind_Context * context, int32_t regno, int32_t val) {
  12656.     // 0xb078
  12657.     g131 = regno;
  12658.     _Unwind_VRS_Set(context, 0, regno, 0, (char *)&val);
  12659. }
  12660.  
  12661. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12662. // Address range: 0xb0a4 - 0xb16b
  12663. // Line range:    547 - 598
  12664. int32_t __gnu_Unwind_Backtrace(int32_t (*trace)(struct _Unwind_Context *, char *), char * trace_argument, struct anon_struct_6 * entry_vrs) {
  12665.     struct anon_struct_5 v1;
  12666.     struct anon_struct_5 v2;
  12667.     struct _Unwind_Control_Block v3;
  12668.     int32_t v4 = (int32_t)entry_vrs; // 0xb0a4_2
  12669.     int32_t * v5 = (int32_t *)(v4 + 60); // 0xb0a4_3
  12670.     int32_t v6 = g135; // 0xb0ac
  12671.     int32_t v7 = g138; // 0xb0ac
  12672.     g137 = (int32_t)trace;
  12673.     int32_t * v8 = (int32_t *)(v4 + 64); // 0xb0b4_0
  12674.     *v8 = *v5;
  12675.     g138 = (int32_t)trace_argument;
  12676.     int32_t v9 = (int32_t)&v3; // 0xb0c0_0
  12677.     int32_t v10 = (int32_t)&v1; // 0xb0c8_0
  12678.     g134 = v10;
  12679.     g136 = v9;
  12680.     v1.e1.e0[0] = *(int32_t *)(v4 + 4);
  12681.     v1.e1.e0[1] = *(int32_t *)(v4 + 8);
  12682.     v1.e1.e0[2] = *(int32_t *)(v4 + 12);
  12683.     v1.e1.e0[3] = *(int32_t *)(v4 + 16);
  12684.     int32_t v11 = (int32_t)&v2; // 0xb0d0_0
  12685.     v1.e1.e0[4] = *(int32_t *)(v4 + 20);
  12686.     v1.e1.e0[5] = *(int32_t *)(v4 + 24);
  12687.     v1.e1.e0[6] = *(int32_t *)(v4 + 28);
  12688.     v1.e1.e0[7] = *(int32_t *)(v4 + 32);
  12689.     *(int32_t *)(v11 + 16) = *(int32_t *)(v4 + 36);
  12690.     *(int32_t *)(v11 + 20) = *(int32_t *)(v4 + 40);
  12691.     *(int32_t *)(v11 + 24) = *(int32_t *)(v4 + 44);
  12692.     *(int32_t *)(v11 + 28) = *(int32_t *)(v4 + 48);
  12693.     *(int32_t *)(v11 + 32) = *(int32_t *)(v4 + 52);
  12694.     *(int32_t *)(v11 + 36) = *(int32_t *)(v4 + 56);
  12695.     *(int32_t *)(v11 + 40) = *v5;
  12696.     *(int32_t *)(v11 + 44) = *v8;
  12697.     v1.e0 = -1;
  12698.     // branch -> 0xb0f4
  12699.     int32_t result; // 0xb160
  12700.     while (true) {
  12701.         // 0xb0f4
  12702.         if (get_eit_entry(&v3, v1.e1.e0[15]) == 0) {
  12703.             // 0xb110
  12704.             _Unwind_SetGR((struct _Unwind_Context *)&v1, 12, v9);
  12705.             g127 = v10;
  12706.             int32_t v12 = g138; // 0xb124
  12707.             g128 = v12;
  12708.             g126 = 0xb12c;
  12709.             ((int32_t (*)(int32_t, int32_t))g137)(v10, v12);
  12710.             int32_t v13 = g127; // 0xb12c
  12711.             g1 = true;
  12712.             g2 = v13 < 0;
  12713.             g3 = v13 == 0;
  12714.             if (v13 == 0) {
  12715.                 int32_t v14 = v3.e2.e1; // 0xb134
  12716.                 g133 = v14;
  12717.                 g127 = 8;
  12718.                 g128 = v9;
  12719.                 g132 = v10;
  12720.                 g126 = 0xb148;
  12721.                 ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v14)(8, v9, v10, v14);
  12722.                 int32_t v15 = g127; // 0xb148
  12723.                 g135 = v15;
  12724.                 if ((v15 - 5 & -5) == 0) {
  12725.                     // break -> 0xb158
  12726.                     break;
  12727.                 }
  12728.                 // continue -> 0xb0f4
  12729.                 continue;
  12730.             }
  12731.         }
  12732.         // 0xb108
  12733.         g135 = 9;
  12734.         // branch -> 0xb158
  12735.         // 0xb158
  12736.         restore_non_core_regs(&v1);
  12737.         result = g135;
  12738.         g135 = v6;
  12739.         g138 = v7;
  12740.         return result;
  12741.     }
  12742.     // 0xb158
  12743.     restore_non_core_regs(&v1);
  12744.     result = g135;
  12745.     g135 = v6;
  12746.     g138 = v7;
  12747.     return result;
  12748. }
  12749.  
  12750. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
  12751. // Address range: 0xb16c - 0xb557
  12752. // Line range:    606 - 855
  12753. int32_t __gnu_unwind_pr_common(uint32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context, int32_t id) {
  12754.     struct anon_struct_4 v1;
  12755.     // 0xb16c
  12756.     char * v2;
  12757.     char * matched = v2; // bp-56
  12758.     int32_t v3 = state; // R0
  12759.     int32_t v4 = (int32_t)ucbp; // 0xb16c_0
  12760.     g128 = v4;
  12761.     int32_t v5 = g135; // 0xb16c
  12762.     int32_t v6 = g138; // 0xb16c
  12763.     g137 = (int32_t)context;
  12764.     int32_t v7 = *(int32_t *)(v4 + 76); // 0xb174
  12765.     g132 = v7;
  12766.     g139 = id;
  12767.     g135 = v4;
  12768.     int32_t v8 = v7 + 4; // 0xb184
  12769.     int32_t v9 = v8; // R12
  12770.     int32_t v10 = state % 4; // 0xb188
  12771.     g138 = v10;
  12772.     int32_t v11 = *(int32_t *)v7; // 0xb18c
  12773.     g134 = v11;
  12774.     v1.e1 = (int32_t *)v8;
  12775.     v1.e0 = v11;
  12776.     int32_t v12; // 0xb310_0
  12777.     int32_t v13; // 0xb4f4
  12778.     int32_t v14; // 0xb220
  12779.     int32_t v15; // 0xb4b8
  12780.     int32_t v16; // 0xb1f0
  12781.     int32_t v17; // 0xb1f8
  12782.     int32_t v18; // 0xb2002026
  12783.     int32_t v19; // 0xb200202643
  12784.     int32_t v20; // 0xb21c45
  12785.     int32_t v21; // 0xb1e4
  12786.     int32_t v22; // 0xb2002228
  12787.     int32_t v23; // 0xb4dc6
  12788.     int32_t v24;
  12789.     int32_t v25;
  12790.     if (id == 0) {
  12791.         int32_t v26 = 256 * v11; // 0xb19c
  12792.         g134 = v26;
  12793.         v1.e0 = v26;
  12794.         v1.e2 = 3;
  12795.         v19 = v8;
  12796.         // branch -> 0xb1dc
  12797.     } else {
  12798.         // 0xb1b4
  12799.         if (id <= 2) {
  12800.             int32_t v27 = 0x10000 * v11; // 0xb1c4
  12801.             g134 = v27;
  12802.             g132 = 2;
  12803.             v1.e0 = v27;
  12804.             v1.e2 = 2;
  12805.             int32_t v28 = 4 * (v11 / 0x10000 % 256) + v8; // 0xb1d8
  12806.             v9 = v28;
  12807.             v19 = v28;
  12808.             // branch -> 0xb1dc
  12809.         } else {
  12810.             v19 = v8;
  12811.         }
  12812.         // 0xb1dc
  12813.         v18 = v19;
  12814.         if (v10 == 2) {
  12815.             // if_b1e4_0_true
  12816.             v21 = *(int32_t *)(v4 + 56);
  12817.             v9 = v21;
  12818.             v18 = v21;
  12819.             // branch -> after_if_b1e4_0
  12820.         }
  12821.         // after_if_b1e4_0
  12822.         if (*(int32_t *)(v4 + 80) % 2 == 0) {
  12823.             // 0xb1f0
  12824.             v16 = state ^ 8;
  12825.             v17 = v16 / 8 % 2;
  12826.             v22 = *(int32_t *)v18;
  12827.             g134 = v22;
  12828.             int32_t result; // 0xb550_2
  12829.             if (v22 == 0) {
  12830.                 // 0xb4b8
  12831.                 v23 = 0;
  12832.                 // branch -> 0xb4b8
  12833.                 // 0xb4b8
  12834.                 if (g139 < 3) {
  12835.                     // 0xb4d4
  12836.                     __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
  12837.                     // branch -> 0xb524
  12838.                 } else {
  12839.                     // 0xb4d4
  12840.                     __gnu_unwind_24bit((struct _Unwind_Context *)v16, g128, g132);
  12841.                     if (g127 == 0) {
  12842.                         // 0xb4dc
  12843.                         g133 = v23;
  12844.                         if (v23 == 0) {
  12845.                             // if_b4e4_0_true
  12846.                             result = 8;
  12847.                             // branch -> 0xb54c
  12848.                         } else {
  12849.                             // 0xb4ec
  12850.                             v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
  12851.                             _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
  12852.                             // branch -> 0xb518
  12853.                             // 0xb518
  12854.                             _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
  12855.                             result = 7;
  12856.                             // branch -> 0xb54c
  12857.                         }
  12858.                         // 0xb54c
  12859.                         g135 = v5;
  12860.                         g138 = v6;
  12861.                         return result;
  12862.                     }
  12863.                 }
  12864.                 // 0xb524
  12865.                 // branch -> 0xb54c
  12866.                 // 0xb54c
  12867.                 g135 = v5;
  12868.                 g138 = v6;
  12869.                 return 9;
  12870.             }
  12871.             // 0xb20c
  12872.             v12 = (int32_t)&matched;
  12873.             v24 = 0;
  12874.             // branch -> 0xb20c
  12875.             while (true) {
  12876.                 // 0xb20c
  12877.                 v14 = v18;
  12878.                 // branch -> 0xb20c
  12879.               lab_0xb20c:;
  12880.                 int32_t v29; // 0xb4c0
  12881.                 int32_t v30; // 0xb518
  12882.                 int32_t v31; // 0xb4c0
  12883.                 int32_t v32; // 0xb518
  12884.                 int32_t v33; // 0xb4c0
  12885.                 int32_t v34; // 0xb518
  12886.                 int32_t v35;
  12887.                 int32_t v36;
  12888.                 int32_t v37;
  12889.                 int32_t v38; // 0xb4c8
  12890.                 int32_t v39; // 0xb4f0
  12891.                 int32_t v40; // 0xb500
  12892.                 int32_t v41; // 0xb50c
  12893.                 while (true) {
  12894.                     int32_t v42 = *(int32_t *)(g135 + 72); // 0xb210
  12895.                     g133 = v42;
  12896.                     int32_t v43; // 0xb21c
  12897.                     if (g139 == 2) {
  12898.                         // if_b21c_0_true
  12899.                         v43 = *(int32_t *)(v14 + 4);
  12900.                         g136 = v14 + 8;
  12901.                         // branch -> after_if_b22c_0
  12902.                     } else {
  12903.                         // if_b224_0_true
  12904.                         g136 = v14 + 4;
  12905.                         g134 = (int32_t)*(int16_t *)v14;
  12906.                         v43 = (int32_t)*(int16_t *)(v14 + 2);
  12907.                         // branch -> after_if_b22c_0
  12908.                     }
  12909.                     uint32_t v44 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15); // 0xb238
  12910.                     v3 = v44;
  12911.                     uint32_t v45 = (v43 & -2) + v42; // 0xb23c
  12912.                     int32_t v46; // 0xb260
  12913.                     if (v45 > v44) {
  12914.                         // if_b240_0_true
  12915.                         v9 = 0;
  12916.                         v46 = g134;
  12917.                         // branch -> 0xb25c
  12918.                     } else {
  12919.                         int32_t v47 = g134; // 0xb248
  12920.                         int32_t v48 = v47 & -2; // 0xb248
  12921.                         g133 = v48;
  12922.                         if (v44 < v48 + v45) {
  12923.                             // if_b254_0_true
  12924.                             v9 = 1;
  12925.                             v46 = v47;
  12926.                             // branch -> 0xb25c
  12927.                         } else {
  12928.                             v46 = v47;
  12929.                         }
  12930.                     }
  12931.                     int32_t v49 = -((v43 % 2)) & 2 | v46 % 2; // 0xb264
  12932.                     int32_t v50 = v49; // R4
  12933.                     int32_t v51;
  12934.                     switch ((int2_t)v49) {
  12935.                         default: {
  12936.                             // 0xb274
  12937.                             if (v49 == 2) {
  12938.                                 float32_t v52 = fabsf((float32_t)*(int32_t *)g136);
  12939.                                 v50 = v52;
  12940.                                 int32_t v53; // 0xb4dc7
  12941.                                 if (g138 != 0) {
  12942.                                     int32_t v54 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13); // 0xb424
  12943.                                     v3 = v54;
  12944.                                     if (*(int32_t *)(g135 + 32) != v54) {
  12945.                                         v53 = v24;
  12946.                                         goto lab_0xb498_4;
  12947.                                     }
  12948.                                     int32_t * v55 = (int32_t *)(g135 + 40); // 0xb430_0
  12949.                                     if (g136 != *v55) {
  12950.                                         v53 = v24;
  12951.                                         goto lab_0xb498_4;
  12952.                                     }
  12953.                                     // 0xb43c
  12954.                                     v43 = 0;
  12955.                                     int32_t v56 = 4; // R3
  12956.                                     *v55 = v50;
  12957.                                     *(int32_t *)(g135 + 48) = v56;
  12958.                                     *(int32_t *)(g135 + 44) = v43;
  12959.                                     *(int32_t *)(g135 + 52) = g136 + v56;
  12960.                                     int32_t v57 = g136; // 0xb458
  12961.                                     if (*(int32_t *)v57 >= v43) {
  12962.                                         // 0xb490
  12963.                                         v53 = 1;
  12964.                                         // branch -> 0xb498
  12965.                                         goto lab_0xb498_4;
  12966.                                         // 0xb54c
  12967.                                         g135 = v5;
  12968.                                         g138 = v6;
  12969.                                         return result;
  12970.                                     }
  12971.                                     int32_t v63 = selfrel_offset31((int32_t *)(v57 + 4 + 4 * v50)); // 0xb46c
  12972.                                     _Unwind_SetGR((struct _Unwind_Context *)g137, 15, v63);
  12973.                                     // branch -> 0xb488
  12974.                                     // 0xb488
  12975.                                     // branch -> 0xb518
  12976.                                     // 0xb518
  12977.                                     _Unwind_SetGR((struct _Unwind_Context *)g137, v43, g135);
  12978.                                     // branch -> 0xb54c
  12979.                                     // 0xb54c
  12980.                                     g135 = v5;
  12981.                                     g138 = v6;
  12982.                                     return 7;
  12983.                                 }
  12984.                                 // 0xb3b0
  12985.                                 int32_t v58; // 0xb498
  12986.                                 int32_t v59; // 0xb4a8
  12987.                                 if (v9 != 0) {
  12988.                                     // 0xb3b8
  12989.                                     g133 = v17;
  12990.                                     if ((int32_t)v52 == 0) {
  12991.                                         // after_if_b3c0_0.thread
  12992.                                         g133 = 1;
  12993.                                         // branch -> 0xb3cc
  12994.                                     } else {
  12995.                                         // after_if_b3c0_0
  12996.                                         if (v17 == 0) {
  12997.                                             v53 = v24;
  12998.                                           lab_0xb498_4:
  12999.                                             // 0xb498
  13000.                                             v58 = g136;
  13001.                                             v59 = v58;
  13002.                                             if (*(int32_t *)v58 < 0) {
  13003.                                               lab_if_b4a4_0_true:;
  13004.                                                 int32_t v60 = v58 + 4; // 0xb4a4
  13005.                                                 g136 = v60;
  13006.                                                 v59 = v60;
  13007.                                                 // branch -> after_if_b4a4_0
  13008.                                             }
  13009.                                           lab_after_if_b4a4_0:;
  13010.                                             int32_t v61 = v59 + 4 * (v50 + 1); // 0xb4a8
  13011.                                             v9 = v61;
  13012.                                             int32_t v62 = *(int32_t *)v61; // 0xb20022
  13013.                                             g134 = v62;
  13014.                                             if (v62 == 0) {
  13015.                                                 v25 = v53;
  13016.                                                 // break (via goto) -> 0xb4b8
  13017.                                                 goto lab_0xb4b8_2;
  13018.                                             }
  13019.                                             v20 = v61;
  13020.                                             v24 = v53;
  13021.                                             // continue (via goto) -> 0xb20c
  13022.                                             goto lab_0xb20c_2;
  13023.                                         }
  13024.                                     }
  13025.                                     int32_t v64 = g135 + 88; // 0xb3cc
  13026.                                     if ((int32_t)v52 == 0) {
  13027.                                         // 0xb52c
  13028.                                         *(int32_t *)(g135 + 32) = _Unwind_GetGR((struct _Unwind_Context *)g137, 13);
  13029.                                         // branch -> 0xb540
  13030.                                         // 0xb540
  13031.                                         *(int32_t *)(g135 + 36) = (int32_t)matched;
  13032.                                         *(int32_t *)(g135 + 40) = g136;
  13033.                                         // branch -> 0xb54c
  13034.                                         // 0xb54c
  13035.                                         g135 = v5;
  13036.                                         g138 = v6;
  13037.                                         return 6;
  13038.                                     }
  13039.                                     int32_t v65 = 0; // 0xb3e099
  13040.                                     // branch -> 0xb3e0
  13041.                                     while (true) {
  13042.                                         int32_t v66 = v65 + 1; // 0xb3e0
  13043.                                         v43 = v66;
  13044.                                         matched = (char *)v64;
  13045.                                         int32_t v67 = g136 + 4 * v66; // 0xb3ec
  13046.                                         _Unwind_decode_typeinfo_ptr(v67, g128);
  13047.                                         g132 = 0;
  13048.                                         g133 = v12;
  13049.                                         g128 = v67;
  13050.                                         bool v68 = __cxa_type_match((int32_t *)g135, (int32_t *)v67, NULL); // 0xb404
  13051.                                         v3 = v68;
  13052.                                         if (v68) {
  13053.                                             v53 = v24;
  13054.                                             goto lab_0xb498_4;
  13055.                                         }
  13056.                                         int32_t v69 = v43;
  13057.                                         if (v69 != v50) {
  13058.                                             // 0xb3e0
  13059.                                             v65 = v69;
  13060.                                             // branch -> 0xb3e0
  13061.                                             continue;
  13062.                                         }
  13063.                                     }
  13064.                                     // 0xb4b8
  13065.                                     v36 = g139;
  13066.                                     v15 = v36;
  13067.                                     v23 = v25;
  13068.                                     // branch -> 0xb4b8
  13069.                                     // 0xb4b8
  13070.                                     if (v15 < 3) {
  13071.                                         // 0xb4d4
  13072.                                         v38 = g137;
  13073.                                         __gnu_unwind_execute((struct _Unwind_Context_1 *)v38, (struct anon_struct_13 *)&v1);
  13074.                                         // branch -> 0xb524
  13075.                                         // 0xb524
  13076.                                         result = 9;
  13077.                                         // branch -> 0xb54c
  13078.                                         // 0xb54c
  13079.                                         g135 = v5;
  13080.                                         g138 = v6;
  13081.                                         return result;
  13082.                                     }
  13083.                                     // 0xb4d4
  13084.                                     v29 = v3;
  13085.                                     v31 = g128;
  13086.                                     v33 = g132;
  13087.                                     __gnu_unwind_24bit((struct _Unwind_Context *)v29, v31, v33);
  13088.                                     v37 = g127;
  13089.                                     if (v37 == 0) {
  13090.                                         // 0xb4dc
  13091.                                         g133 = v23;
  13092.                                         if (v23 == 0) {
  13093.                                             // if_b4e4_0_true
  13094.                                             result = 8;
  13095.                                             // branch -> 0xb54c
  13096.                                             // 0xb54c
  13097.                                             g135 = v5;
  13098.                                             g138 = v6;
  13099.                                             return result;
  13100.                                         }
  13101.                                         // 0xb4ec
  13102.                                         v39 = g137;
  13103.                                         v13 = _Unwind_GetGR((struct _Unwind_Context *)v39, 15);
  13104.                                         v40 = g137;
  13105.                                         _Unwind_SetGR((struct _Unwind_Context *)v40, 14, v13);
  13106.                                         v41 = g137;
  13107.                                         v35 = g11;
  13108.                                         v34 = v35;
  13109.                                         v32 = 15;
  13110.                                         v30 = v41;
  13111.                                         // branch -> 0xb518
  13112.                                         // 0xb518
  13113.                                         _Unwind_SetGR((struct _Unwind_Context *)v30, v32, v34);
  13114.                                         result = 7;
  13115.                                         // branch -> 0xb54c
  13116.                                         // 0xb54c
  13117.                                         g135 = v5;
  13118.                                         g138 = v6;
  13119.                                         return result;
  13120.                                     }
  13121.                                     // 0xb524
  13122.                                     result = 9;
  13123.                                     // branch -> 0xb54c
  13124.                                     // 0xb54c
  13125.                                     g135 = v5;
  13126.                                     g138 = v6;
  13127.                                     return result;
  13128.                                 }
  13129.                                 v53 = v24;
  13130.                                 // 0xb498
  13131.                                 v58 = g136;
  13132.                                 if (*(int32_t *)v58 < 0) {
  13133.                                     goto lab_if_b4a4_0_true;
  13134.                                 }
  13135.                                 v59 = v58;
  13136.                                 goto lab_after_if_b4a4_0;
  13137.                             }
  13138.                             // 0xb524
  13139.                             // branch -> 0xb54c
  13140.                             // 0xb54c
  13141.                             g135 = v5;
  13142.                             g138 = v6;
  13143.                             return 9;
  13144.                         }
  13145.                         case 1: {
  13146.                             // 0xb2d0
  13147.                             if (g138 != 0) {
  13148.                                 int32_t v70 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13); // 0xb35c
  13149.                                 v3 = v70;
  13150.                                 if (*(int32_t *)(g135 + 32) == v70) {
  13151.                                     int32_t v71 = *(int32_t *)(g135 + 40); // 0xb368
  13152.                                     if (g136 == v71) {
  13153.                                         int32_t v72 = selfrel_offset31((int32_t *)v71); // 0xb378
  13154.                                         _Unwind_SetGR((struct _Unwind_Context *)g137, 15, v72);
  13155.                                         // branch -> 0xb488
  13156.                                         // 0xb488
  13157.                                         // branch -> 0xb518
  13158.                                         // 0xb518
  13159.                                         _Unwind_SetGR((struct _Unwind_Context *)g137, 0, g135);
  13160.                                         // branch -> 0xb54c
  13161.                                         // 0xb54c
  13162.                                         g135 = v5;
  13163.                                         g138 = v6;
  13164.                                         return 7;
  13165.                                     }
  13166.                                 }
  13167.                               lab_0xb398_2:
  13168.                                 // 0xb398
  13169.                                 v51 = g136 + 8;
  13170.                                 // branch -> 0xb200
  13171.                               lab_0xb200:
  13172.                                 // 0xb200
  13173.                                 v9 = v51;
  13174.                                 int32_t v73 = *(int32_t *)v51; // 0xb200
  13175.                                 g134 = v73;
  13176.                                 if (v73 == 0) {
  13177.                                     v25 = v24;
  13178.                                     // break (via goto) -> 0xb4b8
  13179.                                     goto lab_0xb4b8_2;
  13180.                                 }
  13181.                                 v14 = v51;
  13182.                                 // continue -> 0xb20c
  13183.                                 continue;
  13184.                             }
  13185.                             break;
  13186.                         }
  13187.                         case 0: {
  13188.                             int32_t v74 = 0;
  13189.                             if (g138 != 0) {
  13190.                                 // if_b288_0_true
  13191.                                 v74 = v9 % 2;
  13192.                                 // branch -> after_if_b288_0
  13193.                             }
  13194.                             int32_t v75 = g136; // 0xb28c
  13195.                             int32_t v76 = v75 + 4; // 0xb28c
  13196.                             v43 = v76;
  13197.                             if (v74 == 0) {
  13198.                                 v51 = v76;
  13199.                                 goto lab_0xb200;
  13200.                             }
  13201.                             int32_t v77 = selfrel_offset31((int32_t *)v75); // 0xb29c
  13202.                             *(int32_t *)(g135 + 56) = v43;
  13203.                             if (!__cxa_begin_cleanup((int32_t *)g135)) {
  13204.                                 // 0xb524
  13205.                                 // branch -> 0xb54c
  13206.                                 // 0xb54c
  13207.                                 g135 = v5;
  13208.                                 g138 = v6;
  13209.                                 return 9;
  13210.                             }
  13211.                             // 0xb2b8
  13212.                             // branch -> 0xb518
  13213.                             // 0xb518
  13214.                             _Unwind_SetGR((struct _Unwind_Context *)g137, 15, v77);
  13215.                             // branch -> 0xb54c
  13216.                             // 0xb54c
  13217.                             g135 = v5;
  13218.                             g138 = v6;
  13219.                             return 7;
  13220.                         }
  13221.                     }
  13222.                     // 0xb2d8
  13223.                     if (v9 == 0) {
  13224.                         goto lab_0xb398_2;
  13225.                     }
  13226.                     int32_t v78 = g136; // 0xb2e0
  13227.                     int32_t v79 = v78 + 4; // 0xb2e0
  13228.                     int32_t * v80 = (int32_t *)v79; // 0xb2e0_0
  13229.                     int32_t v81 = *v80; // 0xb2e0
  13230.                     g133 = v81;
  13231.                     if (v81 == -2) {
  13232.                         // 0xb524
  13233.                         // branch -> 0xb54c
  13234.                         // 0xb54c
  13235.                         g135 = v5;
  13236.                         g138 = v6;
  13237.                         return 9;
  13238.                     }
  13239.                     // 0xb2f4
  13240.                     matched = (char *)(g135 + 88);
  13241.                     int32_t v82; // 0xb338_0
  13242.                     int32_t v83; // 0xb330
  13243.                     int32_t v84; // 0xb33c
  13244.                     int32_t v85; // 0xb348
  13245.                     if (v81 == -1) {
  13246.                         // 0xb328
  13247.                         v83 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13);
  13248.                         v82 = (int32_t)matched;
  13249.                         v84 = g135;
  13250.                         if (v50 == 2) {
  13251.                             // if_b348_0_true
  13252.                             *(int32_t *)(v84 + 32) = v83;
  13253.                             v85 = v84 + 44;
  13254.                             *(int32_t *)v85 = v82;
  13255.                             // branch -> 0xb540
  13256.                             // 0xb540
  13257.                             *(int32_t *)(g135 + 36) = v85;
  13258.                             *(int32_t *)(g135 + 40) = g136;
  13259.                             // branch -> 0xb54c
  13260.                             // 0xb54c
  13261.                             g135 = v5;
  13262.                             g138 = v6;
  13263.                             return 6;
  13264.                         }
  13265.                         // after_if_b340_0
  13266.                         *(int32_t *)(v84 + 32) = v83;
  13267.                         // branch -> 0xb540
  13268.                         // 0xb540
  13269.                         *(int32_t *)(g135 + 36) = v82;
  13270.                         *(int32_t *)(g135 + 40) = g136;
  13271.                         // branch -> 0xb54c
  13272.                         // 0xb54c
  13273.                         g135 = v5;
  13274.                         g138 = v6;
  13275.                         return 6;
  13276.                     }
  13277.                     // 0xb304
  13278.                     _Unwind_decode_typeinfo_ptr(v79, g128);
  13279.                     int32_t v86 = *(int32_t *)v78 < 0; // 0xb30c
  13280.                     g132 = v86;
  13281.                     g133 = v12;
  13282.                     g128 = v79;
  13283.                     bool v87 = __cxa_type_match((int32_t *)g135, v80, (char **)v86); // 0xb31c
  13284.                     int32_t v88 = v87; // 0xb31c_7
  13285.                     v3 = v88;
  13286.                     v50 = v88;
  13287.                     if (!v87) {
  13288.                         goto lab_0xb398_2;
  13289.                     }
  13290.                     // 0xb328
  13291.                     v83 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13);
  13292.                     v82 = (int32_t)matched;
  13293.                     v84 = g135;
  13294.                     if (v50 == 2) {
  13295.                         // if_b348_0_true
  13296.                         *(int32_t *)(v84 + 32) = v83;
  13297.                         v85 = v84 + 44;
  13298.                         *(int32_t *)v85 = v82;
  13299.                         // branch -> 0xb540
  13300.                         // 0xb540
  13301.                         *(int32_t *)(g135 + 36) = v85;
  13302.                         *(int32_t *)(g135 + 40) = g136;
  13303.                         // branch -> 0xb54c
  13304.                         // 0xb54c
  13305.                         g135 = v5;
  13306.                         g138 = v6;
  13307.                         return 6;
  13308.                     }
  13309.                     // after_if_b340_0
  13310.                     *(int32_t *)(v84 + 32) = v83;
  13311.                     // branch -> 0xb540
  13312.                     // 0xb540
  13313.                     *(int32_t *)(g135 + 36) = v82;
  13314.                     *(int32_t *)(g135 + 40) = g136;
  13315.                     // branch -> 0xb54c
  13316.                     // 0xb54c
  13317.                     g135 = v5;
  13318.                     g138 = v6;
  13319.                     return 6;
  13320.                 }
  13321.                 // 0xb4b8
  13322.                 v36 = g139;
  13323.                 v15 = v36;
  13324.                 v23 = v25;
  13325.                 // branch -> 0xb4b8
  13326.                 // 0xb4b8
  13327.                 if (v15 < 3) {
  13328.                     // 0xb4d4
  13329.                     v38 = g137;
  13330.                     __gnu_unwind_execute((struct _Unwind_Context_1 *)v38, (struct anon_struct_13 *)&v1);
  13331.                     // branch -> 0xb524
  13332.                     // 0xb524
  13333.                     result = 9;
  13334.                     // branch -> 0xb54c
  13335.                     // 0xb54c
  13336.                     g135 = v5;
  13337.                     g138 = v6;
  13338.                     return result;
  13339.                 }
  13340.                 // 0xb4d4
  13341.                 v29 = v3;
  13342.                 v31 = g128;
  13343.                 v33 = g132;
  13344.                 __gnu_unwind_24bit((struct _Unwind_Context *)v29, v31, v33);
  13345.                 v37 = g127;
  13346.                 if (v37 == 0) {
  13347.                     // 0xb4dc
  13348.                     g133 = v23;
  13349.                     if (v23 == 0) {
  13350.                         // if_b4e4_0_true
  13351.                         result = 8;
  13352.                         // branch -> 0xb54c
  13353.                         // 0xb54c
  13354.                         g135 = v5;
  13355.                         g138 = v6;
  13356.                         return result;
  13357.                     }
  13358.                     // 0xb4ec
  13359.                     v39 = g137;
  13360.                     v13 = _Unwind_GetGR((struct _Unwind_Context *)v39, 15);
  13361.                     v40 = g137;
  13362.                     _Unwind_SetGR((struct _Unwind_Context *)v40, 14, v13);
  13363.                     v41 = g137;
  13364.                     v35 = g11;
  13365.                     v34 = v35;
  13366.                     v32 = 15;
  13367.                     v30 = v41;
  13368.                     // branch -> 0xb518
  13369.                     // 0xb518
  13370.                     _Unwind_SetGR((struct _Unwind_Context *)v30, v32, v34);
  13371.                     result = 7;
  13372.                     // branch -> 0xb54c
  13373.                     // Detected a possible infinite recursion (goto support failed); quitting...
  13374.                     // Detected a possible infinite recursion (goto support failed); quitting...
  13375.                 }
  13376.                 // 0xb524
  13377.                 result = 9;
  13378.                 // branch -> 0xb54c
  13379.                 // Detected a possible infinite recursion (goto support failed); quitting...
  13380.             }
  13381.         } else {
  13382.             // 0xb4b0
  13383.             v23 = 0;
  13384.             // branch -> 0xb4b8
  13385.         }
  13386.         // 0xb4b8
  13387.         if (id < 3) {
  13388.             // 0xb4d4
  13389.             __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
  13390.             // branch -> 0xb524
  13391.         } else {
  13392.             // 0xb4d4
  13393.             __gnu_unwind_24bit((struct _Unwind_Context *)v3, g128, g132);
  13394.             if (g127 == 0) {
  13395.                 // 0xb4dc
  13396.                 g133 = v23;
  13397.                 if (v23 == 0) {
  13398.                     // if_b4e4_0_true
  13399.                     // branch -> 0xb54c
  13400.                 } else {
  13401.                     // 0xb4ec
  13402.                     v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
  13403.                     _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
  13404.                     // branch -> 0xb518
  13405.                     // 0xb518
  13406.                     _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
  13407.                     // branch -> 0xb54c
  13408.                 }
  13409.                 // Detected a possible infinite recursion (goto support failed); quitting...
  13410.             }
  13411.         }
  13412.         // 0xb524
  13413.         // branch -> 0xb54c
  13414.         // Detected a possible infinite recursion (goto support failed); quitting...
  13415.     }
  13416.     // 0xb1dc
  13417.     v18 = v19;
  13418.     if (v10 == 2) {
  13419.         // if_b1e4_0_true
  13420.         v21 = *(int32_t *)(v4 + 56);
  13421.         v9 = v21;
  13422.         v18 = v21;
  13423.         // branch -> after_if_b1e4_0
  13424.     }
  13425.     // after_if_b1e4_0
  13426.     if (*(int32_t *)(v4 + 80) % 2 == 0) {
  13427.         // 0xb1f0
  13428.         v16 = state ^ 8;
  13429.         v3 = v16;
  13430.         v17 = v16 / 8 % 2;
  13431.         v22 = *(int32_t *)v18;
  13432.         g134 = v22;
  13433.         if (v22 == 0) {
  13434.             v25 = 0;
  13435.           lab_0xb4b8_2:
  13436.             // 0xb4b8
  13437.             v15 = g139;
  13438.             v23 = v25;
  13439.             // branch -> 0xb4b8
  13440.             // 0xb4b8
  13441.             if (v15 < 3) {
  13442.                 // 0xb4d4
  13443.                 __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
  13444.                 // branch -> 0xb524
  13445.             } else {
  13446.                 // 0xb4d4
  13447.                 __gnu_unwind_24bit((struct _Unwind_Context *)v3, g128, g132);
  13448.                 if (g127 == 0) {
  13449.                     // 0xb4dc
  13450.                     g133 = v23;
  13451.                     if (v23 == 0) {
  13452.                         // if_b4e4_0_true
  13453.                         // branch -> 0xb54c
  13454.                     } else {
  13455.                         // 0xb4ec
  13456.                         v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
  13457.                         _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
  13458.                         // branch -> 0xb518
  13459.                         // 0xb518
  13460.                         _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
  13461.                         // branch -> 0xb54c
  13462.                     }
  13463.                     // Detected a possible infinite recursion (goto support failed); quitting...
  13464.                 }
  13465.             }
  13466.             // 0xb524
  13467.             // branch -> 0xb54c
  13468.             // Detected a possible infinite recursion (goto support failed); quitting...
  13469.         } else {
  13470.             // 0xb20c
  13471.             v12 = (int32_t)&matched;
  13472.             v20 = v18;
  13473.             v24 = 0;
  13474.             // branch -> 0xb20c
  13475.           lab_0xb20c_2:
  13476.             while (true) {
  13477.                 // 0xb20c
  13478.                 v14 = v20;
  13479.                 // branch -> 0xb20c
  13480.                 goto lab_0xb20c;
  13481.             }
  13482.         }
  13483.     } else {
  13484.         // 0xb4b0
  13485.         v15 = id;
  13486.         v23 = 0;
  13487.         // branch -> 0xb4b8
  13488.     }
  13489.     // 0xb4b8
  13490.     if (v15 < 3) {
  13491.         // 0xb4d4
  13492.         __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
  13493.         // branch -> 0xb524
  13494.     } else {
  13495.         // 0xb4d4
  13496.         __gnu_unwind_24bit((struct _Unwind_Context *)v3, g128, g132);
  13497.         if (g127 == 0) {
  13498.             // 0xb4dc
  13499.             g133 = v23;
  13500.             if (v23 == 0) {
  13501.                 // if_b4e4_0_true
  13502.                 // branch -> 0xb54c
  13503.             } else {
  13504.                 // 0xb4ec
  13505.                 v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
  13506.                 _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
  13507.                 // branch -> 0xb518
  13508.                 // 0xb518
  13509.                 _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
  13510.                 // branch -> 0xb54c
  13511.             }
  13512.             // Detected a possible infinite recursion (goto support failed); quitting...
  13513.         }
  13514.     }
  13515.     // 0xb524
  13516.     // branch -> 0xb54c
  13517.     // Detected a possible infinite recursion (goto support failed); quitting...
  13518. }
  13519.  
  13520. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
  13521. // Address range: 0xb558 - 0xb55f
  13522. // Line range:    490 - 494
  13523. int32_t __aeabi_unwind_cpp_pr0(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context) {
  13524.     // 0xb558
  13525.     return __gnu_unwind_pr_common(state, ucbp, context, 0);
  13526. }
  13527.  
  13528. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
  13529. // Address range: 0xb560 - 0xb567
  13530. // Line range:    498 - 502
  13531. int32_t __aeabi_unwind_cpp_pr1(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context) {
  13532.     // 0xb560
  13533.     return __gnu_unwind_pr_common(state, ucbp, context, 1);
  13534. }
  13535.  
  13536. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
  13537. // Address range: 0xb568 - 0xb56f
  13538. // Line range:    506 - 510
  13539. int32_t __aeabi_unwind_cpp_pr2(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context) {
  13540.     // 0xb568
  13541.     return __gnu_unwind_pr_common(state, ucbp, context, 2);
  13542. }
  13543.  
  13544. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13545. // Address range: 0xb570 - 0xb8cf
  13546. // Line range:    178 - 446
  13547. int32_t _Unwind_VRS_Pop(struct _Unwind_Context * context, int32_t regclass, int32_t discriminator, int32_t representation) {
  13548.     // 0xb570
  13549.     return 2;
  13550. }
  13551.  
  13552. // Address range: 0xb8d0 - 0xb8e3
  13553. void restore_core_regs(void) {
  13554.     int32_t v1 = g127; // 0xb8d0
  13555.     int32_t v2 = *(int32_t *)(v1 + 60); // 0xb8d4
  13556.     g135 = v2;
  13557.     int32_t v3 = *(int32_t *)v1; // 0xb8dc
  13558.     g127 = v3;
  13559.     int32_t v4 = *(int32_t *)(v1 + 4); // 0xb8dc
  13560.     g128 = v4;
  13561.     int32_t v5 = *(int32_t *)(v1 + 8); // 0xb8dc
  13562.     g132 = v5;
  13563.     int32_t v6 = *(int32_t *)(v1 + 12); // 0xb8dc
  13564.     g133 = v6;
  13565.     g134 = *(int32_t *)(v1 + 16);
  13566.     g135 = *(int32_t *)(v1 + 20);
  13567.     g136 = *(int32_t *)(v1 + 24);
  13568.     g137 = *(int32_t *)(v1 + 28);
  13569.     g138 = *(int32_t *)(v1 + 32);
  13570.     g139 = *(int32_t *)(v1 + 36);
  13571.     g129 = *(int32_t *)(v1 + 40);
  13572.     g130 = *(int32_t *)(v1 + 44);
  13573.     g126 = *(int32_t *)(v1 + 56);
  13574.     ((int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t))v2)(v3, v4, v5, v6, v2);
  13575. }
  13576.  
  13577. // Address range: 0xb8e4 - 0xb8eb
  13578. void __gnu_Unwind_Restore_VFP(void) {
  13579.     // 0xb8e4
  13580.     return;
  13581. }
  13582.  
  13583. // Address range: 0xb8ec - 0xb8f3
  13584. void __gnu_Unwind_Save_VFP(void) {
  13585.     // 0xb8ec
  13586.     return;
  13587. }
  13588.  
  13589. // Address range: 0xb8f4 - 0xb8fb
  13590. void __gnu_Unwind_Restore_VFP_D(void) {
  13591.     // 0xb8f4
  13592.     return;
  13593. }
  13594.  
  13595. // Address range: 0xb8fc - 0xb903
  13596. void __gnu_Unwind_Save_VFP_D(void) {
  13597.     // 0xb8fc
  13598.     return;
  13599. }
  13600.  
  13601. // Address range: 0xb904 - 0xb90b
  13602. void __gnu_Unwind_Restore_VFP_D_16_to_31(void) {
  13603.     // 0xb904
  13604.     return;
  13605. }
  13606.  
  13607. // Address range: 0xb90c - 0xb913
  13608. void __gnu_Unwind_Save_VFP_D_16_to_31(void) {
  13609.     // 0xb90c
  13610.     return;
  13611. }
  13612.  
  13613. // Address range: 0xb914 - 0xb957
  13614. void __gnu_Unwind_Restore_WMMXD(void) {
  13615.     // 0xb914
  13616.     return;
  13617. }
  13618.  
  13619. // Address range: 0xb958 - 0xb99b
  13620. void __gnu_Unwind_Save_WMMXD(void) {
  13621.     // 0xb958
  13622.     return;
  13623. }
  13624.  
  13625. // Address range: 0xb99c - 0xb9af
  13626. void __gnu_Unwind_Restore_WMMXC(void) {
  13627.     // 0xb99c
  13628.     return;
  13629. }
  13630.  
  13631. // Address range: 0xb9b0 - 0xb9c3
  13632. void __gnu_Unwind_Save_WMMXC(void) {
  13633.     // 0xb9b0
  13634.     return;
  13635. }
  13636.  
  13637. // Address range: 0xb9c4 - 0xb9e7
  13638. int32_t _Unwind_RaiseException(struct _Unwind_Control_Block * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13) {
  13639.     int32_t v1 = 0; // bp-68
  13640.     __gnu_Unwind_RaiseException(a1, (struct anon_struct_6 *)&v1);
  13641.     return 9;
  13642. }
  13643.  
  13644. // Address range: 0xb9e8 - 0xba0b
  13645. int32_t ___Unwind_Resume(struct _Unwind_Control_Block * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13) {
  13646.     int32_t v1 = 0; // bp-68
  13647.     __gnu_Unwind_Resume(a1, (struct anon_struct_6 *)&v1);
  13648.     return 0;
  13649. }
  13650.  
  13651. // Address range: 0xba0c - 0xba2f
  13652. int32_t ___Unwind_Resume_or_Rethrow(struct _Unwind_Control_Block * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13) {
  13653.     int32_t v1 = 0; // bp-68
  13654.     return __gnu_Unwind_Resume_or_Rethrow(a1, (struct anon_struct_6 *)&v1);
  13655. }
  13656.  
  13657. // Address range: 0xba30 - 0xba53
  13658. int32_t _Unwind_ForcedUnwind(struct _Unwind_Control_Block * a1, int32_t (*a2)(int32_t, int32_t, char *, struct _Unwind_Control_Block *, struct _Unwind_Context *, char *), char * a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13) {
  13659.     int32_t v1 = 0; // bp-68
  13660.     return __gnu_Unwind_ForcedUnwind(a1, a2, a3, (struct anon_struct_6 *)&v1);
  13661. }
  13662.  
  13663. // Address range: 0xba54 - 0xba77
  13664. int32_t ___Unwind_Backtrace(int32_t (*a1)(struct _Unwind_Context *, char *), char * a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, int32_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13) {
  13665.     int32_t v1 = 0; // bp-68
  13666.     return __gnu_Unwind_Backtrace(a1, a2, (struct anon_struct_6 *)&v1);
  13667. }
  13668.  
  13669. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/pr-support.c
  13670. // Address range: 0xba78 - 0xbad7
  13671. // Line range:    80 - 100
  13672. char next_unwind_byte(struct anon_struct_13 * uws) {
  13673.     int32_t v1 = (int32_t)uws; // 0xba78_0
  13674.     char * v2 = (char *)(v1 + 8); // 0xba78_1
  13675.     char v3 = *v2; // 0xba78
  13676.     int32_t * v4;
  13677.     int32_t v5;
  13678.     if (v3 == 0) {
  13679.         char * v6 = (char *)(v1 + 9); // 0xba84_0
  13680.         char v7 = *v6; // 0xba84
  13681.         if (v7 == 0) {
  13682.             // 0xbad0
  13683.             return -80;
  13684.         }
  13685.         // 0xba90
  13686.         *v6 = (char)((int32_t)v7 - 1);
  13687.         int32_t * v8 = (int32_t *)(v1 + 4); // 0xba98_0
  13688.         int32_t v9 = *v8; // 0xba98
  13689.         *v8 = v9 + 4;
  13690.         uws->e0 = *(int32_t *)v9;
  13691.         v4 = &uws->e0;
  13692.         v5 = 3;
  13693.         // branch -> 0xbab8
  13694.     } else {
  13695.         // 0xbab4
  13696.         v4 = &uws->e0;
  13697.         v5 = (int32_t)v3 - 1;
  13698.         // branch -> 0xbab8
  13699.     }
  13700.     // 0xbab8
  13701.     *v2 = (char)v5;
  13702.     int32_t v10 = *v4; // 0xbabc
  13703.     *v4 = 256 * v10;
  13704.     return v10 / 0x1000000;
  13705. }
  13706.  
  13707. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13708. // Address range: 0xbad8 - 0xbaff
  13709. // Line range:    220 - 225
  13710. void _Unwind_GetGR_1(struct _Unwind_Context_1 * context, int32_t regno) {
  13711.     int32_t v1 = g133; // bp-12
  13712.     _Unwind_VRS_Get((struct _Unwind_Context *)context, 0, 12, 0, (char *)&v1);
  13713. }
  13714.  
  13715. // From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/pr-support.c
  13716. // Address range: 0xbb00 - 0xbb03
  13717. // Line range:    337 - 339
  13718. struct _Unwind_Control_Block_1 * unwind_UCB_from_context(struct _Unwind_Context_1 * context) {
  13719.     // 0xbb00
  13720.     _Unwind_GetGR_1(context, g128);
  13721.     return (struct _Unwind_Control_Block_1 *)context;
  13722. }
  13723.  
  13724. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13725. // Address range: 0xbb04 - 0xbe9b
  13726. // Line range:    216 - 309
  13727. int32_t __gnu_unwind_execute(struct _Unwind_Context_1 * context, struct anon_struct_13 * uws) {
  13728.     // 0xbb04
  13729.     int32_t v1;
  13730.     int32_t reg = v1; // bp-36
  13731.     int32_t v2 = (int32_t)uws; // 0xbb04_1
  13732.     int32_t v3 = g135; // 0xbb04
  13733.     int32_t v4 = g138; // 0xbb04
  13734.     g135 = (int32_t)context;
  13735.     int32_t v5 = &reg; // 0xbb7c_0
  13736.     // branch -> 0xbb18
  13737.     while (true) {
  13738.         uint32_t v6 = (int32_t)next_unwind_byte((struct anon_struct_13 *)v2); // 0xbb1c_3
  13739.         int32_t v7 = v6; // R4
  13740.         if ((v6 & 128) != 0) {
  13741.             int32_t v8 = v6 & 240; // 0xbbb8
  13742.             if (v8 == 128) {
  13743.                 int32_t v9 = (int32_t)next_unwind_byte((struct anon_struct_13 *)v2) | 256 * v6; // 0xbbd0
  13744.                 if (v9 != 0x8000) {
  13745.                     // 0xbbe4
  13746.                     _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 0, 16 * v9 & 0xfff0, 0);
  13747.                     // branch -> 0xbe94
  13748.                     // 0xbe94
  13749.                     g135 = v3;
  13750.                     g138 = v4;
  13751.                     return 9;
  13752.                 }
  13753.                 // 0xbe94
  13754.                 g135 = v3;
  13755.                 g138 = v4;
  13756.                 return 9;
  13757.             }
  13758.             // 0xbc10
  13759.             if (v8 == 144) {
  13760.                 // 0xbc18
  13761.                 if ((v6 & 13) != 13) {
  13762.                     // 0xbc24
  13763.                     g138 = v5;
  13764.                     _Unwind_VRS_Get((struct _Unwind_Context *)g135, 0, v6 % 16, 0, (char *)&reg);
  13765.                     // branch -> 0xbc44
  13766.                     // 0xbc44
  13767.                     _Unwind_VRS_Set((struct _Unwind_Context *)g135, 0, 13, 0, (char *)g138);
  13768.                     // branch -> 0xbb18
  13769.                     continue;
  13770.                 }
  13771.                 // 0xbe94
  13772.                 g135 = v3;
  13773.                 g138 = v4;
  13774.                 return 9;
  13775.             }
  13776.             // 0xbc5c
  13777.             if (v8 == 160) {
  13778.                 int32_t v10 = (int32_t)"trstr" >> (v6 % 8 ^ 7) & (int32_t)"trstr"; // 0xbc7c
  13779.                 int32_t v11; // 0xbe80
  13780.                 if ((v6 & 8) != 0) {
  13781.                     // if_bc84_0_true
  13782.                     v11 = v10 | 0x4000;
  13783.                     // branch -> 0xbe80
  13784.                 } else {
  13785.                     v11 = v10;
  13786.                 }
  13787.                 // 0xbe80
  13788.                 _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 0, v11, 0);
  13789.                 // branch -> 0xbe94
  13790.                 // 0xbe94
  13791.                 g135 = v3;
  13792.                 g138 = v4;
  13793.                 return 9;
  13794.             }
  13795.             // 0xbc8c
  13796.             if (v8 == 176) {
  13797.                 // 0xbc94
  13798.                 if ((v6 & 252) != 180) {
  13799.                     // 0xbd64
  13800.                     // branch -> 0xbe80
  13801.                     // 0xbe80
  13802.                     _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 1, v6 % 8 + 1 | 0x80000, 1);
  13803.                     // branch -> 0xbe94
  13804.                     // 0xbe94
  13805.                     g135 = v3;
  13806.                     g138 = v4;
  13807.                     return 9;
  13808.                 }
  13809.                 // 0xbe94
  13810.                 g135 = v3;
  13811.                 g138 = v4;
  13812.                 return 9;
  13813.             }
  13814.             int32_t v12 = v6 & 248; // 0xbddc
  13815.             if (v8 == 192) {
  13816.                 // 0xbd84
  13817.                 if (v12 != 192) {
  13818.                     // 0xbe00
  13819.                     // branch -> 0xbe94
  13820.                     // 0xbe94
  13821.                     g135 = v3;
  13822.                     g138 = v4;
  13823.                     return 9;
  13824.                 }
  13825.                 // 0xbde8
  13826.                 // branch -> 0xbe80
  13827.                 // 0xbe80
  13828.                 _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 3, v6 % 16 + 1 | 0xa0000, 3);
  13829.                 // branch -> 0xbe94
  13830.                 // 0xbe94
  13831.                 g135 = v3;
  13832.                 g138 = v4;
  13833.                 return 9;
  13834.             }
  13835.             // 0xbe5c
  13836.             if (v12 != 208) {
  13837.                 // 0xbe94
  13838.                 g135 = v3;
  13839.                 g138 = v4;
  13840.                 return 9;
  13841.             }
  13842.             // 0xbe68
  13843.             // branch -> 0xbe80
  13844.             // 0xbe80
  13845.             _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 1, v6 % 8 + 1 | 0x80000, 5);
  13846.             // branch -> 0xbe94
  13847.             // 0xbe94
  13848.             g135 = v3;
  13849.             g138 = v4;
  13850.             return 9;
  13851.         }
  13852.         int32_t v13 = 4 * v6; // 0xbb78
  13853.         g138 = v13;
  13854.         _Unwind_VRS_Get((struct _Unwind_Context *)g135, 0, 13, 0, (char *)&reg);
  13855.         int32_t v14 = v13 & 252; // 0xbb94
  13856.         int32_t v15 = ((v7 & 64) == 0 ? v14 + 4 : -4 - v14) + reg;
  13857.         g138 = v15;
  13858.         reg = v15;
  13859.         // branch -> 0xbc44
  13860.         // 0xbc44
  13861.         _Unwind_VRS_Set((struct _Unwind_Context *)g135, 0, 13, 0, (char *)v5);
  13862.         // branch -> 0xbb18
  13863.     }
  13864. }
  13865.  
  13866. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13867. // Address range: 0xbe9c - 0xbedb
  13868. // Line range:    214 - 332
  13869. int32_t __gnu_unwind_frame(struct _Unwind_Control_Block_1 * ucbp, struct _Unwind_Context_1 * context) {
  13870.     struct anon_struct_13 v1;
  13871.     v1.e0 = (int32_t)context;
  13872.     v1.e1 = (int32_t *)g132;
  13873.     v1.e2 = g133;
  13874.     int32_t v2 = *(int32_t *)((int32_t)ucbp + 76); // 0xbea0
  13875.     v1.e0 = 256 * *(int32_t *)(v2 + 4);
  13876.     v1.e1 = (int32_t *)(v2 + 8);
  13877.     v1.e2 = 3;
  13878.     v1.e2 = *(char *)(v2 + 7);
  13879.     __gnu_unwind_execute(context, &v1);
  13880.     return 9;
  13881. }
  13882.  
  13883. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13884. // Address range: 0xbedc - 0xbeeb
  13885. // Line range:    236 - 351
  13886. int32_t _Unwind_GetRegionStart(struct _Unwind_Context_1 * context) {
  13887.     // 0xbedc
  13888.     return *(int32_t *)((int32_t)unwind_UCB_from_context(context) + 72);
  13889. }
  13890.  
  13891. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13892. // Address range: 0xbeec - 0xbf07
  13893. // Line range:    237 - 370
  13894. char * _Unwind_GetLanguageSpecificData(struct _Unwind_Context_1 * context) {
  13895.     int32_t v1 = *(int32_t *)((int32_t)unwind_UCB_from_context(context) + 76); // 0xbef4
  13896.     return (char *)(v1 + 8 + 4 * (int32_t)*(char *)(v1 + 7));
  13897. }
  13898.  
  13899. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13900. // Address range: 0xbf08 - 0xbf0f
  13901. // Line range:    189 - 378
  13902. int32_t _Unwind_GetDataRelBase(struct _Unwind_Context_1 * context) {
  13903.     // 0xbf08
  13904.     abort();
  13905.     // UNREACHABLE
  13906. }
  13907.  
  13908. // From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
  13909. // Address range: 0xbf10 - 0xbf17
  13910. // Line range:    191 - 384
  13911. int32_t _Unwind_GetTextRelBase(struct _Unwind_Context_1 * context) {
  13912.     // 0xbf10
  13913.     abort();
  13914.     // UNREACHABLE
  13915. }
  13916.  
  13917. // --------------- Dynamically Linked Functions ---------------
  13918.  
  13919. // void __aeabi_memcpy(void * dest, const void * src, size_t n);
  13920. // void __aeabi_memcpy4(int32_t a1, int32_t a2, int32_t a3);
  13921. // int __cxa_atexit(void(* func)(void *), void * arg, void * dso_handle);
  13922. // bool __cxa_begin_cleanup(_Unwind_Control_Block * ucbp);
  13923. // bool __cxa_type_match(_Unwind_Control_Block * ucbp, const type_info * rttip, void ** matched_object);
  13924. // _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int * pcount);
  13925. // void __libc_init(const struct ProgramVars * vars, void(* atfork_prepare)(void), void(* atfork_parent)(void), void(* atfork_child)(void), const char ** apple);
  13926. // void abort(void);
  13927. // void * calloc(size_t nmemb, size_t size);
  13928. // void exit(int status);
  13929. // int fclose(FILE * stream);
  13930. // int feof(FILE * stream);
  13931. // FILE * fopen(const char * restrict filename, const char * restrict modes);
  13932. // int fprintf(FILE * restrict stream, const char * restrict format, ...);
  13933. // int fputs(const char * restrict s, FILE * restrict stream);
  13934. // size_t fread(void * restrict ptr, size_t size, size_t n, FILE * restrict stream);
  13935. // void free(void * ptr);
  13936. // int fseek(FILE * stream, long int off, int whence);
  13937. // long int ftell(FILE * stream);
  13938. // size_t fwrite(const void * restrict ptr, size_t size, size_t n, FILE * restrict s);
  13939. // int getc(FILE * stream);
  13940. // void * malloc(size_t size);
  13941. // void * memchr(void * s, int c, size_t n);
  13942. // void * memcpy(void * restrict dest, const void * restrict src, size_t n);
  13943. // int printf(const char * restrict format, ...);
  13944. // int putc(int c, FILE * stream);
  13945. // int putchar(int c);
  13946. // int puts(const char * s);
  13947. // void qsort(void * base, size_t nmemb, size_t size, __compar_fn_t compar);
  13948. // void * realloc(void * ptr, size_t size);
  13949. // int sprintf(char * restrict s, const char * restrict format, ...);
  13950. // char * strchr(char * s, int c);
  13951. // int strcmp(const char * s1, const char * s2);
  13952. // char * strcpy(char * restrict dest, const char * restrict src);
  13953. // size_t strcspn(const char * s, const char * reject);
  13954. // size_t strlen(const char * s);
  13955. // int strncmp(const char * s1, const char * s2, size_t n);
  13956. // size_t strspn(const char * s, const char * accept);
  13957. // char * strstr(char * haystack, const char * needle);
  13958. // long long int strtoll(const char * restrict nptr, char ** restrict endptr, int base);
  13959. // unsigned long long int strtoull(const char * restrict nptr, char ** restrict endptr, int base);
  13960.  
  13961. // --------------- Instruction-Idiom Functions ----------------
  13962.  
  13963. // float32_t fabsf(float32_t a1);
  13964. // int32_t llvm_ctlz_i32(int32_t a1, bool a2);
  13965.  
  13966. // --------------------- Meta-Information ---------------------
  13967.  
  13968. // Detected compiler/packer: gcc (4.9)
  13969. // Detected language: C
  13970. // Detected functions: 223
  13971. // Decompiler release: v2.2.1 (2016-09-07)
  13972. // Decompilation date: 2017-12-13 12:53:17
Add Comment
Please, Sign In to add comment