aaaaaa123456789 icon

ddump.c (decompiled)

aaaaaa123456789 | PRO | 12/13/17 11:35:21 AM UTC | 0 ⭐ | 536 👁️ | Never ⏰ | []
C |

460.23 KB

|

None

|

0 👍

/

0 👎

//
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
// Copyright (c) 2017 Retargetable Decompiler <[email protected]>
//
 
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
// ---------------- Integer Types Definitions -----------------
 
typedef int8_t int2_t;
 
// ----------------- Float Types Definitions ------------------
 
typedef float float32_t;
 
// ------------------------ Structures ------------------------
 
struct ProgramVars {
    int32_t e0;
};
 
struct _IO_FILE {
    int32_t e0;
};
 
struct _Unwind_Context {
    int32_t e0;
};
 
struct _Unwind_Context_1 {
    int32_t e0;
};
 
struct __EIT_entry {
    int32_t e0;
    int32_t e1;
};
 
struct anon_struct_0 {
    int32_t e0;
    int32_t e1;
    int32_t e2;
    int32_t e3;
    int32_t e4;
};
 
struct anon_struct_1 {
    int32_t e0;
    int32_t e1[5];
};
 
struct anon_struct_10 {
    int32_t e0;
    int32_t e1[5];
};
 
struct anon_struct_11 {
    int32_t e0[4];
};
 
struct anon_struct_12 {
    int32_t e0;
    int32_t * e1;
    int32_t e2;
    int32_t e3;
};
 
struct anon_struct_13 {
    int32_t e0;
    int32_t * e1;
    char e2;
    char e3;
};
 
struct anon_struct_2 {
    int32_t e0[4];
};
 
struct anon_struct_3 {
    int32_t e0;
    int32_t * e1;
    int32_t e2;
    int32_t e3;
};
 
struct _Unwind_Control_Block {
    char e0[8];
    void (*e1)(int32_t, struct _Unwind_Control_Block *);
    struct anon_struct_0 e2;
    struct anon_struct_1 e3;
    struct anon_struct_2 e4;
    struct anon_struct_3 e5;
};
 
struct anon_struct_4 {
    int32_t e0;
    int32_t * e1;
    char e2;
    char e3;
};
 
struct anon_struct_9 {
    int32_t e0;
    int32_t e1;
    int32_t e2;
    int32_t e3;
    int32_t e4;
};
 
struct _Unwind_Control_Block_1 {
    char e0[8];
    void (*e1)(int32_t, struct _Unwind_Control_Block_1 *);
    struct anon_struct_9 e2;
    struct anon_struct_10 e3;
    struct anon_struct_11 e4;
    struct anon_struct_12 e5;
};
 
struct core_regs {
    int32_t e0[16];
};
 
struct anon_struct_6 {
    int32_t e0;
    struct core_regs e1;
};
 
struct vfp_regs {
    int64_t e0[16];
    int32_t e1;
};
 
struct vfpv3_regs {
    int64_t e0[16];
};
 
struct vtable_1e0e0_type {
    int32_t (*e0)(int32_t, int32_t, int32_t *);
};
 
struct wmmxc_regs {
    int32_t e0[4];
};
 
struct wmmxd_regs {
    int64_t e0[16];
};
 
struct anon_struct_5 {
    int32_t e0;
    struct core_regs e1;
    int32_t e2;
    struct vfp_regs e3;
    struct vfpv3_regs e4;
    struct wmmxd_regs e5;
    struct wmmxc_regs e6;
};
 
// ------------------------- Classes --------------------------
 
// PLAYER
 
// ------------------- Function Prototypes --------------------
 
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);
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);
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);
void __aeabi_idiv(void);
int32_t __aeabi_idivmod(int32_t a1, int32_t a2);
int32_t __aeabi_uidivmod(uint32_t a1, uint32_t a2);
int32_t __aeabi_unwind_cpp_pr0(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context);
int32_t __aeabi_unwind_cpp_pr1(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context);
int32_t __aeabi_unwind_cpp_pr2(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context);
void __atexit_handler_wrapper(int32_t a1);
void __gnu_unwind_24bit(struct _Unwind_Context * context, int32_t data, int32_t compact);
int32_t __gnu_Unwind_Backtrace(int32_t (*trace)(struct _Unwind_Context *, char *), char * trace_argument, struct anon_struct_6 * entry_vrs);
int32_t __gnu_unwind_execute(struct _Unwind_Context_1 * context, struct anon_struct_13 * uws);
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);
int32_t __gnu_unwind_frame(struct _Unwind_Control_Block_1 * ucbp, struct _Unwind_Context_1 * context);
int32_t __gnu_unwind_get_pr_addr(int32_t idx);
int32_t __gnu_unwind_pr_common(uint32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context, int32_t id);
int32_t __gnu_Unwind_RaiseException(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs);
void __gnu_Unwind_Restore_VFP(void);
void __gnu_Unwind_Restore_VFP_D(void);
void __gnu_Unwind_Restore_VFP_D_16_to_31(void);
void __gnu_Unwind_Restore_WMMXC(void);
void __gnu_Unwind_Restore_WMMXD(void);
int32_t __gnu_Unwind_Resume(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs);
int32_t __gnu_Unwind_Resume_or_Rethrow(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs);
void __gnu_Unwind_Save_VFP(void);
void __gnu_Unwind_Save_VFP_D(void);
void __gnu_Unwind_Save_VFP_D_16_to_31(void);
void __gnu_Unwind_Save_WMMXC(void);
void __gnu_Unwind_Save_WMMXD(void);
int32_t __udivsi3(int32_t result);
int32_t _start(int32_t a1, int32_t a2, int32_t a3);
void _Unwind_Complete(struct _Unwind_Control_Block * ucbp);
void _Unwind_DebugHook(char * cfa, char * handler);
void _Unwind_decode_typeinfo_ptr(int32_t base, int32_t ptr);
void _Unwind_DeleteException(struct _Unwind_Control_Block * exc);
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);
int32_t _Unwind_GetCFA(struct _Unwind_Context * context);
int32_t _Unwind_GetDataRelBase(struct _Unwind_Context_1 * context);
int32_t _Unwind_GetGR(struct _Unwind_Context * context, int32_t regno);
void _Unwind_GetGR_1(struct _Unwind_Context_1 * context, int32_t regno);
char * _Unwind_GetLanguageSpecificData(struct _Unwind_Context_1 * context);
int32_t _Unwind_GetRegionStart(struct _Unwind_Context_1 * context);
int32_t _Unwind_GetTextRelBase(struct _Unwind_Context_1 * context);
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);
void _Unwind_SetGR(struct _Unwind_Context * context, int32_t regno, int32_t val);
int32_t _Unwind_VRS_Get(struct _Unwind_Context * context, int32_t regclass, int32_t regno, int32_t representation, char * valuep);
int32_t _Unwind_VRS_Pop(struct _Unwind_Context * context, int32_t regclass, int32_t discriminator, int32_t representation);
int32_t _Unwind_VRS_Set(struct _Unwind_Context * context, uint32_t regclass, int32_t regno, int32_t representation, char * valuep);
int32_t assign_script_value(int32_t * a1, char * a2, int32_t a3, int32_t result);
int32_t check_exact_symbol_match(int32_t a1, int32_t a2, int32_t a3);
int32_t code_labels_setting_handler(char * str, int32_t a2, int32_t a3);
int32_t compare_ELF_symbols(int32_t * a1, int32_t * a2);
int32_t concatenate(int32_t * a1, int32_t * a2, char * a3, int32_t a4);
int64_t convert_string_to_number(char * str, int32_t a2);
int32_t copy_script_value(char * a1, char a2, int32_t a3, char * a4);
int32_t data_labels_setting_handler(char * str, int32_t a2, int32_t a3);
int32_t destroy_ELF_symbols(char * a1, int32_t a2);
void destroy_script_value(int32_t a1);
int32_t destroy_script_variables(char * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6);
int32_t destroy_string_array(char * a1, int32_t a2, int32_t a3, int32_t a4);
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);
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);
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);
int32_t dump_incbins(struct _IO_FILE * stream, struct _IO_FILE * a2, int32_t a3);
int32_t duplicate_string(void);
int32_t enforce_value_size(int32_t a1, uint32_t a2);
int32_t execute_script(int32_t a1, int32_t a2, int32_t a3);
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);
int32_t execute_transforms(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5);
int32_t find_first_non_space(char * str);
int32_t find_script_variable(int32_t * a1, char * str);
int32_t find_symbol_for_address(uint32_t a1);
void function_27e0(void);
void function_2a08(int32_t (*a1)(int32_t));
int32_t function_2a88(char * a1);
int32_t function_6eb4(int32_t a1);
int32_t function_7ae8(int32_t a1);
int32_t function_7d34(int32_t a1);
int32_t function_a830(uint32_t a1, uint32_t a2, int32_t a3);
int32_t function_a8f8(int32_t a1);
void function_a9bc(int32_t a1);
int32_t function_add(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_af90(int32_t a1);
int32_t function_and(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_asr(int32_t a1, uint32_t a2, int32_t * a3);
int32_t function_checkmax(int32_t a1, int32_t a2, int32_t * a3, int32_t a4);
int32_t function_checkmaxu(uint32_t a1, uint32_t a2, int32_t * a3);
int32_t function_checkmin(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_checkminu(uint32_t a1, uint32_t a2, int32_t * a3);
int32_t function_checkptr(int32_t a1, int32_t a2, int32_t * a3, int32_t a4);
int32_t function_compare(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_compareu(uint32_t a1, uint32_t a2, int32_t * a3);
int32_t function_divide(int32_t a1, int32_t a2);
int32_t function_forcemax(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_forcemaxu(uint32_t a1, uint32_t a2, int32_t * a3);
int32_t function_forcemin(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_forceminu(uint32_t a1, uint32_t a2, int32_t * a3);
int32_t function_modulo(uint32_t a1, uint32_t a2);
int32_t function_multiply(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_or(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_rdiv(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_require(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5);
int32_t function_requirenot(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_rmod(uint32_t a1, uint32_t a2, int32_t * a3);
int32_t function_rsub(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_shl(int32_t a1, uint32_t a2, int32_t * a3);
int32_t function_shr(uint32_t a1, uint32_t a2, int32_t * a3);
int32_t function_subtract(int32_t a1, int32_t a2, int32_t * a3);
int32_t function_xor(int32_t a1, int32_t a2, int32_t * a3);
int32_t generate_incbin(int32_t a1, int32_t a2, int32_t a3);
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);
int32_t generate_script_error(char * str, int32_t a2);
int32_t generate_script_output_line(char * a1, int32_t a2, int32_t * a3);
int32_t get_command(int32_t a1, int32_t a2);
int32_t get_dump_file(char * a1, int32_t a2, int32_t a3);
int32_t get_eit_entry(struct _Unwind_Control_Block * ucbp, int32_t return_address);
int32_t get_file_length(struct _IO_FILE * stream);
char * get_incbin_data(void);
int32_t get_line_type(void);
int32_t get_value_from_string(char * a1, int32_t a2);
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);
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);
int32_t headers_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4);
int32_t indent_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4);
int32_t init_script_variables(int32_t a1, int32_t a2, int32_t a3);
int32_t is_incbin(char * str);
int32_t load_symbols(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5);
char next_unwind_byte(struct anon_struct_13 * uws);
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);
int32_t output_pointer(int32_t a1, struct _IO_FILE * a2);
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);
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);
int32_t parse_incbin(int32_t * a1, int32_t a2, int32_t a3);
int32_t preview_incbin(int32_t a1, int32_t a2, int32_t a3);
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);
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);
int32_t read_16(char * a1);
int32_t read_32(char * a1);
int32_t read_ELF_section_table(struct _IO_FILE * a1, int32_t * a2, int32_t * a3);
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);
int32_t read_file_buffer(struct _IO_FILE * a1, int32_t offset, int32_t size);
int32_t read_file_by_lines(struct _IO_FILE * stream);
int32_t read_file_string(struct _IO_FILE * stream, int32_t offset);
int32_t read_file_value(struct _IO_FILE * a1);
int32_t read_line(struct _IO_FILE * stream);
struct _IO_FILE * read_symbols_from_ELF(void);
void restore_core_regs(void);
void restore_non_core_regs(struct anon_struct_5 * vrs);
int32_t run_script(int32_t a1, int32_t a2, struct _IO_FILE * a3, int32_t a4);
int32_t run_script_auto(int32_t a1, int32_t a2, char * file_path, struct _IO_FILE * a4);
int32_t script_get_expression_value(char * a1, int32_t a2, int32_t * a3, int32_t a4);
int32_t script_get_initializer_value(char * a1, int32_t * a2, int32_t * a3);
int32_t script_get_transforms_for_line(int32_t * a1, int32_t str4, int32_t * a3);
int32_t script_loop_test(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5);
int32_t script_parse_assignment_line(int32_t a1);
int32_t script_transform_add(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_all(void);
int32_t script_transform_and(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_any(void);
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);
int32_t script_transform_asr(int32_t a1, int32_t a2);
int32_t script_transform_basic(char a1, int32_t a2, int32_t a3);
int32_t script_transform_byte_count(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5);
int32_t script_transform_bytesuntil(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4);
int32_t script_transform_byteswhile(uint32_t a1, uint32_t a2, int32_t a3);
int32_t script_transform_checkmax(int32_t a1, int32_t a2);
int32_t script_transform_checkmaxu(void);
int32_t script_transform_checkmin(int32_t a1, int32_t a2);
int32_t script_transform_checkminu(void);
int32_t script_transform_checkptr(void);
int32_t script_transform_compare(int32_t a1, int32_t a2);
int32_t script_transform_compareu(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_copy(unsigned char a1, int32_t a2, char * a3, int32_t a4);
int32_t script_transform_count(void);
int32_t script_transform_count_values(int32_t a1, int32_t a2, int32_t * a3, int32_t a4);
int32_t script_transform_divide(int32_t a1, int32_t a2);
int32_t script_transform_forcemax(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_forcemaxu(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_forcemin(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_forceminu(int32_t a1, int32_t a2);
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);
int32_t script_transform_item(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5);
int32_t script_transform_length(uint32_t a1, int32_t a2, int32_t a3, uint32_t a4, char * a5);
int32_t script_transform_modulo(int32_t a1, int32_t a2);
int32_t script_transform_multi(uint32_t a1, int32_t a2, int32_t a3, int32_t a4);
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);
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);
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);
int32_t script_transform_multiply(int32_t a1, int32_t a2);
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);
int32_t script_transform_or(int32_t a1, int32_t a2);
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);
int32_t script_transform_rdiv(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_require(void);
int32_t script_transform_requirenot(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_rmod(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_rotate(char a1, int32_t a2, char * a3, uint32_t a4);
int32_t script_transform_rotateback(char a1, int32_t a2, char * a3, int32_t a4);
int32_t script_transform_rsub(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_shl(void);
int32_t script_transform_shr(int32_t a1, int32_t a2, int32_t a3);
int32_t script_transform_skip(unsigned char a1, int32_t a2, int32_t a3, int32_t a4);
int32_t script_transform_subtract(int32_t a1, int32_t a2);
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);
int32_t script_transform_xor(void);
struct __EIT_entry * search_EIT_table(struct __EIT_entry * table, int32_t nrec, int32_t return_address);
int32_t selfrel_offset31(int32_t * p);
int32_t settings_help(int32_t a1, int32_t a2, int32_t a3, int32_t a4);
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);
int32_t split_by_spaces(void);
int32_t string_array_size(int32_t * a1);
int32_t unload_symbols(void);
void unwind_phase2(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * vrs);
int32_t unwind_phase2_forced(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs, int32_t resuming);
struct _Unwind_Control_Block_1 * unwind_UCB_from_context(struct _Unwind_Context_1 * context);
int32_t validate_ELF_file(int32_t a1, int32_t a2);
int32_t validate_file_value(int32_t a1, int32_t a2);
int32_t validate_pointers(int32_t a1, uint32_t a2, int32_t a3);
int32_t validate_variable_name(char * str);
int32_t write_header_comment(int32_t * a1, struct _IO_FILE * stream);
int32_t write_incbin_for_segment(int32_t a1, int32_t a2, int32_t a3, struct _IO_FILE * a4);
 
// --------------------- Global Variables ---------------------
 
int32_t g126 = 0; // LR
int32_t g127 = 0; // R0
int32_t g128 = 0; // R1
int32_t g129 = 0; // R10
int32_t g130 = 0; // R11
int32_t g131 = 0; // R12
int32_t g132 = 0; // R2
int32_t g133 = 0; // R3
int32_t g134 = 0; // R4
int32_t g135 = 0; // R5
int32_t g136 = 0; // R6
int32_t g137 = 0; // R7
int32_t g138 = 0; // R8
int32_t g139 = 0; // R9
bool g1 = false; // flagc
bool g2 = false; // flagn
bool g3 = false; // flagz
int32_t g4 = 0x82bc; // 0x1e0b8
int32_t g5 = 0x833c; // 0x1e0bc
int32_t g7 = 0xd840; // 0x1e0c8
int32_t g8 = 0x8974; // 0x1e0cc
int32_t g10 = 0xb558; // 0x1e0d4
int32_t g11 = 0; // 0x1e0d8
int32_t g14 = 0x844c; // 0x1e0e8
int32_t g15 = 0xb568; // 0x1e0ec
int32_t g16 = 0x890c; // 0x1e0f0
int32_t g18 = 0x83c4; // 0x1e0f8
int32_t g19 = 0x87d4; // 0x1e0fc
int32_t g20 = 0x8784; // 0x1e100
int32_t g21 = 0x8524; // 0x1e104
int32_t g22 = 0x88a4; // 0x1e108
int32_t g23 = 0x85a4; // 0x1e10c
int32_t g24; // 0x1e110
int32_t g25 = 0x8624; // 0x1e118
int32_t g26 = 0x8a68; // 0x1e11c
int32_t g27 = 0x85e4; // 0x1e124
int32_t g28 = 0x8a00; // 0x1e128
int32_t g29 = 0x883c; // 0x1e12c
int32_t g30 = 0x1e8c000; // 0x1e12f
int32_t g32 = 0x86f0; // 0x1e134
int32_t g33 = 0; // 0x1e138
int32_t g34 = 0x82fc; // 0x1e13c
int32_t g35 = 0x8668; // 0x1e140
int32_t g36; // 0x1e144
int32_t g37 = 0x84a4; // 0x1e14c
int32_t g38 = 0; // 0x1e150
int32_t g40 = 0x8378; // 0x1e160
int32_t g41 = 0x8564; // 0x1e164
int32_t g42 = 0x86ac; // 0x1e168
int32_t g43 = 0x84e4; // 0x1e170
int32_t g45 = 0xb560; // 0x1e178
int32_t g47 = 0x8734; // 0x1e180
int32_t g48 = 161; // 0x1e184
char * g49[16] = {
    "TRANSPARENT",
    "DARK_GREY",
    "RED",
    "GREEN",
    "BLUE",
    "YELLOW",
    "CYAN",
    "MAGENTA",
    "LIGHT_GRAY",
    "BLACK",
    "BLACK2",
    "SILVER",
    "WHITE",
    "SKY_BLUE",
    "LIGHT_BLUE",
    "WHITE2"
}; // 0x1e588
int32_t g50 = 0; // 0x1e5c8
char (*g51)[8] = "headers"; // 0x1e704
char (*g52)[4] = "add"; // 0x1e740
int32_t g53 = 0; // 0x1e8c0
int32_t g54 = 32; // 0x4108
int32_t g55 = 0x8dcb; // 0x4318
int32_t g56 = 40; // 0x4e28
int32_t g57 = 432; // 0x5170
int32_t g58 = 644; // 0x5c78
int32_t g59 = 32; // 0x6230
int32_t g60 = 40; // 0x70a4
int32_t g61 = -0x1f7f0000; // 0x827c
int32_t g62 = 28; // 0x8e0c
int32_t g63 = 32; // 0x9314
int32_t g64 = 0xa000013; // 0x9354
int32_t g65 = 0xa000012; // 0x94b4
int32_t g66 = 80; // 0x9638
int32_t g67 = -0x1e5fb000; // 0xa100
int32_t g68 = -0x1c5fffff; // 0xa104
char * g69; // 0xa114
char * g70 = "\xe4"; // 0xa118
int32_t g71 = -0x1a3ff000; // 0xa11c
char * g72 = "\xe0\x10\x8d\xe5\x89\x01"; // 0xa120
char * g73 = "\x89\x01"; // 0xa124
int32_t g74 = -0x1a60f984; // 0xa128
int32_t g75 = -0x1d725f28; // 0xa12c
int32_t g76 = -0x1a60c998; // 0xa130
int32_t g77 = -0x1d729f1c; // 0xa134
int32_t g78 = -0x1f710000; // 0xa138
int32_t g79 = -0x1a72ffe0; // 0xa13c
char ** g80 = (char **)-0x1a60f998; // 0xa140
char ** g81 = (char **)-0x1d728f20; // 0xa144
int32_t g82 = -0x1a60e99c; // 0xa148
char * g83; // 0xa14c
int32_t g84 = -0x1f710000; // 0xa150
char * g85 = "\x18"; // 0xa154
char * g86 = "\x44\x06\x9f\xe5\x01\x10\x8f\xe0\x34\x26\x9f\xe5"; // 0xa158
int32_t g87 = -0x1f70efff; // 0xa15c
char * g88 = "\x34\x26\x9f\xe5"; // 0xa160
char * g89; // 0xa164
int32_t g90 = -0x1a72ffec; // 0xa168
char * g91 = "\x34\x06\x9f\xe5\x1c\x10\x8d\xe5"; // 0xa16c
char * g92 = "\x1c\x10\x8d\xe5"; // 0xa170
int32_t g93 = -0x1f710000; // 0xa174
char * g94 = "$"; // 0xa178
char * g95 = "\x10\x06\x9f\xe5\x10\x16\x9f\xe5"; // 0xa17c
char * g96 = "\x10\x16\x9f\xe5"; // 0xa180
int32_t g97 = -0x1f710000; // 0xa184
int32_t g98 = -0x11f6f4f0; // 0xa188
char ** g99 = (char **)-0x1f70fffd; // 0xa18c
int32_t g100 = -0x11f7f4f0; // 0xa190
int32_t g101 = -0x1f70fffe; // 0xa194
int32_t g102 = -0x1a60d990; // 0xa198
char * g103 = "\x10\x0b\x29\xee\x01"; // 0xa19c
char * g104 = "\x01"; // 0xa1a0
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
char * g106 = "\x10\x0b\x28\xee\xc8\x05\x9f\xe5\x01\x10\x8f\xe0\x34\x10\x8d\xe5\xd0\x15\x9f\xe5"; // 0xa1a8
char * g107 = "\xc8\x05\x9f\xe5\x01\x10\x8f\xe0\x34\x10\x8d\xe5\xd0\x15\x9f\xe5"; // 0xa1ac
int32_t g108 = -0x1a60fa58; // 0xa1d8
int32_t g109 = -0x1f710000; // 0xa1e0
char * g110 = "T"; // 0xa1e4
int32_t g111 = 260; // 0xa400
int32_t g112 = -776; // 0xa680
int32_t g113 = -0x1caffff8; // 0xacd4
int32_t g114 = -0x1caffff8; // 0xae98
int32_t g115 = -0x7e1cffd5; // 0xc12f
int32_t g116 = 0xa19ee2; // 0xc25f
int32_t g117 = 0x42002f; // 0xc328
int32_t g118 = 0x7efffbff; // 0xcd73
int32_t g119 = 0x30250020; // 0xce21
int32_t g120 = 0x20732500; // 0xd393
int32_t g121 = 1; // 0xd520
int32_t g122 = 0x4f43007b; // 0xd61b
int32_t g123 = 0x557b007d; // 0xd6e6
int32_t g124 = 0x7fff5370; // 0xd738
int32_t g125 = 0x7c500;
char * (*g6)[16] = &g49; // 0x1e0c0
char (**g9)[8] = &g51; // 0x1e0d0
int32_t * g12 = &g50; // 0x1e0dc
struct vtable_1e0e0_type g13 = {
    .e0 = function_rdiv
}; // 0x1e0e0
int32_t * g17 = &g124; // 0x1e0f4
int32_t * g31 = &g53; // 0x1e130
int32_t * g39 = &g118; // 0x1e154
int32_t * g44 = &g48; // 0x1e174
char (**g46)[4] = &g52; // 0x1e17c
 
// ------------------------ Functions -------------------------
 
// Address range: 0x27e0 - 0x29f7
void function_27e0(void) {
    // 0x27e0
    return;
}
 
// Address range: 0x2a00 - 0x2a07
void __atexit_handler_wrapper(int32_t a1) {
    // 0x2a00
    return;
}
 
// Address range: 0x2a08 - 0x2a0b
void function_2a08(int32_t (*a1)(int32_t)) {
    int32_t v1 = (int32_t)a1;
    g127 = v1;
    a1(v1);
}
 
// Address range: 0x2a0c - 0x2a87
int32_t _start(int32_t a1, int32_t a2, int32_t a3) {
    char ** v1 = (char **)g130;
    int32_t v2 = *(int32_t *)0x2a70 + 0x2a20; // 0x2a18
    int32_t v3 = *(int32_t *)(v2 + *(int32_t *)0x2a74);
    int32_t v4;
    int32_t result = &v4; // 0x2a54_0
    g127 = result;
    int32_t v5 = *(int32_t *)(*(int32_t *)0x2a84 + v2); // 0x2a58
    __libc_init((struct ProgramVars *)&v4, NULL, (void (**)())v5, (void (**)())&v3, v1);
    g130 = (int32_t)v1;
    return result;
}
 
// Address range: 0x2a88 - 0x2aa7
int32_t function_2a88(char * a1) {
    int32_t v1 = *(int32_t *)0x2aa0; // 0x2a8c
    int32_t v2 = *(int32_t *)0x2aa4; // 0x2a90
    return __cxa_atexit((void (**)(char *))(v2 + 0x2aa0), a1, (char *)(v1 + 0x2a9c));
}
 
// Address range: 0x2aa8 - 0x2d47
int32_t get_command(int32_t a1, int32_t a2) {
    int32_t v1 = g134; // 0x2aa8
    int32_t v2 = g135; // 0x2aa8
    int32_t v3 = g136; // 0x2aa8
    int32_t v4 = g137; // 0x2aa8
    int32_t v5 = g138; // 0x2aa8
    int32_t v6 = g129; // 0x2aa8
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    g134 = a2;
    int32_t v8 = *(int32_t *)0x2d44; // 0x2ad0
    g132 = v8;
    int32_t v9 = v8 + 0x2b04; // 0x2afc
    g136 = *(int32_t *)(*(int32_t *)0x2d38 + 0x2b10);
    g138 = *(int32_t *)0x2d28 + 0x2b18;
    int32_t v10 = *(int32_t *)(*(int32_t *)0x2d2c + 0x2b20); // 0x2b18
    int32_t v11 = *(int32_t *)(*(int32_t *)0x2d34 + 0x2b2c); // 0x2b24
    int32_t v12 = *(int32_t *)(*(int32_t *)0x2d1c + 0x2b70); // 0x2b68
    int32_t v13 = *(int32_t *)(*(int32_t *)0x2d18 + 0x2b7c); // 0x2b74
    int32_t * v14 = (int32_t *)*(int32_t *)(*(int32_t *)0x2d24 + 0x2ae8); // 0x2c7c_0
    char * format = (char *)(*(int32_t *)0x2d3c + 0x2af4);
    // branch -> 0x2b98
    while (true) {
        // 0x2b98
        printf((char *)(*(int32_t *)0x2d04 + 0x2acc));
        int32_t v15 = read_line((struct _IO_FILE *)*(int32_t *)(*(int32_t *)0x2d08 + 0x2adc)); // 0x2ba8
        g129 = v15;
        char * str = (char *)v15; // 0x2bb0_0
        if (*str != 0) {
            // 0x2bbc
            if (strcmp(str, (char *)(*(int32_t *)0x2d0c + 0x2b40)) != 0) {
                // 0x2bd0
                if (strcmp((char *)g129, (char *)(*(int32_t *)0x2d10 + 0x2b4c)) != 0) {
                    int32_t v16 = g129; // 0x2be8
                    g137 = v16;
                    int32_t str2 = *(int32_t *)*(int32_t *)(*(int32_t *)0x2d14 + 0x2b58); // 0x2bec
                    if (str2 != 0) {
                        // 0x2bf8
                        g135 = 0;
                        g129 = 0;
                        uint32_t v17 = 0; // 0x2c04
                        // branch -> 0x2c00
                        while (true) {
                            // 0x2c00
                            if (((v17 == 0 ? 1 : v17 < 32 ? 1 << v17 : 0) & g134) != 0) {
                                int32_t strcmp_rc = strcmp((char *)g137, (char *)str2); // 0x2c10
                                g3 = strcmp_rc == 0;
                                int32_t result; // 0x2cf8
                                if (strcmp_rc == 0) {
                                    // 0x2cf0
                                    free((char *)g137);
                                    result = g129 % 256;
                                    g127 = result;
                                    g134 = v1;
                                    g135 = v2;
                                    g136 = v3;
                                    g137 = v4;
                                    g138 = v5;
                                    g129 = v6;
                                    g130 = v7;
                                    return result;
                                }
                                int32_t str3 = *(int32_t *)(12 * g135 + v13 + 4); // 0x2c28
                                if (str3 != 0) {
                                    int32_t strcmp_rc2 = strcmp((char *)g137, (char *)str3); // 0x2c38
                                    g3 = strcmp_rc2 == 0;
                                    if (strcmp_rc2 == 0) {
                                        // 0x2cf0
                                        free((char *)g137);
                                        result = g129 % 256;
                                        g127 = result;
                                        g134 = v1;
                                        g135 = v2;
                                        g136 = v3;
                                        g137 = v4;
                                        g138 = v5;
                                        g129 = v6;
                                        g130 = v7;
                                        return result;
                                    }
                                }
                            }
                            int32_t v18 = g129 + 1; // 0x2c44
                            g129 = v18;
                            int32_t v19 = v18 % 256; // 0x2c4c
                            g135 = v19;
                            int32_t v20 = *(int32_t *)(12 * v19 + v12); // 0x2c58
                            if (v20 == 0) {
                                // break -> 0x2c64
                                break;
                            }
                            str2 = v20;
                            v17 = v19;
                            // continue -> 0x2c00
                        }
                        // 0x2c64
                        v16 = g137;
                        // branch -> 0x2c64
                    }
                    // 0x2c64
                    free((char *)v16);
                    puts((char *)(*(int32_t *)0x2d20 + 0x2b64));
                    // branch -> 0x2b98
                    continue;
                }
                // 0x2c78
                if (*v14 != 0) {
                  lab_0x2c88_2:
                    // 0x2c88
                    g137 = 0;
                    g135 = 0;
                    int32_t v21 = 0; // 0x2cd08
                    uint32_t v22 = 0; // 0x2c94
                    // branch -> 0x2c90
                    while (true) {
                        int32_t v23 = v21; // 0x2cd0
                        if (((v22 == 0 ? 1 : v22 < 32 ? 1 << v22 : 0) & g134) != 0) {
                            // 0x2c9c
                            printf((char *)g138);
                            int32_t v24 = g137; // 0x2ca4
                            int32_t v25 = 3 * v24; // 0x2ca4
                            if (*(int32_t *)(12 * v24 + v10 + 4) != 0) {
                                // 0x2cbc
                                printf((char *)(*(int32_t *)0x2d30 + 0x2b34));
                                // branch -> 0x2cc4
                            }
                            // 0x2cc4
                            puts((char *)*(int32_t *)(v11 + 4 * v25 + 8));
                            v23 = g135;
                            // branch -> 0x2cd0
                        }
                        int32_t v26 = v23 + 1; // 0x2cd0
                        g135 = v26;
                        int32_t v27 = v26 % 256; // 0x2cd4
                        g137 = v27;
                        if (*(int32_t *)(12 * v27 + g136) == 0) {
                            // break -> 0x2b80
                            break;
                        }
                        v21 = v26;
                        v22 = v27;
                        // continue -> 0x2c90
                    }
                    // 0x2b80
                    g132 = v9;
                    printf(format);
                    free((char *)g129);
                    // branch -> 0x2b98
                    continue;
                }
              lab_0x2b80_2:
                // 0x2b80
                g132 = v9;
                printf(format);
                free((char *)g129);
                // branch -> 0x2b98
                continue;
            }
            // 0x2c78
            if (*v14 == 0) {
                goto lab_0x2b80_2;
            }
            goto lab_0x2c88_2;
        }
        // 0x2c78
        if (*v14 == 0) {
            goto lab_0x2b80_2;
        }
        goto lab_0x2c88_2;
    }
}
 
// Address range: 0x2d48 - 0x2e43
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) {
    int32_t v1 = g135; // 0x2d48
    int32_t v2 = g138; // 0x2d48
    if (*(int32_t *)*(int32_t *)(*(int32_t *)0x2e20 + 0x2d64) == 0) {
        // 0x2dfc
        g135 = v1;
        g138 = v2;
        return printf((char *)(*(int32_t *)0x2e38 + 0x2e10));
    }
    int32_t v3 = 0; // R9
    g138 = 0;
    int32_t v4 = *(int32_t *)(*(int32_t *)0x2e34 + 0x2d80); // 0x2d78
    int32_t v5 = *(int32_t *)(*(int32_t *)0x2e28 + 0x2d94); // 0x2d8c
    g135 = *(int32_t *)(*(int32_t *)0x2e30 + 0x2d9c);
    int32_t v6 = v4; // 0x2df07
    int32_t v7 = 0; // 0x2de05
    uint32_t v8 = 0; // 0x2da8
    // branch -> 0x2da4
    while (true) {
        int32_t v9 = v6; // 0x2df0
        int32_t v10 = v7; // 0x2de0
        if (((v8 == 0 ? 1 : v8 < 32 ? 1 << v8 : 0) & a1) != 0) {
            // 0x2db0
            printf((char *)(*(int32_t *)0x2e24 + 0x2d88));
            int32_t v11 = v3; // 0x2db8
            int32_t v12 = 3 * v11; // 0x2db8
            if (*(int32_t *)(v5 + 12 * v11 + 4) != 0) {
                // 0x2dcc
                printf((char *)(*(int32_t *)0x2e2c + 0x2da4));
                // branch -> 0x2dd4
            }
            // 0x2dd4
            puts((char *)*(int32_t *)(g135 + 4 * v12 + 8));
            v9 = v4;
            v10 = g138;
            // branch -> 0x2de0
        }
        int32_t v13 = v10 + 1; // 0x2de0
        g138 = v13;
        int32_t v14 = v13 % 256; // 0x2de4
        v3 = v14;
        if (*(int32_t *)(12 * v14 + v9) == 0) {
            // 0x2dfc
            // branch -> 0x2dfc
            // 0x2dfc
            g135 = v1;
            g138 = v2;
            return printf((char *)(*(int32_t *)0x2e38 + 0x2e10));
        }
        // 0x2de0
        v6 = v9;
        v7 = v13;
        v8 = v14;
        // branch -> 0x2da4
    }
}
 
// Address range: 0x2e44 - 0x313f
struct _IO_FILE * read_symbols_from_ELF(void) {
    int32_t v1 = g134; // 0x2e44
    int32_t v2 = g135; // 0x2e44
    int32_t v3 = g136; // 0x2e44
    int32_t v4 = g137; // 0x2e44
    int32_t v5 = g138; // 0x2e44
    int32_t v6 = g129; // 0x2e44
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    int32_t v8 = g128; // 0x2e50
    g136 = v8;
    g137 = 0;
    g134 = g132;
    *(int32_t *)v8 = 0;
    struct _IO_FILE * file = fopen((char *)g127, (char *)(*(int32_t *)0x3124 + 0x2e68)); // 0x2e68
    int32_t v9; // 0x2f5c
    if (file == NULL) {
        // 0x2f0c
        *(int32_t *)g134 = *(int32_t *)0x313c + 0x2f18;
        // branch -> 0x2f5c
    } else {
        // 0x2e78
        int32_t v10;
        int32_t v11 = &v10; // 0x2e7c_0
        g133 = v11;
        g128 = 0;
        g132 = 4;
        int32_t v12 = read_file_value(file); // 0x2e88
        int32_t v13 = v10; // 0x2e8c
        int32_t v14 = v13; // 0x2f28
        int32_t v15; // 0x2fb0
        int32_t * v16; // 0x2f44_0
        int32_t v17; // 0x2f3c
        int32_t v18; // R6
        int32_t v19; // 0x305410
        int32_t nmemb; // 0x3080
        int32_t v20; // 0x2f80
        int32_t v21; // 0x2f44
        int32_t v22; // 0x305c
        int32_t v23; // 0x2f68
        int32_t v24; // 0x2f74
        int32_t v25; // 0x2fa0
        int32_t v26; // 0x3094
        if (v13 == 0) {
            // 0x2e98
            if (v12 == 0x464c457f) {
                // 0x2ea8
                g133 = v11;
                g128 = 16;
                g132 = 4;
                int32_t v27 = read_file_value(file); // 0x2eb8
                int32_t v28 = v10; // 0x2ebc
                if (v28 == 0) {
                    // 0x2ec8
                    if (v27 == 0x280002) {
                        // 0x2ed8
                        g133 = v11;
                        g128 = 20;
                        g132 = 4;
                        int32_t v29 = read_file_value(file); // 0x2ee8
                        int32_t v30 = v10; // 0x2eec
                        if (v30 == 0) {
                            int32_t v31 = *(int32_t *)0x3130 + 0x2f08; // 0x2f00
                            if (v29 == 1) {
                                // if_2f04_0_true
                                v14 = v31 & -0x10000;
                                // branch -> 0x2f24
                            } else {
                                v14 = v31;
                            }
                        } else {
                            v14 = v30;
                        }
                    } else {
                        // 0x30d8
                        v14 = *(int32_t *)0x312c + 0x30e4;
                        // branch -> 0x2f24
                    }
                    // 0x2f24
                    *(int32_t *)g134 = v14;
                    if (v14 == 0) {
                        // 0x2f30
                        v17 = read_ELF_section_table(file, &v10, (int32_t *)g134);
                        g135 = v17;
                        v21 = g134;
                        v16 = (int32_t *)v21;
                        if (*v16 == 0) {
                            // 0x2f68
                            v23 = v10;
                            v24 = g136;
                            if (v23 == 0) {
                                // 0x3068
                                g137 = 0;
                                v18 = 0;
                                // branch -> 0x3070
                                // 0x3070
                                fclose(file);
                                free((char *)g135);
                                nmemb = v18;
                                if (nmemb == 0) {
                                    // 0x30b8
                                    free((char *)g137);
                                    g137 = 0;
                                    *v16 = *(int32_t *)0x3138 + 0x30d4;
                                    // branch -> 0x2f5c
                                } else {
                                    // 0x3088
                                    v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
                                    qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
                                    *v16 = 0;
                                    *(int32_t *)v24 = v18;
                                    // branch -> 0x2f5c
                                }
                                // 0x2f5c
                                v9 = g137;
                                g134 = v1;
                                g135 = v2;
                                g136 = v3;
                                g137 = v4;
                                g138 = v5;
                                g129 = v6;
                                g130 = v7;
                                return (struct _IO_FILE *)v9;
                            }
                            // 0x2f7c
                            g129 = v21;
                            v20 = v17 + 8;
                            g139 = v20;
                            v18 = 0;
                            g138 = 0;
                            g137 = 0;
                            int32_t v32 = v23; // 0x305c13
                            v19 = 0;
                            v25 = 0;
                            v15 = v20;
                            // branch -> 0x2f94
                            while (true) {
                                // 0x2f94
                                v22 = v32;
                                int32_t v33; // 0x3054
                                int32_t v34; // 0x3058
                                if (*(int32_t *)(v15 - 8) == 2) {
                                  lab_0x2fa0_2:;
                                    int32_t v35 = g137; // 0x2fa8
                                    int32_t v36 = *(int32_t *)(v15 - 4); // 0x2fac
                                    int32_t v37 = *(int32_t *)v15; // 0x2fac
                                    int32_t v38 = *(int32_t *)(v15 + 4); // 0x2fb0
                                    int32_t v39 = *(int32_t *)(v15 + 8); // 0x2fb0
                                    int32_t v40 = 20 * v38 + v17; // 0x2fc0
                                    int32_t v41 = *(int32_t *)v40; // 0x2fc0
                                    g134 = v41;
                                    g135 = *(int32_t *)(v40 + 8);
                                    int32_t v42;
                                    g137 = &v42;
                                    g136 = *(int32_t *)(v40 + 16);
                                    int32_t v43 = read_ELF_symbols_from_section(file, 2, v36, v37, v38, v39, v41); // R4
                                    if (*(int32_t *)g129 == 0) {
                                        // 0x3010
                                        v18 = v25;
                                        int32_t mem = (int32_t)realloc((char *)v35, 4 * (v42 + v25)); // 0x3024_5
                                        int32_t v44 = v42; // 0x3028
                                        g135 = v44;
                                        g137 = mem;
                                        __aeabi_memcpy4(4 * v18 + mem, v43, 4 * v44);
                                        free((char *)v43);
                                        int32_t v45 = g135 + v18; // 0x3048
                                        v18 = v45;
                                        g135 = v17;
                                        v22 = v10;
                                        // branch -> 0x3054
                                        // 0x3054
                                        v33 = g138 + 1;
                                        g138 = v33;
                                        v34 = g139 + 20;
                                        g139 = v34;
                                        if (v33 >= v22) {
                                            // break -> 0x3070
                                            break;
                                        }
                                        v32 = v22;
                                        v19 = v33;
                                        v25 = v45;
                                        v15 = v34;
                                        // continue -> 0x2f94
                                        continue;
                                    }
                                    // 0x30e4
                                    fclose(file);
                                    free((char *)v17);
                                    v18 = v25;
                                    g135 = v35;
                                    if (v25 == 0) {
                                        // 0x3118
                                        free((char *)v35);
                                        // branch -> 0x2f58
                                        // 0x2f58
                                        g137 = 0;
                                        // branch -> 0x2f5c
                                        // 0x2f5c
                                        v9 = g137;
                                        g134 = v1;
                                        g135 = v2;
                                        g136 = v3;
                                        g137 = v4;
                                        g138 = v5;
                                        g129 = v6;
                                        g130 = v7;
                                        return (struct _IO_FILE *)v9;
                                    }
                                    int32_t v46 = v35; // 0x3108
                                    // branch -> 0x3108
                                    while (true) {
                                        // 0x3108
                                        free((char *)*(int32_t *)v46);
                                        int32_t v47 = v18; // 0x3110
                                        v18 = v47 - 1;
                                        if (v47 == 1) {
                                            // 0x3118
                                            // branch -> 0x3118
                                            // 0x3118
                                            free((char *)g135);
                                            // branch -> 0x2f58
                                            // 0x2f58
                                            g137 = 0;
                                            // branch -> 0x2f5c
                                            // 0x2f5c
                                            v9 = g137;
                                            g134 = v1;
                                            g135 = v2;
                                            g136 = v3;
                                            g137 = v4;
                                            g138 = v5;
                                            g129 = v6;
                                            g130 = v7;
                                            return (struct _IO_FILE *)v9;
                                        }
                                        // 0x3108
                                        v46 += 4;
                                        // branch -> 0x3108
                                    }
                                    // 0x3070
                                    fclose(file);
                                    int32_t v48 = g135; // 0x3078
                                    free((char *)v48);
                                    nmemb = v18;
                                    int32_t v49; // 0x2f64
                                    if (nmemb == 0) {
                                        int32_t v50 = g137; // 0x30b8
                                        free((char *)v50);
                                        g137 = 0;
                                        int32_t v51 = *(int32_t *)0x3138; // 0x30c8
                                        *v16 = v51 + 0x30d4;
                                        // branch -> 0x2f5c
                                        // 0x2f5c
                                        v9 = g137;
                                        g134 = v1;
                                        g135 = v2;
                                        g136 = v3;
                                        g137 = v4;
                                        g138 = v5;
                                        g129 = v6;
                                        v49 = v7;
                                        g130 = v49;
                                        return (struct _IO_FILE *)v9;
                                    }
                                    int32_t v52 = *(int32_t *)0x3134; // 0x3088
                                    v26 = *(int32_t *)(v52 + 0x309c);
                                    int32_t base = g137; // 0x3098
                                    qsort((char *)base, nmemb, 4, (int32_t (**)(char *, char *))v26);
                                    *v16 = 0;
                                    int32_t v53 = v18; // 0x30b0
                                    *(int32_t *)v24 = v53;
                                    // branch -> 0x2f5c
                                    // 0x2f5c
                                    v9 = g137;
                                    g134 = v1;
                                    g135 = v2;
                                    g136 = v3;
                                    g137 = v4;
                                    g138 = v5;
                                    g129 = v6;
                                    v49 = v7;
                                    g130 = v49;
                                    return (struct _IO_FILE *)v9;
                                }
                              lab_0x3054_2:
                                // 0x3054
                                v33 = v19 + 1;
                                g138 = v33;
                                v34 = v15 + 20;
                                g139 = v34;
                                if (v33 >= v22) {
                                    // break -> 0x3070
                                    break;
                                }
                                v32 = v22;
                                v19 = v33;
                                v15 = v34;
                                // continue -> 0x2f94
                            }
                            // 0x3070
                            fclose(file);
                            free((char *)g135);
                            nmemb = v18;
                            if (nmemb == 0) {
                                // 0x30b8
                                free((char *)g137);
                                g137 = 0;
                                *v16 = *(int32_t *)0x3138 + 0x30d4;
                                // branch -> 0x2f5c
                            } else {
                                // 0x3088
                                v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
                                qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
                                *v16 = 0;
                                *(int32_t *)v24 = v18;
                                // branch -> 0x2f5c
                            }
                            // 0x2f5c
                            v9 = g137;
                            g134 = v1;
                            g135 = v2;
                            g136 = v3;
                            g137 = v4;
                            g138 = v5;
                            g129 = v6;
                            g130 = v7;
                            return (struct _IO_FILE *)v9;
                        }
                    }
                    // 0x2f50
                    fclose(file);
                    // branch -> 0x2f58
                    // 0x2f58
                    g137 = 0;
                    // branch -> 0x2f5c
                    // 0x2f5c
                    v9 = g137;
                    g134 = v1;
                    g135 = v2;
                    g136 = v3;
                    g137 = v4;
                    g138 = v5;
                    g129 = v6;
                    g130 = v7;
                    return (struct _IO_FILE *)v9;
                }
                v14 = v28;
            } else {
                // 0x2f1c
                v14 = *(int32_t *)0x3128 + 0x2f28;
                // branch -> 0x2f24
            }
            // 0x2f24
            *(int32_t *)g134 = v14;
            if (v14 == 0) {
                // 0x2f30
                v17 = read_ELF_section_table(file, &v10, (int32_t *)g134);
                g135 = v17;
                v21 = g134;
                v16 = (int32_t *)v21;
                if (*v16 == 0) {
                    // 0x2f68
                    v23 = v10;
                    v24 = g136;
                    if (v23 == 0) {
                        // 0x3068
                        g137 = 0;
                        v18 = 0;
                        // branch -> 0x3070
                    } else {
                        // 0x2f7c
                        g129 = v21;
                        v20 = v17 + 8;
                        g139 = v20;
                        v18 = 0;
                        g138 = 0;
                        g137 = 0;
                        v25 = 0;
                        v15 = v20;
                        // branch -> 0x2f94
                        while (true) {
                            // 0x2f94
                            if (*(int32_t *)(v15 - 8) == 2) {
                                goto lab_0x2fa0_2;
                            }
                            v22 = v23;
                            goto lab_0x3054_2;
                        }
                    }
                    // 0x3070
                    fclose(file);
                    free((char *)g135);
                    nmemb = v18;
                    if (nmemb == 0) {
                        // 0x30b8
                        free((char *)g137);
                        g137 = 0;
                        *v16 = *(int32_t *)0x3138 + 0x30d4;
                        // branch -> 0x2f5c
                    } else {
                        // 0x3088
                        v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
                        qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
                        *v16 = 0;
                        *(int32_t *)v24 = v18;
                        // branch -> 0x2f5c
                    }
                    // 0x2f5c
                    v9 = g137;
                    g134 = v1;
                    g135 = v2;
                    g136 = v3;
                    g137 = v4;
                    g138 = v5;
                    g129 = v6;
                    g130 = v7;
                    return (struct _IO_FILE *)v9;
                }
            }
            // 0x2f50
            fclose(file);
            // branch -> 0x2f58
            // 0x2f58
            g137 = 0;
            // branch -> 0x2f5c
            // 0x2f5c
            v9 = g137;
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g137 = v4;
            g138 = v5;
            g129 = v6;
            g130 = v7;
            return (struct _IO_FILE *)v9;
        }
        // 0x2f24
        *(int32_t *)g134 = v14;
        if (v14 == 0) {
            // 0x2f30
            v17 = read_ELF_section_table(file, &v10, (int32_t *)g134);
            g135 = v17;
            v21 = g134;
            v16 = (int32_t *)v21;
            if (*v16 == 0) {
                // 0x2f68
                v23 = v10;
                v24 = g136;
                if (v23 == 0) {
                    // 0x3068
                    g137 = 0;
                    v18 = 0;
                    // branch -> 0x3070
                } else {
                    // 0x2f7c
                    g129 = v21;
                    v20 = v17 + 8;
                    g139 = v20;
                    v18 = 0;
                    g138 = 0;
                    g137 = 0;
                    v19 = 0;
                    v25 = 0;
                    v15 = v20;
                    // branch -> 0x2f94
                    while (true) {
                        // 0x2f94
                        if (*(int32_t *)(v15 - 8) == 2) {
                            goto lab_0x2fa0_2;
                        }
                        v22 = v23;
                        goto lab_0x3054_2;
                    }
                }
                // 0x3070
                fclose(file);
                free((char *)g135);
                nmemb = v18;
                if (nmemb == 0) {
                    // 0x30b8
                    free((char *)g137);
                    g137 = 0;
                    *v16 = *(int32_t *)0x3138 + 0x30d4;
                    // branch -> 0x2f5c
                } else {
                    // 0x3088
                    v26 = *(int32_t *)(*(int32_t *)0x3134 + 0x309c);
                    qsort((char *)g137, nmemb, 4, (int32_t (**)(char *, char *))v26);
                    *v16 = 0;
                    *(int32_t *)v24 = v18;
                    // branch -> 0x2f5c
                }
                // 0x2f5c
                v9 = g137;
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g137 = v4;
                g138 = v5;
                g129 = v6;
                g130 = v7;
                return (struct _IO_FILE *)v9;
            }
        }
        // 0x2f50
        fclose(file);
        // branch -> 0x2f58
        // 0x2f58
        g137 = 0;
        // branch -> 0x2f5c
    }
    // 0x2f5c
    v9 = g137;
    g134 = v1;
    g135 = v2;
    g136 = v3;
    g137 = v4;
    g138 = v5;
    g129 = v6;
    g130 = v7;
    return (struct _IO_FILE *)v9;
}
 
// Address range: 0x3140 - 0x3223
int32_t validate_ELF_file(int32_t a1, int32_t a2) {
    int32_t v1 = g134; // 0x3140
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    int32_t v3;
    g133 = &v3;
    g128 = 0;
    g132 = 4;
    g134 = a1;
    int32_t v4 = read_file_value((struct _IO_FILE *)a1); // 0x315c
    g127 = v3;
    g3 = v3 == 0;
    int32_t result4 = v3; // 0x3174_2
    if (v3 == 0) {
        // 0x3178
        g3 = v4 == 0x464c457f;
        if (v4 != 0x464c457f) {
            int32_t result = *(int32_t *)0x3218 + 0x3204; // 0x31fc
            g127 = result;
            g134 = v1;
            g130 = v2;
            return result;
        }
        // 0x3188
        int32_t v5;
        g133 = &v5;
        g128 = 16;
        g132 = 4;
        int32_t v6 = read_file_value((struct _IO_FILE *)g134); // 0x3198
        g127 = v5;
        g3 = v5 == 0;
        if (v5 == 0) {
            // 0x31ac
            g3 = v6 == 0x280002;
            if (v6 != 0x280002) {
                int32_t result2 = *(int32_t *)0x321c + 0x3214; // 0x320c
                g127 = result2;
                g134 = v1;
                g130 = v2;
                return result2;
            }
            // 0x31bc
            int32_t v7;
            g133 = &v7;
            g128 = 20;
            g132 = 4;
            int32_t v8 = read_file_value((struct _IO_FILE *)g134); // 0x31cc
            g127 = v7;
            g3 = v7 == 0;
            if (v7 == 0) {
                // 0x31e0
                g3 = v8 == 1;
                int32_t v9 = *(int32_t *)0x3220 + 0x31f0; // 0x31e8
                int32_t result3 = v8 == 1 ? v9 & -0x10000 : v9; // 0x31e8
                g127 = result3;
                g134 = v1;
                g130 = v2;
                return result3;
            }
            result4 = v7;
        } else {
            result4 = v5;
        }
    }
    // 0x3170
    g134 = v1;
    g130 = v2;
    return result4;
}
 
// Address range: 0x3224 - 0x33ff
int32_t read_ELF_section_table(struct _IO_FILE * a1, int32_t * a2, int32_t * a3) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g134; // 0x3224
    int32_t v3 = g135; // 0x3224
    int32_t v4 = g136; // 0x3224
    int32_t v5 = g138; // 0x3224
    int32_t v6 = g130; // bp-8
    g130 = &v6;
    g135 = v1;
    g129 = (int32_t)a2;
    g128 = 32;
    g132 = 4;
    g133 = v1;
    g137 = (int32_t)a1;
    g136 = read_file_value(a1);
    int32_t v7 = g135; // 0x3250
    g134 = 0;
    int32_t result; // 0x33ec
    if (*(int32_t *)v7 == 0) {
        // 0x3260
        g128 = 46;
        g132 = 2;
        g133 = v7;
        g138 = read_file_value((struct _IO_FILE *)g137);
        int32_t v8 = g135; // 0x3278
        if (*(int32_t *)v8 == 0) {
            // 0x3284
            g128 = 48;
            g132 = 2;
            g133 = v8;
            uint32_t v9 = read_file_value((struct _IO_FILE *)g137); // 0x3294
            int32_t * v10 = (int32_t *)g135; // 0x3298_0
            if (*v10 == 0) {
                // 0x32a4
                if (g136 != 0) {
                    uint32_t v11 = g138; // 0x32a8
                    if (v11 != 0) {
                        // 0x32b0
                        if (v9 != 0) {
                            // 0x32b8
                            if (v11 > 39) {
                                int32_t mem = (int32_t)malloc(20 * v9); // 0x32f0_3
                                g134 = mem;
                                int32_t v12 = g136 + 36; // 0x32f8
                                g136 = v12;
                                int32_t v13 = mem + 8; // R9
                                g138 = 0;
                                int32_t v14 = g135; // 0x3310
                                // branch -> 0x3304
                                while (true) {
                                    // 0x3304
                                    g128 = v12 - 32;
                                    g132 = 4;
                                    g133 = v14;
                                    *(int32_t *)(v13 - 8) = read_file_value((struct _IO_FILE *)g137);
                                    int32_t v15 = g135; // 0x331c
                                    if (*(int32_t *)v15 == 0) {
                                        // 0x3328
                                        g128 = g136 - 20;
                                        g132 = 4;
                                        g133 = v15;
                                        *(int32_t *)(v13 - 4) = read_file_value((struct _IO_FILE *)g137);
                                        int32_t v16 = g135; // 0x3340
                                        if (*(int32_t *)v16 == 0) {
                                            // 0x334c
                                            g128 = g136 - 16;
                                            g132 = 4;
                                            g133 = v16;
                                            *(int32_t *)v13 = read_file_value((struct _IO_FILE *)g137);
                                            int32_t v17 = g135; // 0x3364
                                            if (*(int32_t *)v17 == 0) {
                                                // 0x3370
                                                g128 = g136 - 12;
                                                g132 = 4;
                                                g133 = v17;
                                                *(int32_t *)(v13 + 4) = read_file_value((struct _IO_FILE *)g137);
                                                int32_t v18 = g135; // 0x3388
                                                if (*(int32_t *)v18 == 0) {
                                                    // 0x3394
                                                    g128 = g136;
                                                    g132 = 4;
                                                    g133 = v18;
                                                    *(int32_t *)(v13 + 8) = read_file_value((struct _IO_FILE *)g137);
                                                    int32_t v19 = g135; // 0x33ac
                                                    if (*(int32_t *)v19 == 0) {
                                                        // 0x33b8
                                                        v13 += 20;
                                                        int32_t v20 = g138 + 1; // 0x33c0
                                                        g138 = v20;
                                                        int32_t v21 = g136 + v11; // 0x33c4
                                                        g136 = v21;
                                                        if (v20 >= v9) {
                                                            // break -> 0x33d4
                                                            break;
                                                        }
                                                        v14 = v19;
                                                        v12 = v21;
                                                        // continue -> 0x3304
                                                        continue;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    // 0x33e0
                                    free((char *)g134);
                                    g134 = 0;
                                    // branch -> 0x33ec
                                    // 0x33ec
                                    result = g134;
                                    g134 = v2;
                                    g135 = v3;
                                    g136 = v4;
                                    g138 = v5;
                                    g130 = v6;
                                    return result;
                                }
                                // 0x33d4
                                *(int32_t *)g129 = v9;
                                // branch -> 0x33ec
                            } else {
                                // 0x32c0
                                *v10 = *(int32_t *)0x33fc + 0x32cc;
                                // branch -> 0x33ec
                            }
                            // 0x33ec
                            result = g134;
                            g134 = v2;
                            g135 = v3;
                            g136 = v4;
                            g138 = v5;
                            g130 = v6;
                            return result;
                        }
                    }
                }
                // 0x32d0
                *v10 = *(int32_t *)0x33f8 + 0x32dc;
                // branch -> 0x33ec
            }
        }
    }
    // 0x33ec
    result = g134;
    g134 = v2;
    g135 = v3;
    g136 = v4;
    g138 = v5;
    g130 = v6;
    return result;
}
 
// Address range: 0x3400 - 0x3627
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) {
    int32_t v1 = g135; // 0x3400
    int32_t v2 = g138; // 0x3400
    int32_t v3 = g139; // 0x3400
    int32_t v4 = g129; // 0x3400
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    g135 = (int32_t)a1;
    int32_t v6;
    g134 = v6;
    g137 = a4;
    int32_t v7;
    int32_t * v8 = (int32_t *)v7; // 0x3428_0
    *v8 = 0;
    int32_t result2; // 0x361c
    if (a4 == 0) {
        // 0x3584
        g138 = 0;
        // branch -> 0x358c
        // 0x358c
        *v8 = 0;
        *(int32_t *)g134 = 0;
        result2 = g138;
        // branch -> 0x361c
    } else {
        // 0x3430
        g139 = 0;
        g138 = 0;
        g129 = 0;
        int32_t v9 = g137; // bp-56
        int32_t v10 = g135; // 0x3440
        struct _IO_FILE * v11 = (struct _IO_FILE *)v10;
        int32_t v12 = 0; // 0x3450
        int32_t v13 = g134; // 0x344c
        // branch -> 0x3444
        while (true) {
            // 0x3444
            g132 = 1;
            g133 = v13;
            int32_t v14 = v12 + a3; // 0x3450
            g136 = v14;
            g128 = v14 + 12;
            uint32_t v15 = read_file_value(v11); // 0x345c
            int32_t v16 = g134; // 0x3460
            if (*(int32_t *)v16 == 0) {
                uint32_t v17 = v15 % 16; // 0x346c
                int32_t v18; // 0x3578
                int32_t v19; // 0x344c5
                if ((v17 + 255) % 256 <= 1) {
                    int32_t v20 = g138; // 0x3480
                    g128 = g136;
                    g132 = 4;
                    g135 = v10;
                    g133 = v16;
                    int32_t v21 = read_file_value(v11); // 0x3498
                    int32_t v22 = g134; // 0x349c
                    if (*(int32_t *)v22 == 0) {
                        // 0x34a8
                        g132 = v22;
                        int32_t v23;
                        int32_t str = read_file_string((struct _IO_FILE *)g135, v21 + v23); // 0x34b8
                        g138 = str;
                        if (*(int32_t *)g134 == 0) {
                            int32_t len = strlen((char *)str); // 0x34d0
                            int32_t mem = (int32_t)malloc(len + 13); // 0x34d8_3
                            g137 = g134;
                            g134 = mem;
                            strcpy((char *)(mem + 9), (char *)g138);
                            free((char *)g138);
                            g128 = g136 + 4;
                            *(char *)(g134 + 8) = (char)v17;
                            g132 = 4;
                            g133 = g137;
                            *(int32_t *)g134 = read_file_value((struct _IO_FILE *)g135);
                            int32_t v24 = g137; // 0x3518
                            if (*(int32_t *)v24 == 0) {
                                // 0x3524
                                g128 = g136 + 8;
                                g132 = 4;
                                g133 = v24;
                                *(int32_t *)(g134 + 4) = read_file_value((struct _IO_FILE *)g135);
                                if (*(int32_t *)g137 == 0) {
                                    int32_t v25 = g139 + 1; // 0x3548
                                    g135 = v25;
                                    int32_t mem2 = (int32_t)realloc((char *)v20, 4 * v25); // 0x3554_5
                                    g138 = mem2;
                                    *(int32_t *)(4 * g139 + mem2) = g134;
                                    int32_t v26 = g137; // 0x3560
                                    g134 = v26;
                                    g139 = g135;
                                    g137 = v9;
                                    v18 = v9;
                                    v19 = v26;
                                    // branch -> 0x356c
                                    goto lab_0x356c;
                                }
                            }
                            // 0x35e8
                            free((char *)g134);
                            g135 = v20;
                            if (g139 == 0) {
                                // 0x3614
                                free((char *)*&g135);
                                g138 = 0;
                                // branch -> 0x361c
                                // 0x361c
                                g135 = v1;
                                g138 = v2;
                                g139 = v3;
                                g129 = v4;
                                g130 = v5;
                                return 0;
                            }
                            int32_t v27 = v20; // 0x3600
                            // branch -> 0x3600
                            while (true) {
                                // 0x3600
                                free((char *)*(int32_t *)v27);
                                int32_t v28 = g139; // 0x3608
                                g139 = v28 - 1;
                                if (v28 != 1) {
                                    // 0x3600
                                    v27 += 4;
                                    // branch -> 0x3600
                                    continue;
                                }
                            }
                            // 0x358c
                            // branch -> 0x358c
                            // 0x358c
                            *v8 = g139;
                            *(int32_t *)g134 = 0;
                            int32_t result = g138;
                            // branch -> 0x361c
                            // 0x361c
                            g135 = v1;
                            g138 = v2;
                            g139 = v3;
                            g129 = v4;
                            g130 = v5;
                            return result;
                        }
                    }
                    // 0x35c4
                    g135 = v20;
                    if (g139 != 0) {
                        // branch -> 0x35d4
                        while (true) {
                            // 0x35d4
                            free((char *)*(int32_t *)v20);
                            int32_t v29 = g139; // 0x35dc
                            g139 = v29 - 1;
                            if (v29 != 1) {
                                // 0x35d4
                                v20 += 4;
                                // branch -> 0x35d4
                                continue;
                            }
                        }
                    }
                    // 0x3614
                    free((char *)g135);
                    g138 = 0;
                    // branch -> 0x361c
                    // 0x361c
                    g135 = v1;
                    g138 = v2;
                    g139 = v3;
                    g129 = v4;
                    g130 = v5;
                    return 0;
                }
                // 0x346c
                v18 = g137;
                v19 = v16;
                // branch -> 0x356c
              lab_0x356c:
                // 0x356c
                g135 = v10;
                int32_t v30 = g129 + a6; // 0x3574
                g129 = v30;
                if (v30 >= v18) {
                    // break -> 0x358c
                    break;
                }
                v12 = v30;
                v13 = v19;
                // continue -> 0x3444
                continue;
            } else {
                // 0x35a0
                if (g139 != 0) {
                    int32_t v31 = g138; // 0x35ac
                    // branch -> 0x35ac
                    while (true) {
                        // 0x35ac
                        free((char *)*(int32_t *)v31);
                        int32_t v32 = g139; // 0x35b4
                        g139 = v32 - 1;
                        if (v32 != 1) {
                            // 0x35ac
                            v31 += 4;
                            // branch -> 0x35ac
                            continue;
                        }
                    }
                }
            }
            // 0x3614
            free((char *)g138);
            g138 = 0;
            // branch -> 0x361c
            // 0x361c
            g135 = v1;
            g138 = v2;
            g139 = v3;
            g129 = v4;
            g130 = v5;
            return 0;
        }
    }
    // 0x361c
    g135 = v1;
    g138 = v2;
    g139 = v3;
    g129 = v4;
    g130 = v5;
    return result2;
}
 
// Address range: 0x3628 - 0x365f
int32_t destroy_ELF_symbols(char * a1, int32_t a2) {
    int32_t result2 = (int32_t)a1;
    int32_t v1 = g134; // 0x3628
    int32_t v2 = g135; // 0x3628
    g135 = a2;
    g134 = result2;
    g3 = a2 == 0;
    if (a2 != 0) {
        int32_t result = *(int32_t *)a1; // 0x3644
        free((char *)result);
        return result;
    }
    // 0x3654
    g134 = v1;
    g135 = v2;
    free(a1);
    return result2;
}
 
// Address range: 0x3660 - 0x36b3
int32_t compare_ELF_symbols(int32_t * a1, int32_t * a2) {
    int32_t v1 = *a2; // 0x3660
    int32_t v2 = *a1; // 0x3664
    uint32_t v3 = *(int32_t *)v1; // 0x3668
    uint32_t v4 = *(int32_t *)v2; // 0x366c
    int32_t result; // 0x36b0_1
    int32_t v5; // 0x36ac
    if (v4 != v3) {
        int32_t v6 = (int32_t)(v4 >= v3) ^ 1;
        if (v4 < v3) {
            v5 = 0;
            // 0x36a8
            if (v6 != 0) {
                // if_36ac_0_true
                result = v5 - 1;
                // branch -> after_if_36ac_0
            } else {
                result = v5;
            }
            // after_if_36ac_0
            return result;
        }
        // 0x36a8
        v5 = 1;
        // branch -> 0x36a8
        // 0x36a8
        if (v6 != 0) {
            // if_36ac_0_true
            result = v5 - 1;
            // branch -> after_if_36ac_0
        } else {
            result = v5;
        }
        // after_if_36ac_0
        return result;
    }
    uint32_t v7 = *(int32_t *)(v2 + 4); // 0x3678
    uint32_t v8 = *(int32_t *)(v1 + 4); // 0x3680
    int32_t v9 = v7 > v8;
    if (v7 >= v8) {
        v5 = 0;
        // 0x36a8
        if (v9 != 0) {
            // if_36ac_0_true
            result = v5 - 1;
            // branch -> after_if_36ac_0
        } else {
            result = v5;
        }
        // after_if_36ac_0
        return result;
    }
    // 0x36a8
    v5 = 1;
    // branch -> 0x36a8
    // 0x36a8
    if (v9 != 0) {
        // if_36ac_0_true
        result = v5 - 1;
        // branch -> after_if_36ac_0
    } else {
        result = v5;
    }
    // after_if_36ac_0
    return result;
}
 
// Address range: 0x36b4 - 0x36ff
int32_t validate_file_value(int32_t a1, int32_t a2) {
    g128 = a2;
    int32_t v1 = g134; // 0x36b4
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    g134 = g133;
    int32_t v3;
    g133 = &v3;
    g132 %= 256;
    int32_t v4 = read_file_value((struct _IO_FILE *)a1); // 0x36cc
    g127 = v3;
    g3 = v3 == 0;
    int32_t result = v3; // 0x36f0_2
    if (v3 == 0) {
        // 0x36e0
        int32_t v5;
        g127 = v5;
        g3 = v4 == g134;
        if (v4 == g134) {
            int32_t v6 = v5 & -0x10000; // 0x36e8
            g127 = v6;
            result = v6;
            // branch -> 0x36ec
        } else {
            result = v5;
        }
    }
    // 0x36ec
    g134 = v1;
    g130 = v2;
    return result;
}
 
// Address range: 0x3700 - 0x3763
int32_t read_line(struct _IO_FILE * stream) {
    int32_t v1 = g135; // 0x3700
    int32_t v2 = g138; // 0x3700
    g135 = 0;
    g138 = 0;
    // branch -> 0x3720
    while (true) {
        int32_t v3 = 0x1000000 * getc((struct _IO_FILE *)(int32_t)stream);
        int32_t v4 = v3 / 0x1000000; // R6
        if (v3 != 0xd000000) {
            int32_t v5 = g138 + 1; // 0x3734
            int32_t mem = (int32_t)realloc((char *)g135, v5); // 0x3740_5
            g135 = mem;
            if (v4 == -1 || v4 == 10) {
                // 0x3754
                *(char *)(g138 + mem) = 0;
                int32_t result = g135; // 0x375c
                g135 = v1;
                g138 = v2;
                return result;
            }
            // 0x3718
            *(char *)(g138 + mem) = (char)v4;
            g138 = v5;
            // branch -> 0x3720
        }
        // 0x3720
        // branch -> 0x3720
    }
}
 
// Address range: 0x3764 - 0x37d7
int32_t get_file_length(struct _IO_FILE * stream) {
    int32_t v1 = g134; // 0x3764
    int32_t v2 = g135; // 0x3764
    int32_t v3 = g130; // 0x3764
    int32_t stream2 = (int32_t)stream; // R4
    int32_t curr_file_offset = ftell(stream); // 0x3770
    g135 = 0;
    int32_t result; // 0x37d0
    if (curr_file_offset < 0) {
        // 0x37d0
        result = g135;
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return result;
    }
    // 0x3784
    if (fseek((struct _IO_FILE *)stream2, 0, SEEK_END) == 0) {
        int32_t curr_file_offset2 = ftell((struct _IO_FILE *)stream2); // R7
        g135 = 0;
        if (fseek((struct _IO_FILE *)stream2, curr_file_offset, SEEK_SET) == 0) {
            int32_t v4 = curr_file_offset2; // 0x37cc
            if (curr_file_offset2 == -1) {
                // if_37c8_0_true
                v4 = curr_file_offset2 & -0x10000;
                // branch -> after_if_37c8_0
            }
            // after_if_37c8_0
            g135 = v4;
            // branch -> 0x37d0
        }
    }
    // 0x37d0
    result = g135;
    g134 = v1;
    g135 = v2;
    g130 = v3;
    return result;
}
 
// Address range: 0x37d8 - 0x38af
int32_t read_file_by_lines(struct _IO_FILE * stream) {
    int32_t v1 = g135; // 0x37d8
    int32_t v2 = g138; // 0x37d8
    int32_t v3 = g130; // 0x37d8
    int32_t stream2 = (int32_t)stream; // R4
    int32_t is_feof = feof(stream); // 0x37e8
    g135 = is_feof;
    int32_t mem = (int32_t)realloc(NULL, 4); // 0x37f8_5
    g138 = mem;
    int32_t result; // 0x38a4
    if (is_feof == 0) {
        int32_t v4 = 1; // 0x3818
        int32_t v5 = 0; // 0x3814
        // branch -> 0x3814
        while (true) {
            int32_t v6 = v4; // R9
            int32_t v7 = 0; // R6
            int32_t v8 = 0; // R10
            // branch -> 0x3830
            int32_t v9; // R7
            while (true) {
              lab_0x3830:;
                int32_t v10 = 0x1000000 * getc((struct _IO_FILE *)stream2);
                v9 = v10 / 0x1000000;
                if (v10 != 0xd000000) {
                    // break -> 0x3844
                    break;
                }
                // continue -> 0x3830
            }
            int32_t v11 = v8 + 1; // 0x3844
            g135 = v11;
            int32_t mem2 = (int32_t)realloc((char *)v7, v11); // 0x3850_5
            v7 = mem2;
            if (v9 != -1) {
                // after_if_385c_0
                if (v9 != 10) {
                    // 0x3828
                    *(char *)(v8 + mem2) = (char)v9;
                    v8 = g135;
                    // branch -> 0x3830
                    goto lab_0x3830;
                }
            }
            // 0x3864
            *(char *)(v8 + mem2) = 0;
            *(int32_t *)(4 * v5 + g138) = v7;
            int32_t is_feof2 = feof((struct _IO_FILE *)stream2); // 0x3878
            int32_t v12 = v6 + 1; // 0x387c
            g135 = is_feof2;
            int32_t mem3 = (int32_t)realloc((char *)g138, 4 * v12); // 0x388c_5
            g138 = mem3;
            if (is_feof2 != 0) {
                // 0x389c
                // branch -> 0x389c
                // 0x389c
                *(int32_t *)(mem3 + 4 * v6) = 0;
                result = g138;
                g135 = v1;
                g138 = v2;
                g130 = v3;
                return result;
            }
            // 0x3864
            v4 = v12;
            v5 = v6;
            // branch -> 0x3814
        }
    }
    // 0x389c
    *(int32_t *)mem = 0;
    result = g138;
    g135 = v1;
    g138 = v2;
    g130 = v3;
    return result;
}
 
// Address range: 0x38b0 - 0x396f
int32_t read_file_buffer(struct _IO_FILE * a1, int32_t offset, int32_t size) {
    int32_t v1 = g135; // 0x38b0
    int32_t v2 = g138; // 0x38b0
    g135 = g133;
    int32_t stream = (int32_t)a1; // R7
    *(int32_t *)g133 = 0;
    if (size == 0) {
        // 0x3950
        g135 = v1;
        g138 = v2;
        return 0;
    }
    int32_t result = 0; // R4
    if (fseek((struct _IO_FILE *)stream, offset, SEEK_SET) != 0) {
        // 0x38ec
        *(int32_t *)g135 = *(int32_t *)0x3958 + 0x38f8;
        g135 = v1;
        g138 = v2;
        return result;
    }
    char * mem = malloc(size); // 0x3904
    g138 = (int32_t)mem;
    int32_t items_read = fread(mem, 1, size, (struct _IO_FILE *)stream); // 0x3918
    if (items_read == size) {
        int32_t result2 = g138; // 0x3924
        g135 = v1;
        g138 = v2;
        return result2;
    }
    int32_t v3 = *(int32_t *)0x3960; // 0x3938
    *(int32_t *)g135 = items_read == 0 ? *(int32_t *)0x395c + 0x3948 : v3 + 0x394c;
    free((char *)g138);
    // branch -> 0x3950
    // 0x3950
    g135 = v1;
    g138 = v2;
    return result;
}
 
// Address range: 0x3970 - 0x3b1f
int32_t read_file_value(struct _IO_FILE * a1) {
    int32_t v1 = g135; // 0x3970
    int32_t v2 = g138; // 0x3970
    int32_t v3 = g130; // 0x3970
    g135 = (int32_t)a1;
    *(int32_t *)g133 = 0;
    if (g132 != 0) {
        // 0x3998
        if (g132 < 9) {
            // 0x39b0
            *(int32_t *)g133 = 0;
            int32_t result; // 0x3a84
            if (fseek((struct _IO_FILE *)g135, g128, SEEK_SET) == 0) {
                char * mem = malloc(g132); // 0x39ec
                g138 = (int32_t)mem;
                int32_t items_read = fread(mem, 1, g132, (struct _IO_FILE *)g135); // 0x3a00
                if (items_read != g132) {
                    int32_t v4 = *(int32_t *)0x3b18; // 0x3a14
                    *(int32_t *)g133 = items_read == 0 ? *(int32_t *)0x3b14 + 0x3a24 : v4 + 0x3a28;
                    free((char *)g138);
                    g138 = 0;
                    // branch -> 0x3a30
                }
                // 0x3a30
                if (*(int32_t *)g133 == 0) {
                    // 0x3a44
                    int32_t v5; // 0x3a60
                    if (g132 < 4) {
                        uint32_t v6 = g132 % 4; // 0x3a58
                        v5 = g132 - v6;
                        if (g132 != v6) {
                            int32_t v7 = g138; // 0x3a84
                            result = *(int32_t *)v7;
                            // branch -> 0x3a84
                            while (v5 != 4) {
                                // 0x3a84
                                v5 -= 4;
                                v7 += 4;
                                result = *(int32_t *)v7;
                                // continue -> 0x3a84
                            }
                            // 0x3ab0
                            if (v6 == 0) {
                                // 0x3af0
                                free((char *)g138);
                                // branch -> 0x39d8
                                // 0x39d8
                                // branch -> 0x39dc
                                // 0x39dc
                                g135 = v1;
                                g138 = v2;
                                g130 = v3;
                                return result;
                            }
                        } else {
                            result = 0;
                            v5 = 0;
                        }
                    } else {
                        // 0x3a50
                        result = 0;
                        v5 = 0;
                        // branch -> 0x3ad0
                    }
                    int32_t v8 = 8 * v5; // 0x3ae8
                    int32_t v9 = g132 - v5; // 0x3ae0
                    int32_t v10 = g138 + v5; // 0x3adc
                    int32_t v11 = (int32_t)*(char *)v10; // 0x3adc
                    uint32_t v12 = v8 & 248; // 0x3ae4
                    int32_t v13 = (v12 == 0 ? v11 : v12 < 32 ? v11 << v12 : 0) | result; // 0x3ae4
                    result = v13;
                    // branch -> 0x3adc
                    while (v9 != 1) {
                        // 0x3adc
                        v8 += 8;
                        v9--;
                        v10++;
                        v11 = (int32_t)*(char *)v10;
                        v12 = v8 & 248;
                        v13 |= (v12 == 0 ? v11 : v12 < 32 ? v11 << v12 : 0);
                        result = v13;
                        // continue -> 0x3adc
                    }
                    // 0x3af0
                    free((char *)g138);
                    // branch -> 0x39d8
                    // branch -> 0x39dc
                } else {
                    result = 0;
                }
            } else {
                // 0x39cc
                // branch -> 0x39d4
                // 0x39d4
                *(int32_t *)g133 = *(int32_t *)0x3b10 + 0x39d8;
                // branch -> 0x39d8
                // 0x39d8
                result = 0;
                // branch -> 0x39dc
            }
            // 0x39dc
            g135 = v1;
            g138 = v2;
            g130 = v3;
            return result;
        }
        // 0x39a0
        // branch -> 0x39d4
        // 0x39d4
        *(int32_t *)g133 = *(int32_t *)0x3b1c + 0x39b0;
        // branch -> 0x39d8
    }
    // 0x39d8
    // branch -> 0x39dc
    // 0x39dc
    g135 = v1;
    g138 = v2;
    g130 = v3;
    return 0;
}
 
// Address range: 0x3b20 - 0x3bdf
int32_t read_file_string(struct _IO_FILE * stream, int32_t offset) {
    int32_t v1 = g134; // bp-32
    int32_t v2 = g135; // 0x3b20
    int32_t v3 = g138; // 0x3b20
    int32_t v4 = g130; // bp-8
    g138 = g132;
    if (fseek(stream, offset, SEEK_SET) != 0) {
        // 0x3b44
        // branch -> 0x3b94
        // 0x3b94
        *(int32_t *)g138 = *(int32_t *)0x3bcc + 0x3b50;
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g130 = v4;
        return 0;
    }
    int32_t result = 0; // R4
    g135 = 0;
    // branch -> 0x3b58
    while (true) {
        int32_t v5 = 0x1000000 * getc((struct _IO_FILE *)(int32_t)stream);
        if (v5 == -0x1000000) {
            int32_t v6 = *(int32_t *)0x3bd4; // 0x3ba8
            *(int32_t *)g138 = g135 == 0 ? *(int32_t *)0x3bd0 + 0x3bb4 : v6 + 0x3bb8;
            free((char *)result);
            g134 = v1;
            g135 = v2;
            g138 = v3;
            g130 = v4;
            return 0;
        }
        int32_t v7 = g135 + 1; // 0x3b6c
        int32_t mem = (int32_t)realloc((char *)result, v7); // 0x3b78_5
        result = mem;
        int32_t v8 = v5 / 0x1000000; // 0x3b80
        *(char *)(g135 + mem) = (char)v8;
        g135 = v7;
        if (v8 == 0) {
            // break -> 0x3b94
            break;
        }
        // continue -> 0x3b58
    }
    // 0x3b94
    *(int32_t *)g138 = 0;
    g134 = v1;
    g135 = v2;
    g138 = v3;
    g130 = v4;
    return result;
}
 
// Address range: 0x3be0 - 0x3fbf
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) {
    int32_t v1;
    char * v2 = (char *)v1; // bp-60
    g133 = (int32_t)stream;
    int32_t v3 = g134; // 0x3be0
    int32_t v4 = g135; // 0x3be0
    int32_t v5 = g136; // 0x3be0
    int32_t v6 = g137; // 0x3be0
    int32_t (*v7)() = (int32_t (*)())g138;
    int32_t v8 = g130; // bp-8
    g130 = &v8;
    g129 = a3;
    g135 = a2;
    g137 = (int32_t)a1;
    int32_t str;
    if (a3 < 2) {
        // 0x3c24
        str = 0x7479622e;
        // branch -> 0x3c38
    } else {
        // 0x3c0c
        sprintf((char *)&str, (char *)(*(int32_t *)0x3f90 + 0x3c1c));
        a3 = g129;
        // branch -> 0x3c38
    }
    // 0x3c38
    g132 = 2 * a3;
    int32_t format = *(int32_t *)0x3f94 + 0x3c48; // 0x3c40
    g128 = format;
    int32_t str2;
    int32_t v9 = &str2; // 0x3c44_0
    g127 = sprintf((char *)&str2, (char *)format);
    int32_t v10 = g135; // 0x3c4c
    g1 = true;
    g2 = v10 < 0;
    g3 = v10 == 0;
    int32_t result; // 0x3fbc_1
    int32_t v11;
    int32_t v12;
    int32_t v13;
    int32_t v14;
    int32_t v15; // 0x3f8c
    if (v10 == 0) {
      lab_0x3f68:
        // 0x3f68
        g134 = v14;
        g135 = v13;
        g136 = v12;
        g137 = v11;
        g138 = v3;
        g139 = v4;
        g129 = v5;
        g130 = v6;
        v7();
        if (g3) {
            // if_3fb8_0_true
            v15 = g127 & g128 & g132 & g133;
            g138 = g136 / 0x40000000 & v15;
            result = v15;
            // branch -> after_if_3fb8_0
        } else {
            // 0x3f68
            result = g127;
            // branch -> after_if_3fb8_0
        }
        // after_if_3fb8_0
        return result;
    }
    uint32_t v16 = g129; // 0x3c54
    int32_t v17;
    int32_t str3;
    if (v16 == 0) {
        int32_t v18 = (int32_t)&v2;
        g134 = v18;
        g138 = v9;
        int32_t v19 = *(int32_t *)0x3fac + 0x3e5c; // 0x3e54
        int32_t v20 = *(int32_t *)0x3fbc + 0x3e74; // 0x3e6c
        char * format3 = (char *)v20;
        int32_t v21 = &str3; // 0x3edc_0
        char * format2 = (char *)(*(int32_t *)0x3fb8 + 0x3e68);
        // branch -> 0x3e80
        while (true) {
            // 0x3e80
            int32_t v22;
            generate_initial_indented_line((int32_t *)v18, &str2, g132, g133, v17, 0, v22);
            v17 = 0;
            concatenate((int32_t *)g134, &str2, (char *)&str, v19);
            uint32_t v23 = g135; // 0x3ea8
            uint32_t v24 = v23 < 32 ? v23 : 32; // 0x3eac
            g137 = v24;
            uint32_t v25 = g129; // 0x3eb4
            int32_t v26 = v23 - v24; // 0x3ebc
            g136 = g134;
            g134 = *(int32_t *)0x3fb4 + 0x3e80;
            g135 = v9;
            g139 = v21;
            int32_t v27 = v24 / v25; // R10
            char * v28;
            int32_t v29; // 0x3f58
            if (v25 <= v24) {
                // 0x3ee8
                g137 = 0;
                // branch -> 0x3eec
                while (true) {
                    // 0x3eec
                    sprintf((char *)&str3, (char *)&str2);
                    v17 = 0;
                    int32_t v30 = g134; // 0x3f20
                    if (g137 != 0) {
                        // if_3f18_0_true
                        v30 = *(int32_t *)0x3fb0 + 0x3f20;
                        // branch -> after_if_3f18_0
                    }
                    // after_if_3f18_0
                    concatenate((int32_t *)g136, &str2, (char *)v30, v21);
                    int32_t v31 = g137 + 1; // 0x3f24
                    g137 = v31;
                    if (v31 >= v27) {
                        // break -> 0x3f30
                        break;
                    }
                    // continue -> 0x3eec
                }
                // 0x3f30
                printf(format2);
                g132 = (int32_t)v2;
                g128 = v20;
                fprintf(stream, format3);
                v28 = v2;
                g127 = (int32_t)v28;
                free(v28);
                g135 = v26;
                v29 = g136;
                g134 = v29;
                g129 = 0;
                g1 = true;
                g2 = v26 < 0;
                g3 = v23 == v24;
                if (v23 == v24) {
                    // break -> 0x3f68
                    break;
                }
                v18 = v29;
                // continue -> 0x3e80
                continue;
            }
            // 0x3f30
            printf(format2);
            g132 = (int32_t)v2;
            g128 = v20;
            fprintf(stream, format3);
            v28 = v2;
            g127 = (int32_t)v28;
            free(v28);
            g135 = v26;
            v29 = g136;
            g134 = v29;
            g129 = 0;
            g1 = true;
            g2 = v26 < 0;
            g3 = v23 == v24;
            if (v23 == v24) {
                // break -> 0x3f68
                break;
            }
            v18 = v29;
            // continue -> 0x3e80
        }
        // 0x3f68
        g134 = v14;
        g135 = v13;
        g136 = v12;
        g137 = v11;
        g138 = v3;
        g139 = v4;
        g129 = v5;
        g130 = v6;
        v7();
        if (g3) {
            // if_3fb8_0_true
            v15 = g127 & g128 & g132 & g133;
            g138 = g136 / 0x40000000 & v15;
            result = v15;
            // branch -> after_if_3fb8_0
        } else {
            // 0x3f68
            result = g127;
            // branch -> after_if_3fb8_0
        }
        // after_if_3fb8_0
        return result;
    }
    uint32_t v32 = v16 % 4; // 0x3c60
    g134 = v16 - v32;
    int32_t v33;
    g138 = &v33;
    int32_t v34 = *(int32_t *)0x3f98 + 0x3c90; // 0x3c88
    int32_t v35 = *(int32_t *)0x3fa8 + 0x3ca8; // 0x3ca0
    char * format5 = (char *)v35;
    int32_t v36 = *(int32_t *)0x3fa0 + 0x3cb4; // 0x3cac
    char * format4 = (char *)(*(int32_t *)0x3fa4 + 0x3c9c);
    int32_t v37 = &str3; // 0x3dc8_0
    // branch -> 0x3cb4
  lab_0x3cb4:
    while (true) {
        // 0x3cb4
        g136 = (int32_t)&v2;
        g139 = v9;
        generate_initial_indented_line((int32_t *)&v2, &str2, g132, g133, v17, 0, v35);
        v17 = 0;
        concatenate((int32_t *)&v2, &str2, (char *)&str, v34);
        int32_t v38 = g135; // 0x3ce4
        uint32_t v39 = v38; // 0x3d0c
        if (v38 > 31) {
            // if_3cf0_0_true
            v39 = 32;
            // branch -> after_if_3cf0_0
        }
        int32_t v40 = v38 - v39; // 0x3cf8
        g135 = v40;
        g139 = v39 / v16;
        g129 = v16;
        char * v41;
        if (v16 <= v39) {
            // 0x3d18
            g136 = 0;
            int32_t v42 = g137; // 0x3d50
            int32_t v43 = v16; // 0x3dac
            // branch -> 0x3d1c
            while (true) {
                int32_t v44 = v42; // 0x3db441
                int32_t v45 = 0; // 0x3dac
                int32_t v46; // 0x3dfc
                if (v43 >= 4) {
                    int32_t v47 = g134; // 0x3d30
                    if (v47 != 0) {
                        int32_t v48 = v47 + v42; // 0x3d50
                        int32_t v49 = 0; // 0x3d58
                        v33 = *(int32_t *)(v49 + v42);
                        // branch -> 0x3d58
                        while (v47 != v49 + 4) {
                            // 0x3d58
                            v49 += 4;
                            v33 = *(int32_t *)(v49 + v42);
                            // continue -> 0x3d58
                        }
                        // 0x3d88
                        if (v32 == 0) {
                            // 0x3dc8
                            g135 = v37;
                            sprintf((char *)&str3, (char *)&str2);
                            v17 = 0;
                            v46 = v36;
                            if (g136 != 0) {
                              lab_if_3df4_0_true:
                                // if_3df4_0_true
                                v46 = *(int32_t *)0x3f9c + 0x3dfc;
                                // branch -> after_if_3df4_0
                            }
                          lab_after_if_3df4_0:
                            // after_if_3df4_0
                            concatenate((int32_t *)&v2, &str2, (char *)v46, v37);
                            int32_t v50 = g136 + 1; // 0x3e04
                            g136 = v50;
                            int32_t v51 = g137 + (v16 + 255) % 256 + 1; // 0x3e0c
                            g137 = v51;
                            if (v50 < g139) {
                                // after_if_3df4_0.dec_label_pc_3d1c_crit_edge
                                v42 = v51;
                                v43 = g129;
                                // branch -> 0x3d1c
                                continue;
                            } else {
                                // 0x3e14
                                printf(format4);
                                g132 = (int32_t)v2;
                                g128 = v35;
                                fprintf(stream, format5);
                                v41 = v2;
                                g127 = (int32_t)v41;
                                free(v41);
                                g135 = v40;
                                g1 = true;
                                g2 = v40 < 0;
                                g3 = v38 == v39;
                                if (v38 == v39) {
                                    // break (via goto) -> 0x3f68
                                    goto lab_0x3f68;
                                }
                                // continue (via goto) -> 0x3cb4
                                goto lab_0x3cb4;
                            }
                        } else {
                            v44 = v48;
                            v45 = v47;
                        }
                    } else {
                        v44 = v42;
                        v45 = 0;
                    }
                }
                int32_t v52 = v43 - v45; // 0x3db8
                int32_t v53 = v44; // 0x3db4
                g135 = (int32_t)*(char *)v53;
                // branch -> 0x3db4
                while (v52 != 1) {
                    // 0x3db4
                    v52--;
                    v53++;
                    g135 = (int32_t)*(char *)v53;
                    // continue -> 0x3db4
                }
                // 0x3dc8
                g135 = v37;
                sprintf((char *)&str3, (char *)&str2);
                v17 = 0;
                if (g136 == 0) {
                    v46 = v36;
                    goto lab_after_if_3df4_0;
                }
                goto lab_if_3df4_0_true;
            }
        }
        // 0x3e14
        printf(format4);
        g132 = (int32_t)v2;
        g128 = v35;
        fprintf(stream, format5);
        v41 = v2;
        g127 = (int32_t)v41;
        free(v41);
        g135 = v40;
        g1 = true;
        g2 = v40 < 0;
        g3 = v38 == v39;
        if (v38 == v39) {
            // break -> 0x3f68
            break;
        }
        // continue -> 0x3cb4
    }
    // 0x3f68
    g134 = v14;
    g135 = v13;
    g136 = v12;
    g137 = v11;
    g138 = v3;
    g139 = v4;
    g129 = v5;
    g130 = v6;
    v7();
    if (g3) {
        // if_3fb8_0_true
        v15 = g127 & g128 & g132 & g133;
        g138 = g136 / 0x40000000 & v15;
        result = v15;
        // branch -> after_if_3fb8_0
    } else {
        // 0x3f68
        result = g127;
        // branch -> after_if_3fb8_0
    }
    // after_if_3fb8_0
    return result;
}
 
// Address range: 0x3fc0 - 0x433f
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) {
    // 0x3fc0
    g133 = a4;
    int32_t v1 = g134; // 0x3fc0
    int32_t v2 = g135; // 0x3fc0
    int32_t v3 = g138; // 0x3fc0
    int32_t v4 = g129; // 0x3fc0
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    g139 = a2;
    g137 = a4;
    int32_t * v6 = (int32_t *)(a1 + 4); // 0x3fe0_0
    int32_t v7 = *v6; // 0x3fe0
    printf("Binary inclusion size: %u\n", v7);
    g138 = 16;
    int32_t v8 = v7; // 0x4004
    if (v7 < 16) {
        // if_3ffc_0_true
        v8 = 16;
        // branch -> after_if_3ffc_0
    }
    int32_t v9 = v8 % 256; // R4
    printf("First %hhu bytes:", (char)v8);
    if (v9 != 0) {
        // 0x4018
        g135 = 0;
        g136 = (int32_t)" %02hhx";
        int32_t format = (int32_t)" %02hhx"; // 0x4028
        int32_t v10 = 0; // 0x4024
        // branch -> 0x4024
        while (true) {
            // 0x4024
            printf((char *)format, *(char *)(g139 + v10));
            int32_t v11 = g135 + 1; // 0x4030
            g135 = v11;
            if (v11 < v9) {
                // 0x4024
                format = g136;
                v10 = v11;
                // branch -> 0x4024
                continue;
            }
        }
    }
    // 0x403c
    putchar(10);
    g134 = a1;
    int32_t v12 = *v6; // 0x4048
    int32_t v13 = g137; // 0x404c
    int32_t v14 = g138 & 16 * v12 ^ 0x7f09f; // 0x405c
    g129 = v14;
    if ((v12 & 2) == 0) {
        int32_t v15 = 32; // 0x4078
        if (validate_pointers(g139, v12, a3) != 0) {
            // if_4074_0_true
            v15 = 96;
            // branch -> after_if_4074_0
        }
        int32_t v16 = g129 | v15; // 0x4078
        g129 = v16;
        v14 = v16;
        // branch -> 0x407c
    }
    int32_t v17 = v14; // 0x4098
    if (*(int32_t *)*(int32_t *)0x1e110 != 0) {
        int32_t v18 = v14 | 0x80000; // 0x4094
        g129 = v18;
        v17 = v18;
        // branch -> after_if_4094_0
    }
    uint32_t v19 = get_command((int32_t)"Action for current .incbin: ", v17); // 0x409c
    g138 = v19;
    if (v19 < 12) {
        // 0x4244
        if (v19 == 0) {
            // 0x430c
            g126 = &g55;
            exit(0);
            // UNREACHABLE
        }
        // 0x424c
        if (v19 <= 1 || v19 == 2) {
            // 0x4254
            g135 = v2;
            g138 = v3;
            g129 = v4;
            return 3 - v19;
        }
        // 0x4260
        if (0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2 != 0) {
            // 0x4274
            return write_header_comment((int32_t *)g134, (struct _IO_FILE *)a3);
        }
        uint32_t result = v19 - 3; // 0x4280
        if (result < 3) {
            // 0x42ec
            g135 = v2;
            g138 = v3;
            g129 = v4;
            return result;
        }
        int32_t v20 = *(int32_t *)(g134 + 4); // 0x4294
        uint32_t v21 = result % 256; // 0x429c
        int32_t v22 = v21 == 0 ? 1 : v21 < 32 ? (1 << v21) % 256 : 0; // 0x42a0
        int32_t v23;
        int32_t v24;
        int32_t v25;
        int32_t v26;
        return output_binary_data((char *)g139, v20, v22, (struct _IO_FILE *)a3, v26, v25, v13, a3, v24, a1, v23, v1);
    }
    // 0x40ac
    g137 = 0;
    g135 = -12;
    int32_t v27 = g33; // 0x40c4
    g136 = v27 + 84;
    uint32_t v28 = v19 % 256; // 0x40ec
    uint32_t v29 = v28 - 12; // 0x40ec
    g1 = v29 > 6;
    g2 = v28 < 19;
    g3 = v29 == 7;
    if (v29 > 7) {
        // 0x422c
        return get_command((int32_t)"Action for current .incbin: ", g129);
    }
    // 0x40f8
    g128 = &g54;
    int32_t v30 = *(int32_t *)(4 * v29 + (int32_t)&g54); // 0x4100
    g127 = v30;
    ((int32_t (*)(int32_t, int32_t))(v30 + (int32_t)&g54))(v30, (int32_t)&g54);
    if (g3) {
        // after_if_4114_0
        abort();
        // UNREACHABLE
    }
    // after_if_4124_0
    g138 = a9;
    int32_t v31 = *(int32_t *)(g134 + 4); // 0x4130
    g137 = v31;
    g135 = 0;
    int32_t v32 = 256 * (a9 % 256) | 16; // 0x413c
    g134 = v32;
    // branch -> 0x4140
    int32_t v33;
    int32_t v34; // 0x4178
    while (true) {
        // 0x4140
        dump_data_line_as_text((struct _IO_FILE *)g136, g139, v32 - 16, v31, v27, (int32_t)"Script file: ", v13, a3, 0);
        int32_t v35 = g135 + 1; // 0x4154
        g135 = v35;
        if (v35 % 256 <= 15) {
            uint32_t v36 = g134; // 0x4164
            int32_t v37 = v36 + 16; // 0x4164
            int32_t v38 = g137; // 0x4168
            g134 = v37;
            if (v36 >= v38) {
                // break -> 0x4174
                break;
            }
            v31 = v38;
            v32 = v37;
            // continue -> 0x4140
            continue;
        }
        // 0x4174
        g134 = v33;
        v34 = g138 + 1;
        g138 = v34;
        g137 = 0;
        g135 = -12;
        if (256 * (v34 % 256) >= *(int32_t *)(v33 + 4)) {
            // 0x422c
            return get_command((int32_t)"Action for current .incbin: ", g129);
        }
        // if_4194_0_true
        g138 = 0;
        // branch -> 0x422c
        // 0x422c
        return get_command((int32_t)"Action for current .incbin: ", g129);
    }
    // 0x4174
    g134 = v33;
    v34 = g138 + 1;
    g138 = v34;
    g137 = 0;
    g135 = -12;
    if (256 * (v34 % 256) < *(int32_t *)(v33 + 4)) {
        // if_4194_0_true
        g138 = 0;
        // branch -> 0x422c
    }
    // 0x422c
    return get_command((int32_t)"Action for current .incbin: ", g129);
}
 
// Address range: 0x4340 - 0x4397
int32_t preview_incbin(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g134; // 0x4340
    int32_t v2 = g135; // 0x4340
    int32_t v3 = g136; // 0x4340
    int32_t v4 = g137; // 0x4340
    int32_t v5 = g138; // 0x4340
    int32_t v6 = g130; // bp-8
    g130 = &v6;
    g138 = a1;
    g134 = a3;
    g135 = a2;
    g136 = 0;
    int32_t v7 = g33 + 84; // 0x4360
    g137 = v7;
    // branch -> 0x4364
    while (true) {
        // 0x4364
        dump_data_line_as_text((struct _IO_FILE *)v7, a1, a2, a3, v1, v2, v3, v4, v5);
        int32_t v8 = g135 + 16; // 0x4378
        g135 = v8;
        uint32_t v9 = g134; // 0x437c
        g1 = v8 >= v9;
        g3 = v8 == v9;
        uint32_t v10 = g136; // 0x4380
        if (v8 >= v9) {
            int32_t result = v10 % 256; // 0x43847
            g127 = result;
            // branch -> 0x4390
            // 0x4390
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g137 = v4;
            g138 = v5;
            g130 = v6;
            return result;
        }
        int32_t v11 = v10 + 1; // 0x4380
        g136 = v11;
        uint32_t result2 = v11 % 256; // 0x43842
        g127 = result2;
        g1 = result2 > 15;
        g3 = result2 == 16;
        if (result2 <= 15) {
            // 0x4364
            a3 = v9;
            a2 = v8;
            a1 = g138;
            v7 = g137;
            // branch -> 0x4364
            continue;
        }
        // 0x4390
        g134 = v1;
        g135 = v2;
        g136 = v3;
        g137 = v4;
        g138 = v5;
        g130 = v6;
        return result2;
    }
}
 
// Address range: 0x4398 - 0x445b
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) {
    int32_t v1 = g135; // 0x4398
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    g135 = a1;
    g134 = a2;
    printf("File to write: ");
    int32_t result = read_line((struct _IO_FILE *)g33); // 0x43bc
    char * file_path = (char *)result; // 0x43c4_0
    if (*file_path != 0) {
        // 0x43d0
        return (int32_t)fopen(file_path, "w");
    }
    // 0x4440
    g135 = v1;
    free(file_path);
    return result;
}
 
// Address range: 0x445c - 0x44e7
int32_t get_dump_file(char * a1, int32_t a2, int32_t a3) {
    int32_t v1 = g135; // 0x445c
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    g135 = (int32_t)a1;
    printf("File to write: ");
    int32_t v3 = read_line((struct _IO_FILE *)g33); // 0x447c
    char * file_path = (char *)v3; // 0x4484_0
    if (*file_path == 0) {
        // 0x44c8
        free((char *)v3);
        g135 = v1;
        return 0;
    }
    struct _IO_FILE * file = fopen(file_path, (char *)g135); // 0x4498
    g135 = (int32_t)file;
    char * v4 = (char *)v3;
    if (file != NULL) {
        // 0x44a8
        free(v4);
        int32_t result = g135; // 0x44b0
        g135 = v1;
        return result;
    }
    // 0x44b8
    printf("err: could not open file %s for writing\n", v4);
    // branch -> 0x44c8
    // 0x44c8
    free((char *)v3);
    g135 = v1;
    return 0;
}
 
// Address range: 0x44e8 - 0x4647
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) {
    int32_t v1 = g134; // 0x44e8
    int32_t v2 = g135; // 0x44e8
    int32_t v3 = g136; // 0x44e8
    int32_t v4 = g137; // 0x44e8
    int32_t v5 = g138; // 0x44e8
    int32_t v6 = g139; // 0x44e8
    int32_t v7 = g129; // 0x44e8
    int32_t v8 = g130; // bp-8
    int32_t v9 = g126; // 0x44e8
    g130 = &v8;
    g134 = (int32_t)stream;
    g138 = a2;
    g139 = a3;
    fprintf(stream, "%08x:   ", a3);
    uint32_t v10 = a4 - g139; // 0x4514
    int32_t v11 = v10 > 16 ? 16 : v10 % 256; // 0x451c
    g136 = v11;
    int32_t v12; // 0x458c
    int32_t stream2; // 0x4620
    int32_t v13; // 0x45d0
    uint32_t v14; // 0x45dc
    if (v11 == 0) {
        // 0x456c
        g135 = 0;
        // branch -> 0x4570
    } else {
        // 0x452c
        g135 = 0;
        int32_t v15 = 0; // 0x453c
        // branch -> 0x453c
        while (true) {
            char v16 = *(char *)(g138 + g139 + v15); // 0x4544
            fprintf((struct _IO_FILE *)g134, (char *)(int32_t)"%02hhx ", v16);
            int32_t v17 = g135 + 1; // 0x4550
            g135 = v17;
            uint32_t v18 = v17 % 256; // 0x4554
            if (v18 >= g136) {
                // 0x4560
                if (v18 < 16) {
                    // 0x4570
                    // branch -> 0x4578
                    while (true) {
                        // 0x4578
                        fwrite((char *)(int32_t)"   ", 3, 1, (struct _IO_FILE *)g134);
                        v12 = g135 + 1;
                        g135 = v12;
                        if (v12 % 256 < 16) {
                          lab_0x4578:
                            // 0x4578
                            // branch -> 0x4578
                            continue;
                        }
                    }
                }
                // 0x459c
                fwrite("  ", 2, 1, (struct _IO_FILE *)g134);
                if (g136 != 0) {
                    // 0x45bc
                    g129 = 0;
                    g135 = *(int32_t *)&g39;
                    v13 = *(int32_t *)0x1e144;
                    g137 = v13;
                    v14 = (int32_t)*(char *)(g138 + g139);
                    if (v14 % 8 == 0) {
                        // 0x4600
                        return putc(64, (struct _IO_FILE *)g134);
                    }
                    // 0x45f0
                    return fputs((char *)*(int32_t *)(4 * v14 + v13), (struct _IO_FILE *)g134);
                }
                // 0x461c
                stream2 = g134;
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g137 = v4;
                g138 = v5;
                g139 = v6;
                g129 = v7;
                g130 = v8;
                g126 = v9;
                return putc(10, (struct _IO_FILE *)stream2);
            }
            // 0x453c
            v15 = v18;
            // branch -> 0x453c
        }
    }
    // 0x4570
    // branch -> 0x4578
    while (true) {
        // 0x4578
        fwrite((char *)(int32_t)"   ", 3, 1, (struct _IO_FILE *)g134);
        v12 = g135 + 1;
        g135 = v12;
        if (v12 % 256 < 16) {
            goto lab_0x4578;
        }
        // 0x459c
        fwrite("  ", 2, 1, (struct _IO_FILE *)g134);
        if (g136 != 0) {
            // 0x45bc
            g129 = 0;
            g135 = *(int32_t *)&g39;
            v13 = *(int32_t *)0x1e144;
            g137 = v13;
            v14 = (int32_t)*(char *)(g138 + g139);
            if (v14 % 8 == 0) {
                // 0x4600
                return putc(64, (struct _IO_FILE *)g134);
            }
            // 0x45f0
            return fputs((char *)*(int32_t *)(4 * v14 + v13), (struct _IO_FILE *)g134);
        }
        // 0x461c
        stream2 = g134;
        g134 = v1;
        g135 = v2;
        g136 = v3;
        g137 = v4;
        g138 = v5;
        g139 = v6;
        g129 = v7;
        g130 = v8;
        g126 = v9;
        return putc(10, (struct _IO_FILE *)stream2);
    }
}
 
// Address range: 0x4648 - 0x470b
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) {
    int32_t v1 = g135; // 0x4648
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    g134 = a1;
    g135 = a2;
    printf("File to write: ");
    int32_t result = read_line((struct _IO_FILE *)g33); // 0x466c
    char * file_path = (char *)result; // 0x4674_0
    if (*file_path != 0) {
        // 0x4680
        return (int32_t)fopen(file_path, "wb");
    }
    // 0x46ec
    g135 = v1;
    free(file_path);
    return result;
}
 
// Address range: 0x470c - 0x4867
char * get_incbin_data(void) {
    int32_t v1 = g135; // 0x470c
    int32_t v2 = g136; // 0x470c
    int32_t v3 = g137; // 0x470c
    int32_t v4 = g138; // 0x470c
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    char * found_char_pos = strchr(strstr((char *)g127, ".incbin"), 34); // 0x4724
    int32_t v6; // 0x484c
    if (found_char_pos == NULL) {
        // 0x47b8
        puts("err: no filename specified");
        // branch -> 0x4848
        // 0x4848
        g138 = 0;
        // branch -> 0x484c
        // 0x484c
        v6 = g138;
        g135 = v1;
        g136 = v2;
        g137 = v3;
        g138 = v4;
        g130 = v5;
        return (char *)v6;
    }
    int32_t str = (int32_t)found_char_pos + 1; // 0x4730
    char * found_char_pos2 = strchr((char *)str, 34); // 0x473c
    int32_t v7 = (int32_t)found_char_pos2; // 0x473c_4
    g135 = v7;
    if (found_char_pos2 == NULL) {
        // 0x47c8
        puts("err: invalid filename specification");
        // branch -> 0x4848
        // 0x4848
        g138 = 0;
        // branch -> 0x484c
    } else {
        int32_t v8 = v7 - str; // 0x474c
        g137 = v8;
        char * mem = malloc(v8 + 9); // 0x4754
        int32_t v9 = (int32_t)mem; // 0x4754_3
        g138 = v9;
        int32_t v10 = v9 + 8; // 0x475c
        g134 = v10;
        int32_t v11 = 0; // R9
        *(int32_t *)mem = 0;
        *(int32_t *)(g138 + 4) = v11;
        __aeabi_memcpy((char *)v10, (char *)str, g137);
        *(char *)(g137 + g134) = (char)v11;
        char * found_char_pos3 = strchr((char *)g135, 44); // 0x4788
        if (found_char_pos3 != NULL) {
            int32_t str2 = (int32_t)found_char_pos3 + 1; // 0x4794
            g136 = str2;
            char * found_char_pos4 = strchr((char *)str2, 44); // 0x47a0
            int32_t v12 = (int32_t)found_char_pos4; // 0x47a0_4
            g135 = v12;
            int32_t len;
            if (found_char_pos4 == NULL) {
                // 0x47d8
                len = strlen((char *)g136);
                // branch -> 0x47e4
            } else {
                // 0x47b0
                len = v12 - g136;
                // branch -> 0x47e4
            }
            int32_t v13 = get_value_from_string((char *)g136, len); // 0x47e8
            *(int32_t *)g138 = v13;
            if (v13 == -1) {
                // 0x4834
                // branch -> 0x483c
                // 0x483c
                puts((char *)(int32_t)"err: invalid offset");
                free((char *)g138);
                // branch -> 0x4848
                // 0x4848
                g138 = 0;
                // branch -> 0x484c
            } else {
                int32_t v14 = g135; // 0x47f8
                if (v14 != 0) {
                    int32_t str3 = v14 + 1; // 0x4800
                    g134 = str3;
                    int32_t len2 = strlen((char *)str3); // 0x4808
                    int32_t v15 = get_value_from_string((char *)g134, len2); // 0x4814
                    *(int32_t *)(g138 + 4) = v15;
                    if (v15 <= 0) {
                        // 0x483c
                        puts((char *)(int32_t)"err: invalid length");
                        free((char *)g138);
                        // branch -> 0x4848
                        // 0x4848
                        g138 = 0;
                        // branch -> 0x484c
                    }
                }
            }
            // 0x484c
            v6 = g138;
            g135 = v1;
            g136 = v2;
            g137 = v3;
            g138 = v4;
            g130 = v5;
            return (char *)v6;
        }
    }
    // 0x484c
    v6 = g138;
    g135 = v1;
    g136 = v2;
    g137 = v3;
    g138 = v4;
    g130 = v5;
    return (char *)v6;
}
 
// Address range: 0x4868 - 0x48c7
int32_t is_incbin(char * str) {
    int32_t v1 = g134; // bp-16
    int32_t v2 = g135; // 0x4868
    int32_t v3 = g130; // bp-8
    char * substr_pos = strstr(str, ".incbin"); // 0x4880
    g135 = (int32_t)substr_pos;
    if (substr_pos == NULL) {
        // 0x48bc
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return 0;
    }
    char * found_char_pos = strchr((char *)(int32_t)str, 64); // 0x4898
    uint32_t v4 = g135; // 0x489c
    int32_t v5 = 0; // 0x48b4
    if (found_char_pos == NULL) {
        // if_48b0_0_true
        v5 = 1;
        // branch -> after_if_48b0_0
    }
    // after_if_48b0_0
    g134 = v1;
    g135 = v2;
    g130 = v3;
    return v5 | (int32_t)(v4 < (int32_t)found_char_pos);
}
 
// Address range: 0x48c8 - 0x49d3
int32_t write_header_comment(int32_t * a1, struct _IO_FILE * stream) {
    int32_t v1;
    char * v2 = (char *)v1; // bp-40
    int32_t v3 = (int32_t)a1;
    int32_t v4 = g134; // 0x48c8
    int32_t v5 = g135; // 0x48c8
    int32_t v6 = g136; // 0x48c8
    int32_t v7 = g137; // 0x48c8
    int32_t v8 = g138; // 0x48c8
    int32_t v9 = g139; // 0x48c8
    int32_t v10 = g130; // bp-8
    g130 = &v10;
    int32_t v11 = *a1; // 0x48dc
    g134 = v11;
    int32_t v12 = *(int32_t *)(v3 + 4); // 0x48dc
    g139 = v12;
    g138 = (int32_t)stream;
    char * mem = malloc(1); // 0x48e4
    g137 = 0;
    g136 = (int32_t)&v2;
    v2 = mem;
    *mem = 0;
    int32_t v13 = g137;
    concatenate((int32_t *)&v2, &v13, ".incbin \"", v3 + 8);
    int32_t str;
    g135 = &str;
    sprintf((char *)&str, "0x%08x", v11);
    concatenate((int32_t *)&v2, &v13, (char *)&str, (int32_t)", ");
    sprintf((char *)&str, "0x%x", v12);
    concatenate((int32_t *)&v2, &v13, (char *)&str, 0);
    int32_t result = (int32_t)v2; // R4
    printf(">>>> @ replacing: %s\n", v2);
    g132 = result;
    fprintf(stream, "@ replacing %s\n", (char *)result);
    free((char *)result);
    g134 = v4;
    g135 = v5;
    g136 = v6;
    g137 = v7;
    g138 = v8;
    g139 = v9;
    g130 = v10;
    return result;
}
 
// Address range: 0x49d4 - 0x4aab
int32_t generate_incbin(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g134; // 0x49d4
    int32_t v2 = g135; // 0x49d4
    int32_t v3 = g136; // 0x49d4
    int32_t v4 = g137; // 0x49d4
    int32_t v5 = g138; // 0x49d4
    int32_t v6 = g139; // 0x49d4
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    g134 = a1;
    g138 = a3;
    g137 = a2;
    char * mem = malloc(1); // 0x49f0
    g135 = 0;
    char * v8; // bp-36
    g139 = (int32_t)&v8;
    int32_t v9; // bp-40
    g136 = &v9;
    v8 = mem;
    *mem = 0;
    v9 = g135;
    concatenate((int32_t *)&v8, &v9, ".incbin \"", a1);
    int32_t str;
    g134 = &str;
    sprintf((char *)&str, "0x%08x", a2);
    concatenate((int32_t *)&v8, &v9, (char *)&str, (int32_t)", ");
    sprintf((char *)&str, "0x%x", a3);
    concatenate((int32_t *)&v8, &v9, (char *)&str, 0);
    int32_t result = (int32_t)v8;
    g127 = result;
    g134 = v1;
    g135 = v2;
    g136 = v3;
    g137 = v4;
    g138 = v5;
    g139 = v6;
    g130 = v7;
    return result;
}
 
// Address range: 0x4aac - 0x4bdf
int32_t write_incbin_for_segment(int32_t a1, int32_t a2, int32_t a3, struct _IO_FILE * a4) {
    // 0x4aac
    int32_t v1;
    char * str = (char *)v1; // bp-60
    int32_t v2;
    char * v3 = (char *)v2; // bp-40
    int32_t v4 = g134; // 0x4aac
    int32_t v5 = g135; // 0x4aac
    int32_t v6 = g136; // 0x4aac
    int32_t v7 = g137; // 0x4aac
    int32_t v8 = g138; // 0x4aac
    int32_t v9 = g129; // 0x4aac
    int32_t v10 = g130; // 0x4aac
    int32_t v11 = v10; // bp-8
    g130 = &v11;
    g135 = a3;
    g138 = (int32_t)a4;
    g136 = a2;
    g134 = a1;
    int32_t result; // 0x4bc0_2
    if (a3 != 0) {
        char * mem = malloc(1); // 0x4ad4
        g137 = 0;
        g129 = (int32_t)&v3;
        int32_t v12;
        g139 = &v12;
        v3 = mem;
        *mem = 0;
        int32_t v13 = g137; // 0x4afc
        v12 = v13;
        concatenate((int32_t *)&v3, &v12, ".incbin \"", g134);
        int32_t v14 = (int32_t)&str;
        g134 = v14;
        sprintf((char *)&str, "0x%08x", g136);
        concatenate((int32_t *)&v3, &v12, (char *)&str, (int32_t)", ");
        sprintf((char *)&str, "0x%x", g135);
        concatenate((int32_t *)&v3, &v12, (char *)&str, 0);
        g134 = (int32_t)v3;
        generate_initial_indented_line((int32_t *)&str, NULL, v14, 0, (int32_t)(char *)g137, v13, 0);
        printf(">>>> %s%s\n", str, (char *)g134);
        fprintf((struct _IO_FILE *)g138, "%s%s\n", str, (char *)g134);
        free((char *)g134);
        free(str);
        result = (int32_t)str;
        // branch -> 0x4bbc
    } else {
        result = a1;
        v11 = v10;
    }
    // 0x4bbc
    g134 = v4;
    g135 = v5;
    g136 = v6;
    g137 = v7;
    g138 = v8;
    g129 = v9;
    g130 = v11;
    return result;
}
 
// Address range: 0x4be0 - 0x4db7
int32_t parse_incbin(int32_t * a1, int32_t a2, int32_t a3) {
    int32_t v1 = g134; // 0x4be0
    int32_t v2 = g135; // 0x4be0
    int32_t v3 = g136; // 0x4be0
    int32_t v4 = g138; // 0x4be0
    int32_t v5 = g139; // 0x4be0
    int32_t v6 = g129; // 0x4be0
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    g136 = (int32_t)a1;
    g139 = g133;
    g138 = a3;
    g134 = a2;
    g137 = 1;
    char * mem = malloc(1); // 0x4c04
    int32_t v8 = 0; // R2
    char * file_path = mem; // bp-40
    *mem = 0;
    int32_t v9 = v8; // bp-44
    int32_t v10 = g136 + 8; // bp-56
    concatenate((int32_t *)&file_path, &v9, (char *)a2, (int32_t)&g117);
    g134 = (int32_t)fopen(file_path, "rb");
    free(file_path);
    int32_t stream = g134; // 0x4c54
    if (stream == 0) {
        // 0x4d24
        puts("err: could not open file for reading");
        // branch -> 0x4d74
    } else {
        int32_t v11 = g136; // 0x4c5c
        int32_t offset = *(int32_t *)v11; // 0x4c5c
        int32_t v12; // 0x4ca0
        char * mem2; // 0x4cc0
        int32_t items_read; // 0x4ce8
        int32_t v13; // 0x4d88
        int32_t v14;
        int32_t v15; // 0x4cb0
        int32_t v16; // 0x4d04
        int32_t v17; // 0x4d08
        int32_t v18; // 0x4d0c
        int32_t size; // 0x4c90
        int32_t v19; // 0x4ce0
        int32_t v20; // 0x4cf4
        int32_t v21; // 0x4d04
        int32_t v22; // 0x4cb4
        if (offset != 0) {
            // 0x4c68
            if (fseek((struct _IO_FILE *)stream, offset, SEEK_SET) != 0) {
                // 0x4c7c
                fclose((struct _IO_FILE *)g134);
                // branch -> 0x4d6c
                // 0x4d6c
                puts((char *)(int32_t)"err: could not seek on file");
                g137 = 1;
                // branch -> 0x4d74
                // 0x4d74
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g138 = v4;
                g139 = v5;
                g129 = v6;
                g130 = v7;
                return g137;
            }
            // 0x4c68
            // branch -> 0x4c90
            // 0x4c90
            size = *(int32_t *)(g136 + 4);
            g135 = size;
            if (size != 0) {
                // 0x4cbc
                mem2 = malloc(size);
                g129 = (int32_t)mem2;
                if (mem2 == NULL) {
                    // 0x4d34
                    fclose((struct _IO_FILE *)g134);
                    // branch -> 0x4d6c
                    // 0x4d6c
                    puts((char *)(int32_t)"err: out of memory");
                    g137 = 1;
                    // branch -> 0x4d74
                    // 0x4d74
                    g134 = v1;
                    g135 = v2;
                    g136 = v3;
                    g138 = v4;
                    g139 = v5;
                    g129 = v6;
                    g130 = v7;
                    return g137;
                }
                // 0x4cd0
                v19 = g138;
                g137 = 1;
                items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
                g135 = items_read;
                v20 = *(int32_t *)(g136 + 4);
                g138 = v20;
                fclose((struct _IO_FILE *)g134);
                if (items_read == v20) {
                    // 0x4d04
                    v16 = g139;
                    v21 = *(int32_t *)v16;
                    v17 = g136;
                    v18 = g129;
                    if (v21 == 0) {
                        // 0x4d80
                        v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
                        v14 = v13;
                        // branch -> 0x4d8c
                    } else {
                        // 0x4d18
                        v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
                        // branch -> 0x4d8c
                    }
                    // 0x4d8c
                    g137 = v14;
                    free((char *)g129);
                    // branch -> 0x4d74
                } else {
                    // 0x4d48
                    printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
                    // branch -> 0x4d74
                }
                // 0x4d74
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g138 = v4;
                g139 = v5;
                g129 = v6;
                g130 = v7;
                return g137;
            }
            // 0x4c9c
            v12 = get_file_length((struct _IO_FILE *)g134);
            v9 = v12;
            if (v12 == 0) {
                // 0x4d5c
                fclose((struct _IO_FILE *)g134);
                // branch -> 0x4d6c
                // 0x4d6c
                puts((char *)(int32_t)"err: could not get file length for file");
                g137 = 1;
                // branch -> 0x4d74
                // 0x4d74
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g138 = v4;
                g139 = v5;
                g129 = v6;
                g130 = v7;
                return g137;
            }
            // 0x4cb0
            v15 = g136;
            v22 = v12 - *(int32_t *)v15;
            g135 = v22;
            *(int32_t *)(v15 + 4) = v22;
            // branch -> 0x4cbc
            // 0x4cbc
            mem2 = malloc(g135);
            g129 = (int32_t)mem2;
            if (mem2 == NULL) {
                // 0x4d34
                fclose((struct _IO_FILE *)g134);
                // branch -> 0x4d6c
                // 0x4d6c
                puts((char *)(int32_t)"err: out of memory");
                g137 = 1;
                // branch -> 0x4d74
                // 0x4d74
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g138 = v4;
                g139 = v5;
                g129 = v6;
                g130 = v7;
                return g137;
            }
            // 0x4cd0
            v19 = g138;
            g137 = 1;
            items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
            g135 = items_read;
            v20 = *(int32_t *)(g136 + 4);
            g138 = v20;
            fclose((struct _IO_FILE *)g134);
            if (items_read == v20) {
                // 0x4d04
                v16 = g139;
                v21 = *(int32_t *)v16;
                v17 = g136;
                v18 = g129;
                if (v21 == 0) {
                    // 0x4d80
                    v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
                    v14 = v13;
                    // branch -> 0x4d8c
                } else {
                    // 0x4d18
                    v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
                    // branch -> 0x4d8c
                }
                // 0x4d8c
                g137 = v14;
                free((char *)g129);
                // branch -> 0x4d74
            } else {
                // 0x4d48
                printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
                // branch -> 0x4d74
            }
            // 0x4d74
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g138 = v4;
            g139 = v5;
            g129 = v6;
            g130 = v7;
            return g137;
        }
        // 0x4c90
        size = *(int32_t *)(v11 + 4);
        g135 = size;
        if (size == 0) {
            // 0x4c9c
            v12 = get_file_length((struct _IO_FILE *)g134);
            v9 = v12;
            if (v12 == 0) {
                // 0x4d5c
                fclose((struct _IO_FILE *)g134);
                // branch -> 0x4d6c
                // 0x4d6c
                puts((char *)(int32_t)"err: could not get file length for file");
                g137 = 1;
                // branch -> 0x4d74
                // 0x4d74
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g138 = v4;
                g139 = v5;
                g129 = v6;
                g130 = v7;
                return g137;
            }
            // 0x4cb0
            v15 = g136;
            v22 = v12 - *(int32_t *)v15;
            g135 = v22;
            *(int32_t *)(v15 + 4) = v22;
            // branch -> 0x4cbc
            // 0x4cbc
            mem2 = malloc(g135);
            g129 = (int32_t)mem2;
            if (mem2 == NULL) {
                // 0x4d34
                fclose((struct _IO_FILE *)g134);
                // branch -> 0x4d6c
                // 0x4d6c
                puts((char *)(int32_t)"err: out of memory");
                g137 = 1;
                // branch -> 0x4d74
                // 0x4d74
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g138 = v4;
                g139 = v5;
                g129 = v6;
                g130 = v7;
                return g137;
            }
            // 0x4cd0
            v19 = g138;
            g137 = 1;
            items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
            g135 = items_read;
            v20 = *(int32_t *)(g136 + 4);
            g138 = v20;
            fclose((struct _IO_FILE *)g134);
            if (items_read == v20) {
                // 0x4d04
                v16 = g139;
                v21 = *(int32_t *)v16;
                v17 = g136;
                v18 = g129;
                if (v21 == 0) {
                    // 0x4d80
                    v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
                    v14 = v13;
                    // branch -> 0x4d8c
                } else {
                    // 0x4d18
                    v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
                    // branch -> 0x4d8c
                }
                // 0x4d8c
                g137 = v14;
                free((char *)g129);
                // branch -> 0x4d74
            } else {
                // 0x4d48
                printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
                // branch -> 0x4d74
            }
            // 0x4d74
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g138 = v4;
            g139 = v5;
            g129 = v6;
            g130 = v7;
            return g137;
        }
        // 0x4cbc
        mem2 = malloc(size);
        g129 = (int32_t)mem2;
        if (mem2 == NULL) {
            // 0x4d34
            fclose((struct _IO_FILE *)g134);
            // branch -> 0x4d6c
            // 0x4d6c
            puts((char *)(int32_t)"err: out of memory");
            g137 = 1;
            // branch -> 0x4d74
            // 0x4d74
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g138 = v4;
            g139 = v5;
            g129 = v6;
            g130 = v7;
            return g137;
        }
        // 0x4cd0
        v19 = g138;
        g137 = 1;
        items_read = fread(mem2, 1, g135, (struct _IO_FILE *)g134);
        g135 = items_read;
        v20 = *(int32_t *)(g136 + 4);
        g138 = v20;
        fclose((struct _IO_FILE *)g134);
        if (items_read == v20) {
            // 0x4d04
            v16 = g139;
            v21 = *(int32_t *)v16;
            v17 = g136;
            v18 = g129;
            if (v21 == 0) {
                // 0x4d80
                v13 = handle_incbin_data(v17, v18, v19, v16, v10, (char *)v8, v19, v9, (int32_t)file_path);
                v14 = v13;
                // branch -> 0x4d8c
            } else {
                // 0x4d18
                v14 = run_script_auto(v17, v18, (char *)v21, (struct _IO_FILE *)v19);
                // branch -> 0x4d8c
            }
            // 0x4d8c
            g137 = v14;
            free((char *)g129);
            // branch -> 0x4d74
        } else {
            // 0x4d48
            printf("err: could not read %u bytes from file\n", *(int32_t *)(g136 + 4));
            // branch -> 0x4d74
        }
        // 0x4d74
        g134 = v1;
        g135 = v2;
        g136 = v3;
        g138 = v4;
        g139 = v5;
        g129 = v6;
        g130 = v7;
        return g137;
    }
    // 0x4d74
    g134 = v1;
    g135 = v2;
    g136 = v3;
    g138 = v4;
    g139 = v5;
    g129 = v6;
    g130 = v7;
    return g137;
}
 
// Address range: 0x4db8 - 0x4e9b
int32_t validate_pointers(int32_t a1, uint32_t a2, int32_t a3) {
    // 0x4db8
    g127 = a1;
    g128 = a2;
    int32_t v1 = g134; // bp-24
    int32_t v2 = g135; // 0x4db8
    int32_t v3 = g136; // 0x4db8
    int32_t v4 = g137; // 0x4db8
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    g126 = 0;
    g131 = 0x203ffff;
    g133 = 4;
    int32_t v6 = 4; // 0x4dec
    // branch -> 0x4de0
    int32_t result; // 0x4e88
    while (true) {
        uint32_t v7 = v6 - 4; // 0x4de0
        g1 = v7 >= a2;
        g3 = v7 == a2;
        if (v7 < a2) {
            // 0x4e90
            g127 = g126;
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g137 = v4;
            g130 = v5;
            return g126;
        }
        int32_t v8 = g127 + v6; // 0x4dec
        g132 = 0;
        unsigned char v9 = *(char *)(v8 - 1); // 0x4df4
        int32_t v10 = v9; // 0x4df4
        g135 = v10;
        g1 = v9 > 8;
        g2 = v9 < 9;
        g3 = v9 == 9;
        if (v9 > 9) {
            result = 0;
            // 0x4e88
            g127 = result;
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g137 = v4;
            g130 = v5;
            return result;
        }
        int32_t v11 = (int32_t)*(char *)(v8 - 3); // 0x4e00
        g137 = v11;
        char v12 = *(char *)(v8 - 4); // 0x4e04
        char v13 = *(char *)(v8 - 2); // 0x4e08
        g136 = &g56;
        g134 = 256 * v11 | 0x1000000 * v10 | (int32_t)v12 | 0x10000 * (int32_t)v13;
        int32_t v14 = 4 * v10; // 0x4e1c
        g135 = v14;
        int32_t v15 = *(int32_t *)(v14 + (int32_t)&g56); // 0x4e20
        g135 = v15;
        ((int32_t (*)())(v15 + (int32_t)&g56))();
        if (g3) {
            // if_4e44_0_true
            g127 = 0;
            // branch -> after_if_4e44_0
        }
        int32_t v16 = g133 + 4; // 0x4e50
        g133 = v16;
        int32_t v17 = g134; // 0x4e54
        g1 = true;
        g3 = v17 == 0;
        if (v17 != 0) {
            // break -> after_if_4e44_0.dec_label_pc_4e88_crit_edge
            break;
        }
        v6 = v16;
        // continue -> 0x4de0
    }
    // after_if_4e44_0.dec_label_pc_4e88_crit_edge
    result = g132;
    // branch -> 0x4e88
    // 0x4e88
    g127 = result;
    g134 = v1;
    g135 = v2;
    g136 = v3;
    g137 = v4;
    g130 = v5;
    return result;
}
 
// Address range: 0x4e9c - 0x4ef3
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) {
    int32_t v1 = g135; // 0x4e9c
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    g135 = a2;
    g134 = a3;
    g136 = result;
    if (a2 == 0) {
        // if_4eb4_0_true
        g135 = v1;
        return result;
    }
    // after_if_4eb4_0
    g137 = 0;
    int32_t v3 = 0; // 0x4ec0
    // branch -> 0x4ebc
    while (true) {
        int32_t v4 = result + v3; // 0x4ec0
        char v5 = *(char *)v4; // 0x4ec0
        int32_t v6 = (int32_t)*(char *)(v4 + 1); // 0x4ec4
        g132 = v6;
        int32_t v7 = (int32_t)*(char *)(v4 + 2); // 0x4ec8
        g133 = v7;
        char v8 = *(char *)(v4 + 3); // 0x4ecc
        int32_t result2 = output_pointer(256 * v6 | (int32_t)v5 | 0x10000 * v7 | 0x1000000 * (int32_t)v8, (struct _IO_FILE *)a3); // 0x4ee0
        g127 = result2;
        int32_t v9 = g137 + 4; // 0x4ee4
        g137 = v9;
        uint32_t v10 = g135; // 0x4ee8
        g1 = v9 >= v10;
        g2 = v9 - v10 < 0;
        g3 = v9 == v10;
        if (v9 >= v10) {
            // 0x4ef0
            g134 = a5;
            g135 = a6;
            g136 = a7;
            g137 = a8;
            int32_t v11;
            g130 = v11;
            int32_t v12;
            ((int32_t (*)())v12)();
            return result2;
        }
        // 0x4ebc
        a3 = g134;
        v3 = v9;
        result = g136;
        // branch -> 0x4ebc
    }
}
 
// Address range: 0x4ef4 - 0x503b
int32_t output_pointer(int32_t a1, struct _IO_FILE * a2) {
    int32_t v1 = g134; // 0x4ef4
    int32_t v2 = g135; // 0x4ef4
    int32_t v3 = g136; // 0x4ef4
    int32_t v4 = g137; // 0x4ef4
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    int32_t v6;
    g136 = &v6;
    int32_t v7;
    g137 = &v7;
    g134 = (int32_t)a2;
    g135 = a1;
    int32_t v8;
    generate_initial_indented_line(&v6, &v7, g132, g133, v8, 0, 0);
    concatenate(&v6, &v7, ".4byte ", 0);
    int32_t v9 = g135; // 0x4f34
    int32_t format;
    int32_t result; // 0x5008
    if (v9 == 0) {
        // 0x4fe4
        printf(">>>> %s0\n", (char *)v6);
        format = (int32_t)"%s0\n";
        // branch -> 0x5000
    } else {
        // 0x4f3c
        int32_t str;
        if (g24 != 0) {
            int32_t v10 = find_symbol_for_address(v9); // 0x4f54
            if (v10 == 0) {
                // 0x4f50
                // branch -> 0x4f98
                // 0x4f98
                g136 = &str;
                sprintf((char *)&str, "0x%x", g135);
                concatenate(&v6, &v7, (char *)&str, 0);
                // branch -> 0x4fc4
            } else {
                // 0x4f64
                g137 = 0;
                int32_t v11 = *(int32_t *)v10; // 0x4f6c
                int32_t v12 = g135; // 0x4f78
                g135 = v12 - v11;
                int32_t v13 = &g120; // 0x4f8c
                if (v12 != v11) {
                    // if_4f80_0_true
                    v13 = (int32_t)" + ";
                    // branch -> after_if_4f80_0
                }
                // after_if_4f80_0
                concatenate(&v6, &v7, (char *)(v10 + 9), v13);
                int32_t v14 = g135; // 0x4f90
                if (v14 != 0) {
                    // 0x4f98
                    g136 = &str;
                    sprintf((char *)&str, "0x%x", v14);
                    concatenate(&v6, &v7, (char *)&str, 0);
                    // branch -> 0x4fc4
                }
            }
            // 0x4fc4
            printf(">>>> %s\n", (char *)v6);
            format = (int32_t)"%s\n";
            // branch -> 0x5000
            // 0x5000
            g132 = v6;
            g128 = format;
            fprintf((struct _IO_FILE *)g134, (char *)format);
            result = v6;
            free((char *)result);
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g137 = v4;
            g130 = v5;
            return result;
        }
        // 0x4f98
        g136 = &str;
        sprintf((char *)&str, "0x%x", v9);
        concatenate(&v6, &v7, (char *)&str, 0);
        // branch -> 0x4fc4
        // 0x4fc4
        printf(">>>> %s\n", (char *)v6);
        format = (int32_t)"%s\n";
        // branch -> 0x5000
    }
    // 0x5000
    g132 = v6;
    g128 = format;
    fprintf((struct _IO_FILE *)g134, (char *)format);
    result = v6;
    free((char *)result);
    g134 = v1;
    g135 = v2;
    g136 = v3;
    g137 = v4;
    g130 = v5;
    return result;
}
 
// Address range: 0x503c - 0x5343
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) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x503c
    int32_t v3 = g138; // 0x503c
    int32_t v4 = g130; // bp-8
    g130 = &v4;
    g135 = a2;
    g136 = (int32_t)a1;
    int32_t v5;
    int32_t v6;
    int32_t v7;
    int32_t v8;
    generate_initial_indented_line(&v5, NULL, v1, a4, v8, v7, v6);
    int32_t v9 = g136 + 8; // 0x5068
    int32_t v10 = g135; // 0x5074
    int32_t v11 = 1 - v10; // 0x5074
    g134 = 0;
    char * format3 = "%s.string \"%s\"\n"; // bp-88
    // branch -> 0x5234
    while (true) {
        int32_t v12 = v10; // 0x523c
        int32_t v13 = v11; // 0x5238
        int32_t v14 = 0; // 0x5238
        int32_t v15 = 0; // 0x5234
        int32_t v16 = 0; // 0x52b82
        // branch -> 0x5234
        while (true) {
          lab_0x5234_2:
            // 0x5234
            g137 = v13 - v14;
            g139 = v14 + v12;
            int32_t v17 = v15;
            // branch -> 0x50e0
            while (true) {
                // 0x50e0
                // branch -> 0x50e0
                int32_t v18; // 0x5118
                int32_t v19;
                int32_t v20;
                int32_t v21;
                int32_t v22;
                int32_t v23;
                int32_t v24; // 0x52b81
                int32_t v25; // 0x51c8
                while (true) {
                    int32_t v26 = g136; // 0x50e0
                    uint32_t v27 = *(int32_t *)(v26 + 4); // 0x50e0
                    uint32_t v28 = g134; // 0x50e4
                    int32_t n = v27 - v28; // 0x50e4
                    if (v27 <= v28) {
                        // 0x52b8
                        write_incbin_for_segment(v9, *(int32_t *)v26 + v16, v27 - v16, a3);
                        free((char *)v5);
                        g135 = v2;
                        g138 = v3;
                        return 0;
                    }
                    // 0x50ec
                    g129 = n;
                    char * found_byte_pos = memchr((char *)g139, 255, n); // 0x50fc
                    int32_t v29 = (int32_t)found_byte_pos; // 0x50fc_6
                    int32_t v30; // 0x51c8
                    if (found_byte_pos == NULL) {
                        // after_if_5104_0thread-pre-split
                        v30 = g129;
                        // branch -> after_if_5104_0
                    } else {
                        int32_t v31 = g137 + v29; // 0x5104
                        g129 = v31;
                        v30 = v31;
                        // branch -> after_if_5104_0
                    }
                    // after_if_5104_0
                    if (v30 < 1000) {
                        // 0x51c0
                        g135 = v10;
                        v25 = g134 + v30;
                        g134 = v25;
                        v24 = v16;
                        // branch -> 0x50d0
                    } else {
                        // 0x5110
                        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);
                        g138 = v18;
                        if (v18 != 0) {
                            // break -> 0x5128
                            break;
                        }
                        // continue -> 0x50e0
                        continue;
                    }
                  lab_0x50d0:
                    // 0x50d0
                    v12 = v10;
                    v13 = v11;
                    v14 = v25;
                    v15 = v17;
                    v16 = v24;
                    // branch -> 0x5234
                    goto lab_0x5234_2;
                }
                // 0x5128
                if (v17 == 0) {
                    // 0x5134
                    printf("String found:\n%s\n", (char *)v18);
                    uint32_t v32 = get_command((int32_t)"Keep string? ", (int32_t)&g125 & 0xffff | 0x20000); // 0x5154
                    g1 = v32 > 16;
                    g2 = v32 < 17;
                    g3 = v32 == 17;
                    if (v32 > 17) {
                        // 0x50d8
                        v17 = 0;
                        // branch -> 0x50e0
                        continue;
                    } else {
                        // 0x5160
                        g128 = &g57;
                        int32_t v33 = *(int32_t *)(4 * v32 + (int32_t)&g57); // 0x5168
                        g127 = v33;
                        ((int32_t (*)(int32_t, int32_t))(v33 + (int32_t)&g57))(v33, (int32_t)&g57);
                        if (g3) {
                            // if_519c_0_true
                            // branch -> after_if_519c_0
                        }
                        // after_if_519c_0
                        g137 = 0;
                        int32_t v34 = *(int32_t *)g136; // 0x51d8
                        g135 = v22;
                        write_incbin_for_segment(v21, v34 + v23, g134 - v23, (struct _IO_FILE *)v22);
                        printf(format);
                        g133 = g138;
                        fprintf((struct _IO_FILE *)g135, format2);
                        free((char *)g138);
                        int32_t v35 = g129 + g134; // 0x5220
                        g134 = v35;
                        g135 = v19;
                        v23 = v35;
                        // branch -> 0x5234
                        while (true) {
                            // 0x5234
                            v12 = v19;
                            v13 = v20;
                            v14 = v35;
                            v15 = g137;
                            // branch -> 0x5234
                            goto lab_0x5234_2;
                        }
                    }
                } else {
                    // 0x5258
                    g135 = v1;
                    write_incbin_for_segment(v9, *(int32_t *)g136 + v16, g134 - v16, a3);
                    printf(">>>> %s.string \"%s\"\n", (char *)v5, (char *)g138);
                    int32_t v36 = g138; // 0x5294
                    g133 = v36;
                    fprintf((struct _IO_FILE *)g135, format3, (char *)v5, (char *)v36);
                    free((char *)g138);
                    int32_t v37 = g129 + g134; // 0x52a4
                    g134 = v37;
                    g135 = v10;
                    v25 = v37;
                    v24 = v37;
                    // branch -> 0x50d0
                    goto lab_0x50d0;
                }
                while (true) {
                    // 0x5234
                    g137 = v13 - v14;
                    g139 = v14 + v12;
                    v17 = v15;
                    // branch -> 0x50e0
                    break;
                }
            }
        }
    }
}
 
// Address range: 0x5344 - 0x542b
int main() {
    int32_t v1 = (int32_t)a2;
    int32_t v2 = g135; // 0x5344
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g134 = v1;
    if (a1 != 4) {
        // 0x53b8
        // branch -> 0x53fc
        // 0x53fc
        fprintf((struct _IO_FILE *)(g33 + 168), (char *)(int32_t)"usage: %s <infile> <outfile> <directory>\n");
        g135 = v2;
        return 1;
    }
    struct _IO_FILE * file = fopen((char *)*(int32_t *)(v1 + 4), "r"); // 0x5364
    g135 = (int32_t)file;
    int32_t format; // 0x5400
    if (file == NULL) {
        // 0x53d0
        format = (int32_t)"error: could not open file %s for reading\n";
        // branch -> 0x53fc
    } else {
        struct _IO_FILE * file2 = fopen((char *)*(int32_t *)(g134 + 8), "w"); // 0x5380
        g136 = (int32_t)file2;
        if (file2 != NULL) {
            // 0x5390
            dump_incbins((struct _IO_FILE *)g135, file2, *(int32_t *)(g134 + 12));
            fclose((struct _IO_FILE *)g135);
            fclose((struct _IO_FILE *)g136);
            g135 = v2;
            return 0;
        }
        // 0x53e8
        format = (int32_t)"error: could not open file %s for writing\n";
        // branch -> 0x53fc
    }
    // 0x53fc
    fprintf((struct _IO_FILE *)(g33 + 168), (char *)format);
    g135 = v2;
    return 1;
}
 
// Address range: 0x542c - 0x55db
int32_t dump_incbins(struct _IO_FILE * stream, struct _IO_FILE * a2, int32_t a3) {
    int32_t v1 = g135; // 0x542c
    int32_t v2 = g136; // 0x542c
    int32_t v3 = g138; // 0x542c
    int32_t v4 = g130; // bp-8
    g130 = &v4;
    g134 = 0;
    g135 = (int32_t)a2;
    g136 = (int32_t)stream;
    int32_t v5 = 0; // bp-40
    int32_t result; // 0x55b0
    if (feof(stream) == 0) {
        // 0x5458
        g137 = 0;
        char * format = "%s\n"; // bp-64
        g129 = (int32_t)"==== %s\n";
        g138 = (int32_t)"%s\n";
        // branch -> 0x5564
        while (true) {
            int32_t v6 = read_line((struct _IO_FILE *)g136); // 0x5568
            g139 = v6;
            int32_t v7 = v6; // 0x557c
            if (g137 == 0) {
                // 0x54b0
                if (is_incbin((char *)v6) == 0) {
                    // 0x54b0
                    // branch -> 0x5578
                    // 0x5578
                    printf((char *)g129, (char *)g139);
                    fprintf((struct _IO_FILE *)g135, (char *)g138, (char *)g139);
                    // branch -> 0x5594
                } else {
                    // 0x54c0
                    printf("<<<< %s\n", (char *)g139);
                    g127 = g139;
                    char * v8 = get_incbin_data(); // 0x54d0
                    g134 = (int32_t)v8;
                    if (v8 == NULL) {
                        // 0x5514
                        printf(">>>> %s\n", (char *)g139);
                        fprintf((struct _IO_FILE *)g135, "%s\n", (char *)g139);
                        g137 = 0;
                        // branch -> 0x5594
                    } else {
                        // 0x54e0
                        g133 = &v5;
                        int32_t v9 = parse_incbin((int32_t *)v8, a3, g135); // 0x54f0
                        g137 = 0;
                        if (v9 != 1) {
                            // 0x5500
                            if (v9 == 2) {
                                // 0x5538
                                g137 = 1;
                                // branch -> 0x553c
                                // 0x553c
                                printf(">>>> %s\n", (char *)g139);
                                fprintf((struct _IO_FILE *)g135, format, (char *)g139);
                                // branch -> 0x5558
                            } else {
                                // 0x5508
                                if (v9 == 3) {
                                    // if_550c_0_true
                                    g137 = 1;
                                    // branch -> 0x5558
                                }
                            }
                          lab_0x5558:
                            // 0x5558
                            free((char *)g134);
                            // branch -> 0x5594
                            // 0x5594
                            free((char *)g139);
                            if (feof((struct _IO_FILE *)g136) != 0) {
                                // break -> 0x55ac
                                break;
                            }
                            // continue -> 0x5564
                            continue;
                        }
                        // 0x553c
                        printf(">>>> %s\n", (char *)g139);
                        fprintf((struct _IO_FILE *)g135, format, (char *)g139);
                        // branch -> 0x5558
                        goto lab_0x5558;
                    }
                    // 0x5594
                    free((char *)g139);
                    if (feof((struct _IO_FILE *)g136) != 0) {
                        // break -> 0x55ac
                        break;
                    }
                    // continue -> 0x5564
                    continue;
                }
              lab_0x5594:
                // 0x5594
                free((char *)g139);
                if (feof((struct _IO_FILE *)g136) != 0) {
                    // break -> 0x55ac
                    break;
                }
                // continue -> 0x5564
                continue;
            }
            // 0x5578
            printf((char *)g129, (char *)v7);
            fprintf((struct _IO_FILE *)g135, (char *)g138, (char *)g139);
            // branch -> 0x5594
            goto lab_0x5594;
        }
        // 0x55ac
        result = v5;
        // branch -> 0x55b0
    } else {
        // 0x542c
        result = g134;
        // branch -> 0x55b0
    }
    // 0x55b0
    free((char *)result);
    g135 = v1;
    g136 = v2;
    g138 = v3;
    return result;
}
 
// Address range: 0x55dc - 0x5693
int32_t script_get_expression_value(char * a1, int32_t a2, int32_t * a3, int32_t a4) {
    int32_t v1 = (int32_t)a1;
    int32_t v2 = (int32_t)a3;
    g132 = v2;
    g133 = a4;
    int32_t v3 = g134; // bp-16
    int32_t v4 = g135; // 0x55dc
    int32_t v5 = g130; // bp-8
    int32_t v6 = g126; // 0x55dc
    g130 = &v5;
    g135 = v1;
    g134 = v2;
    if (*a1 != 36) {
        // 0x5634
        if ((int32_t)convert_string_to_number(a1, 1) != 0) {
            // 0x5648
            return convert_string_to_number((char *)g135, 0);
        }
        // 0x5668
        g127 = (int32_t)"syntax error";
        g134 = v3;
        g135 = v4;
        g130 = v5;
        g126 = v6;
        return duplicate_string();
    }
    int32_t v7 = v1 + 1; // 0x55f8
    g132 = v7;
    int32_t v8 = find_script_variable((int32_t *)a2, (char *)v7); // 0x5604
    if (v8 == 0) {
        // 0x5658
        g127 = (int32_t)"unknown variable";
        g134 = v3;
        g135 = v4;
        g130 = v5;
        g126 = v6;
        return duplicate_string();
    }
    uint32_t v9 = ((int32_t)*(char *)v8 + 255) % 256; // 0x5618
    g128 = v9;
    if (v9 < 3) {
        // 0x5678
        *(int32_t *)g134 = *(int32_t *)(v8 + 4);
        g134 = v3;
        g135 = v4;
        g130 = v5;
        return 0;
    }
    // 0x5624
    g127 = (int32_t)"variable does not contain an integer";
    g134 = v3;
    g135 = v4;
    g130 = v5;
    g126 = v6;
    return duplicate_string();
}
 
// Address range: 0x5694 - 0x56f3
int32_t get_line_type(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2 = find_first_non_space((char *)g127); // 0x569c
    char v3 = *(char *)v2; // 0x56a0
    g128 = v3;
    g3 = v3 == 0;
    if (v3 == 0) {
        // 0x56c8
        g127 = 0;
        g130 = v1;
        return 0;
    }
    // 0x56ac
    if (v3 != 58) {
        // 0x56b4
        g3 = v3 == 36;
        int32_t result = v3 == 36 ? 1 : 4;
        g127 = result;
        g130 = v1;
        return result;
    }
    char v4 = *(char *)(v2 + 1); // 0x56d4
    g128 = v4;
    int32_t result2; // 0x56ec
    if (v4 == 36) {
        // after_if_56e0_0.thread
        g3 = false;
        result2 = 2;
        // branch -> after_if_56e8_0
    } else {
        // after_if_56e0_0
        g3 = v4 == 58;
        if (v4 == 58) {
            // if_56e8_0_true
            result2 = 3;
            // branch -> after_if_56e8_0
        } else {
            result2 = 0;
        }
    }
    // after_if_56e8_0
    g127 = result2;
    g130 = v1;
    return result2;
}
 
// Address range: 0x56f4 - 0x589b
int32_t run_script(int32_t a1, int32_t a2, struct _IO_FILE * a3, int32_t a4) {
    // 0x56f4
    int32_t v1;
    char * v2 = (char *)v1; // bp-40
    int32_t v3 = g134; // 0x56f4
    int32_t v4 = g135; // 0x56f4
    int32_t v5 = g138; // 0x56f4
    int32_t v6 = g130; // bp-8
    g130 = &v6;
    g138 = a1;
    g134 = (int32_t)a3;
    g139 = a2;
    printf("Script file: ");
    int32_t v7 = read_line((struct _IO_FILE *)g33); // 0x5720
    g137 = v7;
    char * file_path = (char *)v7; // 0x5728_0
    if (*file_path == 0) {
        // 0x57b8
        free(file_path);
        // branch -> 0x5870
        // 0x5870
        g135 = v4;
        g138 = v5;
        return 0;
    }
    // 0x5734
    g136 = (int32_t)fopen(file_path, "r");
    free((char *)g137);
    int32_t v8 = g136; // 0x5750
    if (v8 == 0) {
        // 0x57c8
        puts("err: could not open script file");
        // branch -> 0x5870
        // 0x5870
        g135 = v4;
        g138 = v5;
        return 0;
    }
    // 0x5758
    g135 = read_file_by_lines((struct _IO_FILE *)v8);
    fclose((struct _IO_FILE *)g136);
    int32_t v9;
    g133 = &v9;
    g137 = 0;
    int32_t v10 = g139; // 0x5778
    int32_t v11 = g135; // 0x577c
    v9 = 0;
    g139 = execute_script(g138, v10, v11);
    destroy_string_array((char *)g135, v10, v11, g133);
    int32_t v12 = v9; // 0x5794
    int32_t result; // 0x5870
    if (v12 == 0) {
        int32_t v13 = 0; // 0x5804
        if (0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2 != 0) {
            // 0x57f0
            write_header_comment((int32_t *)g138, (struct _IO_FILE *)g134);
            v13 = v9;
            // branch -> 0x57fc
        }
        // 0x57fc
        generate_initial_indented_line((int32_t *)&v2, NULL, v11, g133, (int32_t)v2, v13, v3);
        int32_t v14 = *(int32_t *)g139; // 0x5808
        int32_t v15 = v14; // R2
        int32_t v16 = (int32_t)v2;
        if (v14 != 0) {
            // 0x5818
            g135 = g139 + 4;
            // branch -> 0x582c
            while (true) {
                // 0x582c
                printf((char *)(int32_t)">>>> %s%s\n", (char *)v16, (char *)v14);
                int32_t v17 = *(int32_t *)(g135 - 4); // 0x5834
                g133 = v17;
                fprintf((struct _IO_FILE *)g134, (char *)(int32_t)"%s%s\n", v2, (char *)v17);
                int32_t v18 = g135; // 0x5848
                int32_t v19 = *(int32_t *)v18; // 0x5848
                v15 = v19;
                g135 = v18 + 4;
                int32_t v20 = (int32_t)v2;
                if (v19 != 0) {
                    // 0x582c
                    v14 = v19;
                    v16 = v20;
                    // branch -> 0x582c
                    continue;
                } else {
                    v16 = v20;
                }
            }
        }
        // 0x585c
        free((char *)v16);
        destroy_string_array((char *)g139, v16, v15, g133);
        result = 1;
        // branch -> 0x5870
    } else {
        // 0x57a0
        printf("err: %s\n", (char *)v12);
        free((char *)v9);
        result = g137;
        // branch -> 0x5870
    }
    // 0x5870
    g135 = v4;
    g138 = v5;
    return result;
}
 
// Address range: 0x589c - 0x5997
int32_t execute_script(int32_t a1, int32_t a2, int32_t a3) {
    // 0x589c
    g132 = a3;
    int32_t v1 = g134; // 0x589c
    int32_t v2 = g135; // 0x589c
    int32_t v3 = g136; // 0x589c
    int32_t v4 = g137; // 0x589c
    int32_t v5 = g138; // 0x589c
    int32_t v6 = g139; // 0x589c
    int32_t v7 = g129; // 0x589c
    int32_t v8 = g130; // bp-8
    g130 = &v8;
    g137 = a1;
    g136 = a2;
    int32_t v9 = 0; // bp-40
    g128 = 1;
    g134 = g133;
    g139 = a3;
    char * mem = calloc(4, 1); // 0x58c8
    g129 = &v9;
    g138 = (int32_t)mem;
    int32_t v10 = 0;
    // branch -> 0x593c
    while (true) {
        // branch -> 0x593c
        int32_t v11;
        int32_t v12; // 0x596c
        int32_t v13;
        int32_t v14;
        int32_t v15; // 0x593c
        while (true) {
            // 0x593c
            v15 = g134;
            int32_t * v16 = (int32_t *)v15; // 0x593c_0
            int32_t result; // 0x598c
            if (*v16 != 0) {
                // 0x5980
                destroy_string_array((char *)g138, g128, g132, v11);
                g138 = 0;
                result = 0;
                // branch -> 0x598c
                // 0x598c
                g127 = result;
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g137 = v4;
                g138 = v5;
                g139 = v6;
                g129 = v7;
                g130 = v8;
                return result;
            }
            int32_t v17 = g137; // 0x594c
            uint32_t v18 = *(int32_t *)(v17 + 4); // 0x594c
            g128 = v18;
            g1 = v9 >= v18;
            g3 = v9 == v18;
            if (v9 < v18) {
                // 0x598c
                result = g138;
                // branch -> 0x598c
                // 0x598c
                g127 = result;
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g137 = v4;
                g138 = v5;
                g139 = v6;
                g129 = v7;
                g130 = v8;
                return result;
            }
            // 0x5958
            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);
            g135 = v12;
            if (v12 != 0) {
                // break -> 0x597c
                break;
            }
            v11 = v15;
            // continue -> 0x593c
        }
        int32_t v19 = string_array_size((int32_t *)v12); // 0x58e4
        int32_t v20 = v19 + v10; // 0x58f0
        int32_t v21 = 4 * v20; // 0x58fc
        int32_t mem2 = (int32_t)realloc((char *)g138, v21 + 4); // 0x5904_5
        g138 = mem2;
        int32_t v22 = 4 * v19; // 0x5918
        g132 = v22;
        __aeabi_memcpy4(mem2 + 4 * v10, g135, v22);
        free((char *)g135);
        g128 = v20;
        *(int32_t *)(g138 + v21) = 0;
        v13 = v20;
        v10 = v20;
        v14 = v19;
        v11 = v15;
        // branch -> 0x593c
    }
}
 
// Address range: 0x5998 - 0x5aef
int32_t run_script_auto(int32_t a1, int32_t a2, char * file_path, struct _IO_FILE * a4) {
    // 0x5998
    int32_t v1;
    char * v2 = (char *)v1;
    g132 = (int32_t)file_path;
    int32_t v3 = (int32_t)a4;
    g133 = v3;
    int32_t v4 = g135; // 0x5998
    int32_t v5 = g138; // 0x5998
    int32_t v6 = g129; // 0x5998
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    g139 = a1;
    g136 = a2;
    g129 = 0;
    g128 = (int32_t)"r";
    g135 = v3;
    int32_t v8 = 0; // bp-40
    struct _IO_FILE * file = fopen(file_path, "r"); // 0x59c4
    g137 = (int32_t)file;
    if (file != NULL) {
        // 0x59d4
        g129 = read_file_by_lines(file);
        fclose((struct _IO_FILE *)g137);
        g133 = &v8;
        g138 = execute_script(g139, g136, g129);
        if (v8 == 0) {
            int32_t v9 = 0; // 0x5a60
            if (0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2 != 0) {
                // 0x5a48
                write_header_comment((int32_t *)g139, (struct _IO_FILE *)g135);
                v9 = v8;
                // branch -> 0x5a54
            }
            // 0x5a54
            g139 = 0;
            int32_t v10;
            generate_initial_indented_line((int32_t *)&v2, NULL, g132, g133, v10, (int32_t)v2, v9);
            int32_t v11 = *(int32_t *)g138; // 0x5a64
            int32_t v12 = v11; // R2
            int32_t v13 = (int32_t)v2;
            if (v11 != 0) {
                // 0x5a74
                g134 = g138 + 4;
                // branch -> 0x5a88
                while (true) {
                    // 0x5a88
                    printf((char *)(int32_t)">>>> %s%s\n", (char *)v13, (char *)v11);
                    int32_t v14 = *(int32_t *)(g134 - 4); // 0x5a90
                    g133 = v14;
                    fprintf((struct _IO_FILE *)g135, (char *)(int32_t)"%s%s\n", v2, (char *)v14);
                    int32_t v15 = g134; // 0x5aa4
                    int32_t v16 = *(int32_t *)v15; // 0x5aa4
                    v12 = v16;
                    g134 = v15 + 4;
                    int32_t v17 = (int32_t)v2;
                    if (v16 != 0) {
                        // 0x5a88
                        v11 = v16;
                        v13 = v17;
                        // branch -> 0x5a88
                        continue;
                    } else {
                        v13 = v17;
                    }
                }
            }
            // 0x5ab8
            free((char *)v13);
            destroy_string_array((char *)g138, v13, v12, g133);
            destroy_string_array((char *)g129, g128, g132, g133);
            // branch -> 0x5ad0
            // 0x5ad0
            g135 = v4;
            g138 = v5;
            g129 = v6;
            return g139;
        }
    }
    // 0x5a0c
    destroy_string_array((char *)g129, g128, g132, g133);
    printf("err: %s\n", (char *)v8);
    free((char *)v8);
    // branch -> 0x5ad0
    // 0x5ad0
    g135 = v4;
    g138 = v5;
    g129 = v6;
    return 1;
}
 
// Address range: 0x5af0 - 0x5fb3
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) {
    int32_t v1 = (int32_t)a4;
    g133 = v1;
    int32_t v2 = (int32_t)a14;
    int32_t v3 = g134; // 0x5af0
    int32_t v4 = g135; // 0x5af0
    int32_t v5 = g136; // 0x5af0
    int32_t v6 = g137; // 0x5af0
    int32_t v7 = g138; // 0x5af0
    int32_t v8 = g139; // 0x5af0
    int32_t v9 = g129; // 0x5af0
    int32_t v10 = g130; // bp-8
    g130 = &v10;
    g129 = a3;
    g135 = a1;
    g138 = v1;
    g134 = a2;
    g136 = string_array_size((int32_t *)a3);
    init_script_variables(a1, a2, *(int32_t *)a5);
    int32_t v11 = *(int32_t *)g138; // 0x5b34
    g128 = v11;
    g134 = 0;
    int32_t v12 = g136; // 0x5b3c
    int32_t v13 = 0; // 0x5f34
    if (v11 == 0) {
        // if_5b44_0_true
        v13 = 1;
        // branch -> after_if_5b44_0
    }
    // after_if_5b44_0
    int32_t mem2; // 0x5f48_5
    int32_t v14; // 0x5f64
    int32_t v15; // 0x5f78
    int32_t v16; // 0x5f78
    int32_t v17; // 0x5f5c
    if (v12 == 0) {
        // 0x5f2c
        g128 = 0;
        // branch -> 0x5f34
    } else {
        // 0x5b50
        g132 = 0;
        if (v11 == 0) {
            // 0x5b60
            g137 = g129 - 4;
            g139 = 0;
            g136 = 0;
            int32_t v18 = (int32_t)format;
            int32_t v19 = (int32_t)format2;
            int32_t v20 = 0; // 0x5c50
            // branch -> 0x5c50
            while (true) {
              lab_0x5c50:
                // 0x5c50
                g135 = v20 + 1;
                g127 = *(int32_t *)(4 * v20 + g129);
                uint32_t v21 = get_line_type(); // 0x5c5c67
                g1 = v21 > 3;
                g2 = v21 < 4;
                g3 = v21 == 4;
                int32_t v22; // 0x5f20
                int32_t v23; // 0x5e74
                int32_t v24; // 0x5f00
                if (v21 > 4) {
                    // 0x5e74
                    v23 = g136;
                    g134 = v23;
                    // branch -> 0x5f00
                } else {
                    while (true) {
                        // 0x5c68
                        g128 = &g58;
                        int32_t v25 = *(int32_t *)(4 * v21 + (int32_t)&g58); // 0x5c70
                        g127 = v25;
                        ((int32_t (*)(int32_t, int32_t))(v25 + (int32_t)&g58))(v25, (int32_t)&g58);
                        if (g3) {
                            // after_if_5c84_0
                            // branch -> after_if_5c88_0
                        }
                        // after_if_5c88_0
                        *(int32_t *)(g130 - 32) = 0;
                        int32_t v26 = *(int32_t *)(4 * g136 + g129); // 0x5c94
                        int32_t v27 = find_script_variable((int32_t *)a15, (char *)(find_first_non_space((char *)v26) + 2)); // 0x5ca4
                        int32_t len2; // 0x5d9c
                        char * mem3; // 0x5da4
                        int32_t v28; // R10
                        int32_t str3; // 0x5d90
                        int32_t v29; // 0x5dcc
                        int32_t v30; // 0x5e58
                        if (v27 == 0) {
                            // 0x5d7c
                            g127 = a8;
                            g126 = 0x5d84;
                            int32_t v31 = duplicate_string(); // 0x5d80
                            g138 = v31;
                            *(int32_t *)(g130 - 32) = v31;
                            str3 = g138;
                            if (str3 == 0) {
                                // 0x5d7c
                                v29 = 0;
                                // branch -> 0x5dcc
                              lab_0x5dcc:;
                                // 0x5dcc
                                int32_t v32; // 0x5f70
                                if (v29 == 0) {
                                    // 0x5dd4
                                    g138 = v2;
                                    int32_t str; // 0x5e24
                                    int32_t len; // 0x5e2c
                                    char * mem; // 0x5e34
                                    int32_t v33;
                                    if (g135 < *(int32_t *)(g130 - 36)) {
                                        // 0x5e20
                                        g127 = a7;
                                        g126 = 0x5e28;
                                        str = duplicate_string();
                                        g134 = str;
                                        len = strlen((char *)str);
                                        mem = malloc(len + 20);
                                        v28 = (int32_t)mem;
                                        g128 = v18;
                                        g135 = v33;
                                        g133 = g134;
                                        g132 = v33;
                                        sprintf(mem, format);
                                        free((char *)g134);
                                        v30 = g138;
                                        // branch -> 0x5e58
                                      lab_0x5e58_3:
                                        // 0x5e58
                                        *(int32_t *)v30 = v28;
                                        int32_t v34 = *(int32_t *)(g130 - 40); // 0x5e60
                                        g129 = v34;
                                        if (v28 == 0) {
                                            // 0x5e58
                                            g127 = *(int32_t *)(4 * g136 + v34);
                                            uint32_t v35 = get_line_type(); // 0x5c5c
                                            g1 = v35 > 3;
                                            g2 = v35 < 4;
                                            g3 = v35 == 4;
                                            if (v35 > 4) {
                                                // break -> 0x5e74
                                                break;
                                            }
                                            v21 = v35;
                                            // continue -> 0x5c68
                                            continue;
                                        } else {
                                            // 0x5f60
                                            v14 = g139;
                                            // branch -> 0x5f60
                                        }
                                        // 0x5f60
                                        g135 = 0;
                                        if (v14 == 0) {
                                            // 0x5f80
                                            free((char *)0);
                                            g134 = v3;
                                            g135 = v4;
                                            g136 = v5;
                                            g137 = v6;
                                            g138 = v7;
                                            g139 = v8;
                                            g129 = v9;
                                            g130 = v10;
                                            return 0;
                                        }
                                        // 0x5f6c
                                        v32 = v14;
                                        // branch -> 0x5f70
                                        while (true) {
                                            // 0x5f70
                                            free((char *)*(int32_t *)(4 * v32 - 4));
                                            v15 = g139;
                                            v16 = v15 - 1;
                                            g139 = v16;
                                            if (v15 == 1) {
                                                // 0x5f80
                                                // branch -> 0x5f80
                                                // 0x5f80
                                                free((char *)g135);
                                                g134 = v3;
                                                g135 = v4;
                                                g136 = v5;
                                                g137 = v6;
                                                g138 = v7;
                                                g139 = v8;
                                                g129 = v9;
                                                g130 = v10;
                                                return 0;
                                            }
                                          lab_0x5f70_3:
                                            // 0x5f70
                                            v32 = v16;
                                            // branch -> 0x5f70
                                        }
                                        // 0x5e74
                                        v23 = g136;
                                        g134 = v23;
                                        // branch -> 0x5f00
                                    } else {
                                        // 0x5de4
                                        g135 = v33;
                                        g134 = 1;
                                        int32_t v36 = v33; // 0x5dec
                                        // branch -> 0x5dec
                                        while (true) {
                                            // 0x5dec
                                            g127 = *(int32_t *)(4 * v36 + g129);
                                            int32_t v37 = get_line_type(); // 0x5df0
                                            if (v37 == 3) {
                                                int32_t v38 = g134; // 0x5e08
                                                g134 = v38 - 1;
                                                if (v38 == 1) {
                                                    int32_t v39 = g135 + 1; // 0x5e6c
                                                    g134 = v39;
                                                    v23 = v39;
                                                    // branch -> 0x5f00
                                                    // 0x5f00
                                                    v24 = *(int32_t *)g138;
                                                    g128 = v24;
                                                    g132 = v12;
                                                    v22 = 0;
                                                    if (v24 == 0) {
                                                      lab_if_5f10_0_true_2:
                                                        // if_5f10_0_true
                                                        v22 = 1;
                                                        // branch -> after_if_5f10_0
                                                    }
                                                  lab_after_if_5f10_0_2:
                                                    // after_if_5f10_0
                                                    if (v23 < v12) {
                                                        // 0x5be0
                                                        g136 = v23;
                                                        if (v24 == 0) {
                                                            // 0x5be0
                                                            v20 = v23;
                                                            // branch -> 0x5c50
                                                            goto lab_0x5c50;
                                                        }
                                                    }
                                                    int32_t v40 = g139; // 0x5f1c
                                                    g134 = v40;
                                                    if (v22 != 0) {
                                                        // 0x5f3c
                                                        mem2 = (int32_t)realloc(NULL, 4 * v40 + 4);
                                                        g128 = 0;
                                                        *(int32_t *)(4 * g134 + mem2) = 0;
                                                        g134 = v3;
                                                        g135 = v4;
                                                        g136 = v5;
                                                        g137 = v6;
                                                        g138 = v7;
                                                        g139 = v8;
                                                        g129 = v9;
                                                        g130 = v10;
                                                        return mem2;
                                                    }
                                                    v17 = v40;
                                                    // 0x5f5c
                                                    g139 = v17;
                                                    v14 = v17;
                                                    // branch -> 0x5f60
                                                    // 0x5f60
                                                    g135 = 0;
                                                    if (v14 == 0) {
                                                        // 0x5f80
                                                        free((char *)0);
                                                        g134 = v3;
                                                        g135 = v4;
                                                        g136 = v5;
                                                        g137 = v6;
                                                        g138 = v7;
                                                        g139 = v8;
                                                        g129 = v9;
                                                        g130 = v10;
                                                        return 0;
                                                    }
                                                    // 0x5f6c
                                                    // branch -> 0x5f70
                                                    while (true) {
                                                        // 0x5f70
                                                        free((char *)*(int32_t *)(4 * v14 - 4));
                                                        v15 = g139;
                                                        v16 = v15 - 1;
                                                        g139 = v16;
                                                        if (v15 != 1) {
                                                            goto lab_0x5f70_3;
                                                        }
                                                        // 0x5f80
                                                        // branch -> 0x5f80
                                                        // 0x5f80
                                                        free((char *)g135);
                                                        g134 = v3;
                                                        g135 = v4;
                                                        g136 = v5;
                                                        g137 = v6;
                                                        g138 = v7;
                                                        g139 = v8;
                                                        g129 = v9;
                                                        g130 = v10;
                                                        return 0;
                                                    }
                                                }
                                            } else {
                                                // 0x5dfc
                                                if (v37 == 2) {
                                                    // if_5e00_0_true
                                                    g134++;
                                                    // branch -> 0x5e10
                                                }
                                            }
                                            int32_t v41 = g135 + 1; // 0x5e14
                                            g135 = v41;
                                            if (v41 >= *(int32_t *)(g130 - 36)) {
                                                // break -> 0x5e20
                                                break;
                                            }
                                            v36 = v41;
                                            // continue -> 0x5dec
                                        }
                                        // 0x5e20
                                        g127 = a7;
                                        g126 = 0x5e28;
                                        str = duplicate_string();
                                        g134 = str;
                                        len = strlen((char *)str);
                                        mem = malloc(len + 20);
                                        v28 = (int32_t)mem;
                                        g128 = v18;
                                        g135 = v33;
                                        g133 = g134;
                                        g132 = v33;
                                        sprintf(mem, format);
                                        free((char *)g134);
                                        v30 = g138;
                                        // branch -> 0x5e58
                                        goto lab_0x5e58_3;
                                    }
                                  lab_0x5f00:
                                    // 0x5f00
                                    v24 = *(int32_t *)g138;
                                    g128 = v24;
                                    g132 = v12;
                                    if (v24 == 0) {
                                        goto lab_if_5f10_0_true_2;
                                    }
                                    v22 = 0;
                                    goto lab_after_if_5f10_0_2;
                                } else {
                                    int32_t v42 = g135; // 0x5c44
                                    g134 = v42;
                                    g138 = v2;
                                    v23 = v42;
                                    // branch -> 0x5f00
                                    goto lab_0x5f00;
                                }
                                // 0x5f60
                                g135 = 0;
                                int32_t v43; // 0x5f80
                                int32_t v44; // 0x5f90
                                if (v14 == 0) {
                                    v43 = 0;
                                    // 0x5f80
                                    free((char *)v43);
                                    g134 = v3;
                                    g135 = v4;
                                    g136 = v5;
                                    g137 = v6;
                                    g138 = v7;
                                    g139 = v8;
                                    g129 = v9;
                                    v44 = v10;
                                    g130 = v44;
                                    return 0;
                                }
                                // 0x5f6c
                                v32 = v14;
                                int32_t v45 = -4; // 0x5f70
                                // branch -> 0x5f70
                                while (true) {
                                    int32_t v46 = *(int32_t *)(4 * v32 + v45); // 0x5f70
                                    free((char *)v46);
                                    v15 = g139;
                                    v16 = v15 - 1;
                                    g139 = v16;
                                    if (v15 != 1) {
                                        goto lab_0x5f70_3;
                                    }
                                    int32_t v47 = g135;
                                    v43 = v47;
                                    // branch -> 0x5f80
                                    // 0x5f80
                                    free((char *)v43);
                                    g134 = v3;
                                    g135 = v4;
                                    g136 = v5;
                                    g137 = v6;
                                    g138 = v7;
                                    g139 = v8;
                                    g129 = v9;
                                    v44 = v10;
                                    g130 = v44;
                                    return 0;
                                }
                            }
                        } else {
                            int32_t str2 = *(int32_t *)(g130 - 32); // 0x5cb0
                            g138 = str2;
                            int32_t v48 = *(int32_t *)(v27 + 4); // 0x5cb4
                            if (str2 == 0) {
                                v29 = v48;
                                goto lab_0x5dcc;
                            }
                            // 0x5d98
                            len2 = strlen((char *)str2);
                            mem3 = malloc(len2 + 20);
                            g128 = v19;
                            g132 = g135;
                            g133 = g138;
                            v28 = (int32_t)mem3;
                            sprintf(mem3, format2);
                            free((char *)g138);
                            g138 = v2;
                            v30 = v2;
                            // branch -> 0x5e58
                            goto lab_0x5e58_3;
                        }
                        // 0x5d98
                        len2 = strlen((char *)str3);
                        mem3 = malloc(len2 + 20);
                        g128 = v19;
                        g132 = g135;
                        g133 = g138;
                        v28 = (int32_t)mem3;
                        sprintf(mem3, format2);
                        free((char *)g138);
                        g138 = v2;
                        v30 = v2;
                        // branch -> 0x5e58
                        goto lab_0x5e58_3;
                    }
                }
                // 0x5f00
                v24 = *(int32_t *)g138;
                g128 = v24;
                g132 = v12;
                if (v24 == 0) {
                    goto lab_if_5f10_0_true_2;
                }
                v22 = 0;
                goto lab_after_if_5f10_0_2;
            }
        }
    }
    // 0x5f34
    if (v13 != 0) {
        // 0x5f3c
        mem2 = (int32_t)realloc(NULL, 4);
        g128 = 0;
        *(int32_t *)(4 * g134 + mem2) = 0;
        g134 = v3;
        g135 = v4;
        g136 = v5;
        g137 = v6;
        g138 = v7;
        g139 = v8;
        g129 = v9;
        g130 = v10;
        return mem2;
    }
    v17 = 0;
    // 0x5f5c
    g139 = v17;
    v14 = v17;
    // branch -> 0x5f60
    // 0x5f60
    g135 = 0;
    if (v14 == 0) {
        // 0x5f80
        free((char *)0);
        g134 = v3;
        g135 = v4;
        g136 = v5;
        g137 = v6;
        g138 = v7;
        g139 = v8;
        g129 = v9;
        g130 = v10;
        return 0;
    }
    // 0x5f6c
    // branch -> 0x5f70
    while (true) {
        // 0x5f70
        free((char *)*(int32_t *)(4 * v14 - 4));
        v15 = g139;
        v16 = v15 - 1;
        g139 = v16;
        if (v15 != 1) {
            goto lab_0x5f70_3;
        }
        // 0x5f80
        // branch -> 0x5f80
        // 0x5f80
        free((char *)g135);
        g134 = v3;
        g135 = v4;
        g136 = v5;
        g137 = v6;
        g138 = v7;
        g139 = v8;
        g129 = v9;
        g130 = v10;
        return 0;
    }
}
 
// Address range: 0x5fb4 - 0x5fff
int32_t generate_script_error(char * str, int32_t a2) {
    int32_t v1 = g135; // 0x5fb4
    g135 = (int32_t)str;
    char * mem = malloc(strlen(str) + 20); // 0x5fcc
    sprintf(mem, "line %u: %s", a2, (char *)g135);
    free((char *)g135);
    g135 = v1;
    return (int32_t)mem;
}
 
// Address range: 0x6000 - 0x6047
int32_t script_loop_test(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5) {
    int32_t v1 = (int32_t)a3;
    g132 = v1;
    g133 = a4;
    int32_t v2 = g135; // 0x6000
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g134 = v1;
    g135 = a2;
    int32_t v4 = find_script_variable((int32_t *)a2, (char *)(find_first_non_space((char *)a1) + 2)); // 0x601c
    g1 = true;
    g2 = v4 < 0;
    g3 = v4 == 0;
    if (v4 != 0) {
        // if_6028_0_true
        g135 = v2;
        return *(int32_t *)(v4 + 4);
    }
    // after_if_6028_0
    g127 = (int32_t)"unknown variable";
    g126 = 0x6038;
    int32_t v5 = duplicate_string(); // 0x6034
    *(int32_t *)g134 = v5;
    g127 = 0;
    g134 = a5;
    int32_t v6;
    g135 = v6;
    int32_t v7;
    g130 = v7;
    int32_t v8;
    ((int32_t (*)(int32_t))v8)(0);
    return 0;
}
 
// Address range: 0x6048 - 0x61fb
// Used cryptographic patterns:
//  - rfc3548_Base_64_Encoding_with_URL_and_Filename_Safe_Alphabet (8-bit, little endian)
int32_t generate_script_output_line(char * a1, int32_t a2, int32_t * a3) {
    int32_t v1 = g134; // 0x6048
    int32_t v2 = g135; // 0x6048
    int32_t v3 = g138; // 0x6048
    int32_t v4 = g130; // bp-8
    g130 = &v4;
    g136 = (int32_t)a1;
    int32_t v5 = (int32_t)a3; // bp-48
    g139 = a2;
    char * mem = malloc(1); // 0x6064
    char * v6 = mem; // bp-40
    *mem = 0;
    int32_t v7 = 0; // bp-44
    int32_t str = g136; // 0x6078
    if (*(char *)str == 0) {
        // 0x61c0
        g135 = v2;
        g138 = v3;
        return (int32_t)v6;
    }
    // 0x6084
    g129 = (int32_t)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    // branch -> 0x608c
    while (true) {
        char * found_char_pos = strchr((char *)str, 36); // 0x6094
        int32_t v8 = (int32_t)found_char_pos; // 0x6094_4
        g134 = v8;
        if (found_char_pos == NULL) {
            // 0x61ac
            concatenate((int32_t *)&v6, &v7, (char *)g136, 0);
            // branch -> 0x61c0
            // 0x61c0
            g135 = v2;
            g138 = v3;
            return (int32_t)v6;
        }
        int32_t v9 = g136; // 0x60a4
        int32_t v10 = v8 - v9; // 0x60a4
        if (v8 == v9) {
            // branch -> 0x60f8
        } else {
            // 0x60ac
            g135 = v10;
            char * mem2 = realloc(v6, v10 + 1 + v7); // 0x60c0
            int32_t v11 = (int32_t)mem2; // 0x60c0_5
            int32_t v12 = v7; // 0x60c4
            g138 = v12;
            v6 = mem2;
            __aeabi_memcpy((char *)(v11 + v12), (char *)g136, g135);
            int32_t v13 = g138 + g135; // 0x60e0
            v7 = v13;
            *(char *)(v13 + v11) = 0;
            v8 = g134;
            // branch -> 0x60f8
        }
        int32_t v14 = v8 + 1; // 0x60fc
        g136 = v14;
        char v15 = *(char *)v14; // 0x60fc
        int32_t str2; // 0x611838
        if (v15 == 45) {
            // if_611c_0_true
            str2 = v8 + 2;
            g136 = str2;
            g137 = 1;
            // branch -> 0x6120
        } else {
            // after_if_6108_0
            g137 = 2;
            if (v15 == 43) {
                // 0x6110
                g137 = 0;
                int32_t v16 = v8 + 2; // 0x6118
                g136 = v16;
                str2 = v16;
                // branch -> 0x6120
            } else {
                str2 = v14;
            }
        }
        int32_t ini_seg_bytes = strspn((char *)str2, (char *)g129); // 0x6128
        g134 = ini_seg_bytes;
        char * mem3 = malloc(ini_seg_bytes + 1); // 0x6134
        g135 = (int32_t)mem3;
        __aeabi_memcpy(mem3, (char *)g136, g134);
        int32_t v17 = g135; // 0x614c
        *(char *)(g134 + v17) = 0;
        g138 = find_script_variable((int32_t *)g139, (char *)v17);
        free((char *)g135);
        int32_t v18 = g138; // 0x6168
        if (v18 == 0) {
            // 0x61cc
            free(v6);
            g127 = (int32_t)"unknown variable";
            *(int32_t *)v5 = duplicate_string();
            g135 = v2;
            g138 = v3;
            return 0;
        }
        int32_t v19 = *(int32_t *)v18; // 0x6170
        int32_t v20 = *(int32_t *)(v18 + 4); // 0x6170
        int32_t v21 = *(int32_t *)(v18 + 8); // 0x6170
        int32_t v22 = print_script_variable_contents(v19, v20, (char *)v21, g137 % 256, v5, v7, (int32_t)v6, v1); // 0x6178
        g135 = v22;
        concatenate((int32_t *)&v6, &v7, (char *)v22, 0);
        free((char *)g135);
        int32_t v23 = g134 + g136; // 0x619c
        g136 = v23;
        if (*(char *)v23 == 0) {
            // break -> 0x61c0
            break;
        }
        str = v23;
        // continue -> 0x608c
    }
    // 0x61c0
    g135 = v2;
    g138 = v3;
    return (int32_t)v6;
}
 
// Address range: 0x61fc - 0x6873
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) {
    int32_t v1 = (int32_t)a3;
    g132 = v1;
    g133 = a4;
    int32_t v2 = g134; // 0x61fc
    int32_t v3 = g135; // 0x61fc
    int32_t v4 = g136; // 0x61fc
    int32_t result = g138; // 0x61fc
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    uint32_t v6 = a1 % 256; // 0x6208
    g136 = a4;
    g135 = v1;
    g134 = a2;
    g1 = v6 > 6;
    g2 = v6 < 7;
    g3 = v6 == 7;
    if (v6 > 7) {
        // 0x67d8
        g134 = v2;
        g135 = v3;
        g136 = v4;
        g138 = result;
        g130 = v5;
        return result;
    }
    // 0x6220
    g128 = &g59;
    int32_t v7 = *(int32_t *)(4 * v6 + (int32_t)&g59); // 0x6228
    g127 = v7;
    ((int32_t (*)(int32_t, int32_t))(v7 + (int32_t)&g59))(v7, (int32_t)&g59);
    if (g3) {
        // if_624c_0_true
        // branch -> after_if_624c_0
    }
    int32_t mem = (int32_t)malloc(2 * g134 | 1); // 0x6258_3
    g138 = mem;
    if (g134 == 0) {
        // 0x67d8
        g134 = v2;
        g135 = v3;
        g136 = v4;
        g138 = result;
        g130 = v5;
        return mem;
    }
    // branch -> 0x6278
    while (true) {
        int32_t v8 = g135; // 0x6278
        g135 = v8 + 1;
        char v9 = *(char *)v8; // 0x6278
        sprintf((char *)mem, (char *)(int32_t)"%02hhx", v9);
        int32_t v10 = g134; // 0x6288
        g134 = v10 - 1;
        if (v10 == 1) {
            int32_t result2 = g138;
            // branch -> 0x67d8
            // 0x67d8
            g134 = v2;
            g135 = v3;
            g136 = v4;
            g138 = result;
            g130 = v5;
            return result2;
        }
        // 0x6278
        mem += 2;
        // branch -> 0x6278
    }
}
 
// Address range: 0x6874 - 0x69ef
int32_t script_parse_assignment_line(int32_t a1) {
    g127 = a1;
    int32_t v1 = g134; // 0x6874
    int32_t v2 = g135; // 0x6874
    int32_t v3 = g138; // 0x6874
    int32_t v4 = g130; // bp-8
    g130 = &v4;
    g135 = g128;
    int32_t v5 = split_by_spaces(); // 0x6884
    g134 = v5;
    g3 = v5 == 0;
    if (v5 == 0) {
        // 0x695c
        g127 = (int32_t)"syntax error in assignment statement";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g130 = v4;
        return duplicate_string();
    }
    int32_t v6 = g134; // 0x68b8
    int32_t v7;
    if (string_array_size((int32_t *)v5) > 1) {
        int32_t v8 = *(int32_t *)v6; // 0x68b8
        char v9 = *(char *)v8; // 0x68bc
        int32_t v10 = v6; // 0x694c
        if (v9 == 36) {
            int32_t v11 = validate_variable_name((char *)(v8 + 1)); // 0x68cc
            int32_t v12 = g134;
            if (v11 != 0) {
                int32_t v13 = v12 + 8; // 0x68dc
                g136 = v13;
                g139 = *(int32_t *)v12;
                int32_t nmemb = string_array_size((int32_t *)v13); // 0x68e4
                g138 = nmemb;
                char * mem = calloc(nmemb, 8); // 0x68f0
                g137 = (int32_t)mem;
                int32_t v14 = script_get_transforms_for_line((int32_t *)g136, g135, (int32_t *)mem); // 0x6904
                g136 = v14;
                if (v14 == 0) {
                    int32_t v15 = *(int32_t *)(g134 + 4); // 0x6914
                    int32_t v16;
                    int32_t v17 = script_get_initializer_value((char *)v15, &v16, (int32_t *)g135); // 0x6920
                    g136 = v17;
                    if (v17 == 0) {
                        // 0x6968
                        int32_t v18;
                        int32_t v19;
                        g136 = execute_transforms(v16, v19, v18, g137, g138);
                        free((char *)g137);
                        g132 = v18;
                        destroy_script_value(v16);
                        int32_t v20;
                        int32_t v21;
                        if (g136 == 0) {
                            char * v22 = (char *)(g139 + 1); // 0x69b8_0
                            if (*v22 != 0) {
                                // 0x69c4
                                assign_script_value((int32_t *)g135, v22, v21, v20);
                                // branch -> 0x69dc
                                // 0x69dc
                                destroy_string_array((char *)g134, g128, g132, g133);
                                // branch -> 0x6940
                                // 0x6940
                                g134 = v1;
                                g135 = v2;
                                g138 = v3;
                                return g136;
                            }
                        }
                        // 0x69a4
                        g128 = v20;
                        int32_t v23;
                        g132 = v23;
                        destroy_script_value(v21);
                        // branch -> 0x69dc
                        // 0x69dc
                        destroy_string_array((char *)g134, g128, g132, g133);
                        // branch -> 0x6940
                        // 0x6940
                        g134 = v1;
                        g135 = v2;
                        g138 = v3;
                        return g136;
                    }
                }
                // 0x6930
                destroy_string_array((char *)g134, g128, g132, g133);
                free((char *)g137);
                // branch -> 0x6940
                // 0x6940
                g134 = v1;
                g135 = v2;
                g138 = v3;
                return g136;
            }
            v10 = v12;
        }
        // 0x694c
        destroy_string_array((char *)v10, (int32_t)v9, g132, g133);
        v7 = (int32_t)"invalid variable for assignment";
        // branch -> 0x695c
    } else {
        // 0x68a4
        destroy_string_array((char *)v6, g128, g132, g133);
        v7 = (int32_t)"syntax error in assignment statement";
        // branch -> 0x695c
    }
    // 0x695c
    g127 = v7;
    g134 = v1;
    g135 = v2;
    g138 = v3;
    g130 = v4;
    return duplicate_string();
}
 
// Address range: 0x69f0 - 0x6b93
int32_t script_get_transforms_for_line(int32_t * a1, int32_t str4, int32_t * a3) {
    g128 = str4;
    int32_t v1 = (int32_t)a3;
    g132 = v1;
    int32_t v2 = g134; // 0x69f0
    int32_t v3 = g135; // 0x69f0
    int32_t v4 = g137; // 0x69f0
    int32_t v5 = g138; // 0x69f0
    int32_t v6 = g139; // 0x69f0
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    int32_t v8 = (int32_t)a1; // R6
    g137 = v1;
    int32_t str = *a1; // 0x6a04
    g135 = str;
    g138 = 0;
    int32_t result; // 0x6b58
    if (str == 0) {
        // 0x6b58
        result = g138;
        g134 = v2;
        g135 = v3;
        g137 = v4;
        g138 = v5;
        g139 = v6;
        g130 = v7;
        return result;
    }
    // 0x6a18
    g139 = 1;
    int32_t v9 = *(int32_t *)&g46; // 0x6a20
    g134 = v9;
    // branch -> 0x6a34
  lab_0x6a34:
    while (true) {
        char * found_char_pos = strchr((char *)str, 58); // 0x6a3c
        int32_t v10 = (int32_t)found_char_pos; // 0x6a3c_4
        int32_t str6; // 0x6b14
        int32_t len; // 0x6b28
        char * mem; // 0x6b30
        int32_t v11; // 0x6b3c
        int32_t v12; // 0x6b40
        if (found_char_pos == NULL) {
            // 0x6b64
            g127 = (int32_t)"syntax error";
            // branch -> 0x6b14
            // 0x6b14
            g126 = 0x6b18;
            str6 = duplicate_string();
            g135 = str6;
            if (str6 != 0) {
                // 0x6b24
                int32_t str2; // 0x6b24
                len = strlen((char *)str2);
                mem = malloc(len + 24);
                g138 = (int32_t)mem;
                v11 = g139;
                g132 = v11;
                v12 = g135;
                g133 = v12;
                g128 = (int32_t)"transform %u: %s";
                sprintf(mem, "transform %u: %s", v11, (char *)v12);
                free((char *)g135);
                // branch -> 0x6b58
            }
          lab_0x6b58:
            // 0x6b58
            result = g138;
            g134 = v2;
            g135 = v3;
            g137 = v4;
            g138 = v5;
            g139 = v6;
            g130 = v7;
            return result;
        }
        int32_t v13 = str4; // 0x6a48
        int32_t str3 = *(int32_t *)g134; // 0x6a4c
        str4 = str3;
        if (str3 == 0) {
            // 0x6b70
            g127 = (int32_t)"unknown transform";
            // branch -> 0x6b14
            // 0x6b14
            g126 = 0x6b18;
            str6 = duplicate_string();
            g135 = str6;
            if (str6 == 0) {
                // 0x6b58
                result = g138;
                g134 = v2;
                g135 = v3;
                g137 = v4;
                g138 = v5;
                g139 = v6;
                g130 = v7;
                return result;
            }
        } else {
            // 0x6a58
            g138 = v10 - g135;
            g136 = v13;
            g134 = &g47;
            // branch -> 0x6a74
            while (true) {
                int32_t len2 = strlen((char *)str3); // 0x6a78
                if (len2 == g138) {
                    // 0x6a84
                    g132 = len2;
                    if (strncmp((char *)str4, (char *)g135, len2) == 0) {
                        int32_t v14 = g136; // 0x6ab8
                        str4 = v14;
                        int32_t v15;
                        int32_t str5 = script_get_expression_value((char *)(v10 + 1), v14, &v15, g133); // 0x6ac4
                        g135 = str5;
                        if (str5 != 0) {
                            // 0x6b24
                            len = strlen((char *)str5);
                            mem = malloc(len + 24);
                            g138 = (int32_t)mem;
                            v11 = g139;
                            g132 = v11;
                            v12 = g135;
                            g133 = v12;
                            g128 = (int32_t)"transform %u: %s";
                            sprintf(mem, "transform %u: %s", v11, (char *)v12);
                            free((char *)g135);
                            // branch -> 0x6b58
                            // 0x6b58
                            result = g138;
                            g134 = v2;
                            g135 = v3;
                            g137 = v4;
                            g138 = v5;
                            g139 = v6;
                            g130 = v7;
                            return result;
                        }
                        // 0x6ad4
                        g139++;
                        *(int32_t *)g137 = *(int32_t *)g134;
                        g138 = 0;
                        *(int32_t *)(g137 + 4) = v15;
                        g137 += 8;
                        g134 = (int32_t)(char (**)[4])v9;
                        int32_t v16 = v8 + 4; // 0x6af8
                        v8 = v16;
                        int32_t v17 = *(int32_t *)v16; // 0x6af8
                        g135 = v17;
                        if (v17 == 0) {
                            // break (via goto) -> 0x6b58
                            goto lab_0x6b58;
                        }
                        str = v17;
                        // continue (via goto) -> 0x6a34
                        goto lab_0x6a34;
                        // 0x6b58
                        result = g138;
                        g134 = v2;
                        g135 = v3;
                        g137 = v4;
                        g138 = v5;
                        g139 = v6;
                        int32_t v18 = v7; // 0x6b60
                        g130 = v18;
                        return result;
                    }
                }
                int32_t v19 = g134; // 0x6a9c
                int32_t v20 = *(int32_t *)(v19 + 4); // 0x6a9c
                str4 = v20;
                g134 = v19 + 8;
                if (v20 == 0) {
                    // break -> 0x6b08
                    break;
                }
                str3 = v20;
                // continue -> 0x6a74
            }
            // 0x6b08
            g138 = 0;
            g127 = (int32_t)"unknown transform";
            // branch -> 0x6b14
            // 0x6b14
            g126 = 0x6b18;
            str6 = duplicate_string();
            g135 = str6;
            if (str6 == 0) {
                // 0x6b58
                result = g138;
                g134 = v2;
                g135 = v3;
                g137 = v4;
                g138 = v5;
                g139 = v6;
                g130 = v7;
                return result;
            }
        }
        // 0x6b24
        len = strlen((char *)str6);
        mem = malloc(len + 24);
        g138 = (int32_t)mem;
        v11 = g139;
        g132 = v11;
        v12 = g135;
        g133 = v12;
        g128 = (int32_t)"transform %u: %s";
        sprintf(mem, "transform %u: %s", v11, (char *)v12);
        free((char *)g135);
        // branch -> 0x6b58
        // 0x6b58
        result = g138;
        g134 = v2;
        g135 = v3;
        g137 = v4;
        g138 = v5;
        g139 = v6;
        g130 = v7;
        return result;
    }
}
 
// Address range: 0x6b94 - 0x6db7
int32_t script_get_initializer_value(char * a1, int32_t * a2, int32_t * a3) {
    int32_t v1 = (int32_t)a1;
    int32_t v2 = (int32_t)a3;
    g132 = v2;
    int32_t v3 = g134; // 0x6b94
    int32_t v4 = g135; // 0x6b94
    int32_t v5 = g137; // 0x6b94
    int32_t v6 = g130; // bp-8
    g130 = &v6;
    g135 = v2;
    int32_t v7 = v1 + 1; // 0x6ba8
    g136 = v7;
    char v8 = *a1; // 0x6ba8
    g137 = v8;
    g134 = (int32_t)a2;
    if (v8 != 58) {
        // if_6bb4_0_true
        g136 = v1;
        v7 = v1;
        // branch -> after_if_6bb4_0
    }
    char * v9 = (char *)v7; // 0x6bb8_0
    char v10 = *v9; // 0x6bb8
    int32_t v11; // 0x6d64
    int32_t v12; // 0x6d30
    int32_t v13; // 0x6d54
    int32_t v14;
    int32_t v15;
    int32_t v16; // 0x6cb0
    int32_t result; // 0x6cf8
    int32_t v17; // 0x6c60_0
    int32_t v18; // 0x6d04
    int32_t v19; // 0x6d08
    int32_t v20; // 0x6d20
    int32_t v21; // 0x6d28
    int32_t v22; // 0x6d40
    int32_t v23; // 0x6d48
    int32_t v24; // 0x6d48
    if (v10 == 36) {
        int32_t v25 = find_script_variable(a3, (char *)(v7 + 1)); // 0x6bcc
        if (v25 == 0) {
            // 0x6c28
            g127 = (int32_t)"variable does not exist";
            // branch -> 0x6cf0
            // 0x6cf0
            g126 = 0x6cf4;
            result = duplicate_string();
            // branch -> 0x6cf8
            // 0x6cf8
            g134 = v3;
            g135 = v4;
            g137 = v5;
            g130 = v6;
            return result;
        }
        int32_t v26 = *(int32_t *)v25; // 0x6bd8
        int32_t v27 = *(int32_t *)(v25 + 4); // 0x6bd8
        int32_t v28 = *(int32_t *)(v25 + 8); // 0x6bd8
        int32_t v29;
        copy_script_value((char *)&v29, (char)v26, v27, (char *)v28);
        int32_t v30;
        if (g137 == 58) {
            // 0x6c60
            v17 = v15;
            if ((v17 + 255) % 256 < 3) {
                // 0x6ca4
                g137 = v14;
                if (v14 < 0) {
                    // 0x6cdc
                    g127 = (int32_t)"negative read amount";
                    // branch -> 0x6cf0
                } else {
                    // 0x6cb0
                    v16 = g135;
                    if (*(int32_t *)v16 != 0) {
                        // 0x6cbc
                        if (*(char *)*(int32_t *)*(int32_t *)(v16 + 4) == 0) {
                            // 0x6d04
                            v18 = *(int32_t *)(v16 + 8);
                            g132 = v18;
                            v19 = *(int32_t *)(v18 + 4);
                            if (v19 < v14) {
                                // 0x6d14
                                g127 = (int32_t)"not enough data to read";
                                // branch -> 0x6cf0
                                // 0x6cf0
                                g126 = 0x6cf4;
                                result = duplicate_string();
                                // branch -> 0x6cf8
                            } else {
                                // 0x6d20
                                v20 = *(int32_t *)v18;
                                v21 = *(int32_t *)(v18 + 8);
                                v12 = script_transform_copy((char)v20, v19, (char *)v21, v14);
                                g136 = v12;
                                if (v12 == 0) {
                                    // 0x6d40
                                    v22 = *(int32_t *)(g135 + 8);
                                    v23 = *(int32_t *)(v22 + 4);
                                    v24 = *(int32_t *)(v22 + 8);
                                    v13 = script_transform_skip((char)*(int32_t *)v22, v23, v24, g137);
                                    g136 = v13;
                                    if (v13 == 0) {
                                        // 0x6d78
                                        assign_script_value((int32_t *)g135, (char *)&g120, v15, v14);
                                        // branch -> 0x6c9c
                                        // 0x6c9c
                                        result = 0;
                                        // branch -> 0x6cf8
                                    } else {
                                        // 0x6d64
                                        v11 = g134;
                                        g128 = *(int32_t *)(v11 + 4);
                                        g132 = *(int32_t *)(v11 + 8);
                                        destroy_script_value(*(int32_t *)v11);
                                        *(int32_t *)(g134 + 8) = 0;
                                        result = g136;
                                        // branch -> 0x6cf8
                                    }
                                    // 0x6cf8
                                    g134 = v3;
                                    g135 = v4;
                                    g137 = v5;
                                    g130 = v6;
                                    return result;
                                }
                                result = v12;
                            }
                            // 0x6cf8
                            g134 = v3;
                            g135 = v4;
                            g137 = v5;
                            g130 = v6;
                            return result;
                        }
                    }
                    // 0x6cd0
                    g127 = (int32_t)"internal state error: $ not found";
                    // branch -> 0x6cf0
                }
                // 0x6cf0
                g126 = 0x6cf4;
                result = duplicate_string();
                // branch -> 0x6cf8
                // 0x6cf8
                g134 = v3;
                g135 = v4;
                g137 = v5;
                g130 = v6;
                return result;
            }
            // 0x6c74
            g132 = v30;
            destroy_script_value(v17);
            g127 = (int32_t)"type mismatch";
            // branch -> 0x6cf0
            // 0x6cf0
            g126 = 0x6cf4;
            result = duplicate_string();
            // branch -> 0x6cf8
        } else {
            // 0x6c8c
            *(int32_t *)(g134 + 8) = v30;
            // branch -> 0x6c9c
            // 0x6c9c
            result = 0;
            // branch -> 0x6cf8
        }
        // 0x6cf8
        g134 = v3;
        g135 = v4;
        g137 = v5;
        g130 = v6;
        return result;
    }
    // 0x6c00
    g128 = 3;
    if (v8 == 58) {
        // after_if_6c10_0
        v15 = 3;
        if (v10 == 0) {
            // 0x6c1c
            // branch -> 0x6c54
            v14 = *(int32_t *)(*(int32_t *)(v2 + 8) + 4);
            // 0x6c60
            v17 = v15;
            if ((v17 + 255) % 256 < 3) {
                // 0x6ca4
                g137 = v14;
                if (v14 < 0) {
                    // 0x6cdc
                    g127 = (int32_t)"negative read amount";
                    // branch -> 0x6cf0
                } else {
                    // 0x6cb0
                    v16 = g135;
                    if (*(int32_t *)v16 != 0) {
                        // 0x6cbc
                        if (*(char *)*(int32_t *)*(int32_t *)(v16 + 4) == 0) {
                            // 0x6d04
                            v18 = *(int32_t *)(v16 + 8);
                            g132 = v18;
                            v19 = *(int32_t *)(v18 + 4);
                            if (v19 < v14) {
                                // 0x6d14
                                g127 = (int32_t)"not enough data to read";
                                // branch -> 0x6cf0
                                // 0x6cf0
                                g126 = 0x6cf4;
                                result = duplicate_string();
                                // branch -> 0x6cf8
                            } else {
                                // 0x6d20
                                v20 = *(int32_t *)v18;
                                v21 = *(int32_t *)(v18 + 8);
                                v12 = script_transform_copy((char)v20, v19, (char *)v21, v14);
                                g136 = v12;
                                if (v12 == 0) {
                                    // 0x6d40
                                    v22 = *(int32_t *)(g135 + 8);
                                    v23 = *(int32_t *)(v22 + 4);
                                    v24 = *(int32_t *)(v22 + 8);
                                    v13 = script_transform_skip((char)*(int32_t *)v22, v23, v24, g137);
                                    g136 = v13;
                                    if (v13 == 0) {
                                        // 0x6d78
                                        assign_script_value((int32_t *)g135, (char *)&g120, v15, v14);
                                        // branch -> 0x6c9c
                                        // 0x6c9c
                                        result = 0;
                                        // branch -> 0x6cf8
                                    } else {
                                        // 0x6d64
                                        v11 = g134;
                                        g128 = *(int32_t *)(v11 + 4);
                                        g132 = *(int32_t *)(v11 + 8);
                                        destroy_script_value(*(int32_t *)v11);
                                        *(int32_t *)(g134 + 8) = 0;
                                        result = g136;
                                        // branch -> 0x6cf8
                                    }
                                    // 0x6cf8
                                    g134 = v3;
                                    g135 = v4;
                                    g137 = v5;
                                    g130 = v6;
                                    return result;
                                }
                                result = v12;
                            }
                            // 0x6cf8
                            g134 = v3;
                            g135 = v4;
                            g137 = v5;
                            g130 = v6;
                            return result;
                        }
                    }
                    // 0x6cd0
                    g127 = (int32_t)"internal state error: $ not found";
                    // branch -> 0x6cf0
                }
                // 0x6cf0
                g126 = 0x6cf4;
                result = duplicate_string();
                // branch -> 0x6cf8
                // 0x6cf8
                g134 = v3;
                g135 = v4;
                g137 = v5;
                g130 = v6;
                return result;
            }
            // 0x6c74
            g132 = 0;
            destroy_script_value(v17);
            g127 = (int32_t)"type mismatch";
            // branch -> 0x6cf0
            // 0x6cf0
            g126 = 0x6cf4;
            result = duplicate_string();
            // branch -> 0x6cf8
            // 0x6cf8
            g134 = v3;
            g135 = v4;
            g137 = v5;
            g130 = v6;
            return result;
        }
    } else {
        // after_if_6c10_0.thread
        v15 = 3;
        // branch -> 0x6c34
    }
    // 0x6c34
    if ((int32_t)convert_string_to_number(v9, 1) == 0) {
        // 0x6ce8
        g127 = (int32_t)"syntax error";
        // branch -> 0x6cf0
        // 0x6cf0
        g126 = 0x6cf4;
        result = duplicate_string();
        // branch -> 0x6cf8
        // 0x6cf8
        g134 = v3;
        g135 = v4;
        g137 = v5;
        g130 = v6;
        return result;
    }
    int32_t v31 = convert_string_to_number((char *)g136, 0); // 0x6c50_3
    // branch -> 0x6c54
    // 0x6c54
    if (g137 == 58) {
        v14 = v31;
        // 0x6c60
        v17 = v15;
        if ((v17 + 255) % 256 < 3) {
            // 0x6ca4
            g137 = v14;
            if (v14 < 0) {
                // 0x6cdc
                g127 = (int32_t)"negative read amount";
                // branch -> 0x6cf0
            } else {
                // 0x6cb0
                v16 = g135;
                if (*(int32_t *)v16 != 0) {
                    // 0x6cbc
                    if (*(char *)*(int32_t *)*(int32_t *)(v16 + 4) == 0) {
                        // 0x6d04
                        v18 = *(int32_t *)(v16 + 8);
                        g132 = v18;
                        v19 = *(int32_t *)(v18 + 4);
                        if (v19 < v14) {
                            // 0x6d14
                            g127 = (int32_t)"not enough data to read";
                            // branch -> 0x6cf0
                            // 0x6cf0
                            g126 = 0x6cf4;
                            result = duplicate_string();
                            // branch -> 0x6cf8
                        } else {
                            // 0x6d20
                            v20 = *(int32_t *)v18;
                            v21 = *(int32_t *)(v18 + 8);
                            v12 = script_transform_copy((char)v20, v19, (char *)v21, v14);
                            g136 = v12;
                            if (v12 == 0) {
                                // 0x6d40
                                v22 = *(int32_t *)(g135 + 8);
                                v23 = *(int32_t *)(v22 + 4);
                                v24 = *(int32_t *)(v22 + 8);
                                v13 = script_transform_skip((char)*(int32_t *)v22, v23, v24, g137);
                                g136 = v13;
                                if (v13 == 0) {
                                    // 0x6d78
                                    assign_script_value((int32_t *)g135, (char *)&g120, v15, v14);
                                    // branch -> 0x6c9c
                                    // 0x6c9c
                                    result = 0;
                                    // branch -> 0x6cf8
                                } else {
                                    // 0x6d64
                                    v11 = g134;
                                    g128 = *(int32_t *)(v11 + 4);
                                    g132 = *(int32_t *)(v11 + 8);
                                    destroy_script_value(*(int32_t *)v11);
                                    *(int32_t *)(g134 + 8) = 0;
                                    result = g136;
                                    // branch -> 0x6cf8
                                }
                                // 0x6cf8
                                g134 = v3;
                                g135 = v4;
                                g137 = v5;
                                g130 = v6;
                                return result;
                            }
                            result = v12;
                        }
                        // 0x6cf8
                        g134 = v3;
                        g135 = v4;
                        g137 = v5;
                        g130 = v6;
                        return result;
                    }
                }
                // 0x6cd0
                g127 = (int32_t)"internal state error: $ not found";
                // branch -> 0x6cf0
            }
            // 0x6cf0
            g126 = 0x6cf4;
            result = duplicate_string();
            // branch -> 0x6cf8
            // 0x6cf8
            g134 = v3;
            g135 = v4;
            g137 = v5;
            g130 = v6;
            return result;
        }
        // 0x6c74
        g132 = 0;
        destroy_script_value(v17);
        g127 = (int32_t)"type mismatch";
        // branch -> 0x6cf0
        // 0x6cf0
        g126 = 0x6cf4;
        result = duplicate_string();
        // branch -> 0x6cf8
    } else {
        // 0x6c8c
        *(int32_t *)(g134 + 8) = 0;
        // branch -> 0x6c9c
        // 0x6c9c
        result = 0;
        // branch -> 0x6cf8
    }
    // 0x6cf8
    g134 = v3;
    g135 = v4;
    g137 = v5;
    g130 = v6;
    return result;
}
 
// Address range: 0x6db8 - 0x6e4b
int32_t init_script_variables(int32_t a1, int32_t a2, int32_t a3) {
    // 0x6db8
    g132 = a3;
    int32_t v1 = g135; // 0x6db8
    int32_t v2 = g138; // 0x6db8
    g135 = a3;
    g138 = a2;
    char * mem = malloc(12); // 0x6dd0
    int32_t result = (int32_t)mem; // R4
    *(int32_t *)mem = 1;
    int32_t mem2 = (int32_t)malloc(4); // 0x6de4_3
    *(int32_t *)(result + 4) = mem2;
    char * mem3 = malloc(1); // 0x6df4
    *(int32_t *)mem2 = (int32_t)mem3;
    *mem3 = 0;
    int32_t mem4 = (int32_t)calloc(1, 12); // 0x6e0c_5
    *(int32_t *)(result + 8) = mem4;
    uint32_t v3 = *(int32_t *)(a1 + 4); // 0x6e18
    uint32_t v4 = g135; // 0x6e1c
    int32_t v5 = v3 - v4; // 0x6e1c
    int32_t size = v3 < v4 ? v5 & -0x10000 : v5; // 0x6e1c
    g1 = true;
    g3 = size == 0;
    *(int32_t *)(mem4 + 4) = size;
    if (size != 0) {
        char * mem5 = malloc(size); // 0x6e30
        *(int32_t *)(mem4 + 8) = (int32_t)mem5;
        int32_t v6 = *(int32_t *)(mem4 + 4); // 0x6e3c
        g132 = v6;
        __aeabi_memcpy(mem5, (char *)(g138 + g135), v6);
        // branch -> 0x6e44
    }
    // 0x6e44
    g127 = result;
    g135 = v1;
    g138 = v2;
    return result;
}
 
// Address range: 0x6e4c - 0x6eab
int32_t find_script_variable(int32_t * a1, char * str) {
    int32_t v1 = (int32_t)a1;
    int32_t v2 = g134; // bp-32
    int32_t v3 = g135; // 0x6e4c
    int32_t v4 = g138; // 0x6e4c
    int32_t v5 = g130; // bp-8
    g138 = v1;
    int32_t v6 = *a1; // 0x6e5c
    if (v6 == 0) {
        // 0x6e98
        g135 = v3;
        g138 = v4;
        return 0;
    }
    int32_t v7 = 0; // R7
    g135 = 0;
    int32_t v8 = 0; // 0x6e74
    // branch -> 0x6e74
    while (true) {
        int32_t str2 = *(int32_t *)(4 * v8 + *(int32_t *)(v1 + 4)); // 0x6e74
        if (strcmp((char *)(int32_t)str, (char *)str2) == 0) {
            int32_t v9 = *(int32_t *)(g138 + 8); // 0x6ea0
            g134 = v2;
            g135 = v3;
            g138 = v4;
            g130 = v5;
            return v7 + v9;
        }
        int32_t v10 = g135 + 1; // 0x6e88
        g135 = v10;
        v7 += 12;
        if (v10 >= v6) {
            // 0x6e98
            // branch -> 0x6e98
            // 0x6e98
            g134 = v2;
            g135 = v3;
            g138 = v4;
            g130 = v5;
            return 0;
        }
        // 0x6e88
        v8 = v10;
        // branch -> 0x6e74
    }
}
 
// Address range: 0x6eac - 0x6eb3
void destroy_script_value(int32_t a1) {
    // 0x6eac
    return;
}
 
// Address range: 0x6eb4 - 0x6ebb
int32_t function_6eb4(int32_t a1) {
    // 0x6eb4
    free((char *)g132);
    return g132;
}
 
// Address range: 0x6ebc - 0x6fef
int32_t assign_script_value(int32_t * a1, char * a2, int32_t a3, int32_t result) {
    int32_t v1 = (int32_t)a1;
    int32_t str = (int32_t)a2;
    g132 = a3;
    g133 = result;
    int32_t v2 = g135; // 0x6ebc
    int32_t v3 = g138; // 0x6ebc
    int32_t v4 = g130; // 0x6ebc
    int32_t v5 = *a1; // 0x6ed0
    g135 = v5;
    g138 = result;
    int32_t mem; // 0x6f84_5
    int32_t mem3; // 0x6fc4_5
    int32_t len; // 0x6f94
    char * mem2; // 0x6f9c
    int32_t result2; // R0
    int32_t v6;
    int32_t v7; // 0x6f74
    int32_t v8; // 0x6fb4
    int32_t v9; // 0x6fb8
    int32_t v10; // 0x6fcc
    int32_t v11; // 0x6fd4
    if (v5 == 0) {
        // 0x6f24
        // branch -> 0x6f74
    } else {
        int32_t v12 = 4; // R9
        g138 = 0;
        int32_t v13 = *(int32_t *)(v1 + 4); // 0x6ef8
        int32_t v14 = 0; // 0x6efc
        // branch -> 0x6efc
        while (true) {
            int32_t str2 = *(int32_t *)(4 * v14 + v13); // 0x6efc
            g128 = str2;
            if (strcmp((char *)str, (char *)str2) == 0) {
                int32_t v15 = *(int32_t *)(v1 + 8); // 0x6f2c
                g138 = v15;
                int32_t v16 = v12 + v15; // 0x6f30
                if (v16 != 4) {
                    int32_t v17 = v16 + 4; // 0x6f40
                    int32_t v18 = *(int32_t *)v17; // 0x6f40
                    if (v18 != 0) {
                        // 0x6f4c
                        free((char *)v18);
                        // branch -> 0x6f50
                    }
                    // 0x6f50
                    *(int32_t *)(v16 - 4) = a3;
                    *(int32_t *)(v12 + g138) = result;
                    // branch -> 0x6fe4
                    // 0x6fe4
                    *(int32_t *)v17 = v6;
                    g135 = v2;
                    g138 = v3;
                    g130 = v4;
                    return result;
                }
                // 0x6f68
                // branch -> 0x6f6c
                // 0x6f6c
                g138 = result;
                // branch -> 0x6f74
                // 0x6f74
                v7 = g135 + 1;
                *(int32_t *)v1 = v7;
                mem = (int32_t)realloc((char *)v13, 4 * v7);
                *(int32_t *)(v1 + 4) = mem;
                len = strlen((char *)str);
                mem2 = malloc(len + 1);
                *(int32_t *)(4 * *(int32_t *)v1 - 4 + mem) = (int32_t)mem2;
                strcpy(mem2, (char *)str);
                v8 = v1;
                v9 = *(int32_t *)(v8 + 8);
                mem3 = (int32_t)realloc((char *)v9, 12 * *(int32_t *)v8);
                *(int32_t *)(v1 + 8) = mem3;
                v10 = *(int32_t *)v1;
                g128 = 3 * v10;
                v11 = 12 * v10 + mem3;
                result2 = v11;
                *(int32_t *)(v11 - 12) = a3;
                *(int32_t *)(result2 - 8) = g138;
                // branch -> 0x6fe4
                // 0x6fe4
                *(int32_t *)(v11 - 4) = v6;
                g135 = v2;
                g138 = v3;
                g130 = v4;
                return result2;
            }
            int32_t v19 = g138 + 1; // 0x6f10
            g138 = v19;
            v12 += 12;
            int32_t v20 = g135; // 0x6f18
            if (v19 >= v20) {
                // 0x6f6c
                // branch -> 0x6f6c
                // 0x6f6c
                g138 = result;
                // branch -> 0x6f74
                // 0x6f74
                v7 = v20 + 1;
                *(int32_t *)v1 = v7;
                mem = (int32_t)realloc((char *)v13, 4 * v7);
                *(int32_t *)(v1 + 4) = mem;
                len = strlen((char *)str);
                mem2 = malloc(len + 1);
                *(int32_t *)(4 * *(int32_t *)v1 - 4 + mem) = (int32_t)mem2;
                strcpy(mem2, (char *)str);
                v8 = v1;
                v9 = *(int32_t *)(v8 + 8);
                mem3 = (int32_t)realloc((char *)v9, 12 * *(int32_t *)v8);
                *(int32_t *)(v1 + 8) = mem3;
                v10 = *(int32_t *)v1;
                g128 = 3 * v10;
                v11 = 12 * v10 + mem3;
                result2 = v11;
                *(int32_t *)(v11 - 12) = a3;
                *(int32_t *)(result2 - 8) = g138;
                // branch -> 0x6fe4
                // 0x6fe4
                *(int32_t *)(v11 - 4) = v6;
                g135 = v2;
                g138 = v3;
                g130 = v4;
                return result2;
            }
            // 0x6f10
            v14 = v19;
            // branch -> 0x6efc
        }
    }
    // 0x6f74
    v7 = 1;
    *(int32_t *)v1 = v7;
    int32_t v21 = *(int32_t *)(v1 + 4); // 0x6f80
    mem = (int32_t)realloc((char *)v21, 4 * v7);
    *(int32_t *)(v1 + 4) = mem;
    len = strlen((char *)str);
    mem2 = malloc(len + 1);
    *(int32_t *)(4 * *(int32_t *)v1 - 4 + mem) = (int32_t)mem2;
    strcpy(mem2, (char *)str);
    v8 = v1;
    v9 = *(int32_t *)(v8 + 8);
    mem3 = (int32_t)realloc((char *)v9, 12 * *(int32_t *)v8);
    *(int32_t *)(v1 + 8) = mem3;
    v10 = *(int32_t *)v1;
    g128 = 3 * v10;
    v11 = 12 * v10 + mem3;
    result2 = v11;
    *(int32_t *)(v11 - 12) = a3;
    *(int32_t *)(result2 - 8) = g138;
    // branch -> 0x6fe4
    // 0x6fe4
    *(int32_t *)(v11 - 4) = v6;
    g135 = v2;
    g138 = v3;
    g130 = v4;
    return result2;
}
 
// Address range: 0x6ff0 - 0x705f
int32_t destroy_script_variables(char * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6) {
    int32_t v1 = (int32_t)a1;
    int32_t v2 = g135; // 0x6ff0
    int32_t v3 = v1; // R4
    int32_t result; // 0x7054
    if (*(int32_t *)a1 == 0) {
        // 0x7044
        free((char *)*(int32_t *)(v1 + 4));
        free((char *)*(int32_t *)(v3 + 8));
        result = v3;
        g135 = v2;
        free((char *)result);
        return result;
    }
    // 0x7008
    g135 = 0;
    int32_t v4 = 8; // R6
    int32_t v5 = 0; // 0x7014
    // branch -> 0x7010
    int32_t v6; // 0x7030
    while (true) {
        // 0x7010
        free((char *)*(int32_t *)(*(int32_t *)(v1 + 4) + 4 * v5));
        int32_t v7 = *(int32_t *)(v4 + *(int32_t *)(v3 + 8)); // 0x7020
        v6 = v3;
        if (v7 != 0) {
            // 0x702c
            free((char *)v7);
            v6 = v3;
            // branch -> 0x7030
        }
        int32_t v8 = g135 + 1; // 0x7034
        g135 = v8;
        v4 += 12;
        if (v8 >= *(int32_t *)v6) {
            // break -> 0x7044
            break;
        }
        v5 = v8;
        v1 = v6;
        // continue -> 0x7010
    }
    // 0x7044
    free((char *)*(int32_t *)(v6 + 4));
    free((char *)*(int32_t *)(v3 + 8));
    result = v3;
    g135 = v2;
    free((char *)result);
    return result;
}
 
// Address range: 0x7060 - 0x7113
int32_t copy_script_value(char * a1, char a2, int32_t a3, char * a4) {
    int32_t v1 = a2;
    int32_t v2 = (int32_t)a4;
    g133 = v2;
    int32_t v3 = g135; // 0x7060
    int32_t v4 = g136; // 0x7060
    int32_t v5 = g137; // 0x7060
    int32_t v6 = g138; // 0x7060
    int32_t v7 = g139; // 0x7060
    int32_t v8 = g130; // bp-8
    g130 = &v8;
    g136 = v1;
    g139 = a3;
    uint32_t v9 = v1 % 256; // 0x7074
    g132 = v9;
    g138 = v2;
    g135 = (int32_t)a1;
    g137 = 0;
    g1 = v9 > 6;
    g2 = v9 < 7;
    g3 = v9 == 7;
    int32_t v10;
    uint32_t v11;
    int32_t result; // 0x70f0
    if (v9 > 7) {
        // 0x70f0
        result = 0x1000000 * v10 / 0x1000000;
        g128 = v11 % 0x10000;
        *(char *)g135 = (char)g136;
        *(char *)(g135 + 3) = (char)result;
        *(int16_t *)(g135 + 1) = (int16_t)v11;
        *(int32_t *)(g135 + 4) = g139;
        *(int32_t *)(g135 + 8) = g137;
        g135 = v3;
        g136 = v4;
        g137 = v5;
        g138 = v6;
        g139 = v7;
        g130 = v8;
        return result;
    }
    // 0x708c
    g133 = &g60;
    g128 = 1;
    g127 = 2;
    int32_t v12 = *(int32_t *)(4 * v9 + (int32_t)&g60); // 0x709c
    g132 = v12;
    ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))(v12 + (int32_t)&g60))(2, 1, v12, (int32_t)&g60);
    if (g3) {
        // after_if_70b8_0
        // branch -> after_if_70c0_0
    }
    int32_t size = 4 * g139; // 0x70cc
    if (size != 0) {
        char * mem = malloc(size); // 0x70dc
        g132 = size;
        g137 = (int32_t)mem;
        __aeabi_memcpy(mem, (char *)g138, size);
        // branch -> 0x70f0
    }
    // 0x70f0
    result = 0x1000000 * v10 / 0x1000000;
    g128 = v11 % 0x10000;
    *(char *)g135 = (char)g136;
    *(char *)(g135 + 3) = (char)result;
    *(int16_t *)(g135 + 1) = (int16_t)v11;
    *(int32_t *)(g135 + 4) = g139;
    *(int32_t *)(g135 + 8) = g137;
    g135 = v3;
    g136 = v4;
    g137 = v5;
    g138 = v6;
    g139 = v7;
    g130 = v8;
    return result;
}
 
// Address range: 0x7114 - 0x7153
// Used cryptographic patterns:
//  - rfc3548_Base_64_Encoding_with_URL_and_Filename_Safe_Alphabet (8-bit, little endian)
int32_t validate_variable_name(char * str) {
    int32_t v1 = g135; // 0x7114
    int32_t ini_seg_bytes = strspn(str, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); // 0x712c
    g135 = ini_seg_bytes;
    int32_t result = 0; // 0x7148
    if (ini_seg_bytes == strlen((char *)(int32_t)str)) {
        // if_7144_0_true
        result = 1;
        // branch -> after_if_7144_0
    }
    // after_if_7144_0
    g135 = v1;
    return result;
}
 
// Address range: 0x7154 - 0x741f
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) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    puts("Enter a setting to view its value, or a setting and a value to change it.");
    puts("Enter ? for help, or a blank line to exit configuration mode.");
    printf("config> ");
    int32_t result = read_line((struct _IO_FILE *)g33); // 0x718c
    char * str = (char *)result; // 0x7194_0
    if (*str != 0) {
        // 0x71a0
        return strcmp(str, "?");
    }
    // 0x73c0
    free(str);
    return result;
}
 
// Address range: 0x7420 - 0x749b
int32_t settings_help(int32_t a1, int32_t a2, int32_t a3, int32_t a4) {
    int32_t v1 = g134; // 0x7420
    int32_t v2 = g135; // 0x7420
    int32_t v3 = g130; // 0x7420
    int32_t v4 = *(int32_t *)&g9; // 0x742c
    g3 = v4 == 0;
    int32_t puts_rc; // 0x7484
    if (v4 == 0) {
        // 0x746c
        puts("Enter a setting to view its value, or a setting and a value to change it.");
        g134 = v1;
        g135 = v2;
        g130 = v3;
        puts_rc = puts("Enter ? for help, or a blank line to exit configuration mode.");
        g127 = puts_rc;
        return puts_rc;
    }
    // 0x743c
    g135 = &g11;
    int32_t v5 = &g11; // 0x7450
    // branch -> 0x7450
    while (true) {
        int32_t v6 = *(int32_t *)v5; // 0x7450
        printf((char *)(int32_t)"%-10s - %s\n", (char *)v4, (char *)v6);
        int32_t v7 = g135; // 0x745c
        int32_t v8 = *(int32_t *)(v7 + 4); // 0x745c
        int32_t v9 = v7 + 12; // 0x7460
        g135 = v9;
        g3 = v8 == 0;
        if (v8 == 0) {
            // 0x746c
            puts("Enter a setting to view its value, or a setting and a value to change it.");
            g134 = v1;
            g135 = v2;
            g130 = v3;
            puts_rc = puts("Enter ? for help, or a blank line to exit configuration mode.");
            g127 = puts_rc;
            return puts_rc;
        }
        // 0x7450
        v4 = v8;
        v5 = v9;
        // branch -> 0x7450
    }
}
 
// Address range: 0x749c - 0x754f
int32_t headers_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4) {
    int32_t v1 = g134; // 0x749c
    int32_t v2 = g130; // 0x749c
    int32_t v3; // 0x7520
    int32_t v4; // 0x7514
    if (str == NULL) {
        // 0x74ec
        v3 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 % 2;
        // branch -> 0x7504
        // 0x7504
        v4 = *(int32_t *)&g44;
        *(char *)v4 = (char)(v4 & 254 | v3);
        g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
        g134 = v1;
        g130 = v2;
        return duplicate_string();
    }
    // 0x74b0
    if (strcmp(str, "off") == 0) {
        // 0x7500
        v3 = 0;
        // branch -> 0x7504
    } else {
        // 0x74c8
        if (strcmp((char *)(int32_t)str, "on") != 0) {
            // if_74e0_0_true
            return 0;
        }
        // after_if_74e0_0
        v3 = 1;
        // branch -> 0x7504
    }
    // 0x7504
    v4 = *(int32_t *)&g44;
    *(char *)v4 = (char)(v4 & 254 | v3);
    g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
    g134 = v1;
    g130 = v2;
    return duplicate_string();
}
 
// Address range: 0x7550 - 0x7657
int32_t indent_setting_handler(char * str, int32_t a2, int32_t a3, int32_t a4) {
    int32_t v1 = g134; // 0x7550
    int32_t v2 = g135; // 0x7550
    int32_t v3 = g130; // 0x7550
    int32_t str2 = (int32_t)str; // R4
    int32_t v4; // 0x75c8
    int32_t v5; // 0x75e4
    if (str == NULL) {
        // 0x75bc
        v4 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 / 2 % 16;
        g135 = v4;
        // branch -> 0x75dc
        // 0x75dc
        v5 = *(int32_t *)&g44;
        *(char *)v5 = (char)(2 * v4 & 30 | v5 & 225);
        if (v4 > 9) {
            // 0x75fc
            g127 = (int32_t)"tab";
            g134 = v1;
            g135 = v2;
            g130 = v3;
            return duplicate_string();
        }
        // 0x760c
        if (g135 != 0) {
            // 0x7614
            return (int32_t)malloc(2);
        }
        // 0x7630
        g127 = (int32_t)"none";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x7564
    if (strcmp(str, "none") == 0) {
        // 0x75d0
        g135 = 0;
        v4 = 0;
        // branch -> 0x75dc
        // 0x75dc
        v5 = *(int32_t *)&g44;
        *(char *)v5 = (char)(2 * v4 & 30 | v5 & 225);
        if (v4 > 9) {
            // 0x75fc
            g127 = (int32_t)"tab";
            g134 = v1;
            g135 = v2;
            g130 = v3;
            return duplicate_string();
        }
        // 0x760c
        if (g135 != 0) {
            // 0x7614
            return (int32_t)malloc(2);
        }
        // 0x7630
        g127 = (int32_t)"none";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x757c
    if (strcmp((char *)str2, "tab") == 0) {
        // 0x75d8
        g135 = 15;
        v4 = 15;
        // branch -> 0x75dc
    } else {
        int32_t v6 = (int32_t)*(char *)str2 - 48; // 0x7598
        g135 = v6;
        if (v6 % 256 > 9 || *(char *)(str2 + 1) != 0) {
            // 0x762c
            g135 = v2;
            return 0;
        }
        v4 = v6;
    }
    // 0x75dc
    v5 = *(int32_t *)&g44;
    *(char *)v5 = (char)(2 * v4 & 30 | v5 & 225);
    if (v4 > 9) {
        // 0x75fc
        g127 = (int32_t)"tab";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x760c
    if (g135 != 0) {
        // 0x7614
        return (int32_t)malloc(2);
    }
    // 0x7630
    g127 = (int32_t)"none";
    g134 = v1;
    g135 = v2;
    g130 = v3;
    return duplicate_string();
}
 
// Address range: 0x7658 - 0x770b
int32_t code_labels_setting_handler(char * str, int32_t a2, int32_t a3) {
    int32_t v1 = g134; // 0x7658
    int32_t v2 = g130; // 0x7658
    int32_t v3; // 0x76dc
    int32_t v4; // 0x76d0
    if (str == NULL) {
        // 0x76a8
        v3 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 / 32 % 2;
        // branch -> 0x76c0
        // 0x76c0
        v4 = *(int32_t *)&g44;
        *(char *)v4 = (char)(v4 & 223 | -v3 & 32);
        g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
        g134 = v1;
        g130 = v2;
        return duplicate_string();
    }
    // 0x766c
    if (strcmp(str, "off") == 0) {
        // 0x76bc
        v3 = 0;
        // branch -> 0x76c0
    } else {
        // 0x7684
        if (strcmp((char *)(int32_t)str, "on") != 0) {
            // if_769c_0_true
            return 0;
        }
        // after_if_769c_0
        v3 = 1;
        // branch -> 0x76c0
    }
    // 0x76c0
    v4 = *(int32_t *)&g44;
    *(char *)v4 = (char)(v4 & 223 | -v3 & 32);
    g127 = v3 == 0 ? (int32_t)"off" : (int32_t)"on";
    g134 = v1;
    g130 = v2;
    return duplicate_string();
}
 
// Address range: 0x770c - 0x77f3
int32_t data_labels_setting_handler(char * str, int32_t a2, int32_t a3) {
    int32_t v1 = g134; // 0x770c
    int32_t v2 = g130; // 0x770c
    int32_t str2 = (int32_t)str; // R4
    int32_t v3; // 0x77b4
    uint32_t v4; // 0x77a4
    if (str == NULL) {
        int32_t v5 = 0x1000000 * *(int32_t *)&g44 / 0x1000000 / 64; // 0x7780
        v3 = v5;
        // branch -> 0x7794
        // 0x7794
        v4 = *(int32_t *)&g44;
        *(char *)v4 = (char)(v4 % 64 | 64 * v3);
        g127 = v3 == 1 ? (int32_t)"exact" : (int32_t)"on";
        if (v5 == 0) {
            // if_77c8_0_true
            g127 = (int32_t)"off";
            // branch -> after_if_77c8_0
        }
        // after_if_77c8_0
        g134 = v1;
        g130 = v2;
        return duplicate_string();
    }
    // 0x7720
    if (strcmp(str, "off") == 0) {
        // 0x7788
        v3 = 0;
        // branch -> 0x7794
        // 0x7794
        v4 = *(int32_t *)&g44;
        *(char *)v4 = (char)(v4 % 64 | 64 * v3);
        g127 = v3 == 1 ? (int32_t)"exact" : (int32_t)"on";
        // if_77c8_0_true
        g127 = (int32_t)"off";
        // branch -> after_if_77c8_0
        // after_if_77c8_0
        g134 = v1;
        g130 = v2;
        return duplicate_string();
    }
    // 0x7738
    int32_t v6; // R1
    if (strcmp((char *)str2, "exact") == 0) {
        // 0x7790
        v6 = 1;
        v3 = 1;
        // branch -> 0x7794
    } else {
        // 0x7750
        if (strcmp((char *)str2, "on") != 0) {
            // if_7768_0_true
            return 0;
        }
        // after_if_7768_0
        v6 = 2;
        v3 = 2;
        // branch -> 0x7794
    }
    // 0x7794
    v4 = *(int32_t *)&g44;
    *(char *)v4 = (char)(v4 % 64 | 64 * v3);
    g127 = v3 == 1 ? (int32_t)"exact" : (int32_t)"on";
    if (v6 == 0) {
        // if_77c8_0_true
        g127 = (int32_t)"off";
        // branch -> after_if_77c8_0
    }
    // after_if_77c8_0
    g134 = v1;
    g130 = v2;
    return duplicate_string();
}
 
// Address range: 0x77f4 - 0x788f
int32_t get_value_from_string(char * a1, int32_t a2) {
    int32_t v1 = g135; // 0x77f4
    int32_t v2 = g130; // 0x77f4
    g135 = (int32_t)a1;
    int32_t v3 = a2; // R4
    if (a1 == NULL || a2 == 0 || *a1 == 0) {
        // 0x7888
        g135 = v1;
        g130 = v2;
        return -1;
    }
    char * mem = malloc(a2 + 1); // 0x7828
    int32_t str = (int32_t)mem; // R6
    __aeabi_memcpy(mem, (char *)g135, v3);
    *(char *)(v3 + str) = 0;
    int32_t endptr;
    int64_t str_as_ull = strtoull((char *)str, (char **)&endptr, 0); // 0x7850
    v3 = str_as_ull;
    g135 = &endptr;
    free((char *)str);
    int32_t result = v3; // 0x788c_22
    if (*(char *)endptr != 0) {
        // if_7878_0_true
        result = -1;
        // branch -> after_if_7878_0
    }
    if (((int32_t)(v3 != -1) ^ 1) > -g135) {
        // if_7884_0_true
        result = -1;
        // branch -> 0x7888
    }
    // 0x7888
    g135 = v1;
    g130 = v2;
    return result;
}
 
// Address range: 0x7890 - 0x7903
int64_t convert_string_to_number(char * str, int32_t a2) {
    g128 = a2;
    int32_t v1 = g135; // 0x7890
    int32_t v2 = g130; // 0x7890
    g135 = a2;
    if (str == NULL) {
        // 0x78f4
        // branch -> 0x78f8
        // 0x78f8
        g135 = v1;
        g130 = v2;
        return 0;
    }
    int32_t v3 = 0; // R4
    int32_t endptr;
    int32_t str_as_ll = strtoll(str, (char **)&endptr, 0); // 0x78b4_6
    int32_t v4 = -str_as_ll; // 0x78b8
    uint32_t v5 = 2 * ((int32_t)(str_as_ll > v4) | (int32_t)&endptr) | (int32_t)(v4 < 0); // 0x78c4
    g132 = 2 - v5;
    uint32_t v6 = (int32_t)(&endptr < NULL); // 0x78cc
    g128 = v3 - v6 - ((int32_t)(v5 < 3) ^ 1);
    int32_t result; // 0x78f8
    if (v3 >= v6) {
        char v7 = *(char *)endptr; // 0x78d8
        g128 = v7;
        if (v7 == 0) {
            // 0x78e4
            int32_t v8; // 0x78ec
            if (g135 != 0) {
                // if_78e8_0_true
                v8 = str_as_ll & -0x10000 | 1;
                // branch -> after_if_78e8_0
            } else {
                v8 = str_as_ll;
            }
            // after_if_78e8_0
            result = v8;
            // branch -> 0x78f8
        } else {
            result = v3;
        }
    } else {
        result = v3;
    }
    // 0x78f8
    g135 = v1;
    g130 = v2;
    return result;
}
 
// Address range: 0x7904 - 0x79bf
int32_t concatenate(int32_t * a1, int32_t * a2, char * a3, int32_t a4) {
    int32_t v1 = (int32_t)a1;
    int32_t v2 = (int32_t)a2;
    int32_t str = (int32_t)a3;
    g133 = a4;
    int32_t v3 = g135; // 0x7908
    int32_t v4 = g138; // 0x7908
    int32_t v5 = g130; // 0x7908
    g138 = v1;
    g1 = true;
    g3 = a3 == NULL;
    int32_t result; // 0x79a0
    int32_t v6; // 0x79a8
    if (a3 == NULL) {
        // 0x79a0
        result = *(int32_t *)v2;
        g132 = 0;
        v6 = *(int32_t *)v1;
        g128 = v6;
        *(char *)(v6 + result) = 0;
        g135 = v3;
        g138 = v4;
        g130 = v5;
        return result;
    }
    // 0x7940
    g135 = *a2;
    int32_t v7 = &a4;
    int32_t len = strlen((char *)str); // 0x794c
    int32_t v8 = len; // R4
    int32_t mem = (int32_t)realloc((char *)*a1, len + 1 + g135); // 0x7960_5
    int32_t v9 = mem; // R7
    *(int32_t *)g138 = mem;
    int32_t v10 = *(int32_t *)v2; // 0x7974
    g135 = v10;
    __aeabi_memcpy((char *)(v9 + v10), (char *)str, v8);
    int32_t v11 = g135 + v8; // 0x7980
    g135 = v11;
    *(int32_t *)v2 = v11;
    int32_t v12 = *(int32_t *)v7; // 0x7994
    g1 = true;
    g3 = v12 == 0;
    // branch -> 0x7948
    while (v12 != 0) {
        // 0x7948
        str = v12;
        v7 += 4;
        len = strlen((char *)str);
        v8 = len;
        mem = (int32_t)realloc((char *)v9, len + 1 + g135);
        v9 = mem;
        *(int32_t *)g138 = mem;
        v10 = *(int32_t *)v2;
        g135 = v10;
        __aeabi_memcpy((char *)(v9 + v10), (char *)str, v8);
        v11 = g135 + v8;
        g135 = v11;
        *(int32_t *)v2 = v11;
        v12 = *(int32_t *)v7;
        g1 = true;
        g3 = v12 == 0;
        // continue -> 0x7948
    }
    // 0x79a0
    // branch -> 0x79a0
    // 0x79a0
    result = *(int32_t *)v2;
    g132 = 0;
    v6 = *(int32_t *)g138;
    g128 = v6;
    *(char *)(v6 + result) = 0;
    g135 = v3;
    g138 = v4;
    g130 = v5;
    return result;
}
 
// Address range: 0x79c0 - 0x79eb
int32_t duplicate_string(void) {
    int32_t v1 = g135; // 0x79c0
    char * str = (char *)g127; // 0x79cc_2
    char * mem = malloc(strlen(str) + 1); // 0x79d4
    int32_t result = (int32_t)mem; // 0x79d4_3
    g128 = g127;
    g135 = result;
    strcpy(mem, str);
    g127 = result;
    g135 = v1;
    return result;
}
 
// Address range: 0x79ec - 0x7ad7
int32_t split_by_spaces(void) {
    int32_t v1 = g135; // 0x79ec
    int32_t v2 = g138; // 0x79ec
    int32_t v3 = g130; // 0x79ec
    g3 = g127 == 0;
    if (g127 == 0) {
        // 0x7a9c
        g127 = 0;
        g135 = v1;
        g138 = v2;
        g130 = v3;
        return 0;
    }
    int32_t str = g127 + strspn((char *)g127, " \t"); // 0x7a14
    int32_t str2 = str; // R4
    char v4 = *(char *)str; // 0x7a14
    g3 = v4 == 0;
    int32_t mem2; // 0x7abc_5
    if (v4 == 0) {
        // 0x7aa8
        g135 = 0;
        // branch -> 0x7ab0
    } else {
        int32_t v5 = 0; // R9
        g135 = 0;
        g138 = (int32_t)" \t";
        int32_t reject = (int32_t)" \t"; // 0x7a34
        // branch -> 0x7a30
        while (true) {
            int32_t v6 = v5 + 1; // 0x7a3c
            int32_t v7 = v6; // R10
            int32_t ini_seg_bytes = strcspn((char *)str, (char *)reject); // R7
            g135 = (int32_t)realloc((char *)g135, 4 * v6);
            char * mem = malloc(ini_seg_bytes + 1); // 0x7a58
            int32_t v8 = (int32_t)mem; // 0x7a58_3
            g132 = ini_seg_bytes;
            *(int32_t *)(4 * v5 + g135) = v8;
            __aeabi_memcpy(mem, (char *)str2, ini_seg_bytes);
            str2 += ini_seg_bytes;
            *(char *)(v8 + ini_seg_bytes) = 0;
            int32_t v9 = str2 + strspn((char *)str2, (char *)g138); // 0x7a88
            str2 = v9;
            char v10 = *(char *)v9; // 0x7a88
            int32_t v11 = v7; // 0x7a8c
            v5 = v11;
            g3 = v10 == 0;
            if (v10 == 0) {
                // 0x7ab0
                // branch -> 0x7ab0
                // 0x7ab0
                mem2 = (int32_t)realloc((char *)g135, 4 * v11 + 4);
                g127 = mem2;
                g128 = 0;
                *(int32_t *)(4 * v7 + mem2) = 0;
                g135 = v1;
                g138 = v2;
                g130 = v3;
                return mem2;
            }
            // 0x7a30
            reject = g138;
            str = v9;
            // branch -> 0x7a30
        }
    }
    // 0x7ab0
    mem2 = (int32_t)realloc((char *)0, 4);
    g127 = mem2;
    g128 = 0;
    *(int32_t *)mem2 = 0;
    g135 = v1;
    g138 = v2;
    g130 = v3;
    return mem2;
}
 
// Address range: 0x7ad8 - 0x7ae7
int32_t string_array_size(int32_t * a1) {
    int32_t v1 = *a1; // 0x7ad8
    g128 = v1;
    if (v1 == 0) {
        // if_7ae0_0_true
        return 0;
    }
    // after_ret_cond_7ae4_0
    return (int32_t)a1;
}
 
// Address range: 0x7ae8 - 0x7b03
int32_t function_7ae8(int32_t a1) {
    int32_t v1 = 0; // 0x7af0
    int32_t result = v1 + 1; // 0x7af4
    // branch -> 0x7af0
    while (*(int32_t *)(4 * v1 + a1 + 4) != 0) {
        // 0x7af0
        v1 = result;
        result = v1 + 1;
        // continue -> 0x7af0
    }
    // 0x7b00
    g3 = true;
    return result;
}
 
// Address range: 0x7b04 - 0x7b43
int32_t destroy_string_array(char * a1, int32_t a2, int32_t a3, int32_t a4) {
    int32_t result = (int32_t)a1;
    g128 = a2;
    g132 = a3;
    g133 = a4;
    int32_t v1 = g134; // 0x7b04
    int32_t v2 = g135; // 0x7b04
    int32_t v3 = g130; // 0x7b04
    int32_t v4 = v3; // bp-8
    g130 = &v4;
    g134 = result;
    g1 = true;
    g3 = a1 == NULL;
    if (a1 == NULL) {
        // if_7b14_0_true
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return result;
    }
    int32_t result2 = *(int32_t *)a1; // 0x7b18
    g1 = true;
    g3 = result2 == 0;
    if (result2 != 0) {
        // 0x7b24
        g135 = result + 4;
        free((char *)result2);
        return result2;
    }
    // 0x7b38
    int32_t v5;
    g134 = v5;
    int32_t v6;
    g135 = v6;
    int32_t v7;
    g130 = v7;
    int32_t v8;
    g126 = v8;
    free(a1);
    return result;
}
 
// Address range: 0x7b44 - 0x7b6b
int32_t find_first_non_space(char * str) {
    // 0x7b44
    return (int32_t)str + strspn(str, " \t");
}
 
// Address range: 0x7b6c - 0x7c33
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) {
    // 0x7b6c
    g132 = a3;
    g133 = a4;
    int32_t v1 = g134; // bp-24
    int32_t v2 = g135; // 0x7b6c
    int32_t v3 = g136; // 0x7b6c
    int32_t v4 = g137; // 0x7b6c
    int32_t v5 = g130; // bp-8
    g135 = (int32_t)a1;
    g137 = (int32_t)a2;
    uint32_t v6 = *(int32_t *)&g44 / 2 % 16; // 0x7b88
    int32_t v7 = v6; // 0x7bbc
    if (v6 >= 10) {
        int32_t mem = (int32_t)malloc(2); // 0x7b98_3
        g127 = mem;
        int32_t v8 = g137; // 0x7b9c
        g1 = true;
        g2 = v8 < 0;
        g3 = v8 == 0;
        g128 = 9;
        *(int32_t *)g135 = mem;
        *(int16_t *)g127 = 9;
        if (v8 != 0) {
            // if_7bb4_0_true
            *(int32_t *)g137 = 1;
            g134 = v1;
            g135 = v2;
            g136 = v3;
            g137 = v4;
            g130 = v5;
            return 1;
        }
        // after_if_7bb4_0
        g134 = a5;
        g135 = a6;
        g136 = a7;
        int32_t v9;
        g137 = v9;
        int32_t v10;
        g130 = v10;
        int32_t v11;
        ((int32_t (*)())v11)();
        v7 = g127;
        // branch -> 0x7bbc
    }
    int32_t mem2 = (int32_t)malloc((v7 + 1) % 256); // 0x7bc4_3
    g131 = 0;
    *(int32_t *)g135 = mem2;
    int32_t v12 = 0; // R2
    if ((0x1000000 * *(int32_t *)&g44 / 0x1000000 & 30) == 0) {
        // 0x7bbc
        // branch -> 0x7c18
    } else {
        // 0x7be8
        g133 = 32;
        char v13 = 32;
        int32_t v14 = mem2; // 0x7bf4
        // branch -> 0x7bf4
        while (true) {
            // 0x7bf4
            *(char *)v14 = v13;
            int32_t v15 = v12 + 1; // 0x7bf8
            v12 = v15;
            int32_t result = *(int32_t *)g135 + v15; // 0x7c08
            if (v15 >= (int32_t)*(char *)&g44 / 2 % 16) {
                // 0x7c14
                // branch -> 0x7c18
                // 0x7c18
                *(char *)result = (char)g131;
                if (g137 != 0) {
                    // if_7c20_0_true
                    *(int32_t *)g137 = v12;
                    // branch -> after_if_7c20_0
                }
                // after_if_7c20_0
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g137 = v4;
                g130 = v5;
                return result;
            }
            // 0x7bf4
            v13 = g133;
            v14 = result;
            // branch -> 0x7bf4
        }
    }
    // 0x7c18
    *(char *)mem2 = (char)g131;
    if (g137 != 0) {
        // if_7c20_0_true
        *(int32_t *)g137 = v12;
        // branch -> after_if_7c20_0
    }
    // after_if_7c20_0
    g134 = v1;
    g135 = v2;
    g136 = v3;
    g137 = v4;
    g130 = v5;
    return mem2;
}
 
// Address range: 0x7c34 - 0x7d1f
int32_t load_symbols(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
    int32_t v1 = g135; // 0x7c34
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    printf("ELF file: ");
    int32_t result2 = read_line((struct _IO_FILE *)g33); // 0x7c54
    g135 = result2;
    char * v3 = (char *)result2; // 0x7c5c_0
    if (*v3 != 0) {
        // 0x7c68
        int32_t v4;
        g132 = &v4;
        int32_t v5;
        g128 = &v5;
        g127 = result2;
        int32_t result = (int32_t)read_symbols_from_ELF(); // 0x7c74_1
        g127 = result;
        return result;
    }
    // 0x7c9c
    g127 = result2;
    g135 = v1;
    g130 = v2;
    free(v3);
    return result2;
}
 
// Address range: 0x7d20 - 0x7d33
int32_t unload_symbols(void) {
    // 0x7d20
    g127 = g24;
    g3 = g24 == 0;
    return g24;
}
 
// Address range: 0x7d34 - 0x7d73
int32_t function_7d34(int32_t a1) {
    int32_t v1 = g134; // 0x7d34
    int32_t v2 = g130; // bp-8
    g130 = &v2;
    int32_t v3 = *(int32_t *)&g31; // 0x7d40
    g134 = v3;
    destroy_ELF_symbols((char *)a1, v3);
    *(int32_t *)g134 = 0;
    *(int32_t *)g24 = 0;
    g134 = v1;
    return g24;
}
 
// Address range: 0x7d74 - 0x7eff
int32_t find_symbol_for_address(uint32_t a1) {
    int32_t v1 = g135; // 0x7d74
    int32_t v2 = g130; // 0x7d74
    uint32_t v3 = *(int32_t *)&g31; // 0x7d80
    g131 = v3;
    g3 = v3 == 0;
    if (v3 == 0) {
        // 0x7df0
        g135 = v1;
        g130 = v2;
        return 0;
    }
    int32_t v4 = g24;
    g126 = v4;
    unsigned char v5;
    int32_t v6; // 0x7e40
    int32_t v7; // 0x7e50
    int32_t v8; // 0x7e5c
    int32_t v9; // 0x7ed0
    int32_t result; // 0x7ed4
    int32_t result3; // 0x7ee4
    int32_t v10; // 0x7e44
    char v11; // 0x7e7c
    unsigned char v12; // 0x7e80
    char v13; // 0x7e9c
    uint32_t v14; // 0x7ec0
    int32_t result2; // 0x7e90
    uint32_t v15; // 0x7ec4
    int32_t result4; // 0x7e40
    if (v3 == 1) {
        v6 = 0;
        // 0x7e40
        result4 = *(int32_t *)(4 * v6 + v4);
        v10 = *(int32_t *)result4;
        if (v10 != a1) {
            // 0x7e9c
            v13 = *(char *)(result4 + 8);
            g3 = v13 == 1;
            result = 0;
            if (v13 == 1) {
                // 0x7eac
                v5 = (char)*(int32_t *)&g44;
                g3 = v5 == 0;
                if (v5 <= 255) {
                    // 0x7ec0
                    v14 = *(int32_t *)(result4 + 4);
                    v15 = a1 - v10;
                    g3 = v15 == v14;
                    v9 = result4;
                    if (v15 < v14) {
                        // if_7ecc_0_true
                        v9 = 0;
                        // branch -> after_if_7ecc_0
                    }
                    // after_if_7ecc_0
                    result = v9;
                    // branch -> 0x7ed4
                } else {
                    result = 0;
                }
            }
            // 0x7ed4
            g135 = v1;
            g130 = v2;
            return result;
        }
        v8 = v6;
        v7 = result4;
        while (true) {
            // 0x7e50
            result2 = v7;
            if (v8 >= v3) {
              lab_0x7e5c_2:;
                int32_t v16 = *(int32_t *)(4 * v8 + v4 + 4); // 0x7e64
                if (*(int32_t *)v16 != a1) {
                    result2 = v7;
                    // break -> 0x7e7c
                    break;
                }
                v8++;
                v7 = v16;
                // continue -> 0x7e50
                continue;
            }
            // 0x7e7c
            v11 = *(char *)(result2 + 8);
            v12 = *(char *)*(int32_t *)&g44;
            g3 = v11 == 2;
            if (v11 == 2) {
                // 0x7e8c
                g135 = v1;
                g130 = v2;
                return 0x4000000 * (int32_t)v12 >> 31 & result2;
            }
            // 0x7edc
            g3 = v12 == 63;
            if (v12 < 64) {
                // if_7ee0_0_true
                // branch -> after_if_7ee0_0
                // after_if_7ee0_0
                g135 = v1;
                g130 = v2;
                return 0;
            }
            // after_if_7ee0_0
            g135 = v1;
            g130 = v2;
            return result2;
        }
        // 0x7e7c
        v11 = *(char *)(result2 + 8);
        v12 = *(char *)*(int32_t *)&g44;
        g3 = v11 == 2;
        if (v11 == 2) {
            // 0x7e8c
            g135 = v1;
            g130 = v2;
            return 0x4000000 * (int32_t)v12 >> 31 & result2;
        }
        // 0x7edc
        g3 = v12 == 63;
        result3 = result2;
        if (v12 < 64) {
            // if_7ee0_0_true
            result3 = 0;
            // branch -> after_if_7ee0_0
        }
        // after_if_7ee0_0
        g135 = v1;
        g130 = v2;
        return result3;
    }
    int32_t v17 = &g30; // 0x7db032
    int32_t v18 = 0; // 0x7dfc
  lab_0x7da8:
    while (true) {
        int32_t v19 = v17; // 0x7dfc
        // branch -> 0x7db0
        while (true) {
            uint32_t v20 = (v19 + v18 + 1) / 2; // 0x7db4
            int32_t v21 = *(int32_t *)(4 * v20 + v4); // 0x7db8
            g135 = v21;
            uint32_t v22 = *(int32_t *)v21; // 0x7dbc
            if (v22 == a1) {
                int32_t v23 = v20 + 1; // 0x7e1c
                // branch -> 0x7e0c
                while (true) {
                    // 0x7e0c
                    if (v23 - 1 >= v3) {
                        int32_t v24 = *(int32_t *)(4 * v23 + v4); // 0x7e1c
                        g135 = v24;
                        if (*(int32_t *)v24 != a1) {
                            result2 = v21;
                            // break -> 0x7e7c
                            break;
                        }
                        v21 = v24;
                        v23++;
                        // continue -> 0x7e0c
                        continue;
                    } else {
                        result2 = v21;
                    }
                }
                // 0x7e7c
                v11 = *(char *)(result2 + 8);
                v12 = *(char *)*(int32_t *)&g44;
                g3 = v11 == 2;
                if (v11 == 2) {
                    // 0x7e8c
                    g135 = v1;
                    g130 = v2;
                    return 0x4000000 * (int32_t)v12 >> 31 & result2;
                }
                // 0x7edc
                g3 = v12 == 63;
                if (v12 < 64) {
                    // if_7ee0_0_true
                    // branch -> after_if_7ee0_0
                    // after_if_7ee0_0
                    g135 = v1;
                    g130 = v2;
                    return 0;
                }
                // after_if_7ee0_0
                g135 = v1;
                g130 = v2;
                return result2;
            }
            // 0x7dc8
            if (v22 > a1) {
                // 0x7dcc
                if (v20 <= v18) {
                    // 0x7df0
                    g3 = v20 == v18;
                    // branch -> 0x7df0
                    // 0x7df0
                    g135 = v1;
                    g130 = v2;
                    return 0;
                }
                int32_t v25 = v20 - 1; // 0x7dd4
                if (v18 >= v25) {
                    // break -> 0x7e3c
                    break;
                }
                v19 = v25;
                // continue -> 0x7db0
                continue;
            } else {
                // 0x7de4
                if (v20 >= v19) {
                    v6 = v20;
                    // break (via goto) -> 0x7e40
                    goto lab_0x7e40;
                }
                v17 = v19;
                v18 = v20;
                // continue (via goto) -> 0x7da8
                goto lab_0x7da8;
            }
          lab_0x7e40:
            // 0x7e40
            result4 = *(int32_t *)(4 * v6 + v4);
            v10 = *(int32_t *)result4;
            if (v10 != a1) {
                // 0x7e9c
                v13 = *(char *)(result4 + 8);
                g3 = v13 == 1;
                if (v13 == 1) {
                    // 0x7eac
                    v5 = (char)*(int32_t *)&g44;
                    g3 = v5 == 0;
                    if (v5 <= 255) {
                        // 0x7ec0
                        v14 = *(int32_t *)(result4 + 4);
                        v15 = a1 - v10;
                        g3 = v15 == v14;
                        if (v15 < v14) {
                            // if_7ecc_0_true
                            // branch -> after_if_7ecc_0
                            // after_if_7ecc_0
                            // branch -> 0x7ed4
                            // 0x7ed4
                            g135 = v1;
                            g130 = v2;
                            return 0;
                        }
                        // after_if_7ecc_0
                        // branch -> 0x7ed4
                        // 0x7ed4
                        g135 = v1;
                        g130 = v2;
                        return result4;
                    }
                }
                // 0x7ed4
                g135 = v1;
                g130 = v2;
                return 0;
            }
            v8 = v6;
            v7 = result4;
            while (true) {
                // 0x7e50
                if (v8 >= v3) {
                    goto lab_0x7e5c_2;
                }
                result2 = v7;
                // 0x7e7c
                v11 = *(char *)(result2 + 8);
                v12 = *(char *)*(int32_t *)&g44;
                g3 = v11 == 2;
                if (v11 == 2) {
                    // 0x7e8c
                    g135 = v1;
                    g130 = v2;
                    return 0x4000000 * (int32_t)v12 >> 31 & result2;
                }
                // 0x7edc
                g3 = v12 == 63;
                if (v12 < 64) {
                    // if_7ee0_0_true
                    // branch -> after_if_7ee0_0
                    // after_if_7ee0_0
                    g135 = v1;
                    g130 = v2;
                    return 0;
                }
                // after_if_7ee0_0
                g135 = v1;
                g130 = v2;
                return result2;
            }
            // 0x7e40
            result4 = *(int32_t *)(4 * v6 + v4);
            v10 = *(int32_t *)result4;
            if (v10 != a1) {
                // 0x7e9c
                v13 = *(char *)(result4 + 8);
                g3 = v13 == 1;
                result = 0;
                if (v13 == 1) {
                    int32_t v26 = *(int32_t *)&g44; // 0x7eb0
                    v5 = (char)v26;
                    g3 = v5 == 0;
                    if (v5 <= 255) {
                        // 0x7ec0
                        v14 = *(int32_t *)(result4 + 4);
                        v15 = a1 - v10;
                        g3 = v15 == v14;
                        v9 = result4;
                        if (v15 >= v14) {
                            // after_if_7ecc_0
                            result = v9;
                            // branch -> 0x7ed4
                            // 0x7ed4
                            g135 = v1;
                            g130 = v2;
                            return result;
                        }
                        // if_7ecc_0_true
                        v9 = 0;
                        // branch -> after_if_7ecc_0
                        // after_if_7ecc_0
                        result = v9;
                        // branch -> 0x7ed4
                        // 0x7ed4
                        g135 = v1;
                        g130 = v2;
                        return result;
                    }
                    result = 0;
                }
                // 0x7ed4
                g135 = v1;
                g130 = v2;
                return result;
            }
            v8 = v6;
            v7 = result4;
            int32_t v27;
            int32_t v28; // 0x7e80
            while (true) {
                // 0x7e50
                if (v8 >= v3) {
                    goto lab_0x7e5c_2;
                }
                result2 = v7;
                // 0x7e7c
                v27 = *(int32_t *)&g44;
                v11 = *(char *)(result2 + 8);
                v12 = *(char *)v27;
                v28 = v12;
                g3 = v11 == 2;
                if (v11 == 2) {
                    // 0x7e8c
                    g135 = v1;
                    g130 = v2;
                    return 0x4000000 * v28 >> 31 & result2;
                }
                // 0x7edc
                g3 = v12 == 63;
                result3 = result2;
                if (v12 >= 64) {
                    // after_if_7ee0_0
                    g135 = v1;
                    g130 = v2;
                    return result3;
                }
                // if_7ee0_0_true
                result3 = 0;
                // branch -> after_if_7ee0_0
                // after_if_7ee0_0
                g135 = v1;
                g130 = v2;
                return result3;
            }
            // 0x7e7c
            v27 = *(int32_t *)&g44;
            v11 = *(char *)(result2 + 8);
            v12 = *(char *)v27;
            v28 = v12;
            g3 = v11 == 2;
            if (v11 == 2) {
                // 0x7e8c
                g135 = v1;
                g130 = v2;
                return 0x4000000 * v28 >> 31 & result2;
            }
            // 0x7edc
            g3 = v12 == 63;
            result3 = result2;
            if (v12 >= 64) {
                // after_if_7ee0_0
                g135 = v1;
                g130 = v2;
                return result3;
            }
            // if_7ee0_0_true
            result3 = 0;
            // branch -> after_if_7ee0_0
            // after_if_7ee0_0
            g135 = v1;
            g130 = v2;
            return result3;
        }
    }
}
 
// Address range: 0x7f00 - 0x7f83
int32_t check_exact_symbol_match(int32_t a1, int32_t a2, int32_t a3) {
    // 0x7f00
    int32_t v1;
    int32_t (*v2)() = (int32_t (*)())v1;
    int32_t v3 = g130; // 0x7f00
    int32_t v4 = g24;
    int32_t v5 = *(int32_t *)&g31; // 0x7f18
    g133 = v5;
    g126 = v4;
    g131 = v5;
    // branch -> 0x7f24
    int32_t v6;
    int32_t v7;
    int32_t v8; // 0x7f80
    uint32_t v9; // 0x7f7c
    unsigned char v10; // 0x7f50
    int32_t v11; // 0x7f5c
    int32_t v12; // 0x7f24
    int32_t v13; // 0x7f54
    int32_t result; // 0x7f64
    while (true) {
        int32_t v14 = 4 * a1 + v4; // 0x7f24
        v12 = *(int32_t *)v14;
        g127 = v12;
        if (a1 >= v5) {
            int32_t v15 = *(int32_t *)*(int32_t *)(v14 + 4); // 0x7f40
            g133 = v15;
            if (*(int32_t *)v12 != v15) {
                // break -> 0x7f4c
                break;
            }
            a1++;
            // continue -> 0x7f24
            continue;
        }
        // 0x7f4c
        v10 = *(char *)(v12 + 8);
        g132 = v10;
        v13 = *(int32_t *)&g44;
        g1 = v10 > 1;
        g3 = v10 == 2;
        v6 = 0x1000000 * v13;
        v11 = v6 / 0x1000000;
        g128 = v11;
        if (v10 == 2) {
            // if_7f68_0_true
            result = 0x4000000 * v13 >> 31 & v12;
            g127 = result;
            g130 = v3;
            return result;
        }
        // after_if_7f68_0
        g1 = v11 > 62;
        g2 = v6 < 0x3f000000;
        g3 = v6 == 0x3f000000;
        if (v11 < 64) {
            // if_7f70_0_true
            g127 = 0;
            // branch -> after_if_7f70_0
        }
        // after_if_7f70_0
        g130 = v7;
        v2();
        v9 = g132 % 256;
        if (g3) {
            // if_7f80_0_true
            v8 = g138;
            g136 = (v9 == 0 ? v8 : v9 < 32 ? v8 << v9 : 0) & g128;
            // branch -> after_if_7f80_0
            // after_if_7f80_0
            return g127;
        }
        // after_if_7f80_0
        return g127;
    }
    // 0x7f4c
    v10 = *(char *)(v12 + 8);
    g132 = v10;
    v13 = *(int32_t *)&g44;
    g1 = v10 > 1;
    g3 = v10 == 2;
    v6 = 0x1000000 * v13;
    v11 = v6 / 0x1000000;
    g128 = v11;
    if (v10 == 2) {
        // if_7f68_0_true
        result = 0x4000000 * v13 >> 31 & v12;
        g127 = result;
        g130 = v3;
        return result;
    }
    // after_if_7f68_0
    g1 = v11 > 62;
    g2 = v6 < 0x3f000000;
    g3 = v6 == 0x3f000000;
    if (v11 < 64) {
        // if_7f70_0_true
        g127 = 0;
        // branch -> after_if_7f70_0
    }
    // after_if_7f70_0
    g130 = v7;
    v2();
    v9 = g132 % 256;
    if (g3) {
        // if_7f80_0_true
        v8 = g138;
        g136 = (v9 == 0 ? v8 : v9 < 32 ? v8 << v9 : 0) & g128;
        // branch -> after_if_7f80_0
    }
    // after_if_7f80_0
    return g127;
}
 
// Address range: 0x7f84 - 0x8047
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) {
    int32_t v1 = g135; // 0x7f84
    int32_t v2 = g138; // 0x7f84
    int32_t v3 = (int32_t)a5; // R4
    g135 = a2;
    int32_t size = a2 + 1; // 0x7f98
    g138 = a4;
    *a5 = a1;
    int32_t v4 = (int32_t)a1 % 256; // 0x7fac
    *(int32_t *)(v3 + 4) = size;
    *(int32_t *)(v3 + 8) = 0;
    if (v4 == 7) {
        // 0x7fe8
        return (int32_t)malloc(4 * size);
    }
    // 0x7fbc
    if (v4 == 6) {
        // 0x8008
        return (int32_t)malloc(2 * size);
    }
    // 0x7fc4
    if (v4 == 5) {
        // 0x7fcc
        return (int32_t)malloc(size);
    }
    // 0x8034
    g127 = (int32_t)"type mismatch";
    g135 = v1;
    g138 = v2;
    return duplicate_string();
}
 
// Address range: 0x8048 - 0x8113
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) {
    int32_t v1 = g135; // 0x8048
    int32_t v2 = g138; // 0x8048
    int32_t v3 = (int32_t)a5; // R4
    int32_t size = a2 + 1; // 0x805c
    g135 = a3;
    g138 = a4;
    *a5 = a1;
    int32_t v4 = (int32_t)a1 % 256; // 0x8070
    *(int32_t *)(v3 + 4) = size;
    *(int32_t *)(v3 + 8) = 0;
    if (v4 == 7) {
        // 0x80b0
        return (int32_t)malloc(4 * size);
    }
    // 0x8080
    if (v4 == 6) {
        // 0x80d4
        return (int32_t)malloc(2 * size);
    }
    // 0x8088
    if (v4 == 5) {
        // 0x8090
        return (int32_t)malloc(size);
    }
    // 0x8100
    g127 = (int32_t)"type mismatch";
    g135 = v1;
    g138 = v2;
    return duplicate_string();
}
 
// Address range: 0x8114 - 0x81c7
int32_t script_transform_rotate(char a1, int32_t a2, char * a3, uint32_t a4) {
    int32_t v1 = g135; // 0x8114
    int32_t v2 = g138; // 0x8114
    g135 = a2;
    g138 = (int32_t)a3;
    int32_t v3;
    *(char *)v3 = a1;
    *(int32_t *)(v3 + 4) = g135;
    *(int32_t *)(v3 + 8) = 0;
    uint32_t v4 = (int32_t)a1 % 256; // 0x8140
    if (v4 <= 4) {
        // 0x814c
        g127 = (int32_t)"type mismatch";
        g135 = v1;
        g138 = v2;
        return duplicate_string();
    }
    uint32_t v5 = g135; // 0x8160
    int32_t v6 = a4 % v5;
    int32_t v7 = 1; // R6
    int32_t v8 = v6; // R7
    int32_t v9; // 0x8188
    if (v4 == 6) {
        // after_if_8178_0.thread
        v7 = 2;
        v9 = 2;
        // branch -> after_if_8180_0
    } else {
        // after_if_8178_0
        if (v4 == 7) {
            // if_8180_0_true
            v7 = 4;
            v9 = 4;
            // branch -> after_if_8180_0
        } else {
            v9 = 1;
        }
    }
    // after_if_8180_0
    if (v6 < 0) {
        // if_818c_0_true
        v8 = v6 + v5;
        // branch -> after_if_818c_0
    }
    char * mem = malloc(v9 * v5); // 0x8190
    int32_t v10 = g135 - v8; // 0x8194
    g135 = v10;
    int32_t v11 = (int32_t)mem; // R9
    __aeabi_memcpy(mem, (char *)(g138 + v7 * v8), v7 * v10);
    __aeabi_memcpy((char *)(v11 + g135 * v7), (char *)g138, v7 * v8);
    *(int32_t *)(v3 + 8) = v11;
    g135 = v1;
    g138 = v2;
    return 0;
}
 
// Address range: 0x81c8 - 0x827b
int32_t script_transform_rotateback(char a1, int32_t a2, char * a3, int32_t a4) {
    int32_t v1 = g135; // 0x81c8
    int32_t v2 = g138; // 0x81c8
    g135 = a2;
    g138 = (int32_t)a3;
    int32_t v3;
    *(char *)v3 = a1;
    *(int32_t *)(v3 + 4) = g135;
    *(int32_t *)(v3 + 8) = 0;
    uint32_t v4 = (int32_t)a1 % 256; // 0x81f4
    if (v4 <= 4) {
        // 0x8200
        g127 = (int32_t)"type mismatch";
        g135 = v1;
        g138 = v2;
        return duplicate_string();
    }
    uint32_t v5 = g135; // 0x8214
    int32_t v6 = -a4 % v5;
    int32_t v7 = 1; // R6
    int32_t v8 = v6; // R7
    int32_t v9; // 0x823c
    if (v4 == 6) {
        // after_if_822c_0.thread
        v7 = 2;
        v9 = 2;
        // branch -> after_if_8234_0
    } else {
        // after_if_822c_0
        if (v4 == 7) {
            // if_8234_0_true
            v7 = 4;
            v9 = 4;
            // branch -> after_if_8234_0
        } else {
            v9 = 1;
        }
    }
    // after_if_8234_0
    if (v6 < 0) {
        // if_8240_0_true
        v8 = v6 + v5;
        // branch -> after_if_8240_0
    }
    char * mem = malloc(v9 * v5); // 0x8244
    int32_t v10 = g135 - v8; // 0x8248
    g135 = v10;
    int32_t v11 = (int32_t)mem; // R9
    __aeabi_memcpy(mem, (char *)(g138 + v7 * v8), v7 * v10);
    __aeabi_memcpy((char *)(v11 + g135 * v7), (char *)g138, v7 * v8);
    *(int32_t *)(v3 + 8) = v11;
    g135 = v1;
    g138 = v2;
    return 0;
}
 
// Address range: 0x827c - 0x828b
int32_t function_add(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x827c
    *a3 = 0;
    return a2 + a1;
}
 
// Address range: 0x828c - 0x82bb
int32_t script_transform_add(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = &g61;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x82ac
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x82bc - 0x82cb
int32_t function_subtract(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x82bc
    *a3 = 0;
    return a1 - a2;
}
 
// Address range: 0x82cc - 0x82fb
int32_t script_transform_subtract(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g4;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x82ec
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x82fc - 0x830b
int32_t function_multiply(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x82fc
    *a3 = 0;
    return a2 * a1;
}
 
// Address range: 0x830c - 0x833b
int32_t script_transform_multiply(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g34;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x832c
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x833c - 0x8347
int32_t function_divide(int32_t a1, int32_t a2) {
    // 0x833c
    *(int32_t *)g132 = 0;
    g127 = a1 / a2;
    return 0;
}
 
// Address range: 0x8348 - 0x8377
int32_t script_transform_divide(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g5;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8368
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8378 - 0x8393
int32_t function_modulo(uint32_t a1, uint32_t a2) {
    // 0x8378
    *(int32_t *)g132 = 0;
    int32_t result = a1 % a2;
    g127 = result;
    return result;
}
 
// Address range: 0x8394 - 0x83c3
int32_t script_transform_modulo(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g40;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x83b4
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x83c4 - 0x83d3
int32_t function_rsub(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x83c4
    *a3 = 0;
    return a2 - a1;
}
 
// Address range: 0x83d4 - 0x8403
int32_t script_transform_rsub(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g18;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x83f4
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8404 - 0x841b
// From class:    PLAYER
// Type:          virtual member function
int32_t function_rdiv(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x8404
    *a3 = 0;
    return a2 / a1;
}
 
// Address range: 0x841c - 0x844b
int32_t script_transform_rdiv(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = (int32_t)g13.e0;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x843c
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x844c - 0x8473
int32_t function_rmod(uint32_t a1, uint32_t a2, int32_t * a3) {
    // 0x844c
    *a3 = 0;
    return a2 % a1;
}
 
// Address range: 0x8474 - 0x84a3
int32_t script_transform_rmod(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g14;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x8494
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x84a4 - 0x84b3
int32_t function_and(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x84a4
    *a3 = 0;
    return a2 & a1;
}
 
// Address range: 0x84b4 - 0x84e3
int32_t script_transform_and(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g37;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x84d4
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x84e4 - 0x84f3
int32_t function_or(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x84e4
    *a3 = 0;
    return a2 | a1;
}
 
// Address range: 0x84f4 - 0x8523
int32_t script_transform_or(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g43;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8514
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8524 - 0x8533
int32_t function_xor(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x8524
    *a3 = 0;
    return a2 ^ a1;
}
 
// Address range: 0x8534 - 0x8563
int32_t script_transform_xor(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g21;
    int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8554
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8564 - 0x8573
int32_t function_shl(int32_t a1, uint32_t a2, int32_t * a3) {
    uint32_t v1 = a2 % 256; // 0x8568
    *a3 = 0;
    return v1 == 0 ? a1 : v1 < 32 ? a1 << v1 : 0;
}
 
// Address range: 0x8574 - 0x85a3
int32_t script_transform_shl(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g41;
    int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8594
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x85a4 - 0x85b3
int32_t function_shr(uint32_t a1, uint32_t a2, int32_t * a3) {
    uint32_t v1 = a2 % 256; // 0x85a8
    *a3 = 0;
    return a1 >> (v1 > 32 ? 32 : v1);
}
 
// Address range: 0x85b4 - 0x85e3
int32_t script_transform_shr(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g23;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x85d4
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x85e4 - 0x85f3
int32_t function_asr(int32_t a1, uint32_t a2, int32_t * a3) {
    uint32_t v1 = a2 % 256; // 0x85e8
    *a3 = 0;
    return a1 >> (v1 == 0 ? 0 : v1 > 31 ? 31 : v1);
}
 
// Address range: 0x85f4 - 0x8623
int32_t script_transform_asr(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g27;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8614
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8624 - 0x8637
int32_t function_forceminu(uint32_t a1, uint32_t a2, int32_t * a3) {
    int32_t result = a1; // R0
    if (a1 < a2) {
        // if_862c_0_true
        result = a2;
        // branch -> after_if_862c_0
    }
    // after_if_862c_0
    *a3 = 0;
    return result;
}
 
// Address range: 0x8638 - 0x8667
int32_t script_transform_forceminu(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g25;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8658
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8668 - 0x867b
int32_t function_forcemaxu(uint32_t a1, uint32_t a2, int32_t * a3) {
    int32_t result = a1; // R0
    if (a1 > a2) {
        // if_8670_0_true
        result = a2;
        // branch -> after_if_8670_0
    }
    // after_if_8670_0
    *a3 = 0;
    return result;
}
 
// Address range: 0x867c - 0x86ab
int32_t script_transform_forcemaxu(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g35;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x869c
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x86ac - 0x86bf
int32_t function_forcemin(int32_t a1, int32_t a2, int32_t * a3) {
    int32_t result = a1; // R0
    if (a1 < a2) {
        // if_86b4_0_true
        result = a2;
        // branch -> after_if_86b4_0
    }
    // after_if_86b4_0
    *a3 = 0;
    return result;
}
 
// Address range: 0x86c0 - 0x86ef
int32_t script_transform_forcemin(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g42;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x86e0
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x86f0 - 0x8703
int32_t function_forcemax(int32_t a1, int32_t a2, int32_t * a3) {
    int32_t result = a1; // R0
    if (a1 > a2) {
        // if_86f8_0_true
        result = a2;
        // branch -> after_if_86f8_0
    }
    // after_if_86f8_0
    *a3 = 0;
    return result;
}
 
// Address range: 0x8704 - 0x8733
int32_t script_transform_forcemax(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g32;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x8724
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8734 - 0x8753
int32_t function_compare(int32_t a1, int32_t a2, int32_t * a3) {
    // 0x8734
    *a3 = 0;
    int32_t v1 = a1 < a2 ? -1 : 1;
    return a1 == a2 ? v1 & -0x10000 : v1;
}
 
// Address range: 0x8754 - 0x8783
int32_t script_transform_compare(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g47;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8774
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8784 - 0x87a3
int32_t function_compareu(uint32_t a1, uint32_t a2, int32_t * a3) {
    // 0x8784
    *a3 = 0;
    int32_t v1 = a1 < a2 ? -1 : 1;
    return a1 == a2 ? v1 & -0x10000 : v1;
}
 
// Address range: 0x87a4 - 0x87d3
int32_t script_transform_compareu(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g20;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x87c4
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x87d4 - 0x880b
int32_t function_checkminu(uint32_t a1, uint32_t a2, int32_t * a3) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x87d4
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g135 = a1;
    g134 = v1;
    int32_t v4; // 0x87fc
    int32_t v5; // 0x87fc
    if (a1 >= a2) {
        // 0x87f0
        g127 = (int32_t)"value not in required range";
        v5 = duplicate_string();
        v4 = g134;
        // branch -> 0x87fc
    } else {
        v5 = 0;
        v4 = v1;
    }
    // 0x87fc
    *(int32_t *)v4 = v5;
    int32_t result = g135; // 0x8800
    g135 = v2;
    return result;
}
 
// Address range: 0x880c - 0x883b
int32_t script_transform_checkminu(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g19;
    int32_t result = script_transform_basic((char)g127, g128, g132); // 0x882c
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x883c - 0x8873
int32_t function_checkmaxu(uint32_t a1, uint32_t a2, int32_t * a3) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x883c
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g135 = a1;
    g134 = v1;
    int32_t v4 = 0; // 0x8864
    if (a1 > a2) {
        // 0x8858
        g127 = (int32_t)"value not in required range";
        v4 = duplicate_string();
        v1 = g134;
        // branch -> 0x8864
    }
    // 0x8864
    *(int32_t *)v1 = v4;
    int32_t result = g135; // 0x8868
    g135 = v2;
    return result;
}
 
// Address range: 0x8874 - 0x88a3
int32_t script_transform_checkmaxu(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g29;
    int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8894
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x88a4 - 0x88db
int32_t function_checkmin(int32_t a1, int32_t a2, int32_t * a3) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x88a4
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g135 = a1;
    g134 = v1;
    int32_t v4 = 0; // 0x88cc
    if (a1 < a2) {
        // 0x88c0
        g127 = (int32_t)"value not in required range";
        v4 = duplicate_string();
        v1 = g134;
        // branch -> 0x88cc
    }
    // 0x88cc
    *(int32_t *)v1 = v4;
    int32_t result = g135; // 0x88d0
    g135 = v2;
    return result;
}
 
// Address range: 0x88dc - 0x890b
int32_t script_transform_checkmin(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g22;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x88fc
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x890c - 0x8943
int32_t function_checkmax(int32_t a1, int32_t a2, int32_t * a3, int32_t a4) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x890c
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g135 = a1;
    g134 = v1;
    int32_t v4 = 0; // 0x8934
    if (a1 > a2) {
        // 0x8928
        g127 = (int32_t)"value not in required range";
        v4 = duplicate_string();
        v1 = g134;
        // branch -> 0x8934
    }
    // 0x8934
    *(int32_t *)v1 = v4;
    int32_t result = g135; // 0x8938
    g135 = v2;
    return result;
}
 
// Address range: 0x8944 - 0x8973
int32_t script_transform_checkmax(int32_t a1, int32_t a2) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g16;
    int32_t result = script_transform_basic((char)a1, a2, g132); // 0x8964
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8974 - 0x89cf
int32_t function_checkptr(int32_t a1, int32_t a2, int32_t * a3, int32_t a4) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x8974
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g135 = a1;
    g134 = v1;
    int32_t result; // 0x89c4
    if (a2 == a1) {
        // after_if_898c_0.thread
        if ((a2 || a1) == 0) {
            // 0x89c0
            *(int32_t *)v1 = 0;
            result = g135;
            g135 = v2;
            return result;
        }
    }
    // 0x899c
    int32_t v4; // 0x89c0
    int32_t v5; // 0x89c0
    if ((a1 & -0x2000000) != 0x8000000) {
        // 0x89b4
        g127 = (int32_t)"value not in required range";
        v5 = duplicate_string();
        v4 = g134;
        // branch -> 0x89c0
    } else {
        v5 = 0;
        v4 = v1;
    }
    // 0x89c0
    *(int32_t *)v4 = v5;
    result = g135;
    g135 = v2;
    return result;
}
 
// Address range: 0x89d0 - 0x89ff
int32_t script_transform_checkptr(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g8;
    int32_t result = script_transform_basic((char)g127, g128, g132); // 0x89f0
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8a00 - 0x8a37
int32_t function_require(int32_t a1, int32_t a2, int32_t * a3, int32_t a4, int32_t a5) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x8a00
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g135 = a1;
    g134 = v1;
    int32_t v4; // 0x8a28
    int32_t v5; // 0x8a28
    if (a1 != a2) {
        // 0x8a1c
        g127 = (int32_t)"value not in required range";
        v5 = duplicate_string();
        v4 = g134;
        // branch -> 0x8a28
    } else {
        v5 = 0;
        v4 = v1;
    }
    // 0x8a28
    *(int32_t *)v4 = v5;
    int32_t result = g135; // 0x8a2c
    g135 = v2;
    return result;
}
 
// Address range: 0x8a38 - 0x8a67
int32_t script_transform_require(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g28;
    int32_t result = script_transform_basic((char)g127, g128, g132); // 0x8a58
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8a68 - 0x8a9f
int32_t function_requirenot(int32_t a1, int32_t a2, int32_t * a3) {
    int32_t v1 = (int32_t)a3;
    int32_t v2 = g135; // 0x8a68
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    g135 = a1;
    g134 = v1;
    int32_t v4 = 0; // 0x8a90
    if (a1 == a2) {
        // 0x8a84
        g127 = (int32_t)"value not in required range";
        v4 = duplicate_string();
        v1 = g134;
        // branch -> 0x8a90
    }
    // 0x8a90
    *(int32_t *)v1 = v4;
    int32_t result = g135; // 0x8a94
    g135 = v2;
    return result;
}
 
// Address range: 0x8aa0 - 0x8acf
int32_t script_transform_requirenot(int32_t a1, int32_t a2, int32_t a3) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g126 = v2;
    g131 = g26;
    int32_t result = script_transform_basic((char)a1, a2, a3); // 0x8ac0
    g127 = result;
    g130 = v1;
    return result;
}
 
// Address range: 0x8ad0 - 0x8b77
int32_t script_transform_byte_count(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5) {
    int32_t v1 = g134; // bp-16
    int32_t v2 = g135; // 0x8ad0
    int32_t v3 = g130; // bp-8
    int32_t v4 = (int32_t)a5; // R12
    *a5 = 3;
    *(int32_t *)(v4 + 8) = 0;
    if (a4 >= 256) {
        // 0x8afc
        g127 = (int32_t)"parameter is not a byte";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x8b0c
    if (a1 % 256 != 0) {
        // 0x8b14
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x8b24
    if (a2 == 0) {
        // 0x8b64
        *(int32_t *)(v4 + 4) = 0;
        g135 = v2;
        return 0;
    }
    int32_t v5 = 0; // 0x8b58
    // branch -> 0x8b30
    int32_t v6; // 0x8b58
    while (true) {
        // 0x8b30
        int32_t v7;
        g135 = v7 == 0;
        if (v7 == 0 == (int32_t)*(char *)(v5 + a3) == a4 % 256) {
            // 0x8b64
            *(int32_t *)(v4 + 4) = v5;
            g135 = v2;
            return 0;
        }
        // 0x8b58
        v6 = v5 + 1;
        if (v6 >= a2) {
            // break -> 0x8b64
            break;
        }
        v5 = v6;
        // continue -> 0x8b30
    }
    // 0x8b64
    *(int32_t *)(v4 + 4) = v6;
    g135 = v2;
    return 0;
}
 
// Address range: 0x8b78 - 0x8c03
int32_t script_transform_byteswhile(uint32_t a1, uint32_t a2, int32_t a3) {
    int32_t v1 = g134; // bp-16
    int32_t v2 = g130; // bp-8
    int32_t v3 = g126; // 0x8b78
    int32_t v4;
    *(char *)v4 = 3;
    *(int32_t *)(v4 + 8) = 0;
    uint32_t v5 = g133 + 128; // 0x8b94
    g126 = v5;
    g1 = v5 > 383;
    g3 = v5 == 384;
    if (v5 >= 384) {
        // 0x8ba0
        g127 = (int32_t)"parameter is not a byte";
        g134 = v1;
        g130 = v2;
        g126 = v3;
        int32_t result = duplicate_string(); // 0x8bac
        g127 = result;
        return result;
    }
    // 0x8bb0
    g3 = a1 % 256 == 0;
    if (a1 % 256 != 0) {
        // 0x8bb8
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g130 = v2;
        g126 = v3;
        int32_t result2 = duplicate_string(); // 0x8bc4
        g127 = result2;
        return result2;
    }
    // 0x8bc8
    g1 = true;
    g3 = a2 == 0;
    if (a2 == 0) {
        // 0x8bf0
        *(int32_t *)(v4 + 4) = 0;
        g127 = 0;
        g134 = v1;
        g130 = v2;
        return 0;
    }
    uint32_t v6 = g133 % 256; // 0x8bd8
    int32_t v7 = 0; // 0x8be4
    // branch -> 0x8bd4
    int32_t v8; // 0x8be4
    while (true) {
        int32_t v9 = (int32_t)*(char *)(v7 + a3); // 0x8bd4
        g126 = v9;
        g1 = v9 >= v6;
        g3 = v9 == v6;
        int32_t v10 = v7; // 0x8bf0
        if (v9 == v6) {
            // 0x8be4
            v8 = v7 + 1;
            g1 = v8 >= a2;
            g3 = v8 == a2;
            if (v8 >= a2) {
                // break -> 0x8bf0
                break;
            }
            v7 = v8;
            // continue -> 0x8bd4
            continue;
        }
        // 0x8bf0
        *(int32_t *)(v4 + 4) = v10;
        g127 = 0;
        g134 = v1;
        g130 = v2;
        return 0;
    }
    // 0x8bf0
    *(int32_t *)(v4 + 4) = v8;
    g127 = 0;
    g134 = v1;
    g130 = v2;
    return 0;
}
 
// Address range: 0x8c04 - 0x8c8f
int32_t script_transform_bytesuntil(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4) {
    int32_t v1 = g134; // bp-16
    int32_t v2 = g130; // bp-8
    int32_t v3;
    *(char *)v3 = 3;
    *(int32_t *)(v3 + 8) = 0;
    uint32_t v4 = a4 + 128; // 0x8c20
    g3 = v4 == 384;
    if (v4 >= 384) {
        // 0x8c2c
        g127 = (int32_t)"parameter is not a byte";
        g134 = v1;
        g130 = v2;
        int32_t result = duplicate_string(); // 0x8c38
        g127 = result;
        return result;
    }
    // 0x8c3c
    g3 = a1 % 256 == 0;
    if (a1 % 256 != 0) {
        // 0x8c44
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g130 = v2;
        int32_t result2 = duplicate_string(); // 0x8c50
        g127 = result2;
        return result2;
    }
    // 0x8c54
    g3 = a2 == 0;
    if (a2 == 0) {
        // 0x8c7c
        *(int32_t *)(v3 + 4) = 0;
        g127 = 0;
        g134 = v1;
        g130 = v2;
        return 0;
    }
    uint32_t v5 = a4 % 256; // 0x8c64
    int32_t v6 = 0; // 0x8c70
    // branch -> 0x8c60
    int32_t v7; // 0x8c70
    while (true) {
        char v8 = *(char *)(v6 + a3); // 0x8c60
        g3 = (int32_t)v8 == v5;
        if ((int32_t)v8 == v5) {
            // 0x8c7c
            *(int32_t *)(v3 + 4) = v6;
            g127 = 0;
            g134 = v1;
            g130 = v2;
            return 0;
        }
        // 0x8c70
        v7 = v6 + 1;
        g3 = v7 == a2;
        if (v7 >= a2) {
            // break -> 0x8c7c
            break;
        }
        v6 = v7;
        // continue -> 0x8c60
    }
    // 0x8c7c
    *(int32_t *)(v3 + 4) = v7;
    g127 = 0;
    g134 = v1;
    g130 = v2;
    return 0;
}
 
// Address range: 0x8c90 - 0x8d97
int32_t execute_transforms(int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5) {
    int32_t v1;
    char * v2 = (char *)v1; // bp-52
    int32_t v3 = g134; // 0x8c90
    int32_t v4 = g135; // 0x8c90
    int32_t v5 = g136; // 0x8c90
    int32_t v6 = g137; // 0x8c90
    int32_t v7 = g138; // 0x8c90
    int32_t v8 = g139; // 0x8c90
    int32_t v9 = g129; // 0x8c90
    int32_t v10 = g130; // bp-8
    g130 = &v10;
    g138 = a4;
    int32_t v11;
    copy_script_value((char *)&v11, (char)a1, a2, (char *)a3);
    int32_t v12;
    g129 = v12;
    g1 = true;
    g2 = a5 < 0;
    g3 = a5 == 0;
    int32_t v13;
    *(int32_t *)(v12 + 8) = v13;
    if (a5 == 0) {
        // 0x8d88
        g127 = 0;
        g134 = v3;
        g135 = v4;
        g136 = v5;
        g137 = v6;
        g138 = v7;
        g139 = v8;
        g129 = v9;
        g130 = v10;
        return 0;
    }
    // 0x8cd4
    g135 = 0;
    int32_t v14 = 0; // 0x8ce0
    // branch -> 0x8cd8
    char * mem; // 0x8d44
    int32_t chars_printed;
    int32_t result;
    int32_t v15; // 0x8d18
    while (true) {
        int32_t v16 = g129; // 0x8cdc
        int32_t v17 = *(int32_t *)v16; // 0x8cdc
        g137 = v17;
        int32_t v18 = 8 * v14 + g138; // 0x8ce0
        int32_t v19 = *(int32_t *)v18; // 0x8ce0
        g131 = v19;
        int32_t v20 = *(int32_t *)(v16 + 4); // 0x8ce4
        g134 = v20;
        int32_t v21 = *(int32_t *)(v16 + 8); // 0x8ce4
        g136 = v21;
        int32_t v22 = *(int32_t *)(v18 + 4); // 0x8ce8
        g133 = v22;
        g127 = v17;
        g128 = v20;
        g132 = v21;
        g126 = 0x8d00;
        ((int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t))v19)(v17, v20, v21, v22, v16);
        g139 = g127;
        g132 = g136;
        destroy_script_value(g137);
        v15 = g139;
        int32_t v23 = g135 + 1; // 0x8d20
        g135 = v23;
        int32_t v24 = 0; // 0x8d30
        if (v15 == 0) {
            // if_8d24_0_true
            v24 = 1;
            // branch -> after_if_8d24_0
        }
        // after_if_8d24_0
        if (v23 >= a5) {
            // 0x8d30
            g1 = true;
            g2 = false;
            g3 = v24 == 0;
            if (v24 == 0) {
                // break -> 0x8d38
                break;
            }
            v14 = v23;
            // continue -> 0x8cd8
            continue;
        }
        // 0x8d38
        if (v15 == 0) {
            // 0x8d88
            g127 = 0;
            g134 = v3;
            g135 = v4;
            g136 = v5;
            g137 = v6;
            g138 = v7;
            g139 = v8;
            g129 = v9;
            g130 = v10;
            return 0;
        }
        // 0x8d40
        mem = malloc(32);
        v2 = mem;
        chars_printed = sprintf(mem, "transform %u: ", g135);
        concatenate((int32_t *)&v2, &chars_printed, (char *)g139, 0);
        free((char *)g139);
        result = (int32_t)v2;
        g127 = result;
        g134 = v3;
        g135 = v4;
        g136 = v5;
        g137 = v6;
        g138 = v7;
        g139 = v8;
        g129 = v9;
        g130 = v10;
        return result;
    }
    // 0x8d38
    if (v15 == 0) {
        // 0x8d88
        g127 = 0;
        g134 = v3;
        g135 = v4;
        g136 = v5;
        g137 = v6;
        g138 = v7;
        g139 = v8;
        g129 = v9;
        g130 = v10;
        return 0;
    }
    // 0x8d40
    mem = malloc(32);
    v2 = mem;
    chars_printed = sprintf(mem, "transform %u: ", g135);
    concatenate((int32_t *)&v2, &chars_printed, (char *)g139, 0);
    free((char *)g139);
    result = (int32_t)v2;
    g127 = result;
    g134 = v3;
    g135 = v4;
    g136 = v5;
    g137 = v6;
    g138 = v7;
    g139 = v8;
    g129 = v9;
    g130 = v10;
    return result;
}
 
// Address range: 0x8d98 - 0x8db7
int32_t enforce_value_size(int32_t a1, uint32_t a2) {
    // 0x8d98
    g128 = a2;
    g1 = a2 > 1;
    g2 = a2 < 2;
    g3 = a2 == 2;
    if (a2 == 2) {
        int32_t result = 0x10000 * a1 / 0x10000; // 0x8db0
        g127 = result;
        return result;
    }
    // 0x8da0
    g1 = a2 != 0;
    g2 = a2 < 1;
    g3 = a2 == 1;
    int32_t result2 = 0x1000000 * a1 / 0x1000000; // 0x8da4
    g127 = result2;
    return result2;
}
 
// Address range: 0x8db8 - 0x8fc7
int32_t script_transform_basic(char a1, int32_t a2, int32_t a3) {
    g132 = a3;
    int32_t v1 = g134; // 0x8db8
    int32_t v2 = g135; // 0x8db8
    int32_t v3 = g136; // 0x8db8
    int32_t v4 = g137; // 0x8db8
    int32_t v5 = g138; // 0x8db8
    int32_t v6 = g139; // 0x8db8
    int32_t v7 = g129; // 0x8db8
    int32_t v8 = g130; // bp-8
    g130 = &v8;
    int32_t v9;
    g139 = v9;
    g137 = a1;
    g135 = g133;
    g136 = a3;
    *(char *)v9 = a1;
    g134 = a2;
    *(int32_t *)(g139 + 8) = 0;
    uint32_t v10 = g137 % 256; // 0x8dec
    uint32_t v11 = v10 - 1; // 0x8dec
    g1 = v11 > 5;
    g2 = v10 < 7;
    g3 = v11 == 6;
    if (v11 > 6) {
        // 0x8e50
        g127 = (int32_t)"type mismatch";
        g126 = 0x8e5c;
        int32_t result = duplicate_string(); // 0x8e58
        g134 = v1;
        g135 = v2;
        g136 = v3;
        g137 = v4;
        g138 = v5;
        g139 = v6;
        g129 = v7;
        return result;
    }
    // 0x8df8
    g128 = &g62;
    int32_t v12;
    g129 = v12;
    int32_t v13 = *(int32_t *)(4 * v11 + (int32_t)&g62); // 0x8e04
    g127 = v13;
    ((int32_t (*)(int32_t, int32_t))(v13 + (int32_t)&g62))(v13, (int32_t)&g62);
    if (g3) {
        // after_if_8e20_0
        abort();
        // UNREACHABLE
    }
    // after_if_8e24_0
    int32_t result2;
    int32_t v14 = &result2; // 0x8e28_0
    g132 = v14;
    int32_t v15 = g134; // 0x8e2c
    g127 = v15;
    int32_t v16 = g135; // 0x8e30
    g128 = v16;
    g126 = 0x8e38;
    ((int32_t (*)(int32_t, int32_t, int32_t))g129)(v15, v16, v14);
    uint32_t v17 = g137 % 256; // 0x8e38
    g128 = v17;
    g1 = v17 > 1;
    g2 = v17 < 2;
    g3 = v17 == 2;
    int32_t v18;
    if (v17 == 2) {
        // 0x8f9c
        v18 = 0x10000 * g127 / 0x10000;
        // branch -> 0x8fa0
    } else {
        // 0x8e44
        g1 = v17 != 0;
        g2 = v17 == 0;
        g3 = v17 == 1;
        v18 = 0x1000000 * g127 / 0x1000000;
        // branch -> 0x8fa0
    }
    // 0x8fa0
    *(int32_t *)(g139 + 4) = v18;
    g127 = result2;
    int32_t v19 = g130; // 0x8fbc
    g134 = *(int32_t *)(v19 - 28);
    g135 = *(int32_t *)(v19 - 24);
    g136 = *(int32_t *)(v19 - 20);
    g137 = *(int32_t *)(v19 - 16);
    g138 = *(int32_t *)(v19 - 12);
    g139 = *(int32_t *)(v19 - 8);
    g129 = *(int32_t *)(v19 - 4);
    g130 = *(int32_t *)v19;
    ((int32_t (*)(int32_t))*(int32_t *)(v19 + 4))(result2);
    if (g3) {
        // if_8fc4_0_true
        g134 = g134 / 256 & result2;
        // branch -> after_if_8fc4_0
    }
    // after_if_8fc4_0
    return result2;
}
 
// Address range: 0x8fc8 - 0x8fdb
int32_t read_16(char * a1) {
    char v1 = *(char *)((int32_t)a1 + 1); // 0x8fcc
    return 256 * (int32_t)v1 | (int32_t)*a1;
}
 
// Address range: 0x8fdc - 0x8ffb
int32_t read_32(char * a1) {
    int32_t v1 = (int32_t)a1;
    char v2 = *(char *)(v1 + 1); // 0x8fdc
    char v3 = *a1; // 0x8fe0
    char v4 = *(char *)(v1 + 2); // 0x8fe4
    char v5 = *(char *)(v1 + 3); // 0x8fe8
    return (int32_t)v3 | 256 * (int32_t)v2 | 0x10000 * (int32_t)v4 | 0x1000000 * (int32_t)v5;
}
 
// Address range: 0x8ffc - 0x90e3
int32_t script_transform_skip(unsigned char a1, int32_t a2, int32_t a3, int32_t a4) {
    int32_t v1 = g134; // bp-32
    int32_t v2 = g135; // 0x8ffc
    int32_t v3 = g138; // 0x8ffc
    int32_t v4 = g130; // bp-8
    int32_t v5 = g126; // 0x8ffc
    g135 = a3;
    int32_t v6 = a2 - a4; // R2
    g133 = 0;
    int32_t v7;
    *(char *)v7 = a1;
    *(int32_t *)(v7 + 4) = v6;
    *(int32_t *)(v7 + 8) = 0;
    if (a4 < 0) {
        // 0x9048
        g127 = (int32_t)"negative skip count";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g130 = v4;
        g126 = v5;
        return duplicate_string();
    }
    int32_t v8 = a1;
    int32_t v9 = v8 - 1; // 0x902c
    g133 = v9;
    if (v9 <= 2) {
        // 0x9038
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g130 = v4;
        g126 = v5;
        return duplicate_string();
    }
    // 0x9058
    if (a4 > a2) {
        // 0x9060
        g127 = (int32_t)"skip count is greater than length";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g130 = v4;
        g126 = v5;
        return duplicate_string();
    }
    // 0x9070
    if (a1 < 8) {
        // 0x908c
        g127 = (int32_t)"internal error";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g130 = v4;
        g126 = v5;
        return duplicate_string();
    }
    // 0x907c
    g133 = 241;
    int32_t v10 = *(int32_t *)(0x1000000 * v8 / 0x400000 + (int32_t)&g121); // 0x90a8
    int32_t size = v6 * v10; // 0x90ac
    g138 = size;
    char * mem = malloc(size); // 0x90b4
    *(int32_t *)(v7 + 8) = (int32_t)mem;
    __aeabi_memcpy(mem, (char *)(g135 + a4 * v10), g138);
    g134 = v1;
    g135 = v2;
    g138 = v3;
    g130 = v4;
    return 0;
}
 
// Address range: 0x90e4 - 0x91ab
int32_t script_transform_item(uint32_t a1, uint32_t a2, int32_t a3, uint32_t a4, char * a5) {
    int32_t v1 = g130; // bp-8
    int32_t v2 = (int32_t)a5; // R12
    *a5 = (char)(a1 + 252);
    *(int32_t *)(v2 + 8) = 0;
    if (a4 < 0) {
        // 0x9124
        g127 = (int32_t)"negative index";
        g130 = v1;
        return duplicate_string();
    }
    uint32_t v3 = a1 % 256; // 0x9108
    if (v3 <= 4) {
        // 0x9114
        g127 = (int32_t)"type mismatch";
        g130 = v1;
        return duplicate_string();
    }
    // 0x9134
    if (a2 <= a4) {
        // 0x9160
        g127 = (int32_t)"index out of bounds";
        g130 = v1;
        return duplicate_string();
    }
    // 0x913c
    if (v3 == 7) {
        // 0x9170
        // branch -> 0x9180
        // 0x9180
        *(int32_t *)(v2 + 4) = *(int32_t *)(4 * a4 + a3);
        return 0;
    }
    // 0x9144
    int32_t v4; // 0x9180
    if (v3 == 6) {
        // 0x9178
        v4 = (int32_t)*(int16_t *)(2 * a4 + a3);
        // branch -> 0x9180
    } else {
        // 0x914c
        if (v3 != 5) {
            // 0x918c
            g127 = (int32_t)"internal error";
            g130 = v1;
            return duplicate_string();
        }
        // 0x9154
        v4 = (int32_t)*(char *)(a4 + a3);
        // branch -> 0x9180
    }
    // 0x9180
    *(int32_t *)(v2 + 4) = v4;
    return 0;
}
 
// Address range: 0x91ac - 0x928f
int32_t script_transform_copy(unsigned char a1, int32_t a2, char * a3, int32_t a4) {
    // 0x91ac
    g133 = a4;
    int32_t v1 = g134; // bp-24
    int32_t v2 = g135; // 0x91ac
    int32_t v3 = g130; // bp-8
    int32_t v4 = g126; // 0x91ac
    int32_t v5 = (int32_t)a3; // R4
    g132 = 0;
    int32_t v6;
    *(char *)v6 = a1;
    *(int32_t *)(v6 + 4) = a4;
    *(int32_t *)(v6 + 8) = 0;
    if (a4 < 0) {
        // 0x91f4
        g127 = (int32_t)"negative length";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        g126 = v4;
        return duplicate_string();
    }
    int32_t v7 = a1;
    int32_t v8 = v7 - 1; // 0x91d8
    g132 = v8;
    if (v8 <= 2) {
        // 0x91e4
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        g126 = v4;
        return duplicate_string();
    }
    // 0x9204
    if (a2 < a4) {
        // 0x920c
        g127 = (int32_t)"length is greater than data size";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        g126 = v4;
        return duplicate_string();
    }
    // 0x921c
    if (a1 < 8) {
        // 0x9238
        g127 = (int32_t)"internal error";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        g126 = v4;
        return duplicate_string();
    }
    // 0x9228
    g135 = 1;
    int32_t v9 = *(int32_t *)(0x1000000 * v7 / 0x400000 + (int32_t)&g121); // 0x9254
    int32_t size = v9 * a4; // 0x9258
    g135 = size;
    char * mem = malloc(size); // 0x9260
    g128 = v5;
    int32_t v10 = g135; // 0x9268
    g132 = v10;
    *(int32_t *)(v6 + 8) = (int32_t)mem;
    __aeabi_memcpy(mem, (char *)v5, v10);
    g134 = v1;
    g135 = v2;
    g130 = v3;
    return 0;
}
 
// Address range: 0x9290 - 0x956f
int32_t script_transform_count_values(int32_t a1, int32_t a2, int32_t * a3, int32_t a4) {
    // 0x9290
    g128 = a2;
    int32_t v1 = (int32_t)a3;
    g132 = v1;
    g133 = a4;
    int32_t v2 = g134; // 0x9290
    int32_t v3 = g135; // 0x9290
    int32_t v4 = g136; // 0x9290
    int32_t v5 = g137; // 0x9290
    int32_t v6 = g138; // 0x9290
    int32_t v7 = g129; // 0x9290
    int32_t v8 = g130; // bp-8
    int32_t v9 = g126; // 0x9290
    g130 = &v8;
    int32_t v10;
    g129 = v10;
    g137 = a1;
    int32_t v11;
    g138 = v11;
    g135 = a4;
    g139 = v1;
    *(char *)v10 = 3;
    *(int32_t *)(g129 + 8) = 0;
    uint32_t v12 = g137 % 256 - 1; // 0x92c4
    g134 = a2;
    g3 = v12 == 2;
    if (v12 <= 2) {
        // 0x92d4
        g127 = (int32_t)"type mismatch";
        g134 = v2;
        g135 = v3;
        g136 = v4;
        g137 = v5;
        g138 = v6;
        g129 = v7;
        g130 = v8;
        g126 = v9;
        g127 = duplicate_string();
        return g131;
    }
    int32_t size = 4 * a2; // 0x92e8
    g136 = size;
    g126 = (int32_t)malloc(size);
    uint32_t v13 = g137 % 256; // 0x92f8
    g1 = v13 > 6;
    g2 = v13 < 7;
    g3 = v13 == 7;
    int32_t v14; // R6
    uint32_t v15; // 0x948c
    int32_t v16; // 0x94d0
    int32_t v17; // 0x9514
    int32_t v18; // 0x951432
    int32_t v19; // 0x9518
    int32_t v20; // 0x9528
    int32_t v21; // 0x9540
    int32_t v22; // 0x950c
    int32_t v23; // 0x9550
    int32_t v24; // 0x94c8
    int32_t v25; // 0x9504
    int32_t v26; // 0x950c
    int32_t v27; // 0x9508
    int32_t v28; // 0x950c
    int32_t v29; // 0x9550
    if (v13 <= 7) {
        // 0x9304
        g128 = &g63;
        int32_t v30 = *(int32_t *)(4 * v13 + (int32_t)&g63); // 0x930c
        g127 = v30;
        ((int32_t (*)(int32_t, int32_t))(v30 + (int32_t)&g63))(v30, (int32_t)&g63);
        if (g3) {
            // if_9330_0_true
            // branch -> after_if_9330_0
        }
        // after_if_9330_0
        if (g134 != 0) {
            // 0x933c
            int32_t v31; // 0x93b8
            int32_t v32; // 0x93b4
            int32_t v33; // 0x93bc
            int32_t v34; // 0x93b0
            int32_t v35; // 0x9558
            int32_t v36; // 0x955c
            int32_t v37; // 0x93b4
            if (g134 < 4) {
                // 0x933c
                v34 = 0;
                // branch -> 0x93a8
            } else {
                // 0x9348
                if (g126 < g139 + g134) {
                    // after_if_9364_0
                    if (g139 < g126 + 4 * g134) {
                        v34 = 0;
                        // 0x93a8
                        v33 = 4 * v34 + g126;
                        v31 = g134 - v34;
                        v32 = v34 + g139;
                        // branch -> 0x93b4
                        while (true) {
                            // 0x93b4
                            g128 = v32 + 1;
                            v37 = (int32_t)*(char *)v32;
                            g133 = v37;
                            g132 = v33 + 4;
                            *(int32_t *)v33 = v37;
                            if (v31 == 1) {
                                // 0x93c4
                                // branch -> 0x9488
                                // 0x9488
                                v14 = 0;
                                v15 = g134;
                                int32_t v38; // 0x9520
                                if (v15 == 0) {
                                    // 0x9488
                                    v38 = g126;
                                    // branch -> 0x9520
                                } else {
                                    // 0x9494
                                    if (v15 < 4) {
                                        // 0x94a4
                                        v24 = g126;
                                        g132 = v24;
                                        v16 = &g65;
                                        // branch -> 0x94cc
                                        while (v16 != 4) {
                                            // 0x94cc
                                            v16 -= 4;
                                            // continue -> 0x94cc
                                        }
                                        // 0x94e4
                                        g128 = &g65;
                                        if (v15 == (int32_t)&g65) {
                                            // 0x9520
                                            free((char *)v24);
                                            v20 = g138;
                                            g3 = v20 == 0;
                                            if (v20 == 0) {
                                                // 0x9520
                                                // branch -> 0x955c
                                                // 0x955c
                                                *(int32_t *)(g129 + 4) = v14;
                                                // branch -> 0x9560
                                                // 0x9560
                                                g127 = 0;
                                                g134 = v2;
                                                g135 = v3;
                                                g136 = v4;
                                                g137 = v5;
                                                g138 = v6;
                                                g129 = v7;
                                                return 0;
                                            }
                                            // 0x9530
                                            if (v20 == 2) {
                                                // 0x954c
                                                v23 = g134;
                                                v29 = v14;
                                                g3 = v29 == v23;
                                                if (v29 == v23) {
                                                    // if_9554_0_true
                                                    // branch -> after_if_9554_0
                                                    // after_if_9554_0
                                                    // branch -> 0x955c
                                                    // 0x955c
                                                    *(int32_t *)(g129 + 4) = 1;
                                                    // branch -> 0x9560
                                                    // 0x9560
                                                    g127 = 0;
                                                    g134 = v2;
                                                    g135 = v3;
                                                    g136 = v4;
                                                    g137 = v5;
                                                    g138 = v6;
                                                    g129 = v7;
                                                    return 0;
                                                }
                                                // after_if_9554_0
                                                // branch -> 0x955c
                                                // 0x955c
                                                *(int32_t *)(g129 + 4) = 0;
                                                // branch -> 0x9560
                                                // 0x9560
                                                g127 = 0;
                                                g134 = v2;
                                                g135 = v3;
                                                g136 = v4;
                                                g137 = v5;
                                                g138 = v6;
                                                g129 = v7;
                                                return 0;
                                            }
                                            // 0x9538
                                            g3 = v20 == 1;
                                            if (v20 != 1) {
                                                // 0x9560
                                                g127 = 0;
                                                g134 = v2;
                                                g135 = v3;
                                                g136 = v4;
                                                g137 = v5;
                                                g138 = v6;
                                                g129 = v7;
                                                return 0;
                                            }
                                            // 0x9540
                                            v21 = v14;
                                            g3 = v21 == 0;
                                            if (v21 != 0) {
                                                // if_9544_0_true
                                                v36 = v21 & -0x10000 | 1;
                                                // branch -> 0x955c
                                            } else {
                                                v36 = 0;
                                            }
                                            // 0x955c
                                            *(int32_t *)(g129 + 4) = v36;
                                            // branch -> 0x9560
                                            // 0x9560
                                            g127 = 0;
                                            g134 = v2;
                                            g135 = v3;
                                            g136 = v4;
                                            g137 = v5;
                                            g138 = v6;
                                            g129 = v7;
                                            return 0;
                                        }
                                        v27 = v24;
                                        v25 = &g65;
                                    } else {
                                        // 0x949c
                                        v27 = g126;
                                        v25 = 0;
                                        // branch -> 0x9504
                                    }
                                    // 0x9504
                                    v19 = v15 - v25;
                                    v17 = 0;
                                    v22 = 4 * v25 + v27;
                                    // branch -> 0x950c
                                    while (true) {
                                        // 0x950c
                                        v26 = v22 + 4;
                                        g128 = v26;
                                        v28 = *(int32_t *)v22;
                                        g132 = v28;
                                        v18 = v17;
                                        if (v28 == g135) {
                                          lab_if_9514_0_true_3:;
                                            int32_t v39 = v17 + 1; // 0x9514
                                            v14 = v39;
                                            v18 = v39;
                                            // branch -> after_if_9514_0
                                        }
                                      lab_after_if_9514_0_3:
                                        // after_if_9514_0
                                        if (v19 == 1) {
                                            // break -> 0x9520
                                            break;
                                        }
                                        v19--;
                                        v17 = v18;
                                        v22 = v26;
                                        // continue -> 0x950c
                                    }
                                    // 0x9520
                                    v38 = v27;
                                    // branch -> 0x9520
                                }
                                // 0x9520
                                free((char *)v38);
                                v20 = g138;
                                g3 = v20 == 0;
                                if (v20 == 0) {
                                    // 0x9520
                                    // branch -> 0x955c
                                    // 0x955c
                                    *(int32_t *)(g129 + 4) = v14;
                                    // branch -> 0x9560
                                    // 0x9560
                                    g127 = 0;
                                    g134 = v2;
                                    g135 = v3;
                                    g136 = v4;
                                    g137 = v5;
                                    g138 = v6;
                                    g129 = v7;
                                    return 0;
                                }
                                // 0x9530
                                if (v20 == 2) {
                                    // 0x954c
                                    v23 = g134;
                                    v29 = v14;
                                    g3 = v29 == v23;
                                    if (v29 == v23) {
                                        // if_9554_0_true
                                        // branch -> after_if_9554_0
                                        // after_if_9554_0
                                        // branch -> 0x955c
                                        // 0x955c
                                        *(int32_t *)(g129 + 4) = 1;
                                        // branch -> 0x9560
                                        // 0x9560
                                        g127 = 0;
                                        g134 = v2;
                                        g135 = v3;
                                        g136 = v4;
                                        g137 = v5;
                                        g138 = v6;
                                        g129 = v7;
                                        return 0;
                                    }
                                    // after_if_9554_0
                                    // branch -> 0x955c
                                    // 0x955c
                                    *(int32_t *)(g129 + 4) = 0;
                                    // branch -> 0x9560
                                    // 0x9560
                                    g127 = 0;
                                    g134 = v2;
                                    g135 = v3;
                                    g136 = v4;
                                    g137 = v5;
                                    g138 = v6;
                                    g129 = v7;
                                    return 0;
                                }
                                // 0x9538
                                g3 = v20 == 1;
                                if (v20 != 1) {
                                    // 0x9560
                                    g127 = 0;
                                    g134 = v2;
                                    g135 = v3;
                                    g136 = v4;
                                    g137 = v5;
                                    g138 = v6;
                                    g129 = v7;
                                    return 0;
                                }
                                // 0x9540
                                v21 = v14;
                                g3 = v21 == 0;
                                if (v21 != 0) {
                                    // if_9544_0_true
                                    v36 = v21 & -0x10000 | 1;
                                    // branch -> 0x955c
                                } else {
                                    v36 = 0;
                                }
                                // 0x955c
                                *(int32_t *)(g129 + 4) = v36;
                                // branch -> 0x9560
                                // 0x9560
                                g127 = 0;
                                g134 = v2;
                                g135 = v3;
                                g136 = v4;
                                g137 = v5;
                                g138 = v6;
                                g129 = v7;
                                return 0;
                            }
                          lab_0x93b4:
                            // 0x93b4
                            v33 = g132;
                            v31--;
                            v32 = g128;
                            // branch -> 0x93b4
                        }
                    }
                }
                // 0x936c
                g133 = g126;
                int32_t v40 = g139; // 0x937c
                int32_t v41 = &g64; // 0x9380
                int32_t v42 = v41 - 4; // 0x9380
                g132 = v42;
                // branch -> 0x937c
                while (v41 != 4) {
                    // 0x937c
                    v40 += 4;
                    v41 = v42;
                    v42 = v41 - 4;
                    g132 = v42;
                    // continue -> 0x937c
                }
                // 0x939c
                g128 = &g64;
                if (g134 == (int32_t)&g64) {
                    // 0x93c4
                    // branch -> 0x9488
                    // 0x9488
                    v14 = 0;
                    v15 = g134;
                    if (v15 == 0) {
                        // 0x9488
                        // branch -> 0x9520
                    } else {
                        // 0x9494
                        if (v15 < 4) {
                            // 0x94a4
                            v24 = g126;
                            g132 = v24;
                            v16 = &g65;
                            // branch -> 0x94cc
                            while (v16 != 4) {
                                // 0x94cc
                                v16 -= 4;
                                // continue -> 0x94cc
                            }
                            // 0x94e4
                            g128 = &g65;
                            if (v15 == (int32_t)&g65) {
                                // 0x9520
                                free((char *)v24);
                                v20 = g138;
                                g3 = v20 == 0;
                                if (v20 == 0) {
                                    // 0x9520
                                    // branch -> 0x955c
                                    // 0x955c
                                    *(int32_t *)(g129 + 4) = v14;
                                    // branch -> 0x9560
                                } else {
                                    // 0x9530
                                    if (v20 != 2) {
                                        // 0x9538
                                        g3 = v20 == 1;
                                        if (v20 == 1) {
                                            // 0x9540
                                            v21 = v14;
                                            g3 = v21 == 0;
                                            if (v21 != 0) {
                                                // if_9544_0_true
                                                v36 = v21 & -0x10000 | 1;
                                                // branch -> 0x955c
                                            } else {
                                                v36 = 0;
                                            }
                                            // 0x955c
                                            *(int32_t *)(g129 + 4) = v36;
                                            // branch -> 0x9560
                                        }
                                        // 0x9560
                                        g127 = 0;
                                        g134 = v2;
                                        g135 = v3;
                                        g136 = v4;
                                        g137 = v5;
                                        g138 = v6;
                                        g129 = v7;
                                        return 0;
                                    }
                                    // 0x954c
                                    v23 = g134;
                                    v29 = v14;
                                    g3 = v29 == v23;
                                    v35 = 0;
                                    if (v29 == v23) {
                                        // if_9554_0_true
                                        v35 = 1;
                                        // branch -> after_if_9554_0
                                    }
                                    // after_if_9554_0
                                    // branch -> 0x955c
                                    // 0x955c
                                    *(int32_t *)(g129 + 4) = v35;
                                    // branch -> 0x9560
                                }
                                // 0x9560
                                g127 = 0;
                                g134 = v2;
                                g135 = v3;
                                g136 = v4;
                                g137 = v5;
                                g138 = v6;
                                g129 = v7;
                                return 0;
                            }
                            v27 = v24;
                            v25 = &g65;
                        } else {
                            // 0x949c
                            v27 = g126;
                            v25 = 0;
                            // branch -> 0x9504
                        }
                        // 0x9504
                        v19 = v15 - v25;
                        v17 = 0;
                        v22 = 4 * v25 + v27;
                        // branch -> 0x950c
                        while (true) {
                            // 0x950c
                            v26 = v22 + 4;
                            g128 = v26;
                            v28 = *(int32_t *)v22;
                            g132 = v28;
                            if (v28 == g135) {
                                goto lab_if_9514_0_true_3;
                            }
                            v18 = v17;
                            goto lab_after_if_9514_0_3;
                        }
                    }
                    // 0x9520
                    free((char *)g126);
                    v20 = g138;
                    g3 = v20 == 0;
                    if (v20 == 0) {
                        // 0x9520
                        // branch -> 0x955c
                        // 0x955c
                        *(int32_t *)(g129 + 4) = v14;
                        // branch -> 0x9560
                    } else {
                        // 0x9530
                        if (v20 != 2) {
                            // 0x9538
                            g3 = v20 == 1;
                            if (v20 == 1) {
                                // 0x9540
                                v21 = v14;
                                g3 = v21 == 0;
                                if (v21 != 0) {
                                    // if_9544_0_true
                                    v36 = v21 & -0x10000 | 1;
                                    // branch -> 0x955c
                                } else {
                                    v36 = 0;
                                }
                                // 0x955c
                                *(int32_t *)(g129 + 4) = v36;
                                // branch -> 0x9560
                            }
                            // 0x9560
                            g127 = 0;
                            g134 = v2;
                            g135 = v3;
                            g136 = v4;
                            g137 = v5;
                            g138 = v6;
                            g129 = v7;
                            return 0;
                        }
                        // 0x954c
                        v23 = g134;
                        v29 = v14;
                        g3 = v29 == v23;
                        v35 = 0;
                        if (v29 == v23) {
                            // if_9554_0_true
                            v35 = 1;
                            // branch -> after_if_9554_0
                        }
                        // after_if_9554_0
                        // branch -> 0x955c
                        // 0x955c
                        *(int32_t *)(g129 + 4) = v35;
                        // branch -> 0x9560
                    }
                    // 0x9560
                    g127 = 0;
                    g134 = v2;
                    g135 = v3;
                    g136 = v4;
                    g137 = v5;
                    g138 = v6;
                    g129 = v7;
                    return 0;
                }
                v34 = &g64;
            }
            // 0x93a8
            v33 = 4 * v34 + g126;
            v31 = g134 - v34;
            v32 = v34 + g139;
            // branch -> 0x93b4
            while (true) {
                // 0x93b4
                g128 = v32 + 1;
                v37 = (int32_t)*(char *)v32;
                g133 = v37;
                g132 = v33 + 4;
                *(int32_t *)v33 = v37;
                if (v31 != 1) {
                    goto lab_0x93b4;
                }
                // 0x93c4
                // branch -> 0x9488
                // 0x9488
                v14 = 0;
                v15 = g134;
                if (v15 == 0) {
                    // 0x9488
                    // branch -> 0x9520
                } else {
                    // 0x9494
                    if (v15 < 4) {
                        // 0x94a4
                        v24 = g126;
                        g132 = v24;
                        v16 = &g65;
                        // branch -> 0x94cc
                        while (v16 != 4) {
                            // 0x94cc
                            v16 -= 4;
                            // continue -> 0x94cc
                        }
                        // 0x94e4
                        g128 = &g65;
                        if (v15 == (int32_t)&g65) {
                            // 0x9520
                            free((char *)v24);
                            v20 = g138;
                            g3 = v20 == 0;
                            if (v20 == 0) {
                                // 0x9520
                                // branch -> 0x955c
                                // 0x955c
                                *(int32_t *)(g129 + 4) = v14;
                                // branch -> 0x9560
                                // 0x9560
                                g127 = 0;
                                g134 = v2;
                                g135 = v3;
                                g136 = v4;
                                g137 = v5;
                                g138 = v6;
                                g129 = v7;
                                return 0;
                            }
                            // 0x9530
                            if (v20 == 2) {
                                // 0x954c
                                v23 = g134;
                                v29 = v14;
                                g3 = v29 == v23;
                                if (v29 == v23) {
                                    // if_9554_0_true
                                    // branch -> after_if_9554_0
                                    // after_if_9554_0
                                    // branch -> 0x955c
                                    // 0x955c
                                    *(int32_t *)(g129 + 4) = 1;
                                    // branch -> 0x9560
                                    // 0x9560
                                    g127 = 0;
                                    g134 = v2;
                                    g135 = v3;
                                    g136 = v4;
                                    g137 = v5;
                                    g138 = v6;
                                    g129 = v7;
                                    return 0;
                                }
                                // after_if_9554_0
                                // branch -> 0x955c
                                // 0x955c
                                *(int32_t *)(g129 + 4) = 0;
                                // branch -> 0x9560
                                // 0x9560
                                g127 = 0;
                                g134 = v2;
                                g135 = v3;
                                g136 = v4;
                                g137 = v5;
                                g138 = v6;
                                g129 = v7;
                                return 0;
                            }
                            // 0x9538
                            g3 = v20 == 1;
                            if (v20 != 1) {
                                // 0x9560
                                g127 = 0;
                                g134 = v2;
                                g135 = v3;
                                g136 = v4;
                                g137 = v5;
                                g138 = v6;
                                g129 = v7;
                                return 0;
                            }
                            // 0x9540
                            v21 = v14;
                            g3 = v21 == 0;
                            if (v21 != 0) {
                                // if_9544_0_true
                                v36 = v21 & -0x10000 | 1;
                                // branch -> 0x955c
                            } else {
                                v36 = 0;
                            }
                            // 0x955c
                            *(int32_t *)(g129 + 4) = v36;
                            // branch -> 0x9560
                            // 0x9560
                            g127 = 0;
                            g134 = v2;
                            g135 = v3;
                            g136 = v4;
                            g137 = v5;
                            g138 = v6;
                            g129 = v7;
                            return 0;
                        }
                        v27 = v24;
                        v25 = &g65;
                    } else {
                        // 0x949c
                        v27 = g126;
                        v25 = 0;
                        // branch -> 0x9504
                    }
                    // 0x9504
                    v19 = v15 - v25;
                    v17 = 0;
                    v22 = 4 * v25 + v27;
                    // branch -> 0x950c
                    while (true) {
                        // 0x950c
                        v26 = v22 + 4;
                        g128 = v26;
                        v28 = *(int32_t *)v22;
                        g132 = v28;
                        if (v28 == g135) {
                            goto lab_if_9514_0_true_3;
                        }
                        v18 = v17;
                        goto lab_after_if_9514_0_3;
                    }
                }
                // 0x9520
                free((char *)g126);
                v20 = g138;
                g3 = v20 == 0;
                if (v20 == 0) {
                    // 0x9520
                    // branch -> 0x955c
                    // 0x955c
                    *(int32_t *)(g129 + 4) = v14;
                    // branch -> 0x9560
                    // Detected a possible infinite recursion (goto support failed); quitting...
                } else {
                    // 0x9530
                    if (v20 == 2) {
                        // 0x954c
                        v23 = g134;
                        v29 = v14;
                        g3 = v29 == v23;
                        v35 = 0;
                        if (v29 == v23) {
                            // if_9554_0_true
                            v35 = 1;
                            // branch -> after_if_9554_0
                            // after_if_9554_0
                            // branch -> 0x955c
                            // 0x955c
                            *(int32_t *)(g129 + 4) = v35;
                            // branch -> 0x9560
                            // Detected a possible infinite recursion (goto support failed); quitting...
                        }
                        // after_if_9554_0
                        // branch -> 0x955c
                        // 0x955c
                        *(int32_t *)(g129 + 4) = v35;
                        // branch -> 0x9560
                        // Detected a possible infinite recursion (goto support failed); quitting...
                    } else {
                        // 0x9538
                        g3 = v20 == 1;
                        if (v20 == 1) {
                            // 0x9540
                            v21 = v14;
                            g3 = v21 == 0;
                            if (v21 != 0) {
                                // if_9544_0_true
                                v36 = v21 & -0x10000 | 1;
                                // branch -> 0x955c
                            } else {
                                v36 = 0;
                            }
                            // 0x955c
                            *(int32_t *)(g129 + 4) = v36;
                            // branch -> 0x9560
                            // Detected a possible infinite recursion (goto support failed); quitting...
                        }
                        // Detected a possible infinite recursion (goto support failed); quitting...
                    }
                    // Detected a possible infinite recursion (goto support failed); quitting...
                }
                // Detected a possible infinite recursion (goto support failed); quitting...
            }
        }
        // 0x93c4
        // branch -> 0x9488
    }
    // 0x9488
    v14 = 0;
    v15 = g134;
    if (v15 == 0) {
        // 0x9488
        // branch -> 0x9520
    } else {
        // 0x9494
        if (v15 < 4) {
            // 0x94a4
            v24 = g126;
            g132 = v24;
            v16 = &g65;
            // branch -> 0x94cc
            while (v16 != 4) {
                // 0x94cc
                v16 -= 4;
                // continue -> 0x94cc
            }
            // 0x94e4
            g128 = &g65;
            if (v15 == (int32_t)&g65) {
                // 0x9520
                free((char *)v24);
                v20 = g138;
                g3 = v20 == 0;
                if (v20 == 0) {
                    // 0x9520
                    // branch -> 0x955c
                    // Detected a possible infinite recursion (goto support failed); quitting...
                } else {
                    // 0x9530
                    if (v20 == 2) {
                        // 0x954c
                        v23 = g134;
                        v29 = v14;
                        g3 = v29 == v23;
                        if (v29 == v23) {
                            // if_9554_0_true
                            // branch -> after_if_9554_0
                        }
                        // after_if_9554_0
                        // branch -> 0x955c
                    } else {
                        // 0x9538
                        g3 = v20 == 1;
                        if (v20 == 1) {
                            // 0x9540
                            v21 = v14;
                            g3 = v21 == 0;
                            if (v21 != 0) {
                                // if_9544_0_true
                                // branch -> 0x955c
                            }
                            // Detected a possible infinite recursion (goto support failed); quitting...
                        }
                        // Detected a possible infinite recursion (goto support failed); quitting...
                    }
                    // Detected a possible infinite recursion (goto support failed); quitting...
                }
                // Detected a possible infinite recursion (goto support failed); quitting...
            } else {
                v27 = v24;
                v25 = &g65;
            }
        } else {
            // 0x949c
            v27 = g126;
            v25 = 0;
            // branch -> 0x9504
        }
        // 0x9504
        v19 = v15 - v25;
        v17 = 0;
        v22 = 4 * v25 + v27;
        // branch -> 0x950c
        while (true) {
            // 0x950c
            v26 = v22 + 4;
            g128 = v26;
            v28 = *(int32_t *)v22;
            g132 = v28;
            if (v28 == g135) {
                goto lab_if_9514_0_true_3;
            }
            v18 = v17;
            goto lab_after_if_9514_0_3;
        }
    }
    // 0x9520
    free((char *)g126);
    v20 = g138;
    g3 = v20 == 0;
    if (v20 == 0) {
        // 0x9520
        // branch -> 0x955c
        // Detected a possible infinite recursion (goto support failed); quitting...
    } else {
        // 0x9530
        if (v20 == 2) {
            // 0x954c
            v23 = g134;
            v29 = v14;
            g3 = v29 == v23;
            if (v29 == v23) {
                // if_9554_0_true
                // branch -> after_if_9554_0
            }
            // after_if_9554_0
            // branch -> 0x955c
        } else {
            // 0x9538
            g3 = v20 == 1;
            if (v20 == 1) {
                // 0x9540
                v21 = v14;
                g3 = v21 == 0;
                if (v21 != 0) {
                    // if_9544_0_true
                    // branch -> 0x955c
                }
                // Detected a possible infinite recursion (goto support failed); quitting...
            }
            // Detected a possible infinite recursion (goto support failed); quitting...
        }
        // Detected a possible infinite recursion (goto support failed); quitting...
    }
    // Detected a possible infinite recursion (goto support failed); quitting...
}
 
// Address range: 0x9570 - 0x9593
int32_t script_transform_count(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g131 = v2;
    g126 = 0;
    int32_t result = script_transform_count_values(g127, g128, (int32_t *)g132, g133); // 0x9588
    g130 = v1;
    return result;
}
 
// Address range: 0x9594 - 0x95b7
int32_t script_transform_any(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g131 = v2;
    g126 = 1;
    int32_t result = script_transform_count_values(g127, g128, (int32_t *)g132, g133); // 0x95ac
    g130 = v1;
    return result;
}
 
// Address range: 0x95b8 - 0x95db
int32_t script_transform_all(void) {
    int32_t v1 = g130; // bp-8
    g130 = &v1;
    int32_t v2;
    g131 = v2;
    g126 = 2;
    int32_t result = script_transform_count_values(g127, g128, (int32_t *)g132, g133); // 0x95d0
    g130 = v1;
    return result;
}
 
// Address range: 0x95dc - 0x99db
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) {
    // 0x95dc
    g132 = a3;
    int32_t v1 = a4;
    g133 = v1;
    int32_t v2 = g134; // 0x95dc
    int32_t v3 = g135; // 0x95dc
    int32_t v4 = g138; // 0x95dc
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    int32_t v6 = (int32_t)a5;
    g137 = v6;
    g134 = a2;
    g138 = a3;
    *(int32_t *)(v6 + 8) = 0;
    int32_t v7; // 0x9948
    uint32_t v8; // 0x9658
    int32_t v9; // 0x9630
    uint32_t v10; // 0x961c
    if (v1 >= 3) {
        // 0x9608
        g129 = v1;
        // branch -> 0x961c
        // 0x961c
        v10 = a1 % 256;
        g1 = v10 > 6;
        g2 = v10 < 7;
        g3 = v10 == 7;
        if (v10 > 7) {
            // 0x967c
            g127 = (int32_t)"internal error";
            // branch -> 0x9960
        } else {
            // 0x9628
            g128 = &g66;
            v9 = *(int32_t *)(4 * v10 + (int32_t)&g66);
            g127 = v9;
            ((int32_t (*)(int32_t, int32_t))(v9 + (int32_t)&g66))(v9, (int32_t)&g66);
            if (g3) {
                // if_9650_0_true
                // branch -> after_if_9650_0
            }
            // after_if_9650_0
            v8 = g129;
            *(char *)g137 = (char)v8;
            *(int32_t *)(g137 + 4) = enforce_value_size(g134, v8 % 256);
            g127 = 0;
            v7 = g130;
            g134 = *(int32_t *)(v7 - 28);
            g135 = *(int32_t *)(v7 - 24);
            g136 = *(int32_t *)(v7 - 20);
            g137 = *(int32_t *)(v7 - 16);
            g138 = *(int32_t *)(v7 - 12);
            g139 = *(int32_t *)(v7 - 8);
            g129 = *(int32_t *)(v7 - 4);
            g130 = *(int32_t *)v7;
            ((int32_t (*)(int32_t))*(int32_t *)(v7 + 4))(0);
            free((char *)g135);
            g127 = (int32_t)"internal error";
            // branch -> 0x9960
        }
        // 0x9960
        g134 = v2;
        g135 = v3;
        g138 = v4;
        g130 = v5;
        return duplicate_string();
    }
    // 0x9610
    g129 = 3;
    if (a4 != 4) {
        // 0x9670
        g127 = (int32_t)"integer size must be 1, 2 or 4";
        // branch -> 0x9960
        // 0x9960
        g134 = v2;
        g135 = v3;
        g138 = v4;
        g130 = v5;
        return duplicate_string();
    }
    // 0x961c
    v10 = a1 % 256;
    g1 = v10 > 6;
    g2 = v10 < 7;
    g3 = v10 == 7;
    if (v10 > 7) {
        // 0x967c
        g127 = (int32_t)"internal error";
        // branch -> 0x9960
    } else {
        // 0x9628
        g128 = &g66;
        v9 = *(int32_t *)(4 * v10 + (int32_t)&g66);
        g127 = v9;
        ((int32_t (*)(int32_t, int32_t))(v9 + (int32_t)&g66))(v9, (int32_t)&g66);
        if (g3) {
            // if_9650_0_true
            // branch -> after_if_9650_0
        }
        // after_if_9650_0
        v8 = g129;
        *(char *)g137 = (char)v8;
        *(int32_t *)(g137 + 4) = enforce_value_size(g134, v8 % 256);
        g127 = 0;
        v7 = g130;
        g134 = *(int32_t *)(v7 - 28);
        g135 = *(int32_t *)(v7 - 24);
        g136 = *(int32_t *)(v7 - 20);
        g137 = *(int32_t *)(v7 - 16);
        g138 = *(int32_t *)(v7 - 12);
        g139 = *(int32_t *)(v7 - 8);
        g129 = *(int32_t *)(v7 - 4);
        g130 = *(int32_t *)v7;
        ((int32_t (*)(int32_t))*(int32_t *)(v7 + 4))(0);
        free((char *)g135);
        g127 = (int32_t)"internal error";
        // branch -> 0x9960
    }
    // 0x9960
    g134 = v2;
    g135 = v3;
    g138 = v4;
    g130 = v5;
    return duplicate_string();
}
 
// Address range: 0x99dc - 0x9ae7
int32_t script_transform_length(uint32_t a1, int32_t a2, int32_t a3, uint32_t a4, char * a5) {
    int32_t v1 = g134; // bp-16
    int32_t v2 = g135; // 0x99dc
    int32_t v3 = g130; // bp-8
    g130 = &v3;
    int32_t v4 = (int32_t)a5;
    g135 = v4;
    *(int32_t *)(v4 + 8) = 0;
    *(char *)g135 = 3;
    if (a4 < 3) {
        // 0x9a6c
        g127 = (int32_t)"length type must be 0, 1, 2 or 4";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x9a10
    g134 = a4;
    uint32_t v5 = a1 % 256; // 0x9a14
    uint32_t v6 = v5 - 1; // 0x9a14
    if (v6 <= 2) {
        // 0x9a20
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x9a30
    if (a4 % 256 == 0) {
        // 0x9a7c
        if (v5 != 4) {
            // 0x9ac0
            *(int32_t *)(g135 + 4) = a2;
            g135 = v2;
            return 0;
        }
        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
        if (str == 0) {
            // 0x9ad0
            *(int32_t *)(g135 + 4) = 0;
            g135 = v2;
            return 0;
        }
        // 0x9a98
        *(int32_t *)(g135 + 4) = strlen((char *)str);
        free((char *)str);
        g135 = v2;
        return 0;
    }
    int32_t v7 = v5 - 5; // 0x9ab4
    if (v5 < 6) {
        // if_9a4c_0_true
        v7 = 0;
        // branch -> after_if_9a4c_0
    }
    uint32_t v8 = (a4 + 255) % 256; // 0x9a50
    uint32_t v9 = v7 % 256; // 0x9a54
    uint32_t v10 = v9 == 0 ? a2 : v9 < 32 ? a2 << v9 : 0; // 0x9a54
    if (1 << v9 != a2) {
        // 0x9a5c
        g127 = (int32_t)"data length is not aligned";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x9ab4
    // branch -> 0x9ad0
    // 0x9ad0
    *(int32_t *)(g135 + 4) = v10 >> (v8 > 32 ? 32 : v8);
    g135 = v2;
    return 0;
}
 
// Address range: 0x9ae8 - 0x9c5f
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) {
    int32_t v1 = g134; // bp-32
    int32_t v2 = g135; // 0x9ae8
    int32_t v3 = g138; // 0x9ae8
    int32_t v4 = g139; // 0x9ae8
    int32_t v5 = g130; // bp-8
    g138 = a5;
    g135 = a3;
    g3 = size == 0;
    *(int32_t *)(a5 + 4) = size;
    *(int32_t *)(g138 + 8) = 0;
    if (size < 0) {
        // 0x9b30
        g127 = (int32_t)"negative item count";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g139 = v4;
        g130 = v5;
        return duplicate_string();
    }
    // 0x9b18
    g3 = a1 % 256 == 0;
    if (a1 % 256 != 0) {
        // 0x9b20
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g139 = v4;
        g130 = v5;
        return duplicate_string();
    }
    // 0x9b40
    g3 = a2 % a6 == 0;
    if (a2 % a6 != 0) {
        // 0x9b54
        g127 = (int32_t)"data length is not aligned";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g139 = v4;
        g130 = v5;
        return duplicate_string();
    }
    int32_t v6 = size * a6; // 0x9b64
    g3 = a2 == v6;
    if (a2 < v6) {
        // 0x9b70
        g127 = (int32_t)"data is too short";
        g134 = v1;
        g135 = v2;
        g138 = v3;
        g139 = v4;
        g130 = v5;
        return duplicate_string();
    }
    // 0x9b80
    g3 = a6 == 4;
    if (a6 == 4) {
        // 0x9bb8
        return (int32_t)malloc(4 * size);
    }
    // 0x9b88
    g3 = a6 == 2;
    if (a6 == 2) {
        // 0x9bf4
        return (int32_t)malloc(2 * size);
    }
    // 0x9b90
    g3 = a6 == 1;
    if (a6 == 1) {
        // 0x9b98
        return (int32_t)malloc(size);
    }
    // 0x9c3c
    g127 = (int32_t)"internal error";
    g134 = v1;
    g135 = v2;
    g138 = v3;
    g139 = v4;
    g130 = v5;
    return duplicate_string();
}
 
// Address range: 0x9c60 - 0x9d73
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) {
    int32_t v1 = g134; // bp-24
    int32_t v2 = g135; // 0x9c60
    int32_t v3 = g130; // bp-8
    g135 = a2;
    int32_t v4 = (int32_t)a5;
    if (a1 % 256 <= 3) {
        // 0x9c88
        *a5 = 5;
        *(int32_t *)(v4 + 4) = size;
        *(int32_t *)(v4 + 8) = 0;
        if (size >= 0) {
            // 0x9ca4
            return (int32_t)malloc(size);
        }
        // 0x9d00
        g127 = (int32_t)"negative item count";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x9cd4
    *(int32_t *)(v4 + 4) = size;
    *(int32_t *)(v4 + 8) = 0;
    if (size < 0) {
        // 0x9d10
        g127 = (int32_t)"negative item count";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x9ce8
    if ((int32_t)a1 % 256 != 0) {
        // 0x9cf0
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    // 0x9d20
    if (g135 < size) {
        // 0x9d28
        g127 = (int32_t)"data is too short";
        g134 = v1;
        g135 = v2;
        g130 = v3;
        return duplicate_string();
    }
    char * mem = malloc(size); // 0x9d3c
    int32_t v5 = (int32_t)mem; // 0x9d3c_3
    g135 = v5;
    __aeabi_memcpy(mem, (char *)(int32_t)a3, size);
    *(int32_t *)(v4 + 8) = v5;
    *(char *)v4 = 5;
    g135 = v2;
    return 0;
}
 
// Address range: 0x9d74 - 0x9e63
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) {
    int32_t v1 = g134; // 0x9d74
    int32_t v2 = g135; // 0x9d74
    int32_t v3 = g136; // 0x9d74
    int32_t v4 = g130; // 0x9d74
    int32_t v5 = v4; // bp-8
    g130 = &v5;
    g134 = a2;
    int32_t v6 = (int32_t)a5;
    g136 = v6;
    g135 = a4;
    if (a1 % 256 > 3) {
        // 0x9e2c
        return script_transform_multiXX(a1, a2, a3, a4, v6, 2, v1, v2, v3, g129, v4, (int32_t (*)(int32_t))g126, v6, a6, a7, a8);
    }
    // 0x9d9c
    *a5 = 6;
    *(int32_t *)(g136 + 4) = g135;
    *(int32_t *)(g136 + 8) = 0;
    if (a4 >= 0) {
        // 0x9db8
        return (int32_t)malloc(2 * g135);
    }
    // 0x9e4c
    g127 = (int32_t)"negative item count";
    g134 = v1;
    g135 = v2;
    g130 = v5;
    return duplicate_string();
}
 
// Address range: 0x9e64 - 0x9f53
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) {
    int32_t v1 = g134; // 0x9e64
    int32_t v2 = g135; // 0x9e64
    int32_t v3 = g136; // 0x9e64
    int32_t v4 = g130; // 0x9e64
    int32_t v5 = v4; // bp-8
    g130 = &v5;
    g134 = a2;
    int32_t v6 = (int32_t)a5;
    g136 = v6;
    g135 = a4;
    if (a1 % 256 > 3) {
        // 0x9f1c
        return script_transform_multiXX(a1, a2, a3, a4, v6, 4, v1, v2, v3, g129, v4, (int32_t (*)(int32_t))g126, v6, a6, a7, a8);
    }
    // 0x9e8c
    *a5 = 7;
    *(int32_t *)(g136 + 4) = g135;
    *(int32_t *)(g136 + 8) = 0;
    if (a4 >= 0) {
        // 0x9ea8
        return (int32_t)malloc(4 * g135);
    }
    // 0x9f3c
    g127 = (int32_t)"negative item count";
    g134 = v1;
    g135 = v2;
    g130 = v5;
    return duplicate_string();
}
 
// Address range: 0x9f54 - 0xa013
int32_t script_transform_multi(uint32_t a1, int32_t a2, int32_t a3, int32_t a4) {
    int32_t v1 = g134; // 0x9f54
    int32_t v2 = g135; // 0x9f54
    int32_t v3 = g136; // 0x9f54
    int32_t v4 = g137; // 0x9f54
    int32_t v5 = g138; // 0x9f54
    int32_t v6 = g129; // 0x9f54
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    int32_t v8;
    g134 = v8;
    g136 = a1;
    g137 = a4;
    g138 = a3;
    g135 = a2;
    g3 = a1 % 256 == 0;
    *(int32_t *)(v8 + 8) = 0;
    int32_t result2; // 0xa004
    if (a1 % 256 == 0) {
        // 0x9f90
        g3 = g137 == 4;
        if (g137 <= 4) {
            uint32_t v9 = g137 % 256; // 0x9fa0
            g3 = v9 == 0 | (1 << v9 & 22) == 0 | v9 >= 32;
            if (v9 != 0) {
                int32_t v10 = g137 - 1; // 0x9fa8
                int32_t v11 = g135; // 0x9fac
                g3 = (v11 & v10) == 0;
                if (v10 == v11) {
                    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
                    g127 = result;
                    g134 = v1;
                    g135 = v2;
                    g136 = v3;
                    g137 = v4;
                    g138 = v5;
                    g129 = v6;
                    g130 = v7;
                    return result;
                }
                // 0x9fb4
                g127 = (int32_t)"data length is not aligned";
                // branch -> 0x9ffc
                // 0x9ffc
                g134 = v1;
                g135 = v2;
                g136 = v3;
                g137 = v4;
                g138 = v5;
                g129 = v6;
                g130 = v7;
                result2 = duplicate_string();
                g127 = result2;
                return result2;
            }
        }
        // 0x9ff4
        g127 = (int32_t)"parameter must be 1, 2 or 4";
        // branch -> 0x9ffc
    } else {
        // 0x9f84
        g127 = (int32_t)"type mismatch";
        // branch -> 0x9ffc
    }
    // 0x9ffc
    g134 = v1;
    g135 = v2;
    g136 = v3;
    g137 = v4;
    g138 = v5;
    g129 = v6;
    g130 = v7;
    result2 = duplicate_string();
    g127 = result2;
    return result2;
}
 
// Address range: 0xa014 - 0xa0e7
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) {
    int32_t v1 = g134; // bp-24
    int32_t v2 = g135; // 0xa014
    int32_t v3 = g136; // 0xa014
    int32_t v4 = g137; // 0xa014
    int32_t v5 = g130; // bp-8
    g130 = &v5;
    g137 = (int32_t)a5;
    g135 = (int32_t)a3;
    g134 = a4;
    *a5 = 4;
    *(int32_t *)(g137 + 4) = g134;
    *(int32_t *)(g137 + 8) = 0;
    if (a4 < 0) {
        // 0xa05c
        g127 = (int32_t)"negative length";
        g134 = v1;
        g135 = v2;
        g130 = v5;
        return duplicate_string();
    }
    // 0xa044
    if (a1 % 256 != 0) {
        // 0xa04c
        g127 = (int32_t)"type mismatch";
        g134 = v1;
        g135 = v2;
        g130 = v5;
        return duplicate_string();
    }
    int32_t size = g134; // 0xa06c
    if (size > a2) {
        // 0xa074
        g127 = (int32_t)"length is greater than data size";
        g134 = v1;
        g135 = v2;
        g130 = v5;
        return duplicate_string();
    }
    char * mem = malloc(size); // 0xa088
    int32_t v6 = g134; // 0xa090
    g136 = (int32_t)mem;
    __aeabi_memcpy(mem, (char *)g135, v6);
    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
    free((char *)v7);
    if (v7 != 0) {
        // if_a0bc_0_true
        *(int32_t *)(g137 + 8) = g136;
        g135 = v2;
        return 0;
    }
    // after_if_a0bc_0
    free((char *)g136);
    g127 = (int32_t)"data does not contain text";
    g134 = (int32_t)a5;
    g135 = a6;
    g130 = a9;
    return duplicate_string();
}
 
// Address range: 0xa0e8 - 0xa827
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) {
    int32_t v1 = 0; // SP
    g133 = a4;
    int32_t v2 = g134; // 0xa0e8
    int32_t v3 = g135; // 0xa0e8
    int32_t v4 = g136; // 0xa0e8
    int32_t v5 = g137; // 0xa0e8
    int32_t (*v6)() = (int32_t (*)())g138;
    int32_t v7 = g130; // bp-8
    g130 = &v7;
    g135 = (int32_t)a1;
    g134 = a2;
    char * mem = malloc(1); // 0xa10c
    int32_t v8 = g134; // 0xa114
    g1 = true;
    g2 = v8 < 0;
    g3 = v8 == 0;
    g110 = mem;
    *mem = 0;
    g109 = 0;
    int32_t v9; // 0xa758_5
    char * mem2; // 0xa758
    int32_t v10;
    int32_t v11;
    int32_t v12;
    int32_t v13;
    int32_t v14; // 0xa7a8
    uint32_t v15; // 0xa790
    int32_t result; // 0xa780
    int32_t v16; // 0xa7a8
    if (v8 == 0) {
        // 0xa0e8
        // branch -> 0xa750
    } else {
        // 0xa128
        g129 = v1 + 216;
        g133 = 0x3517;
        g136 = (int32_t)&g110;
        g72 = "%hhu";
        g137 = v1 + 224;
        g139 = 0;
        g70 = "{UNKNOWN ";
        g69 = "{NAME_END}";
        g71 = &g123;
        g73 = "{PAUSE_UNTIL_PRESS}";
        g77 = &g123;
        g78 = *(int32_t *)&g12;
        g84 = &g123;
        g76 = &g122;
        g85 = "%hhu";
        g83 = "{STRING ";
        int32_t v17 = g36; // 0xa1f8
        g82 = v17;
        g106 = "%hhu";
        g105 = "COLOR";
        g104 = "HIGHLIGHT";
        g103 = "SHADOW";
        g100 = &g122;
        g101 = &g119;
        char ** v18 = (char **)*(int32_t *)&g6;
        g99 = v18;
        g97 = &g119;
        g96 = "{COLOR_HIGHLIGHT_SHADOW ";
        g81 = v18;
        g93 = &g123;
        g80 = v18;
        g102 = &g123;
        g95 = "{SMALL}";
        g94 = "%hhu";
        g132 = &g123;
        g90 = &g123;
        g92 = "{PAUSE ";
        g98 = &g123;
        g128 = &g123;
        g79 = v17;
        g87 = &g123;
        g75 = &g115;
        g74 = &g116;
        g91 = "%hhu";
        g89 = "{SHIFT_TEXT ";
        g88 = "%02hhX%02hhX";
        g86 = "{PLAY_MUSIC 0x";
        g107 = "{PLAY_MUSIC 0x";
        int32_t v19;
        int32_t v20 = &v19; // 0xa460_0
        int32_t v21 = 0; // 0xa3e4
        // branch -> 0xa3e4
        while (true) {
            uint32_t v22 = v21 % 256; // 0xa3e4
            g1 = v22 > 16;
            g2 = v22 < 17;
            g3 = v22 == 17;
            int32_t v23; // 0xa728
            int32_t v24; // 0xa4dc
            if (v22 > 17) {
                // 0xa4bc
                int32_t v25; // 0xa730
                uint32_t v26; // 0xa73c
                if (v22 == 252) {
                    unsigned char v27 = *(char *)g135; // 0xa664
                    int32_t v28 = v27; // 0xa664
                    g139 = v28;
                    g1 = v27 > 23;
                    g2 = v27 < 24;
                    g3 = v27 == 24;
                    int32_t v29; // 0xa3d0
                    int32_t v30; // 0xa3d0
                    if (v27 > 24) {
                        // 0xa3a0
                        sprintf((char *)&g108, "\xe0\x10\x8d\xe5\x89\x01", v27);
                        g67 = -0x1a3ff000;
                        g68 = 0;
                        v30 = g129;
                        v29 = (int32_t)"\xe4";
                        // branch -> 0xa3d0
                    } else {
                        // 0xa670
                        g128 = &g112;
                        int32_t v31 = 4 * v28; // 0xa674
                        g127 = v31;
                        int32_t v32 = *(int32_t *)(v31 + (int32_t)&g112); // 0xa678
                        g132 = v32;
                        ((int32_t (*)(int32_t, int32_t, int32_t))(v32 + (int32_t)&g112))(v31, (int32_t)&g112, v32);
                        if (g3) {
                            // if_a6e0_0_true
                            // branch -> after_if_a6e0_0
                        }
                        // after_if_a6e0_0
                        v30 = 0;
                        v29 = a28;
                        // branch -> 0xa3d0
                    }
                    // 0xa3d0
                    concatenate((int32_t *)g136, (int32_t *)g137, (char *)v29, v30);
                    g139 = 0;
                    // branch -> 0xa72c
                } else {
                    // 0xa4c4
                    if (v22 == 253) {
                        unsigned char v33 = *(char *)g135; // 0xa4cc
                        int32_t v34 = v33; // 0xa4cc
                        if (v33 <= 15) {
                            // 0xa4d8
                            v24 = *(int32_t *)(4 * v34 - 0x1f710000);
                            if (v24 != 0) {
                                // 0xa4e8
                                g139 = 0;
                                g67 = -0x1d729f1c;
                                g68 = 0;
                                v23 = -0x1a60c998;
                                // branch -> 0xa728
                              lab_0xa728_2:
                                // 0xa728
                                concatenate((int32_t *)g136, (int32_t *)g137, (char *)v23, v24);
                                // branch -> 0xa72c
                                // 0xa72c
                                g135++;
                                v25 = g134;
                                g1 = v25 != 0;
                                g134 = v25 - 1;
                                if (v25 == 1) {
                                    // 0xa738
                                    v26 = g139;
                                    g2 = false;
                                    g3 = v26 % 256 == 0;
                                    if (v26 % 256 == 0) {
                                        // 0xa750
                                        mem2 = realloc((char *)(int32_t)"T", -0x1f70ffff);
                                        v9 = (int32_t)mem2;
                                        g127 = v9;
                                        g128 = -0x1f710000;
                                        g132 = 0;
                                        g110 = mem2;
                                        *(char *)(v9 - 0x1f710000) = 0;
                                        // branch -> 0xa76c
                                    } else {
                                        // 0xa744
                                        free("T");
                                        g127 = 0;
                                        // branch -> 0xa76c
                                    }
                                    // 0xa76c
                                    g134 = v13;
                                    g135 = v12;
                                    g136 = v11;
                                    g137 = v10;
                                    g138 = v2;
                                    g139 = v3;
                                    g129 = v4;
                                    g130 = v5;
                                    v6();
                                    result = g127;
                                    if (g3) {
                                        // if_a824_0_true
                                        v15 = g135 % 256;
                                        v14 = g130;
                                        v16 = v15 == 0 ? v14 : v15 < 32 ? v14 << v15 : 0;
                                        *(int16_t *)result = (int16_t)(v16 & result);
                                        g133 = 0;
                                        // branch -> after_if_a824_0
                                        // after_if_a824_0
                                        return result - g129;
                                    }
                                    // after_if_a824_0
                                    return result;
                                }
                              lab_0xa72c_2:
                                // 0xa72c
                                v21 = g139;
                                // branch -> 0xa3e4
                                continue;
                            }
                        }
                        // 0xa700
                        sprintf((char *)&g108, "\x18", v33);
                        g139 = 0;
                        g67 = -0x1f710000;
                        g68 = 0;
                        v24 = g129;
                        v23 = (int32_t)g83;
                        // branch -> 0xa728
                        goto lab_0xa728_2;
                    }
                }
                // 0xa72c
                g135++;
                v25 = g134;
                g1 = v25 != 0;
                g134 = v25 - 1;
                if (v25 != 1) {
                    goto lab_0xa72c_2;
                }
                // 0xa738
                v26 = g139;
                g2 = false;
                g3 = v26 % 256 == 0;
                if (v26 % 256 == 0) {
                    // 0xa750
                    mem2 = realloc((char *)(int32_t)"T", -0x1f70ffff);
                    v9 = (int32_t)mem2;
                    g127 = v9;
                    g128 = -0x1f710000;
                    g132 = 0;
                    g110 = mem2;
                    *(char *)(v9 - 0x1f710000) = 0;
                    // branch -> 0xa76c
                } else {
                    // 0xa744
                    free("T");
                    g127 = 0;
                    // branch -> 0xa76c
                }
                // 0xa76c
                g134 = v13;
                g135 = v12;
                g136 = v11;
                g137 = v10;
                g138 = v2;
                g139 = v3;
                g129 = v4;
                g130 = v5;
                v6();
                result = g127;
                if (g3) {
                    // if_a824_0_true
                    v15 = g135 % 256;
                    v14 = g130;
                    v16 = v15 == 0 ? v14 : v15 < 32 ? v14 << v15 : 0;
                    *(int16_t *)result = (int16_t)(v16 & result);
                    g133 = 0;
                    // branch -> after_if_a824_0
                    // after_if_a824_0
                    return result - g129;
                }
                // after_if_a824_0
                return result;
            }
            // 0xa3f0
            g128 = &g111;
            int32_t v35 = *(int32_t *)(4 * v22 + (int32_t)&g111); // 0xa3f8
            g127 = v35;
            ((int32_t (*)(int32_t, int32_t))(v35 + (int32_t)&g111))(v35, (int32_t)&g111);
            if (g3) {
                // if_a444_0_true
                // branch -> after_if_a444_0
            }
            // after_if_a444_0
            int32_t str;
            g138 = &str;
            int32_t format;
            sprintf((char *)&str, (char *)format);
            int32_t v36;
            v19 = v36;
            int32_t v37 = g139; // 0xa478
            g139 = 0;
            unsigned char v38 = *(char *)g135; // 0xa488
            int32_t v39 = v38; // 0xa488
            if (v38 < 16) {
                // if_a490_0_true
                g138 = *(int32_t *)(4 * v39 + a40);
                // branch -> after_if_a494_0
            }
            // after_if_a494_0
            v24 = *(int32_t *)(4 * ((v37 + 255) % 256) + v20);
            int32_t v40;
            v23 = v40;
            // branch -> 0xa728
            goto lab_0xa728_2;
        }
    }
    // 0xa750
    mem2 = realloc((char *)(int32_t)mem, -0x1f70ffff);
    v9 = (int32_t)mem2;
    g127 = v9;
    g128 = -0x1f710000;
    g132 = 0;
    g110 = mem2;
    *(char *)(v9 - 0x1f710000) = 0;
    // branch -> 0xa76c
    // 0xa76c
    g134 = v13;
    g135 = v12;
    g136 = v11;
    g137 = v10;
    g138 = v2;
    g139 = v3;
    g129 = v4;
    g130 = v5;
    v6();
    result = g127;
    int32_t result2 = result; // 0xa824_2
    if (g3) {
        // if_a824_0_true
        v15 = g135 % 256;
        v14 = g130;
        v16 = v15 == 0 ? v14 : v15 < 32 ? v14 << v15 : 0;
        *(int16_t *)result = (int16_t)(v16 & result);
        g133 = 0;
        result2 = result - g129;
        // branch -> after_if_a824_0
    }
    // after_if_a824_0
    return result2;
}
 
// Address range: 0xa828 - 0xa82f
int32_t __udivsi3(int32_t result) {
    // 0xa828
    g3 = g128 == 1;
    return result;
}
 
// Address range: 0xa830 - 0xa8cf
int32_t function_a830(uint32_t a1, uint32_t a2, int32_t a3) {
    // 0xa830
    if (!g1) {
        // 0xa8c4
        g1 = true;
        g3 = a1 == 0;
        int32_t v1;
        if (a1 != 0) {
            // if_a8c8_0_true
            v1 = -1;
            // branch -> after_if_a8c8_0
        } else {
            v1 = 0;
        }
        int32_t result = v1 / a2;
        g127 = result;
        return result;
    }
    // 0xa834
    g1 = a1 >= a2;
    g3 = a1 == a2;
    if (a1 <= a2) {
        int32_t result2 = a1 == a2;
        g127 = result2;
        return result2;
    }
    // 0xa83c
    g3 = (a3 & a2) == 0;
    int32_t v2 = llvm_ctlz_i32(a2, false); // 0xa8b4
    if (a2 == a3) {
        uint32_t v3 = (31 - v2) % 256; // 0xa8bc
        int32_t result3 = a1 >> (v3 > 32 ? 32 : v3); // 0xa8bc
        g127 = result3;
        return result3;
    }
    uint32_t v4 = (v2 - llvm_ctlz_i32(a1, false)) % 256; // 0xa854
    int32_t v5 = 0; // 0xa868
    uint32_t v6 = v4 == 0 ? 1 : v4 < 32 ? 1 << v4 : 0; // 0xa894
    int32_t v7 = a1; // 0xa864
    uint32_t v8 = v4 == 0 ? a2 : v4 < 32 ? a2 << v4 : 0; // 0xa898
    // branch -> 0xa860
    while (true) {
        int32_t v9 = v7; // 0xa870
        int32_t v10 = v5; // 0xa874
        if (v7 < v8) {
            // if_a864_0_true
            v9 = v7 - v8;
            v10 = v6 | v5;
            // branch -> after_if_a868_0
        }
        uint32_t v11 = v8 / 2; // 0xa86c
        int32_t v12 = v9; // 0xa87c
        int32_t v13 = v10; // 0xa880
        if (v9 < v11) {
            // if_a870_0_true
            v12 = v9 - v11;
            v13 = v10 | v6 / 2;
            // branch -> after_if_a874_0
        }
        uint32_t v14 = v8 / 4; // 0xa878
        int32_t v15 = v12; // 0xa888
        int32_t v16 = v13; // 0xa88c
        if (v12 < v14) {
            // if_a87c_0_true
            v15 = v12 - v14;
            v16 = v13 | v6 / 4;
            // branch -> after_if_a880_0
        }
        uint32_t v17 = v8 / 8; // 0xa884
        int32_t v18 = v15; // 0xa890
        int32_t result4 = v16; // 0xa8a0
        if (v15 < v17) {
            // if_a888_0_true
            v18 = v15 - v17;
            result4 = v16 | v6 / 8;
            // branch -> after_if_a88c_0
        }
        // after_if_a88c_0
        if (v18 == 0) {
            // 0xa8a0
            g1 = true;
            g3 = true;
            g127 = result4;
            return result4;
        }
        // after_if_a894_0
        if (v6 < 16) {
            // 0xa8a0
            g1 = false;
            g3 = true;
            g127 = result4;
            return result4;
        }
        // after_if_a898_0
        v5 = result4;
        v6 /= 16;
        v7 = v18;
        v8 /= 16;
        // branch -> 0xa860
    }
}
 
// Address range: 0xa8d0 - 0xa8ef
int32_t __aeabi_uidivmod(uint32_t a1, uint32_t a2) {
    // 0xa8d0
    g3 = a2 == 0;
    int32_t v1 = a1 / a2;
    g127 = v1;
    return a1 - v1 * a2;
}
 
// Address range: 0xa8f0 - 0xa8f7
void __aeabi_idiv(void) {
    // 0xa8f0
    return;
}
 
// Address range: 0xa8f8 - 0xa9bb
int32_t function_a8f8(int32_t a1) {
    int32_t v1 = g128 ^ a1; // 0xa8f8
    g131 = v1;
    int32_t v2; // 0xa8fc
    if (g2) {
        // if_a8fc_0_true
        v2 = -g128;
        // branch -> after_if_a8fc_0
    }
    // after_if_a8fc_0
    int32_t result; // 0xa984_1
    if (v2 == 1) {
        // 0xa988
        g3 = g128 == 0;
        if (v1 < 0) {
            // if_a98c_0_true
            result = -a1;
            // branch -> after_if_a980_0
        } else {
            result = a1;
        }
        // after_if_a980_0
        return result;
    }
    uint32_t v3 = a1 < 0 ? -a1 : a1;
    g3 = v3 == v2;
    if (v3 > v2) {
        int32_t v4 = llvm_ctlz_i32(v2, false); // 0xa9a4
        uint32_t v5 = (v4 - llvm_ctlz_i32(v3, false)) % 256; // 0xa930
        int32_t v6 = 0; // 0xa944
        uint32_t v7 = v5 == 0 ? 1 : v5 < 32 ? 1 << v5 : 0; // 0xa970
        int32_t v8 = v3; // 0xa940
        uint32_t v9 = v5 == 0 ? v2 : v5 < 32 ? v2 << v5 : 0; // 0xa974
        // branch -> 0xa93c
        while (true) {
            int32_t v10 = v8; // 0xa94c
            int32_t v11 = v6; // 0xa950
            if (v8 >= v9) {
                // if_a944_0_true
                v10 = v8 - v9;
                v11 = v7 | v6;
                // branch -> after_if_a944_0
            }
            uint32_t v12 = v9 / 2; // 0xa948
            int32_t v13 = v10; // 0xa958
            int32_t v14 = v11; // 0xa95c
            if (v10 < v12) {
                // if_a94c_0_true
                v13 = v10 - v12;
                v14 = v11 | v7 / 2;
                // branch -> after_if_a950_0
            }
            uint32_t v15 = v9 / 4; // 0xa954
            int32_t v16 = v13; // 0xa964
            int32_t v17 = v14; // 0xa968
            if (v13 < v15) {
                // if_a958_0_true
                v16 = v13 - v15;
                v17 = v14 | v7 / 4;
                // branch -> after_if_a95c_0
            }
            uint32_t v18 = v9 / 8; // 0xa960
            int32_t v19 = v16; // 0xa96c
            int32_t v20 = v17; // 0xa980
            if (v16 < v18) {
                // if_a964_0_true
                v19 = v16 - v18;
                v20 = v17 | v7 / 8;
                // branch -> after_if_a968_0
            }
            // after_if_a968_0
            if (v19 != 0) {
                // after_if_a970_0
                if (v7 >= 16) {
                    // after_if_a974_0
                    v6 = v20;
                    v7 /= 16;
                    v8 = v19;
                    v9 /= 16;
                    // branch -> 0xa93c
                    continue;
                }
            }
            // 0xa97c
            g3 = g128 == a1;
            if (v1 < 0) {
                // if_a980_0_true
                // branch -> after_if_a980_0
                // after_if_a980_0
                return -v20;
            }
        }
    } else {
        if (v3 < v2) {
            // if_a994_0_true
            a1 = 0;
            // branch -> after_if_a994_0
        }
        // after_if_a994_0
        if (v3 == v2) {
            // if_a99c_0_true
            result = v1 >> 31 | 1;
            // branch -> after_if_a980_0
        } else {
            result = a1;
        }
    }
    // after_if_a980_0
    return result;
}
 
// Address range: 0xa9bc - 0xa9cb
void function_a9bc(int32_t a1) {
    // 0xa9bc
    if (a1 > 0) {
        // if_a9c0_0_true
        // branch -> after_if_a9c0_0
    }
    // after_if_a9c0_0
    if (a1 < 0) {
        // if_a9c4_0_true
        // branch -> after_if_a9c4_0
    }
}
 
// Address range: 0xa9cc - 0xa9eb
int32_t __aeabi_idivmod(int32_t a1, int32_t a2) {
    // 0xa9cc
    g128 = a2;
    g2 = a2 < 0;
    int32_t result = function_a8f8(a1); // 0xa9d8
    g127 = result;
    return result;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
// Address range: 0xa9fc - 0xaa13
// Line range:    454 - 466
int32_t selfrel_offset31(int32_t * p) {
    int32_t v1 = *p; // 0xa9fc
    int32_t v2 = (v1 & 0x40000000) == 0 ? (int32_t)fabsf((float32_t)v1) : v1 | -0x80000000;
    return v2 + (int32_t)p;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xaa14 - 0xaab7
// Line range:    157 - 189
struct __EIT_entry * search_EIT_table(struct __EIT_entry * table, int32_t nrec, int32_t return_address) {
    int32_t v1 = (int32_t)table; // 0xaa14_0
    int32_t v2 = g135; // 0xaa14
    int32_t v3 = g138; // 0xaa14
    g135 = nrec;
    if (nrec == 0) {
        // 0xaaac
        g135 = v2;
        g138 = v3;
        return (struct __EIT_entry *)0;
    }
    int32_t v4 = nrec - 1; // 0xaa24
    g138 = v4;
    int32_t v5 = 0; // R11
    int32_t v6 = 0; // 0xaa38
    // branch -> 0xaa38
    while (true) {
        int32_t v7 = v4 + v6; // 0xaa38
        int32_t v8 = ((int32_t)(v7 < 0) + v7) / 2; // 0xaa40
        int32_t v9 = v8; // R4
        int32_t v10 = 8 * v8; // 0xaa44
        int32_t v11 = v10; // R10
        int32_t v12 = v10 + v1; // 0xaa48
        g135 = v12;
        uint32_t v13 = selfrel_offset31((int32_t *)v12); // 0xaa50
        int32_t v14 = g138; // 0xaa54
        int32_t v15; // 0xaa80
        int32_t v16; // 0xaa78
        int32_t v17;
        if (v9 == v14) {
            // 0xaaa4
            if (return_address < v13) {
              lab_0xaa78:
                // 0xaa78
                v16 = v5;
                if (v14 == v16) {
                    // 0xaa9c
                    g135 = 0;
                    // branch -> 0xaaac
                    // 0xaaac
                    g135 = v2;
                    g138 = v3;
                    return (struct __EIT_entry *)0;
                }
                // 0xaa80
                v15 = v14 - 1;
                // branch -> 0xaa38
              lab_0xaa38:
                // 0xaa38
                v6 = v16;
                v4 = v15;
                // branch -> 0xaa38
                continue;
            }
        } else {
            int32_t v18 = selfrel_offset31((int32_t *)(v11 + 8 + v1)); // 0xaa68
            if (return_address < v13) {
                // 0xaa88
                if (return_address <= v18 - 1) {
                    // 0xaaac
                    v17 = g135;
                    // branch -> 0xaaac
                    // 0xaaac
                    g135 = v2;
                    g138 = v3;
                    return (struct __EIT_entry *)v17;
                }
                int32_t v19 = v9 + 1; // 0xaa94
                v5 = v19;
                v15 = v4;
                v16 = v19;
                // branch -> 0xaa38
                goto lab_0xaa38;
            } else {
                // 0xaa5c
                v14 = v9;
                // branch -> 0xaa78
                goto lab_0xaa78;
            }
        }
        // 0xaaac
        v17 = g135;
        // branch -> 0xaaac
        // 0xaaac
        g135 = v2;
        g138 = v3;
        return (struct __EIT_entry *)v17;
    }
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
// Address range: 0xaab8 - 0xab07
// Line range:    469 - 485
int32_t __gnu_unwind_get_pr_addr(int32_t idx) {
    // 0xaab8
    g3 = idx == 1;
    if (idx == 1) {
        // 0xaadc
        return g45;
    }
    // 0xaac0
    g3 = idx == 2;
    if (idx == 2) {
        // 0xaae8
        return g15;
    }
    // 0xaac8
    g3 = idx == 0;
    if (idx == 0) {
        // 0xaad0
        return g10;
    }
    // 0xaaf4
    return 0;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xab08 - 0xac07
// Line range:    196 - 275
int32_t get_eit_entry(struct _Unwind_Control_Block * ucbp, int32_t return_address) {
    // 0xab08
    int32_t v1;
    int32_t nrec = v1; // bp-20
    nrec = return_address;
    int32_t v2 = g134; // 0xab0c
    int32_t v3 = g135; // 0xab0c
    g134 = (int32_t)ucbp;
    int32_t v4 = return_address - 2; // 0xab18
    g135 = v4;
    int32_t * v5; // 0xabc0_0
    struct __EIT_entry * v6; // 0xab6c
    int32_t v7; // 0xab78
    int32_t v8; // 0xabd0
    int32_t result; // 0xabf8_2
    int32_t v9; // 0xab9c
    int32_t v10; // 0xabb8
    int32_t v11; // 0xab7c
    int32_t v12; // 0xabbc
    uint32_t v13; // 0xabc0
    if (g38 == 0) {
        int32_t v14 = *(int32_t *)&g17; // 0xab54
        int32_t v15 = (g7 - v14) / 8; // 0xab5c
        nrec = v15;
        // branch -> 0xab64
        // 0xab64
        v6 = search_EIT_table((struct __EIT_entry *)v14, v15, v4);
        g135 = (int32_t)v6;
        if (v6 == NULL) {
            // 0xab38
            *(int32_t *)(g134 + 16) = 0;
            // branch -> 0xabf4
            // 0xabf4
            g134 = v2;
            g135 = v3;
            return 9;
        }
        // 0xab78
        v7 = selfrel_offset31(&v6->e0);
        v11 = *(int32_t *)(g135 + 4);
        if (v11 == 1) {
            // if_ab84_0_true
            *(int32_t *)(g134 + 16) = 0;
            *(int32_t *)(g134 + 72) = v7;
            // branch -> 0xabf4
            // 0xabf4
            g134 = v2;
            g135 = v3;
            return 5;
        }
        // 0xab98
        *(int32_t *)(g134 + 72) = v7;
        v9 = g135 + 4;
        if (v11 < 0) {
            // if_aba0_0_true
            *(int32_t *)(g134 + 76) = v9;
            v12 = 1;
            // branch -> 0xabb8
        } else {
            // 0xabac
            *(int32_t *)(g134 + 76) = selfrel_offset31((int32_t *)v9);
            v12 = 0;
            // branch -> 0xabb8
        }
        // 0xabb8
        v10 = g134;
        *(int32_t *)(v10 + 80) = v12;
        v5 = (int32_t *)*(int32_t *)(v10 + 76);
        v13 = *v5;
        if (v13 > -1) {
            // 0xabe8
            *(int32_t *)(g134 + 16) = selfrel_offset31(v5);
            // branch -> 0xabf4
            // 0xabf4
            g134 = v2;
            g135 = v3;
            return 0;
        }
        // 0xabcc
        v8 = __gnu_unwind_get_pr_addr(v13 / 0x1000000 % 16);
        *(int32_t *)(g134 + 16) = v8;
        if (v8 == 0) {
            // if_abdc_0_true
            result = 9;
            // branch -> 0xabf4
        } else {
            // if_abe0_0_true
            result = 0;
            // branch -> 0xabf4
        }
        // 0xabf4
        g134 = v2;
        g135 = v3;
        return result;
    }
    int32_t v16 = __gnu_Unwind_Find_exidx(v4, &nrec); // 0xab2c
    if (v16 == 0) {
        // 0xab38
        *(int32_t *)(g134 + 16) = 0;
        // branch -> 0xabf4
        // 0xabf4
        g134 = v2;
        g135 = v3;
        return 9;
    }
    // 0xab24
    // branch -> 0xab64
    // 0xab64
    v6 = search_EIT_table((struct __EIT_entry *)v16, nrec, g135);
    g135 = (int32_t)v6;
    if (v6 == NULL) {
        // 0xab38
        *(int32_t *)(g134 + 16) = 0;
        // branch -> 0xabf4
        // 0xabf4
        g134 = v2;
        g135 = v3;
        return 9;
    }
    // 0xab78
    v7 = selfrel_offset31(&v6->e0);
    v11 = *(int32_t *)(g135 + 4);
    if (v11 == 1) {
        // if_ab84_0_true
        *(int32_t *)(g134 + 16) = 0;
        *(int32_t *)(g134 + 72) = v7;
        // branch -> 0xabf4
        // 0xabf4
        g134 = v2;
        g135 = v3;
        return 5;
    }
    // 0xab98
    *(int32_t *)(g134 + 72) = v7;
    v9 = g135 + 4;
    if (v11 < 0) {
        // if_aba0_0_true
        *(int32_t *)(g134 + 76) = v9;
        v12 = 1;
        // branch -> 0xabb8
    } else {
        // 0xabac
        *(int32_t *)(g134 + 76) = selfrel_offset31((int32_t *)v9);
        v12 = 0;
        // branch -> 0xabb8
    }
    // 0xabb8
    v10 = g134;
    *(int32_t *)(v10 + 80) = v12;
    v5 = (int32_t *)*(int32_t *)(v10 + 76);
    v13 = *v5;
    if (v13 > -1) {
        // 0xabe8
        *(int32_t *)(g134 + 16) = selfrel_offset31(v5);
        // branch -> 0xabf4
        // 0xabf4
        g134 = v2;
        g135 = v3;
        return 0;
    }
    // 0xabcc
    v8 = __gnu_unwind_get_pr_addr(v13 / 0x1000000 % 16);
    *(int32_t *)(g134 + 16) = v8;
    if (v8 == 0) {
        // if_abdc_0_true
        result = 9;
        // branch -> 0xabf4
    } else {
        // if_abe0_0_true
        result = 0;
        // branch -> 0xabf4
    }
    // 0xabf4
    g134 = v2;
    g135 = v3;
    return result;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
// Address range: 0xac08 - 0xac73
// Line range:    124 - 140
void restore_non_core_regs(struct anon_struct_5 * vrs) {
    uint32_t v1 = vrs->e0; // 0xac08
    int32_t v2 = g134; // 0xac0c
    int32_t v3 = (int32_t)vrs; // R4
    int32_t v4;
    int32_t v5; // 0xac54
    int32_t v6; // 0xac68
    int32_t v7; // 0xac34
    if (v1 % 2 != 0) {
        // 0xac34
        v7 = v3;
        v5 = v7;
        if ((*(int32_t *)v7 & 4) == 0) {
            // 0xac40
            __gnu_Unwind_Restore_VFP_D_16_to_31();
            v5 = v3;
            // branch -> 0xac48
        }
        // 0xac48
        v6 = v5;
        if ((*(int32_t *)v5 & 8) == 0) {
            // 0xac54
            __gnu_Unwind_Restore_WMMXD();
            v6 = v3;
            // branch -> 0xac5c
        }
        // 0xac5c
        if ((*(int32_t *)v6 & 16) != 0) {
            // if_ac64_0_true
            g134 = v2;
            return;
        }
        // after_if_ac64_0
        g134 = v4;
        __gnu_Unwind_Restore_WMMXC();
        return;
    }
    // 0xac1c
    if ((v1 & 2) == 0) {
        // 0xac30
        __gnu_Unwind_Restore_VFP();
        // branch -> 0xac34
    } else {
        // 0xac28
        __gnu_Unwind_Restore_VFP_D();
        // branch -> 0xac34
    }
    // 0xac34
    v7 = v3;
    v5 = v7;
    if ((*(int32_t *)v7 & 4) == 0) {
        // 0xac40
        __gnu_Unwind_Restore_VFP_D_16_to_31();
        v5 = v3;
        // branch -> 0xac48
    }
    // 0xac48
    v6 = v5;
    if ((*(int32_t *)v5 & 8) == 0) {
        // 0xac54
        __gnu_Unwind_Restore_WMMXD();
        v6 = v3;
        // branch -> 0xac5c
    }
    // 0xac5c
    if ((*(int32_t *)v6 & 16) != 0) {
        // if_ac64_0_true
        g134 = v2;
        return;
    }
    // after_if_ac64_0
    g134 = v4;
    __gnu_Unwind_Restore_WMMXC();
}
 
// From module:   ./unwind.h
// Address range: 0xac74 - 0xac87
// Line range:    41 - 65
void _Unwind_decode_typeinfo_ptr(int32_t base, int32_t ptr) {
    // 0xac74
    if (*(int32_t *)base != 0) {
        // if_ac7c_0_true
        // branch -> after_if_ac80_0
    }
}
 
// From module:   ./unwind.h
// Address range: 0xac88 - 0xac8f
// Line range:    68 - 73
void __gnu_unwind_24bit(struct _Unwind_Context * context, int32_t data, int32_t compact) {
    // 0xac88
    g127 = 9;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xac90 - 0xac93
// Line range:    124 - 132
void _Unwind_DebugHook(char * cfa, char * handler) {
    // 0xac90
    return;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xac94 - 0xacf7
// Line range:    281 - 302
void unwind_phase2(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * vrs) {
    int32_t v1 = (int32_t)ucbp; // 0xac94_0
    int32_t v2 = (int32_t)vrs; // 0xac94_1
    g135 = v1;
    g134 = v2;
    // branch -> 0xaca0
    while (true) {
        int32_t v3 = get_eit_entry((struct _Unwind_Control_Block *)v1, *(int32_t *)(v2 + 64)); // 0xaca8
        g1 = true;
        g2 = v3 < 0;
        g3 = v3 == 0;
        g136 = v3;
        if (v3 == 0) {
            int32_t v4 = g134; // 0xacb8
            g127 = 1;
            int32_t v5 = g135; // 0xacc0
            g128 = v5;
            g132 = v4;
            *(int32_t *)(v5 + 20) = *(int32_t *)(v4 + 64);
            int32_t v6 = *(int32_t *)(g135 + 16); // 0xaccc
            g133 = v6;
            g126 = &g113;
            ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v6)(g127, v5, v4, v6);
            uint32_t v7 = g127; // 0xacd4
            if (v7 != 8) {
                // 0xacdc
                g1 = v7 > 6;
                g2 = v7 < 7;
                g3 = v7 == 7;
                if (v7 != 7) {
                    // 0xacb4
                    abort();
                    // UNREACHABLE
                }
                // 0xace4
                _Unwind_DebugHook((char *)g136, (char *)*(int32_t *)(g134 + 64));
                g127 = g134 + 4;
                restore_core_regs();
                return;
            }
            // 0xacb8
            v2 = g134;
            v1 = g135;
            // branch -> 0xaca0
            continue;
        }
        // 0xacb4
        abort();
        // UNREACHABLE
    }
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xacf8 - 0xae1f
// Line range:    308 - 388
int32_t unwind_phase2_forced(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs, int32_t resuming) {
    struct anon_struct_5 v1;
    struct anon_struct_5 v2;
    struct anon_struct_5 v3;
    struct anon_struct_5 v4;
    int32_t v5 = (int32_t)ucbp; // 0xacf8_0
    int32_t v6 = (int32_t)entry_vrs; // 0xacf8_1
    int32_t v7 = g135; // 0xacf8
    int32_t v8 = g138; // 0xacf8
    g138 = *(int32_t *)(v5 + 12);
    g134 = v5;
    g139 = *(int32_t *)(v5 + 24);
    g129 = resuming;
    g130 = (int32_t)&v2;
    int32_t v9 = (int32_t)&v1; // 0xad20_0
    g137 = v9;
    g136 = 0;
    v2.e1.e0[0] = *(int32_t *)(v6 + 4);
    v2.e1.e0[1] = *(int32_t *)(v6 + 8);
    v2.e1.e0[2] = *(int32_t *)(v6 + 12);
    v2.e1.e0[3] = *(int32_t *)(v6 + 16);
    int32_t v10 = (int32_t)&v3; // 0xad28_0
    v2.e1.e0[4] = *(int32_t *)(v6 + 20);
    v2.e1.e0[5] = *(int32_t *)(v6 + 24);
    v2.e1.e0[6] = *(int32_t *)(v6 + 28);
    v2.e1.e0[7] = *(int32_t *)(v6 + 32);
    *(int32_t *)(v10 + 16) = *(int32_t *)(v6 + 36);
    *(int32_t *)(v10 + 20) = *(int32_t *)(v6 + 40);
    *(int32_t *)(v10 + 24) = *(int32_t *)(v6 + 44);
    *(int32_t *)(v10 + 28) = *(int32_t *)(v6 + 48);
    int32_t v11 = v10 + 32; // 0xad38
    g131 = v11;
    *(int32_t *)v11 = *(int32_t *)(v6 + 52);
    *(int32_t *)(v10 + 36) = *(int32_t *)(v6 + 56);
    *(int32_t *)(v10 + 40) = *(int32_t *)(v6 + 60);
    *(int32_t *)(v10 + 44) = *(int32_t *)(v6 + 64);
    v2.e0 = g136;
    // branch -> 0xad48
    uint32_t v12; // 0xade8
    while (true) {
        int32_t v13 = get_eit_entry((struct _Unwind_Control_Block *)g134, v2.e1.e0[15]); // 0xad50
        int32_t v14 = g129; // 0xad54
        int32_t v15 = v14 == 0 ? 25 : 26;
        g129 = v14 == 0 ? 9 : 10;
        g1 = true;
        g2 = v13 < 0;
        g3 = v13 == 0;
        g135 = v13;
        int32_t v16; // 0xadb0
        int32_t v17; // 0xada4
        if (v13 == 0) {
            // 0xad70
            *(int32_t *)(g134 + 20) = v2.e1.e0[15];
            memcpy((char *)&v1, (char *)&v2, 480);
            int32_t v18 = g134; // 0xad88
            int32_t v19 = *(int32_t *)(v18 + 16); // 0xad88
            g133 = v19;
            int32_t v20 = g129; // 0xad8c
            g127 = v20;
            g128 = v18;
            g132 = v9;
            g126 = 0xad9c;
            ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v19)(v20, v18, v9, v19);
            g136 = g127;
            v16 = g129;
            v17 = v1.e1.e0[13];
            // branch -> 0xada4
        } else {
            // if_ad64_0_true
            g129 = v15;
            v16 = v15;
            v17 = v2.e1.e0[13];
            // branch -> 0xada4
        }
        // 0xada4
        v2.e2 = v17;
        g127 = 1;
        g128 = v16;
        int32_t v21 = g134; // 0xadb8
        g132 = v21;
        g133 = v21;
        g126 = 0xadc4;
        ((int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t))g138)(1, v16, v21, v21, g130, g139);
        int32_t result = 9;
        if (g127 == 0) {
            int32_t v22 = g135; // 0xadcc
            if (v22 == 0) {
                // 0xadd4
                g129 = 0;
                memcpy((char *)&v2, (char *)&v1, 480);
                v12 = g136;
                if (v12 != 8) {
                    // break -> 0xadf0
                    break;
                }
                // continue -> 0xad48
                continue;
            } else {
                result = v22;
            }
        }
        // 0xae18
        g135 = v7;
        g138 = v8;
        return result;
    }
    // 0xadf0
    g1 = v12 > 6;
    g2 = v12 < 7;
    g3 = v12 == 7;
    if (v12 == 7) {
        // 0xadf8
        _Unwind_DebugHook((char *)g135, (char *)v2.e1.e0[15]);
        g127 = (int32_t)&v4;
        restore_core_regs();
        // branch -> 0xae18
    }
    // 0xae18
    g135 = v7;
    g138 = v8;
    return 9;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xae20 - 0xae27
// Line range:    210 - 401
int32_t _Unwind_GetCFA(struct _Unwind_Context * context) {
    // 0xae20
    return *(int32_t *)((int32_t)context + 68);
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xae28 - 0xaecb
// Line range:    410 - 448
int32_t __gnu_Unwind_RaiseException(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs) {
    struct anon_struct_5 v1;
    struct anon_struct_5 v2;
    int32_t v3 = (int32_t)entry_vrs; // 0xae28_1
    int32_t * v4 = (int32_t *)(v3 + 60); // 0xae28_2
    int32_t v5 = g135; // 0xae2c
    int32_t * v6 = (int32_t *)(v3 + 64); // 0xae34_0
    *v6 = *v4;
    g135 = (int32_t)ucbp;
    g134 = v3;
    int32_t v7 = (int32_t)&v1; // 0xae40_0
    v1.e1.e0[0] = *(int32_t *)(v3 + 4);
    v1.e1.e0[1] = *(int32_t *)(v3 + 8);
    v1.e1.e0[2] = *(int32_t *)(v3 + 12);
    v1.e1.e0[3] = *(int32_t *)(v3 + 16);
    int32_t v8 = (int32_t)&v2; // 0xae50_0
    v1.e1.e0[4] = *(int32_t *)(v3 + 20);
    v1.e1.e0[5] = *(int32_t *)(v3 + 24);
    v1.e1.e0[6] = *(int32_t *)(v3 + 28);
    v1.e1.e0[7] = *(int32_t *)(v3 + 32);
    *(int32_t *)(v8 + 16) = *(int32_t *)(v3 + 36);
    *(int32_t *)(v8 + 20) = *(int32_t *)(v3 + 40);
    *(int32_t *)(v8 + 24) = *(int32_t *)(v3 + 44);
    *(int32_t *)(v8 + 28) = *(int32_t *)(v3 + 48);
    int32_t v9 = v8 + 32; // 0xae60
    g131 = v9;
    *(int32_t *)v9 = *(int32_t *)(v3 + 52);
    *(int32_t *)(v8 + 36) = *(int32_t *)(v3 + 56);
    *(int32_t *)(v8 + 40) = *v4;
    *(int32_t *)(v8 + 44) = *v6;
    g136 = v7;
    v1.e0 = -1;
    int32_t v10 = get_eit_entry((struct _Unwind_Control_Block *)g135, v1.e1.e0[15]); // 0xae7c
    g127 = v10;
    g1 = true;
    g2 = v10 < 0;
    g3 = v10 == 0;
    if (v10 == 0) {
        int32_t v11 = g135; // 0xae88
        int32_t v12 = *(int32_t *)(v11 + 16); // 0xae88
        g133 = v12;
        g128 = v11;
        g132 = v7;
        g126 = &g114;
        ((int32_t (*)(int32_t, int32_t, int32_t))v12)(v11, v7, v12);
        g137 = 0;
        restore_non_core_regs(&v1);
        if (g137 == 6) {
            // 0xaeb4
            unwind_phase2((struct _Unwind_Control_Block *)g135, (struct anon_struct_6 *)g134);
            // branch -> 0xaec0
        }
    }
    // 0xaec0
    g135 = v5;
    return 9;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xaecc - 0xaee7
// Line range:    458 - 468
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) {
    int32_t v1 = (int32_t)ucbp; // 0xaecc_0
    int32_t v2 = (int32_t)entry_vrs; // 0xaecc_3
    *(int32_t *)(v1 + 24) = (int32_t)stop_arg;
    *(int32_t *)(v1 + 12) = (int32_t)stop_fn;
    *(int32_t *)(v2 + 64) = *(int32_t *)(v2 + 60);
    return unwind_phase2_forced(ucbp, entry_vrs, 0);
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xaee8 - 0xaf5b
// Line range:    475 - 505
int32_t __gnu_Unwind_Resume(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs) {
    int32_t v1 = (int32_t)ucbp; // 0xaee8_0
    int32_t v2 = (int32_t)entry_vrs; // 0xaee8_1
    g135 = v1;
    int32_t v3 = *(int32_t *)(v1 + 12); // 0xaef0
    g136 = v3;
    g134 = v2;
    g1 = true;
    g2 = v3 < 0;
    g3 = v3 == 0;
    *(int32_t *)(v2 + 64) = *(int32_t *)(v1 + 20);
    if (v3 != 0) {
        // 0xaf08
        unwind_phase2_forced(ucbp, entry_vrs, 1);
        // branch -> 0xaf58
        // 0xaf58
        abort();
        // UNREACHABLE
    }
    int32_t v4 = *(int32_t *)(v1 + 16); // 0xaf14
    g133 = v4;
    int32_t v5 = g135; // 0xaf18
    g128 = v5;
    g127 = 2;
    int32_t v6 = g134; // 0xaf20
    g132 = v6;
    g126 = 0xaf28;
    ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v4)(2, v5, v6, v4);
    uint32_t v7 = g127; // 0xaf28
    g1 = v7 > 6;
    g2 = v7 < 7;
    g3 = v7 == 7;
    if (v7 == 7) {
        // 0xaf44
        _Unwind_DebugHook((char *)g136, (char *)*(int32_t *)(g134 + 64));
        g127 = g134 + 4;
        restore_core_regs();
        // branch -> 0xaf58
    } else {
        // 0xaf30
        if (v7 == 8) {
            // 0xaf38
            unwind_phase2((struct _Unwind_Control_Block *)g135, (struct anon_struct_6 *)g134);
            // branch -> 0xaf44
            // 0xaf44
            _Unwind_DebugHook((char *)g136, (char *)*(int32_t *)(g134 + 64));
            g127 = g134 + 4;
            restore_core_regs();
            // branch -> 0xaf58
        }
    }
    // 0xaf58
    abort();
    // UNREACHABLE
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xaf5c - 0xaf7b
// Line range:    513 - 522
int32_t __gnu_Unwind_Resume_or_Rethrow(struct _Unwind_Control_Block * ucbp, struct anon_struct_6 * entry_vrs) {
    int32_t v1 = (int32_t)entry_vrs; // 0xaf5c_1
    if (*(int32_t *)((int32_t)ucbp + 12) == 0) {
        // 0xaf68
        __gnu_Unwind_RaiseException(ucbp, entry_vrs);
        return 9;
    }
    // 0xaf6c
    *(int32_t *)(v1 + 64) = *(int32_t *)(v1 + 60);
    return unwind_phase2_forced(ucbp, entry_vrs, 0);
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xaf7c - 0xaf7f
// Line range:    211 - 528
void _Unwind_Complete(struct _Unwind_Control_Block * ucbp) {
    // 0xaf7c
    return;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xaf80 - 0xaf8f
// Line range:    212 - 538
void _Unwind_DeleteException(struct _Unwind_Control_Block * exc) {
    // 0xaf80
    return;
}
 
// Address range: 0xaf90 - 0xaf97
int32_t function_af90(int32_t a1) {
    // 0xaf90
    g127 = 1;
    ((int32_t (*)(int32_t))g133)(1);
    return 1;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xaf98 - 0xaff3
// Line range:    174 - 180
int32_t _Unwind_VRS_Get(struct _Unwind_Context * context, int32_t regclass, int32_t regno, int32_t representation, char * valuep) {
    // 0xaf98
    g128 = regclass;
    g132 = regno;
    g133 = representation;
    return 2;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xaff4 - 0xb01b
// Line range:    220 - 225
int32_t _Unwind_GetGR(struct _Unwind_Context * context, int32_t regno) {
    // 0xaff4
    int32_t v1;
    int32_t val = v1; // bp-12
    val = g133;
    _Unwind_VRS_Get(context, 0, regno, 0, (char *)&val);
    return val;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xb01c - 0xb077
// Line range:    170 - 211
int32_t _Unwind_VRS_Set(struct _Unwind_Context * context, uint32_t regclass, int32_t regno, int32_t representation, char * valuep) {
    // 0xb01c
    g132 = regno;
    g133 = representation;
    g1 = regclass > 3;
    g2 = regclass < 4;
    g3 = regclass == 4;
    return 2;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xb078 - 0xb0a3
// Line range:    231 - 234
void _Unwind_SetGR(struct _Unwind_Context * context, int32_t regno, int32_t val) {
    // 0xb078
    g131 = regno;
    _Unwind_VRS_Set(context, 0, regno, 0, (char *)&val);
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xb0a4 - 0xb16b
// Line range:    547 - 598
int32_t __gnu_Unwind_Backtrace(int32_t (*trace)(struct _Unwind_Context *, char *), char * trace_argument, struct anon_struct_6 * entry_vrs) {
    struct anon_struct_5 v1;
    struct anon_struct_5 v2;
    struct _Unwind_Control_Block v3;
    int32_t v4 = (int32_t)entry_vrs; // 0xb0a4_2
    int32_t * v5 = (int32_t *)(v4 + 60); // 0xb0a4_3
    int32_t v6 = g135; // 0xb0ac
    int32_t v7 = g138; // 0xb0ac
    g137 = (int32_t)trace;
    int32_t * v8 = (int32_t *)(v4 + 64); // 0xb0b4_0
    *v8 = *v5;
    g138 = (int32_t)trace_argument;
    int32_t v9 = (int32_t)&v3; // 0xb0c0_0
    int32_t v10 = (int32_t)&v1; // 0xb0c8_0
    g134 = v10;
    g136 = v9;
    v1.e1.e0[0] = *(int32_t *)(v4 + 4);
    v1.e1.e0[1] = *(int32_t *)(v4 + 8);
    v1.e1.e0[2] = *(int32_t *)(v4 + 12);
    v1.e1.e0[3] = *(int32_t *)(v4 + 16);
    int32_t v11 = (int32_t)&v2; // 0xb0d0_0
    v1.e1.e0[4] = *(int32_t *)(v4 + 20);
    v1.e1.e0[5] = *(int32_t *)(v4 + 24);
    v1.e1.e0[6] = *(int32_t *)(v4 + 28);
    v1.e1.e0[7] = *(int32_t *)(v4 + 32);
    *(int32_t *)(v11 + 16) = *(int32_t *)(v4 + 36);
    *(int32_t *)(v11 + 20) = *(int32_t *)(v4 + 40);
    *(int32_t *)(v11 + 24) = *(int32_t *)(v4 + 44);
    *(int32_t *)(v11 + 28) = *(int32_t *)(v4 + 48);
    *(int32_t *)(v11 + 32) = *(int32_t *)(v4 + 52);
    *(int32_t *)(v11 + 36) = *(int32_t *)(v4 + 56);
    *(int32_t *)(v11 + 40) = *v5;
    *(int32_t *)(v11 + 44) = *v8;
    v1.e0 = -1;
    // branch -> 0xb0f4
    int32_t result; // 0xb160
    while (true) {
        // 0xb0f4
        if (get_eit_entry(&v3, v1.e1.e0[15]) == 0) {
            // 0xb110
            _Unwind_SetGR((struct _Unwind_Context *)&v1, 12, v9);
            g127 = v10;
            int32_t v12 = g138; // 0xb124
            g128 = v12;
            g126 = 0xb12c;
            ((int32_t (*)(int32_t, int32_t))g137)(v10, v12);
            int32_t v13 = g127; // 0xb12c
            g1 = true;
            g2 = v13 < 0;
            g3 = v13 == 0;
            if (v13 == 0) {
                int32_t v14 = v3.e2.e1; // 0xb134
                g133 = v14;
                g127 = 8;
                g128 = v9;
                g132 = v10;
                g126 = 0xb148;
                ((int32_t (*)(int32_t, int32_t, int32_t, int32_t))v14)(8, v9, v10, v14);
                int32_t v15 = g127; // 0xb148
                g135 = v15;
                if ((v15 - 5 & -5) == 0) {
                    // break -> 0xb158
                    break;
                }
                // continue -> 0xb0f4
                continue;
            }
        }
        // 0xb108
        g135 = 9;
        // branch -> 0xb158
        // 0xb158
        restore_non_core_regs(&v1);
        result = g135;
        g135 = v6;
        g138 = v7;
        return result;
    }
    // 0xb158
    restore_non_core_regs(&v1);
    result = g135;
    g135 = v6;
    g138 = v7;
    return result;
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc
// Address range: 0xb16c - 0xb557
// Line range:    606 - 855
int32_t __gnu_unwind_pr_common(uint32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context, int32_t id) {
    struct anon_struct_4 v1;
    // 0xb16c
    char * v2;
    char * matched = v2; // bp-56
    int32_t v3 = state; // R0
    int32_t v4 = (int32_t)ucbp; // 0xb16c_0
    g128 = v4;
    int32_t v5 = g135; // 0xb16c
    int32_t v6 = g138; // 0xb16c
    g137 = (int32_t)context;
    int32_t v7 = *(int32_t *)(v4 + 76); // 0xb174
    g132 = v7;
    g139 = id;
    g135 = v4;
    int32_t v8 = v7 + 4; // 0xb184
    int32_t v9 = v8; // R12
    int32_t v10 = state % 4; // 0xb188
    g138 = v10;
    int32_t v11 = *(int32_t *)v7; // 0xb18c
    g134 = v11;
    v1.e1 = (int32_t *)v8;
    v1.e0 = v11;
    int32_t v12; // 0xb310_0
    int32_t v13; // 0xb4f4
    int32_t v14; // 0xb220
    int32_t v15; // 0xb4b8
    int32_t v16; // 0xb1f0
    int32_t v17; // 0xb1f8
    int32_t v18; // 0xb2002026
    int32_t v19; // 0xb200202643
    int32_t v20; // 0xb21c45
    int32_t v21; // 0xb1e4
    int32_t v22; // 0xb2002228
    int32_t v23; // 0xb4dc6
    int32_t v24;
    int32_t v25;
    if (id == 0) {
        int32_t v26 = 256 * v11; // 0xb19c
        g134 = v26;
        v1.e0 = v26;
        v1.e2 = 3;
        v19 = v8;
        // branch -> 0xb1dc
    } else {
        // 0xb1b4
        if (id <= 2) {
            int32_t v27 = 0x10000 * v11; // 0xb1c4
            g134 = v27;
            g132 = 2;
            v1.e0 = v27;
            v1.e2 = 2;
            int32_t v28 = 4 * (v11 / 0x10000 % 256) + v8; // 0xb1d8
            v9 = v28;
            v19 = v28;
            // branch -> 0xb1dc
        } else {
            v19 = v8;
        }
        // 0xb1dc
        v18 = v19;
        if (v10 == 2) {
            // if_b1e4_0_true
            v21 = *(int32_t *)(v4 + 56);
            v9 = v21;
            v18 = v21;
            // branch -> after_if_b1e4_0
        }
        // after_if_b1e4_0
        if (*(int32_t *)(v4 + 80) % 2 == 0) {
            // 0xb1f0
            v16 = state ^ 8;
            v17 = v16 / 8 % 2;
            v22 = *(int32_t *)v18;
            g134 = v22;
            int32_t result; // 0xb550_2
            if (v22 == 0) {
                // 0xb4b8
                v23 = 0;
                // branch -> 0xb4b8
                // 0xb4b8
                if (g139 < 3) {
                    // 0xb4d4
                    __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
                    // branch -> 0xb524
                } else {
                    // 0xb4d4
                    __gnu_unwind_24bit((struct _Unwind_Context *)v16, g128, g132);
                    if (g127 == 0) {
                        // 0xb4dc
                        g133 = v23;
                        if (v23 == 0) {
                            // if_b4e4_0_true
                            result = 8;
                            // branch -> 0xb54c
                        } else {
                            // 0xb4ec
                            v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
                            _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
                            // branch -> 0xb518
                            // 0xb518
                            _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
                            result = 7;
                            // branch -> 0xb54c
                        }
                        // 0xb54c
                        g135 = v5;
                        g138 = v6;
                        return result;
                    }
                }
                // 0xb524
                // branch -> 0xb54c
                // 0xb54c
                g135 = v5;
                g138 = v6;
                return 9;
            }
            // 0xb20c
            v12 = (int32_t)&matched;
            v24 = 0;
            // branch -> 0xb20c
            while (true) {
                // 0xb20c
                v14 = v18;
                // branch -> 0xb20c
              lab_0xb20c:;
                int32_t v29; // 0xb4c0
                int32_t v30; // 0xb518
                int32_t v31; // 0xb4c0
                int32_t v32; // 0xb518
                int32_t v33; // 0xb4c0
                int32_t v34; // 0xb518
                int32_t v35;
                int32_t v36;
                int32_t v37;
                int32_t v38; // 0xb4c8
                int32_t v39; // 0xb4f0
                int32_t v40; // 0xb500
                int32_t v41; // 0xb50c
                while (true) {
                    int32_t v42 = *(int32_t *)(g135 + 72); // 0xb210
                    g133 = v42;
                    int32_t v43; // 0xb21c
                    if (g139 == 2) {
                        // if_b21c_0_true
                        v43 = *(int32_t *)(v14 + 4);
                        g136 = v14 + 8;
                        // branch -> after_if_b22c_0
                    } else {
                        // if_b224_0_true
                        g136 = v14 + 4;
                        g134 = (int32_t)*(int16_t *)v14;
                        v43 = (int32_t)*(int16_t *)(v14 + 2);
                        // branch -> after_if_b22c_0
                    }
                    uint32_t v44 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15); // 0xb238
                    v3 = v44;
                    uint32_t v45 = (v43 & -2) + v42; // 0xb23c
                    int32_t v46; // 0xb260
                    if (v45 > v44) {
                        // if_b240_0_true
                        v9 = 0;
                        v46 = g134;
                        // branch -> 0xb25c
                    } else {
                        int32_t v47 = g134; // 0xb248
                        int32_t v48 = v47 & -2; // 0xb248
                        g133 = v48;
                        if (v44 < v48 + v45) {
                            // if_b254_0_true
                            v9 = 1;
                            v46 = v47;
                            // branch -> 0xb25c
                        } else {
                            v46 = v47;
                        }
                    }
                    int32_t v49 = -((v43 % 2)) & 2 | v46 % 2; // 0xb264
                    int32_t v50 = v49; // R4
                    int32_t v51;
                    switch ((int2_t)v49) {
                        default: {
                            // 0xb274
                            if (v49 == 2) {
                                float32_t v52 = fabsf((float32_t)*(int32_t *)g136);
                                v50 = v52;
                                int32_t v53; // 0xb4dc7
                                if (g138 != 0) {
                                    int32_t v54 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13); // 0xb424
                                    v3 = v54;
                                    if (*(int32_t *)(g135 + 32) != v54) {
                                        v53 = v24;
                                        goto lab_0xb498_4;
                                    }
                                    int32_t * v55 = (int32_t *)(g135 + 40); // 0xb430_0
                                    if (g136 != *v55) {
                                        v53 = v24;
                                        goto lab_0xb498_4;
                                    }
                                    // 0xb43c
                                    v43 = 0;
                                    int32_t v56 = 4; // R3
                                    *v55 = v50;
                                    *(int32_t *)(g135 + 48) = v56;
                                    *(int32_t *)(g135 + 44) = v43;
                                    *(int32_t *)(g135 + 52) = g136 + v56;
                                    int32_t v57 = g136; // 0xb458
                                    if (*(int32_t *)v57 >= v43) {
                                        // 0xb490
                                        v53 = 1;
                                        // branch -> 0xb498
                                        goto lab_0xb498_4;
                                        // 0xb54c
                                        g135 = v5;
                                        g138 = v6;
                                        return result;
                                    }
                                    int32_t v63 = selfrel_offset31((int32_t *)(v57 + 4 + 4 * v50)); // 0xb46c
                                    _Unwind_SetGR((struct _Unwind_Context *)g137, 15, v63);
                                    // branch -> 0xb488
                                    // 0xb488
                                    // branch -> 0xb518
                                    // 0xb518
                                    _Unwind_SetGR((struct _Unwind_Context *)g137, v43, g135);
                                    // branch -> 0xb54c
                                    // 0xb54c
                                    g135 = v5;
                                    g138 = v6;
                                    return 7;
                                }
                                // 0xb3b0
                                int32_t v58; // 0xb498
                                int32_t v59; // 0xb4a8
                                if (v9 != 0) {
                                    // 0xb3b8
                                    g133 = v17;
                                    if ((int32_t)v52 == 0) {
                                        // after_if_b3c0_0.thread
                                        g133 = 1;
                                        // branch -> 0xb3cc
                                    } else {
                                        // after_if_b3c0_0
                                        if (v17 == 0) {
                                            v53 = v24;
                                          lab_0xb498_4:
                                            // 0xb498
                                            v58 = g136;
                                            v59 = v58;
                                            if (*(int32_t *)v58 < 0) {
                                              lab_if_b4a4_0_true:;
                                                int32_t v60 = v58 + 4; // 0xb4a4
                                                g136 = v60;
                                                v59 = v60;
                                                // branch -> after_if_b4a4_0
                                            }
                                          lab_after_if_b4a4_0:;
                                            int32_t v61 = v59 + 4 * (v50 + 1); // 0xb4a8
                                            v9 = v61;
                                            int32_t v62 = *(int32_t *)v61; // 0xb20022
                                            g134 = v62;
                                            if (v62 == 0) {
                                                v25 = v53;
                                                // break (via goto) -> 0xb4b8
                                                goto lab_0xb4b8_2;
                                            }
                                            v20 = v61;
                                            v24 = v53;
                                            // continue (via goto) -> 0xb20c
                                            goto lab_0xb20c_2;
                                        }
                                    }
                                    int32_t v64 = g135 + 88; // 0xb3cc
                                    if ((int32_t)v52 == 0) {
                                        // 0xb52c
                                        *(int32_t *)(g135 + 32) = _Unwind_GetGR((struct _Unwind_Context *)g137, 13);
                                        // branch -> 0xb540
                                        // 0xb540
                                        *(int32_t *)(g135 + 36) = (int32_t)matched;
                                        *(int32_t *)(g135 + 40) = g136;
                                        // branch -> 0xb54c
                                        // 0xb54c
                                        g135 = v5;
                                        g138 = v6;
                                        return 6;
                                    }
                                    int32_t v65 = 0; // 0xb3e099
                                    // branch -> 0xb3e0
                                    while (true) {
                                        int32_t v66 = v65 + 1; // 0xb3e0
                                        v43 = v66;
                                        matched = (char *)v64;
                                        int32_t v67 = g136 + 4 * v66; // 0xb3ec
                                        _Unwind_decode_typeinfo_ptr(v67, g128);
                                        g132 = 0;
                                        g133 = v12;
                                        g128 = v67;
                                        bool v68 = __cxa_type_match((int32_t *)g135, (int32_t *)v67, NULL); // 0xb404
                                        v3 = v68;
                                        if (v68) {
                                            v53 = v24;
                                            goto lab_0xb498_4;
                                        }
                                        int32_t v69 = v43;
                                        if (v69 != v50) {
                                            // 0xb3e0
                                            v65 = v69;
                                            // branch -> 0xb3e0
                                            continue;
                                        }
                                    }
                                    // 0xb4b8
                                    v36 = g139;
                                    v15 = v36;
                                    v23 = v25;
                                    // branch -> 0xb4b8
                                    // 0xb4b8
                                    if (v15 < 3) {
                                        // 0xb4d4
                                        v38 = g137;
                                        __gnu_unwind_execute((struct _Unwind_Context_1 *)v38, (struct anon_struct_13 *)&v1);
                                        // branch -> 0xb524
                                        // 0xb524
                                        result = 9;
                                        // branch -> 0xb54c
                                        // 0xb54c
                                        g135 = v5;
                                        g138 = v6;
                                        return result;
                                    }
                                    // 0xb4d4
                                    v29 = v3;
                                    v31 = g128;
                                    v33 = g132;
                                    __gnu_unwind_24bit((struct _Unwind_Context *)v29, v31, v33);
                                    v37 = g127;
                                    if (v37 == 0) {
                                        // 0xb4dc
                                        g133 = v23;
                                        if (v23 == 0) {
                                            // if_b4e4_0_true
                                            result = 8;
                                            // branch -> 0xb54c
                                            // 0xb54c
                                            g135 = v5;
                                            g138 = v6;
                                            return result;
                                        }
                                        // 0xb4ec
                                        v39 = g137;
                                        v13 = _Unwind_GetGR((struct _Unwind_Context *)v39, 15);
                                        v40 = g137;
                                        _Unwind_SetGR((struct _Unwind_Context *)v40, 14, v13);
                                        v41 = g137;
                                        v35 = g11;
                                        v34 = v35;
                                        v32 = 15;
                                        v30 = v41;
                                        // branch -> 0xb518
                                        // 0xb518
                                        _Unwind_SetGR((struct _Unwind_Context *)v30, v32, v34);
                                        result = 7;
                                        // branch -> 0xb54c
                                        // 0xb54c
                                        g135 = v5;
                                        g138 = v6;
                                        return result;
                                    }
                                    // 0xb524
                                    result = 9;
                                    // branch -> 0xb54c
                                    // 0xb54c
                                    g135 = v5;
                                    g138 = v6;
                                    return result;
                                }
                                v53 = v24;
                                // 0xb498
                                v58 = g136;
                                if (*(int32_t *)v58 < 0) {
                                    goto lab_if_b4a4_0_true;
                                }
                                v59 = v58;
                                goto lab_after_if_b4a4_0;
                            }
                            // 0xb524
                            // branch -> 0xb54c
                            // 0xb54c
                            g135 = v5;
                            g138 = v6;
                            return 9;
                        }
                        case 1: {
                            // 0xb2d0
                            if (g138 != 0) {
                                int32_t v70 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13); // 0xb35c
                                v3 = v70;
                                if (*(int32_t *)(g135 + 32) == v70) {
                                    int32_t v71 = *(int32_t *)(g135 + 40); // 0xb368
                                    if (g136 == v71) {
                                        int32_t v72 = selfrel_offset31((int32_t *)v71); // 0xb378
                                        _Unwind_SetGR((struct _Unwind_Context *)g137, 15, v72);
                                        // branch -> 0xb488
                                        // 0xb488
                                        // branch -> 0xb518
                                        // 0xb518
                                        _Unwind_SetGR((struct _Unwind_Context *)g137, 0, g135);
                                        // branch -> 0xb54c
                                        // 0xb54c
                                        g135 = v5;
                                        g138 = v6;
                                        return 7;
                                    }
                                }
                              lab_0xb398_2:
                                // 0xb398
                                v51 = g136 + 8;
                                // branch -> 0xb200
                              lab_0xb200:
                                // 0xb200
                                v9 = v51;
                                int32_t v73 = *(int32_t *)v51; // 0xb200
                                g134 = v73;
                                if (v73 == 0) {
                                    v25 = v24;
                                    // break (via goto) -> 0xb4b8
                                    goto lab_0xb4b8_2;
                                }
                                v14 = v51;
                                // continue -> 0xb20c
                                continue;
                            }
                            break;
                        }
                        case 0: {
                            int32_t v74 = 0;
                            if (g138 != 0) {
                                // if_b288_0_true
                                v74 = v9 % 2;
                                // branch -> after_if_b288_0
                            }
                            int32_t v75 = g136; // 0xb28c
                            int32_t v76 = v75 + 4; // 0xb28c
                            v43 = v76;
                            if (v74 == 0) {
                                v51 = v76;
                                goto lab_0xb200;
                            }
                            int32_t v77 = selfrel_offset31((int32_t *)v75); // 0xb29c
                            *(int32_t *)(g135 + 56) = v43;
                            if (!__cxa_begin_cleanup((int32_t *)g135)) {
                                // 0xb524
                                // branch -> 0xb54c
                                // 0xb54c
                                g135 = v5;
                                g138 = v6;
                                return 9;
                            }
                            // 0xb2b8
                            // branch -> 0xb518
                            // 0xb518
                            _Unwind_SetGR((struct _Unwind_Context *)g137, 15, v77);
                            // branch -> 0xb54c
                            // 0xb54c
                            g135 = v5;
                            g138 = v6;
                            return 7;
                        }
                    }
                    // 0xb2d8
                    if (v9 == 0) {
                        goto lab_0xb398_2;
                    }
                    int32_t v78 = g136; // 0xb2e0
                    int32_t v79 = v78 + 4; // 0xb2e0
                    int32_t * v80 = (int32_t *)v79; // 0xb2e0_0
                    int32_t v81 = *v80; // 0xb2e0
                    g133 = v81;
                    if (v81 == -2) {
                        // 0xb524
                        // branch -> 0xb54c
                        // 0xb54c
                        g135 = v5;
                        g138 = v6;
                        return 9;
                    }
                    // 0xb2f4
                    matched = (char *)(g135 + 88);
                    int32_t v82; // 0xb338_0
                    int32_t v83; // 0xb330
                    int32_t v84; // 0xb33c
                    int32_t v85; // 0xb348
                    if (v81 == -1) {
                        // 0xb328
                        v83 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13);
                        v82 = (int32_t)matched;
                        v84 = g135;
                        if (v50 == 2) {
                            // if_b348_0_true
                            *(int32_t *)(v84 + 32) = v83;
                            v85 = v84 + 44;
                            *(int32_t *)v85 = v82;
                            // branch -> 0xb540
                            // 0xb540
                            *(int32_t *)(g135 + 36) = v85;
                            *(int32_t *)(g135 + 40) = g136;
                            // branch -> 0xb54c
                            // 0xb54c
                            g135 = v5;
                            g138 = v6;
                            return 6;
                        }
                        // after_if_b340_0
                        *(int32_t *)(v84 + 32) = v83;
                        // branch -> 0xb540
                        // 0xb540
                        *(int32_t *)(g135 + 36) = v82;
                        *(int32_t *)(g135 + 40) = g136;
                        // branch -> 0xb54c
                        // 0xb54c
                        g135 = v5;
                        g138 = v6;
                        return 6;
                    }
                    // 0xb304
                    _Unwind_decode_typeinfo_ptr(v79, g128);
                    int32_t v86 = *(int32_t *)v78 < 0; // 0xb30c
                    g132 = v86;
                    g133 = v12;
                    g128 = v79;
                    bool v87 = __cxa_type_match((int32_t *)g135, v80, (char **)v86); // 0xb31c
                    int32_t v88 = v87; // 0xb31c_7
                    v3 = v88;
                    v50 = v88;
                    if (!v87) {
                        goto lab_0xb398_2;
                    }
                    // 0xb328
                    v83 = _Unwind_GetGR((struct _Unwind_Context *)g137, 13);
                    v82 = (int32_t)matched;
                    v84 = g135;
                    if (v50 == 2) {
                        // if_b348_0_true
                        *(int32_t *)(v84 + 32) = v83;
                        v85 = v84 + 44;
                        *(int32_t *)v85 = v82;
                        // branch -> 0xb540
                        // 0xb540
                        *(int32_t *)(g135 + 36) = v85;
                        *(int32_t *)(g135 + 40) = g136;
                        // branch -> 0xb54c
                        // 0xb54c
                        g135 = v5;
                        g138 = v6;
                        return 6;
                    }
                    // after_if_b340_0
                    *(int32_t *)(v84 + 32) = v83;
                    // branch -> 0xb540
                    // 0xb540
                    *(int32_t *)(g135 + 36) = v82;
                    *(int32_t *)(g135 + 40) = g136;
                    // branch -> 0xb54c
                    // 0xb54c
                    g135 = v5;
                    g138 = v6;
                    return 6;
                }
                // 0xb4b8
                v36 = g139;
                v15 = v36;
                v23 = v25;
                // branch -> 0xb4b8
                // 0xb4b8
                if (v15 < 3) {
                    // 0xb4d4
                    v38 = g137;
                    __gnu_unwind_execute((struct _Unwind_Context_1 *)v38, (struct anon_struct_13 *)&v1);
                    // branch -> 0xb524
                    // 0xb524
                    result = 9;
                    // branch -> 0xb54c
                    // 0xb54c
                    g135 = v5;
                    g138 = v6;
                    return result;
                }
                // 0xb4d4
                v29 = v3;
                v31 = g128;
                v33 = g132;
                __gnu_unwind_24bit((struct _Unwind_Context *)v29, v31, v33);
                v37 = g127;
                if (v37 == 0) {
                    // 0xb4dc
                    g133 = v23;
                    if (v23 == 0) {
                        // if_b4e4_0_true
                        result = 8;
                        // branch -> 0xb54c
                        // 0xb54c
                        g135 = v5;
                        g138 = v6;
                        return result;
                    }
                    // 0xb4ec
                    v39 = g137;
                    v13 = _Unwind_GetGR((struct _Unwind_Context *)v39, 15);
                    v40 = g137;
                    _Unwind_SetGR((struct _Unwind_Context *)v40, 14, v13);
                    v41 = g137;
                    v35 = g11;
                    v34 = v35;
                    v32 = 15;
                    v30 = v41;
                    // branch -> 0xb518
                    // 0xb518
                    _Unwind_SetGR((struct _Unwind_Context *)v30, v32, v34);
                    result = 7;
                    // branch -> 0xb54c
                    // Detected a possible infinite recursion (goto support failed); quitting...
                    // Detected a possible infinite recursion (goto support failed); quitting...
                }
                // 0xb524
                result = 9;
                // branch -> 0xb54c
                // Detected a possible infinite recursion (goto support failed); quitting...
            }
        } else {
            // 0xb4b0
            v23 = 0;
            // branch -> 0xb4b8
        }
        // 0xb4b8
        if (id < 3) {
            // 0xb4d4
            __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
            // branch -> 0xb524
        } else {
            // 0xb4d4
            __gnu_unwind_24bit((struct _Unwind_Context *)v3, g128, g132);
            if (g127 == 0) {
                // 0xb4dc
                g133 = v23;
                if (v23 == 0) {
                    // if_b4e4_0_true
                    // branch -> 0xb54c
                } else {
                    // 0xb4ec
                    v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
                    _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
                    // branch -> 0xb518
                    // 0xb518
                    _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
                    // branch -> 0xb54c
                }
                // Detected a possible infinite recursion (goto support failed); quitting...
            }
        }
        // 0xb524
        // branch -> 0xb54c
        // Detected a possible infinite recursion (goto support failed); quitting...
    }
    // 0xb1dc
    v18 = v19;
    if (v10 == 2) {
        // if_b1e4_0_true
        v21 = *(int32_t *)(v4 + 56);
        v9 = v21;
        v18 = v21;
        // branch -> after_if_b1e4_0
    }
    // after_if_b1e4_0
    if (*(int32_t *)(v4 + 80) % 2 == 0) {
        // 0xb1f0
        v16 = state ^ 8;
        v3 = v16;
        v17 = v16 / 8 % 2;
        v22 = *(int32_t *)v18;
        g134 = v22;
        if (v22 == 0) {
            v25 = 0;
          lab_0xb4b8_2:
            // 0xb4b8
            v15 = g139;
            v23 = v25;
            // branch -> 0xb4b8
            // 0xb4b8
            if (v15 < 3) {
                // 0xb4d4
                __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
                // branch -> 0xb524
            } else {
                // 0xb4d4
                __gnu_unwind_24bit((struct _Unwind_Context *)v3, g128, g132);
                if (g127 == 0) {
                    // 0xb4dc
                    g133 = v23;
                    if (v23 == 0) {
                        // if_b4e4_0_true
                        // branch -> 0xb54c
                    } else {
                        // 0xb4ec
                        v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
                        _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
                        // branch -> 0xb518
                        // 0xb518
                        _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
                        // branch -> 0xb54c
                    }
                    // Detected a possible infinite recursion (goto support failed); quitting...
                }
            }
            // 0xb524
            // branch -> 0xb54c
            // Detected a possible infinite recursion (goto support failed); quitting...
        } else {
            // 0xb20c
            v12 = (int32_t)&matched;
            v20 = v18;
            v24 = 0;
            // branch -> 0xb20c
          lab_0xb20c_2:
            while (true) {
                // 0xb20c
                v14 = v20;
                // branch -> 0xb20c
                goto lab_0xb20c;
            }
        }
    } else {
        // 0xb4b0
        v15 = id;
        v23 = 0;
        // branch -> 0xb4b8
    }
    // 0xb4b8
    if (v15 < 3) {
        // 0xb4d4
        __gnu_unwind_execute((struct _Unwind_Context_1 *)g137, (struct anon_struct_13 *)&v1);
        // branch -> 0xb524
    } else {
        // 0xb4d4
        __gnu_unwind_24bit((struct _Unwind_Context *)v3, g128, g132);
        if (g127 == 0) {
            // 0xb4dc
            g133 = v23;
            if (v23 == 0) {
                // if_b4e4_0_true
                // branch -> 0xb54c
            } else {
                // 0xb4ec
                v13 = _Unwind_GetGR((struct _Unwind_Context *)g137, 15);
                _Unwind_SetGR((struct _Unwind_Context *)g137, 14, v13);
                // branch -> 0xb518
                // 0xb518
                _Unwind_SetGR((struct _Unwind_Context *)g137, 15, g11);
                // branch -> 0xb54c
            }
            // Detected a possible infinite recursion (goto support failed); quitting...
        }
    }
    // 0xb524
    // branch -> 0xb54c
    // Detected a possible infinite recursion (goto support failed); quitting...
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
// Address range: 0xb558 - 0xb55f
// Line range:    490 - 494
int32_t __aeabi_unwind_cpp_pr0(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context) {
    // 0xb558
    return __gnu_unwind_pr_common(state, ucbp, context, 0);
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
// Address range: 0xb560 - 0xb567
// Line range:    498 - 502
int32_t __aeabi_unwind_cpp_pr1(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context) {
    // 0xb560
    return __gnu_unwind_pr_common(state, ucbp, context, 1);
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c
// Address range: 0xb568 - 0xb56f
// Line range:    506 - 510
int32_t __aeabi_unwind_cpp_pr2(int32_t state, struct _Unwind_Control_Block * ucbp, struct _Unwind_Context * context) {
    // 0xb568
    return __gnu_unwind_pr_common(state, ucbp, context, 2);
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xb570 - 0xb8cf
// Line range:    178 - 446
int32_t _Unwind_VRS_Pop(struct _Unwind_Context * context, int32_t regclass, int32_t discriminator, int32_t representation) {
    // 0xb570
    return 2;
}
 
// Address range: 0xb8d0 - 0xb8e3
void restore_core_regs(void) {
    int32_t v1 = g127; // 0xb8d0
    int32_t v2 = *(int32_t *)(v1 + 60); // 0xb8d4
    g135 = v2;
    int32_t v3 = *(int32_t *)v1; // 0xb8dc
    g127 = v3;
    int32_t v4 = *(int32_t *)(v1 + 4); // 0xb8dc
    g128 = v4;
    int32_t v5 = *(int32_t *)(v1 + 8); // 0xb8dc
    g132 = v5;
    int32_t v6 = *(int32_t *)(v1 + 12); // 0xb8dc
    g133 = v6;
    g134 = *(int32_t *)(v1 + 16);
    g135 = *(int32_t *)(v1 + 20);
    g136 = *(int32_t *)(v1 + 24);
    g137 = *(int32_t *)(v1 + 28);
    g138 = *(int32_t *)(v1 + 32);
    g139 = *(int32_t *)(v1 + 36);
    g129 = *(int32_t *)(v1 + 40);
    g130 = *(int32_t *)(v1 + 44);
    g126 = *(int32_t *)(v1 + 56);
    ((int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t))v2)(v3, v4, v5, v6, v2);
}
 
// Address range: 0xb8e4 - 0xb8eb
void __gnu_Unwind_Restore_VFP(void) {
    // 0xb8e4
    return;
}
 
// Address range: 0xb8ec - 0xb8f3
void __gnu_Unwind_Save_VFP(void) {
    // 0xb8ec
    return;
}
 
// Address range: 0xb8f4 - 0xb8fb
void __gnu_Unwind_Restore_VFP_D(void) {
    // 0xb8f4
    return;
}
 
// Address range: 0xb8fc - 0xb903
void __gnu_Unwind_Save_VFP_D(void) {
    // 0xb8fc
    return;
}
 
// Address range: 0xb904 - 0xb90b
void __gnu_Unwind_Restore_VFP_D_16_to_31(void) {
    // 0xb904
    return;
}
 
// Address range: 0xb90c - 0xb913
void __gnu_Unwind_Save_VFP_D_16_to_31(void) {
    // 0xb90c
    return;
}
 
// Address range: 0xb914 - 0xb957
void __gnu_Unwind_Restore_WMMXD(void) {
    // 0xb914
    return;
}
 
// Address range: 0xb958 - 0xb99b
void __gnu_Unwind_Save_WMMXD(void) {
    // 0xb958
    return;
}
 
// Address range: 0xb99c - 0xb9af
void __gnu_Unwind_Restore_WMMXC(void) {
    // 0xb99c
    return;
}
 
// Address range: 0xb9b0 - 0xb9c3
void __gnu_Unwind_Save_WMMXC(void) {
    // 0xb9b0
    return;
}
 
// Address range: 0xb9c4 - 0xb9e7
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) {
    int32_t v1 = 0; // bp-68
    __gnu_Unwind_RaiseException(a1, (struct anon_struct_6 *)&v1);
    return 9;
}
 
// Address range: 0xb9e8 - 0xba0b
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) {
    int32_t v1 = 0; // bp-68
    __gnu_Unwind_Resume(a1, (struct anon_struct_6 *)&v1);
    return 0;
}
 
// Address range: 0xba0c - 0xba2f
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) {
    int32_t v1 = 0; // bp-68
    return __gnu_Unwind_Resume_or_Rethrow(a1, (struct anon_struct_6 *)&v1);
}
 
// Address range: 0xba30 - 0xba53
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) {
    int32_t v1 = 0; // bp-68
    return __gnu_Unwind_ForcedUnwind(a1, a2, a3, (struct anon_struct_6 *)&v1);
}
 
// Address range: 0xba54 - 0xba77
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) {
    int32_t v1 = 0; // bp-68
    return __gnu_Unwind_Backtrace(a1, a2, (struct anon_struct_6 *)&v1);
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/pr-support.c
// Address range: 0xba78 - 0xbad7
// Line range:    80 - 100
char next_unwind_byte(struct anon_struct_13 * uws) {
    int32_t v1 = (int32_t)uws; // 0xba78_0
    char * v2 = (char *)(v1 + 8); // 0xba78_1
    char v3 = *v2; // 0xba78
    int32_t * v4;
    int32_t v5;
    if (v3 == 0) {
        char * v6 = (char *)(v1 + 9); // 0xba84_0
        char v7 = *v6; // 0xba84
        if (v7 == 0) {
            // 0xbad0
            return -80;
        }
        // 0xba90
        *v6 = (char)((int32_t)v7 - 1);
        int32_t * v8 = (int32_t *)(v1 + 4); // 0xba98_0
        int32_t v9 = *v8; // 0xba98
        *v8 = v9 + 4;
        uws->e0 = *(int32_t *)v9;
        v4 = &uws->e0;
        v5 = 3;
        // branch -> 0xbab8
    } else {
        // 0xbab4
        v4 = &uws->e0;
        v5 = (int32_t)v3 - 1;
        // branch -> 0xbab8
    }
    // 0xbab8
    *v2 = (char)v5;
    int32_t v10 = *v4; // 0xbabc
    *v4 = 256 * v10;
    return v10 / 0x1000000;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xbad8 - 0xbaff
// Line range:    220 - 225
void _Unwind_GetGR_1(struct _Unwind_Context_1 * context, int32_t regno) {
    int32_t v1 = g133; // bp-12
    _Unwind_VRS_Get((struct _Unwind_Context *)context, 0, 12, 0, (char *)&v1);
}
 
// From module:   /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/pr-support.c
// Address range: 0xbb00 - 0xbb03
// Line range:    337 - 339
struct _Unwind_Control_Block_1 * unwind_UCB_from_context(struct _Unwind_Context_1 * context) {
    // 0xbb00
    _Unwind_GetGR_1(context, g128);
    return (struct _Unwind_Control_Block_1 *)context;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xbb04 - 0xbe9b
// Line range:    216 - 309
int32_t __gnu_unwind_execute(struct _Unwind_Context_1 * context, struct anon_struct_13 * uws) {
    // 0xbb04
    int32_t v1;
    int32_t reg = v1; // bp-36
    int32_t v2 = (int32_t)uws; // 0xbb04_1
    int32_t v3 = g135; // 0xbb04
    int32_t v4 = g138; // 0xbb04
    g135 = (int32_t)context;
    int32_t v5 = &reg; // 0xbb7c_0
    // branch -> 0xbb18
    while (true) {
        uint32_t v6 = (int32_t)next_unwind_byte((struct anon_struct_13 *)v2); // 0xbb1c_3
        int32_t v7 = v6; // R4
        if ((v6 & 128) != 0) {
            int32_t v8 = v6 & 240; // 0xbbb8
            if (v8 == 128) {
                int32_t v9 = (int32_t)next_unwind_byte((struct anon_struct_13 *)v2) | 256 * v6; // 0xbbd0
                if (v9 != 0x8000) {
                    // 0xbbe4
                    _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 0, 16 * v9 & 0xfff0, 0);
                    // branch -> 0xbe94
                    // 0xbe94
                    g135 = v3;
                    g138 = v4;
                    return 9;
                }
                // 0xbe94
                g135 = v3;
                g138 = v4;
                return 9;
            }
            // 0xbc10
            if (v8 == 144) {
                // 0xbc18
                if ((v6 & 13) != 13) {
                    // 0xbc24
                    g138 = v5;
                    _Unwind_VRS_Get((struct _Unwind_Context *)g135, 0, v6 % 16, 0, (char *)&reg);
                    // branch -> 0xbc44
                    // 0xbc44
                    _Unwind_VRS_Set((struct _Unwind_Context *)g135, 0, 13, 0, (char *)g138);
                    // branch -> 0xbb18
                    continue;
                }
                // 0xbe94
                g135 = v3;
                g138 = v4;
                return 9;
            }
            // 0xbc5c
            if (v8 == 160) {
                int32_t v10 = (int32_t)"trstr" >> (v6 % 8 ^ 7) & (int32_t)"trstr"; // 0xbc7c
                int32_t v11; // 0xbe80
                if ((v6 & 8) != 0) {
                    // if_bc84_0_true
                    v11 = v10 | 0x4000;
                    // branch -> 0xbe80
                } else {
                    v11 = v10;
                }
                // 0xbe80
                _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 0, v11, 0);
                // branch -> 0xbe94
                // 0xbe94
                g135 = v3;
                g138 = v4;
                return 9;
            }
            // 0xbc8c
            if (v8 == 176) {
                // 0xbc94
                if ((v6 & 252) != 180) {
                    // 0xbd64
                    // branch -> 0xbe80
                    // 0xbe80
                    _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 1, v6 % 8 + 1 | 0x80000, 1);
                    // branch -> 0xbe94
                    // 0xbe94
                    g135 = v3;
                    g138 = v4;
                    return 9;
                }
                // 0xbe94
                g135 = v3;
                g138 = v4;
                return 9;
            }
            int32_t v12 = v6 & 248; // 0xbddc
            if (v8 == 192) {
                // 0xbd84
                if (v12 != 192) {
                    // 0xbe00
                    // branch -> 0xbe94
                    // 0xbe94
                    g135 = v3;
                    g138 = v4;
                    return 9;
                }
                // 0xbde8
                // branch -> 0xbe80
                // 0xbe80
                _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 3, v6 % 16 + 1 | 0xa0000, 3);
                // branch -> 0xbe94
                // 0xbe94
                g135 = v3;
                g138 = v4;
                return 9;
            }
            // 0xbe5c
            if (v12 != 208) {
                // 0xbe94
                g135 = v3;
                g138 = v4;
                return 9;
            }
            // 0xbe68
            // branch -> 0xbe80
            // 0xbe80
            _Unwind_VRS_Pop((struct _Unwind_Context *)g135, 1, v6 % 8 + 1 | 0x80000, 5);
            // branch -> 0xbe94
            // 0xbe94
            g135 = v3;
            g138 = v4;
            return 9;
        }
        int32_t v13 = 4 * v6; // 0xbb78
        g138 = v13;
        _Unwind_VRS_Get((struct _Unwind_Context *)g135, 0, 13, 0, (char *)&reg);
        int32_t v14 = v13 & 252; // 0xbb94
        int32_t v15 = ((v7 & 64) == 0 ? v14 + 4 : -4 - v14) + reg;
        g138 = v15;
        reg = v15;
        // branch -> 0xbc44
        // 0xbc44
        _Unwind_VRS_Set((struct _Unwind_Context *)g135, 0, 13, 0, (char *)v5);
        // branch -> 0xbb18
    }
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xbe9c - 0xbedb
// Line range:    214 - 332
int32_t __gnu_unwind_frame(struct _Unwind_Control_Block_1 * ucbp, struct _Unwind_Context_1 * context) {
    struct anon_struct_13 v1;
    v1.e0 = (int32_t)context;
    v1.e1 = (int32_t *)g132;
    v1.e2 = g133;
    int32_t v2 = *(int32_t *)((int32_t)ucbp + 76); // 0xbea0
    v1.e0 = 256 * *(int32_t *)(v2 + 4);
    v1.e1 = (int32_t *)(v2 + 8);
    v1.e2 = 3;
    v1.e2 = *(char *)(v2 + 7);
    __gnu_unwind_execute(context, &v1);
    return 9;
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xbedc - 0xbeeb
// Line range:    236 - 351
int32_t _Unwind_GetRegionStart(struct _Unwind_Context_1 * context) {
    // 0xbedc
    return *(int32_t *)((int32_t)unwind_UCB_from_context(context) + 72);
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xbeec - 0xbf07
// Line range:    237 - 370
char * _Unwind_GetLanguageSpecificData(struct _Unwind_Context_1 * context) {
    int32_t v1 = *(int32_t *)((int32_t)unwind_UCB_from_context(context) + 76); // 0xbef4
    return (char *)(v1 + 8 + 4 * (int32_t)*(char *)(v1 + 7));
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xbf08 - 0xbf0f
// Line range:    189 - 378
int32_t _Unwind_GetDataRelBase(struct _Unwind_Context_1 * context) {
    // 0xbf08
    abort();
    // UNREACHABLE
}
 
// From module:   /usr/local/google/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h
// Address range: 0xbf10 - 0xbf17
// Line range:    191 - 384
int32_t _Unwind_GetTextRelBase(struct _Unwind_Context_1 * context) {
    // 0xbf10
    abort();
    // UNREACHABLE
}
 
// --------------- Dynamically Linked Functions ---------------
 
// void __aeabi_memcpy(void * dest, const void * src, size_t n);
// void __aeabi_memcpy4(int32_t a1, int32_t a2, int32_t a3);
// int __cxa_atexit(void(* func)(void *), void * arg, void * dso_handle);
// bool __cxa_begin_cleanup(_Unwind_Control_Block * ucbp);
// bool __cxa_type_match(_Unwind_Control_Block * ucbp, const type_info * rttip, void ** matched_object);
// _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int * pcount);
// void __libc_init(const struct ProgramVars * vars, void(* atfork_prepare)(void), void(* atfork_parent)(void), void(* atfork_child)(void), const char ** apple);
// void abort(void);
// void * calloc(size_t nmemb, size_t size);
// void exit(int status);
// int fclose(FILE * stream);
// int feof(FILE * stream);
// FILE * fopen(const char * restrict filename, const char * restrict modes);
// int fprintf(FILE * restrict stream, const char * restrict format, ...);
// int fputs(const char * restrict s, FILE * restrict stream);
// size_t fread(void * restrict ptr, size_t size, size_t n, FILE * restrict stream);
// void free(void * ptr);
// int fseek(FILE * stream, long int off, int whence);
// long int ftell(FILE * stream);
// size_t fwrite(const void * restrict ptr, size_t size, size_t n, FILE * restrict s);
// int getc(FILE * stream);
// void * malloc(size_t size);
// void * memchr(void * s, int c, size_t n);
// void * memcpy(void * restrict dest, const void * restrict src, size_t n);
// int printf(const char * restrict format, ...);
// int putc(int c, FILE * stream);
// int putchar(int c);
// int puts(const char * s);
// void qsort(void * base, size_t nmemb, size_t size, __compar_fn_t compar);
// void * realloc(void * ptr, size_t size);
// int sprintf(char * restrict s, const char * restrict format, ...);
// char * strchr(char * s, int c);
// int strcmp(const char * s1, const char * s2);
// char * strcpy(char * restrict dest, const char * restrict src);
// size_t strcspn(const char * s, const char * reject);
// size_t strlen(const char * s);
// int strncmp(const char * s1, const char * s2, size_t n);
// size_t strspn(const char * s, const char * accept);
// char * strstr(char * haystack, const char * needle);
// long long int strtoll(const char * restrict nptr, char ** restrict endptr, int base);
// unsigned long long int strtoull(const char * restrict nptr, char ** restrict endptr, int base);
 
// --------------- Instruction-Idiom Functions ----------------
 
// float32_t fabsf(float32_t a1);
// int32_t llvm_ctlz_i32(int32_t a1, bool a2);
 
// --------------------- Meta-Information ---------------------
 
// Detected compiler/packer: gcc (4.9)
// Detected language: C
// Detected functions: 223
// Decompiler release: v2.2.1 (2016-09-07)
// Decompilation date: 2017-12-13 12:53:17

Comments