[*] Binary protection state of ble_advertise

  
  	Full RELRO     Canary found      NX disabled  No PIE       No RPATH     No RUNPATH   No Symbols


[*] Function fprintf tear down of ble_advertise

    ; assembly                                       | /* r2dec pseudo code output */
                                                     | /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/ble_advertise @ 0x403cc4 */
                                                     | #include <stdint.h>
                                                     |  
    ; (fcn) sym.cmd_le_adv_int__int__char_ ()        | void cmd_le_adv_int_int_char_ () {
                                                     |     /* cmd_le_adv(int, int, char*) */
    0x00403cc4 lui gp, 2                             |     
    0x00403cc8 addiu gp, gp, -0x5ca4                 |     
    0x00403ccc addu gp, gp, t9                       |     gp += t9;
    0x00403cd0 addiu sp, sp, -0x80                   |     
    0x00403cd4 sw ra, 0x7c(sp)                       |     *(var_7ch) = ra;
    0x00403cd8 sw fp, 0x78(sp)                       |     *(var_78h) = fp;
    0x00403cdc sw s1, 0x74(sp)                       |     *(var_74h) = s1;
    0x00403ce0 sw s0, 0x70(sp)                       |     *(var_70h) = s0;
    0x00403ce4 move fp, sp                           |     fp = sp;
    0x00403ce8 sw gp, 0x18(sp)                       |     *(var_18h) = gp;
    0x00403cec sw a0, 0x2c(fp)                       |     *(arg_2ch) = a0;
    0x00403cf0 sw a1, 0x28(fp)                       |     *(arg_28h) = a1;
    0x00403cf4 sw a2, 0x24(fp)                       |     *(arg_24h) = a2;
    0x00403cf8 lw t8, -0x7ec8(gp)                    |     t8 = *((gp - 8114));
    0x00403cfc lw t8, (t8)                           |     t8 = *(t8);
    0x00403d00 sw t8, 0x6c(fp)                       |     *(arg_6ch) = t8;
    0x00403d04 lw t8, -0x7fc4(gp)                    |     t8 = sym.get_register_mode__;
    0x00403d08 move t9, t8                           |     t9 = t8;
    0x00403d0c jalr t9                               |     t9 ();
    0x00403d10 nop                                   |     
    0x00403d14 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403d18 move t8, v0                           |     t8 = v0;
    0x00403d1c sw t8, 0x38(fp)                       |     *(arg_38h) = t8;
    0x00403d20 sw zero, 0x3c(fp)                     |     *(arg_3ch) = 0;
    0x00403d24 lw t8, 0x28(fp)                       |     t8 = *(arg_28h);
                                                     |     if (t8 < 0) {
    0x00403d28 bgez t8, 0x403d50                     |         
    0x00403d2c nop                                   |         
    0x00403d30 move a0, zero                         |         a0 = 0;
    0x00403d34 lw t8, -0x7ef8(gp)                    |         t8 = sym.imp.hci_get_route;
    0x00403d38 move t9, t8                           |         t9 = t8;
    0x00403d3c jalr t9                               |         t9 ();
    0x00403d40 nop                                   |         
    0x00403d44 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00403d48 move t8, v0                           |         t8 = v0;
    0x00403d4c sw t8, 0x28(fp)                       |         *(arg_28h) = t8;
                                                     |     }
    0x00403d50 lw a0, 0x28(fp)                       |     a0 = *(arg_28h);
    0x00403d54 lw t8, -0x7f80(gp)                    |     t8 = sym.imp.hci_open_dev;
    0x00403d58 move t9, t8                           |     t9 = t8;
    0x00403d5c jalr t9                               |     t9 ();
    0x00403d60 nop                                   |     
    0x00403d64 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403d68 move t8, v0                           |     t8 = v0;
    0x00403d6c sw t8, 0x40(fp)                       |     *(arg_40h) = t8;
    0x00403d70 lw t8, 0x40(fp)                       |     t8 = *(arg_40h);
                                                     |     if (t8 < 0) {
    0x00403d74 bgez t8, 0x403dac                     |         
    0x00403d78 nop                                   |         
    0x00403d7c lw t8, -0x7fdc(gp)                    |         t8 = *(gp);
                                                     |         /* str.Could_not_open_device */
    0x00403d80 addiu a0, t8, 0x4d94                  |         a0 = t8 + 0x4d94;
    0x00403d84 lw t8, -0x7f38(gp)                    |         t8 = sym.imp.perror;
    0x00403d88 move t9, t8                           |         t9 = t8;
    0x00403d8c jalr t9                               |         t9 ();
    0x00403d90 nop                                   |         
    0x00403d94 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00403d98 addiu a0, zero, 1                     |         a0 = 1;
    0x00403d9c lw t8, -0x7f54(gp)                    |         t8 = sym.imp.exit;
    0x00403da0 move t9, t8                           |         t9 = t8;
    0x00403da4 jalr t9                               |         t9 ();
    0x00403da8 nop                                   |         
                                                     |     }
    0x00403dac addiu t8, fp, 0x5c                    |     t8 = fp + 0x5c;
    0x00403db0 move a0, t8                           |     a0 = t8;
    0x00403db4 move a1, zero                         |     a1 = 0;
    0x00403db8 addiu a2, zero, 0xf                   |     a2 = 0xf;
    0x00403dbc lw t8, -0x7f34(gp)                    |     t8 = sym.imp.memset;
    0x00403dc0 move t9, t8                           |     t9 = t8;
    0x00403dc4 jalr t9                               |     t9 ();
    0x00403dc8 nop                                   |     
    0x00403dcc lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403dd0 lw t8, 0x38(fp)                       |     t8 = *(arg_38h);
                                                     |     if (t8 == 0) {
    0x00403dd4 bnez t8, 0x403de8                     |         
    0x00403dd8 nop                                   |         
    0x00403ddc addiu t8, zero, 0xa0                  |         t8 = 0xa0;
    0x00403de0 b 0x403dec                            |         goto label_0;
    0x00403de4 nop                                   |         
                                                     |     }
    0x00403de8 addiu t8, zero, 0x320                 |     t8 = 0x320;
                                                     | label_0:
    0x00403dec sw t8, 0x3c(fp)                       |     *(arg_3ch) = t8;
    0x00403df0 lw t8, 0x3c(fp)                       |     t8 = *(arg_3ch);
    0x00403df4 andi t8, t8, 0xffff                   |     t8 &= 0xffff;
    0x00403df8 sh t8, 0x5c(fp)                       |     *(arg_5ch) = t8;
    0x00403dfc lw t8, 0x3c(fp)                       |     t8 = *(arg_3ch);
    0x00403e00 andi t8, t8, 0xffff                   |     t8 &= 0xffff;
    0x00403e04 sh t8, 0x5e(fp)                       |     *(arg_5eh) = t8;
    0x00403e08 lw t8, 0x24(fp)                       |     t8 = *(arg_24h);
                                                     |     if (t8 != 0) {
    0x00403e0c beqz t8, 0x403e38                     |         
    0x00403e10 nop                                   |         
    0x00403e14 lw a0, 0x24(fp)                       |         a0 = *(arg_24h);
    0x00403e18 lw t8, -0x7f64(gp)                    |         t8 = sym.imp.atoi;
    0x00403e1c move t9, t8                           |         t9 = t8;
    0x00403e20 jalr t9                               |         t9 ();
    0x00403e24 nop                                   |         
    0x00403e28 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00403e2c move t8, v0                           |         t8 = v0;
    0x00403e30 andi t8, t8, 0xff                     |         t8 &= 0xff;
    0x00403e34 sb t8, 0x60(fp)                       |         *(arg_60h) = t8;
                                                     |     }
    0x00403e38 addiu t8, zero, 7                     |     t8 = 7;
    0x00403e3c sb t8, 0x69(fp)                       |     *(arg_69h) = t8;
    0x00403e40 addiu t8, fp, 0x44                    |     t8 = fp + 0x44;
    0x00403e44 move a0, t8                           |     a0 = t8;
    0x00403e48 move a1, zero                         |     a1 = 0;
    0x00403e4c addiu a2, zero, 0x18                  |     a2 = 0x18;
    0x00403e50 lw t8, -0x7f34(gp)                    |     t8 = sym.imp.memset;
    0x00403e54 move t9, t8                           |     t9 = t8;
    0x00403e58 jalr t9                               |     t9 ();
    0x00403e5c nop                                   |     
    0x00403e60 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403e64 addiu t8, zero, 8                     |     t8 = 8;
    0x00403e68 sh t8, 0x44(fp)                       |     *(arg_44h) = t8;
    0x00403e6c addiu t8, zero, 6                     |     t8 = 6;
    0x00403e70 sh t8, 0x46(fp)                       |     *(arg_46h) = t8;
    0x00403e74 addiu t8, fp, 0x5c                    |     t8 = fp + 0x5c;
    0x00403e78 sw t8, 0x4c(fp)                       |     *(arg_4ch) = t8;
    0x00403e7c addiu t8, zero, 0xf                   |     t8 = 0xf;
    0x00403e80 sw t8, 0x50(fp)                       |     *(arg_50h) = t8;
    0x00403e84 addiu t8, fp, 0x33                    |     t8 = fp + 0x33;
    0x00403e88 sw t8, 0x54(fp)                       |     *(arg_54h) = t8;
    0x00403e8c addiu t8, zero, 1                     |     t8 = 1;
    0x00403e90 sw t8, 0x58(fp)                       |     *(arg_58h) = t8;
    0x00403e94 addiu t8, fp, 0x44                    |     t8 = fp + 0x44;
    0x00403e98 lw a0, 0x40(fp)                       |     a0 = *(arg_40h);
    0x00403e9c move a1, t8                           |     a1 = t8;
    0x00403ea0 addiu a2, zero, 0x3e8                 |     a2 = 0x3e8;
    0x00403ea4 lw t8, -0x7f84(gp)                    |     t8 = sym.imp.hci_send_req;
    0x00403ea8 move t9, t8                           |     t9 = t8;
    0x00403eac jalr t9                               |     t9 ();
    0x00403eb0 nop                                   |     
    0x00403eb4 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403eb8 move t8, v0                           |     t8 = v0;
    0x00403ebc sw t8, 0x34(fp)                       |     *(arg_34h) = t8;
    0x00403ec0 lw t8, 0x34(fp)                       |     t8 = *(arg_34h);
                                                     |     if (t8 < 0) {
    0x00403ec4 bgez t8, 0x403ed4                     |         
    0x00403ec8 nop                                   |         
    0x00403ecc b 0x403f80                            |         goto label_1;
    0x00403ed0 nop                                   |         
                                                     |     }
    0x00403ed4 addiu t8, fp, 0x30                    |     t8 = fp + 0x30;
    0x00403ed8 move a0, t8                           |     a0 = t8;
    0x00403edc move a1, zero                         |     a1 = 0;
    0x00403ee0 addiu a2, zero, 1                     |     a2 = 1;
    0x00403ee4 lw t8, -0x7f34(gp)                    |     t8 = sym.imp.memset;
    0x00403ee8 move t9, t8                           |     t9 = t8;
    0x00403eec jalr t9                               |     t9 ();
    0x00403ef0 nop                                   |     
    0x00403ef4 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403ef8 addiu t8, zero, 1                     |     t8 = 1;
    0x00403efc sb t8, 0x30(fp)                       |     *(arg_30h) = t8;
    0x00403f00 addiu t8, fp, 0x44                    |     t8 = fp + 0x44;
    0x00403f04 move a0, t8                           |     a0 = t8;
    0x00403f08 move a1, zero                         |     a1 = 0;
    0x00403f0c addiu a2, zero, 0x18                  |     a2 = 0x18;
    0x00403f10 lw t8, -0x7f34(gp)                    |     t8 = sym.imp.memset;
    0x00403f14 move t9, t8                           |     t9 = t8;
    0x00403f18 jalr t9                               |     t9 ();
    0x00403f1c nop                                   |     
    0x00403f20 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403f24 addiu t8, zero, 8                     |     t8 = 8;
    0x00403f28 sh t8, 0x44(fp)                       |     *(arg_44h) = t8;
    0x00403f2c addiu t8, zero, 0xa                   |     t8 = 0xa;
    0x00403f30 sh t8, 0x46(fp)                       |     *(arg_46h) = t8;
    0x00403f34 addiu t8, fp, 0x30                    |     t8 = fp + 0x30;
    0x00403f38 sw t8, 0x4c(fp)                       |     *(arg_4ch) = t8;
    0x00403f3c addiu t8, zero, 1                     |     t8 = 1;
    0x00403f40 sw t8, 0x50(fp)                       |     *(arg_50h) = t8;
    0x00403f44 addiu t8, fp, 0x33                    |     t8 = fp + 0x33;
    0x00403f48 sw t8, 0x54(fp)                       |     *(arg_54h) = t8;
    0x00403f4c addiu t8, zero, 1                     |     t8 = 1;
    0x00403f50 sw t8, 0x58(fp)                       |     *(arg_58h) = t8;
    0x00403f54 addiu t8, fp, 0x44                    |     t8 = fp + 0x44;
    0x00403f58 lw a0, 0x40(fp)                       |     a0 = *(arg_40h);
    0x00403f5c move a1, t8                           |     a1 = t8;
    0x00403f60 addiu a2, zero, 0x3e8                 |     a2 = 0x3e8;
    0x00403f64 lw t8, -0x7f84(gp)                    |     t8 = sym.imp.hci_send_req;
    0x00403f68 move t9, t8                           |     t9 = t8;
    0x00403f6c jalr t9                               |     t9 ();
    0x00403f70 nop                                   |     
    0x00403f74 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403f78 move t8, v0                           |     t8 = v0;
    0x00403f7c sw t8, 0x34(fp)                       |     *(arg_34h) = t8;
                                                     | label_1:
    0x00403f80 lw a0, 0x40(fp)                       |     a0 = *(arg_40h);
    0x00403f84 lw t8, -0x7ec0(gp)                    |     t8 = sym.imp.hci_close_dev;
    0x00403f88 move t9, t8                           |     t9 = t8;
    0x00403f8c jalr t9                               |     t9 ();
    0x00403f90 nop                                   |     
    0x00403f94 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00403f98 lw t8, 0x34(fp)                       |     t8 = *(arg_34h);
                                                     |     if (t8 < 0) {
    0x00403f9c bgez t8, 0x404038                     |         
    0x00403fa0 nop                                   |         
    0x00403fa4 lw t8, -0x7f10(gp)                    |         t8 = *((gp - 8132));
    0x00403fa8 lw s1, (t8)                           |         s1 = *(t8);
    0x00403fac lw t8, -0x7ec4(gp)                    |         t8 = sym.imp.__errno_location;
    0x00403fb0 move t9, t8                           |         t9 = t8;
    0x00403fb4 jalr t9                               |         t9 ();
    0x00403fb8 nop                                   |         
    0x00403fbc lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00403fc0 move t8, v0                           |         t8 = v0;
    0x00403fc4 lw t8, (t8)                           |         t8 = *(t8);
    0x00403fc8 move a0, t8                           |         a0 = t8;
    0x00403fcc lw t8, -0x7f6c(gp)                    |         t8 = sym.imp.strerror;
    0x00403fd0 move t9, t8                           |         t9 = t8;
    0x00403fd4 jalr t9                               |         t9 ();
    0x00403fd8 nop                                   |         
    0x00403fdc lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00403fe0 move s0, v0                           |         s0 = v0;
    0x00403fe4 lw t8, -0x7ec4(gp)                    |         t8 = sym.imp.__errno_location;
    0x00403fe8 move t9, t8                           |         t9 = t8;
    0x00403fec jalr t9                               |         t9 ();
    0x00403ff0 nop                                   |         
    0x00403ff4 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00403ff8 move t8, v0                           |         t8 = v0;
    0x00403ffc lw t8, (t8)                           |         t8 = *(t8);
    0x00404000 sw t8, 0x10(sp)                       |         *(var_10h) = t8;
    0x00404004 move a0, s1                           |         a0 = s1;
    0x00404008 lw t8, -0x7fdc(gp)                    |         t8 = *(gp);
                                                     |         /* str.Cant_set_advertise_mode_on_hci_d:__s___d__n */
    0x0040400c addiu a1, t8, 0x4dac                  |         a1 = t8 + 0x4dac;
    0x00404010 lw a2, 0x28(fp)                       |         a2 = *(arg_28h);
    0x00404014 move a3, s0                           |         a3 = s0;
    0x00404018 lw t8, -0x7f40(gp)                    |         t8 = sym.imp.fprintf
    0x0040401c move t9, t8                           |         t9 = t8;
    0x00404020 jalr t9                               |         t9 ();
    0x00404024 nop                                   |         
    0x00404028 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x0040402c addiu t8, zero, -1                    |         t8 = -1;
    0x00404030 b 0x40407c                            |         goto label_2;
    0x00404034 nop                                   |         
                                                     |     }
    0x00404038 lbu t8, 0x33(fp)                      |     t8 = *(arg_33h);
                                                     |     if (t8 != 0) {
    0x0040403c beqz t8, 0x404078                     |         
    0x00404040 nop                                   |         
    0x00404044 lw t8, -0x7f10(gp)                    |         t8 = *((gp - 8132));
    0x00404048 lw v0, (t8)                           |         v0 = *(t8);
    0x0040404c lbu t8, 0x33(fp)                      |         t8 = *(arg_33h);
    0x00404050 move a0, v0                           |         a0 = v0;
    0x00404054 lw v0, -0x7fdc(gp)                    |         v0 = *(gp);
                                                     |         /* str.LE_set_advertise_enable_on_hci_d_returned_status__d_n */
    0x00404058 addiu a1, v0, 0x4dd8                  |         a1 = v0 + 0x4dd8;
    0x0040405c lw a2, 0x28(fp)                       |         a2 = *(arg_28h);
    0x00404060 move a3, t8                           |         a3 = t8;
    0x00404064 lw t8, -0x7f40(gp)                    |         t8 = sym.imp.fprintf
    0x00404068 move t9, t8                           |         t9 = t8;
    0x0040406c jalr t9                               |         t9 ();
    0x00404070 nop                                   |         
    0x00404074 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
                                                     |     }
    0x00404078 move t8, zero                         |     t8 = 0;
                                                     | label_2:
    0x0040407c move v0, t8                           |     v0 = t8;
    0x00404080 lw t8, -0x7ec8(gp)                    |     t8 = *((gp - 8114));
    0x00404084 lw v1, 0x6c(fp)                       |     v1 = *(arg_6ch);
    0x00404088 lw t8, (t8)                           |     t8 = *(t8);
                                                     |     if (v1 != t8) {
    0x0040408c beq v1, t8, 0x4040a4                  |         
    0x00404090 nop                                   |         
    0x00404094 lw t8, -0x7f0c(gp)                    |         t8 = sym.imp.__stack_chk_fail;
    0x00404098 move t9, t8                           |         t9 = t8;
    0x0040409c jalr t9                               |         t9 ();
    0x004040a0 nop                                   |         
                                                     |     }
    0x004040a4 move sp, fp                           |     
    0x004040a8 lw ra, 0x7c(sp)                       |     ra = *(var_7ch);
    0x004040ac lw fp, 0x78(sp)                       |     fp = *(var_78h);
    0x004040b0 lw s1, 0x74(sp)                       |     s1 = *(var_74h);
    0x004040b4 lw s0, 0x70(sp)                       |     s0 = *(var_70h);
    0x004040b8 addiu sp, sp, 0x80                    |     
    0x004040bc jr ra                                 |     return v1;
    0x004040c0 nop                                   |     
                                                     | }
    ; assembly                                       | /* r2dec pseudo code output */
                                                     | /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/ble_advertise @ 0x401ab8 */
                                                     | #include <stdint.h>
                                                     |  
    ; (fcn) sym.cmd_scan_int__int__char_ ()          | void cmd_scan_int_int_char_ () {
                                                     |     /* cmd_scan(int, int, char*) */
    0x00401ab8 lui gp, 2                             |     
    0x00401abc addiu gp, gp, -0x3a98                 |     
    0x00401ac0 addu gp, gp, t9                       |     gp += t9;
    0x00401ac4 addiu sp, sp, -0x50                   |     
    0x00401ac8 sw ra, 0x4c(sp)                       |     *(var_4ch) = ra;
    0x00401acc sw fp, 0x48(sp)                       |     *(var_48h) = fp;
    0x00401ad0 sw s1, 0x44(sp)                       |     *(var_44h) = s1;
    0x00401ad4 sw s0, 0x40(sp)                       |     *(var_40h) = s0;
    0x00401ad8 move fp, sp                           |     fp = sp;
    0x00401adc sw gp, 0x18(sp)                       |     *(var_18h) = gp;
    0x00401ae0 sw a0, 0x2c(fp)                       |     *(arg_2ch) = a0;
    0x00401ae4 sw a1, 0x28(fp)                       |     *(arg_28h) = a1;
    0x00401ae8 sw a2, 0x24(fp)                       |     *(arg_24h) = a2;
    0x00401aec lw t8, -0x7ec8(gp)                    |     t8 = *((gp - 8114));
    0x00401af0 lw t8, (t8)                           |     t8 = *(t8);
    0x00401af4 sw t8, 0x3c(fp)                       |     *(arg_3ch) = t8;
    0x00401af8 lw t8, 0x28(fp)                       |     t8 = *(arg_28h);
    0x00401afc andi t8, t8, 0xffff                   |     t8 &= 0xffff;
    0x00401b00 sh t8, 0x34(fp)                       |     *(arg_34h) = t8;
    0x00401b04 sw zero, 0x38(fp)                     |     *(arg_38h) = 0;
    0x00401b08 lw t8, 0x24(fp)                       |     t8 = *(arg_24h);
                                                     |     if (t8 != 0) {
    0x00401b0c beqz t8, 0x401bc0                     |         
    0x00401b10 nop                                   |         
    0x00401b14 lw a0, 0x24(fp)                       |         a0 = *(arg_24h);
    0x00401b18 lw t8, -0x7fdc(gp)                    |         t8 = *(gp);
                                                     |         /* str.iscan */
    0x00401b1c addiu a1, t8, 0x4e10                  |         a1 = t8 + 0x4e10;
    0x00401b20 lw t8, -0x7f5c(gp)                    |         t8 = sym.imp.strcmp;
    0x00401b24 move t9, t8                           |         t9 = t8;
    0x00401b28 jalr t9                               |         t9 ();
    0x00401b2c nop                                   |         
    0x00401b30 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00401b34 move t8, v0                           |         t8 = v0;
                                                     |         if (t8 == 0) {
    0x00401b38 bnez t8, 0x401b50                     |             
    0x00401b3c nop                                   |             
    0x00401b40 addiu t8, zero, 1                     |             t8 = 1;
    0x00401b44 sw t8, 0x38(fp)                       |             *(arg_38h) = t8;
    0x00401b48 b 0x401bc0                            |             goto label_0;
    0x00401b4c nop                                   |             
                                                     |         }
    0x00401b50 lw a0, 0x24(fp)                       |         a0 = *(arg_24h);
    0x00401b54 lw t8, -0x7fdc(gp)                    |         t8 = *(gp);
                                                     |         /* str.pscan */
    0x00401b58 addiu a1, t8, 0x4e18                  |         a1 = t8 + 0x4e18;
    0x00401b5c lw t8, -0x7f5c(gp)                    |         t8 = sym.imp.strcmp;
    0x00401b60 move t9, t8                           |         t9 = t8;
    0x00401b64 jalr t9                               |         t9 ();
    0x00401b68 nop                                   |         
    0x00401b6c lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00401b70 move t8, v0                           |         t8 = v0;
                                                     |         if (t8 == 0) {
    0x00401b74 bnez t8, 0x401b8c                     |             
    0x00401b78 nop                                   |             
    0x00401b7c addiu t8, zero, 2                     |             t8 = 2;
    0x00401b80 sw t8, 0x38(fp)                       |             *(arg_38h) = t8;
    0x00401b84 b 0x401bc0                            |             goto label_0;
    0x00401b88 nop                                   |             
                                                     |         }
    0x00401b8c lw a0, 0x24(fp)                       |         a0 = *(arg_24h);
    0x00401b90 lw t8, -0x7fdc(gp)                    |         t8 = *(gp);
                                                     |         /* str.piscan */
    0x00401b94 addiu a1, t8, 0x4e20                  |         a1 = t8 + 0x4e20;
    0x00401b98 lw t8, -0x7f5c(gp)                    |         t8 = sym.imp.strcmp;
    0x00401b9c move t9, t8                           |         t9 = t8;
    0x00401ba0 jalr t9                               |         t9 ();
    0x00401ba4 nop                                   |         
    0x00401ba8 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00401bac move t8, v0                           |         t8 = v0;
                                                     |         if (t8 != 0) {
    0x00401bb0 bnez t8, 0x401bc0                     |             goto label_0;
                                                     |         }
    0x00401bb4 nop                                   |         
    0x00401bb8 addiu t8, zero, 3                     |         t8 = 3;
    0x00401bbc sw t8, 0x38(fp)                       |         *(arg_38h) = t8;
                                                     |     }
                                                     | label_0:
    0x00401bc0 lui v0, 4                             |     v0 = 0x40000;
    0x00401bc4 lui t8, 0x8000                        |     t8 = 0x800048dd;
    0x00401bc8 ori t8, t8, 0x48dd                    |     
    0x00401bcc or v0, v0, t8                         |     v0 |= t8;
    0x00401bd0 addiu t8, fp, 0x34                    |     t8 = fp + 0x34;
    0x00401bd4 lw a0, 0x2c(fp)                       |     a0 = *(arg_2ch);
    0x00401bd8 move a1, v0                           |     a1 = v0;
    0x00401bdc move a2, t8                           |     a2 = t8;
    0x00401be0 lw t8, -0x7ee4(gp)                    |     t8 = sym.imp.ioctl;
    0x00401be4 move t9, t8                           |     t9 = t8;
    0x00401be8 jalr t9                               |     t9 ();
    0x00401bec nop                                   |     
    0x00401bf0 lw gp, 0x18(fp)                       |     gp = *(arg_18h);
    0x00401bf4 move t8, v0                           |     t8 = v0;
    0x00401bf8 srl t8, t8, 0x1f                      |     t8 >>= 0x1f;
    0x00401bfc andi t8, t8, 0xff                     |     t8 &= 0xff;
                                                     |     if (t8 != 0) {
    0x00401c00 beqz t8, 0x401c9c                     |         
    0x00401c04 nop                                   |         
    0x00401c08 lw t8, -0x7f10(gp)                    |         t8 = *((gp - 8132));
    0x00401c0c lw s1, (t8)                           |         s1 = *(t8);
    0x00401c10 lw t8, -0x7ec4(gp)                    |         t8 = sym.imp.__errno_location;
    0x00401c14 move t9, t8                           |         t9 = t8;
    0x00401c18 jalr t9                               |         t9 ();
    0x00401c1c nop                                   |         
    0x00401c20 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00401c24 move t8, v0                           |         t8 = v0;
    0x00401c28 lw t8, (t8)                           |         t8 = *(t8);
    0x00401c2c move a0, t8                           |         a0 = t8;
    0x00401c30 lw t8, -0x7f6c(gp)                    |         t8 = sym.imp.strerror;
    0x00401c34 move t9, t8                           |         t9 = t8;
    0x00401c38 jalr t9                               |         t9 ();
    0x00401c3c nop                                   |         
    0x00401c40 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00401c44 move s0, v0                           |         s0 = v0;
    0x00401c48 lw t8, -0x7ec4(gp)                    |         t8 = sym.imp.__errno_location;
    0x00401c4c move t9, t8                           |         t9 = t8;
    0x00401c50 jalr t9                               |         t9 ();
    0x00401c54 nop                                   |         
    0x00401c58 lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00401c5c move t8, v0                           |         t8 = v0;
    0x00401c60 lw t8, (t8)                           |         t8 = *(t8);
    0x00401c64 sw t8, 0x10(sp)                       |         *(var_10h) = t8;
    0x00401c68 move a0, s1                           |         a0 = s1;
    0x00401c6c lw t8, -0x7fdc(gp)                    |         t8 = *(gp);
                                                     |         /* str.Cant_set_scan_mode_on_hci_d:__s___d__n */
    0x00401c70 addiu a1, t8, 0x4e28                  |         a1 = t8 + 0x4e28;
    0x00401c74 lw a2, 0x28(fp)                       |         a2 = *(arg_28h);
    0x00401c78 move a3, s0                           |         a3 = s0;
    0x00401c7c lw t8, -0x7f40(gp)                    |         t8 = sym.imp.fprintf
    0x00401c80 move t9, t8                           |         t9 = t8;
    0x00401c84 jalr t9                               |         t9 ();
    0x00401c88 nop                                   |         
    0x00401c8c lw gp, 0x18(fp)                       |         gp = *(arg_18h);
    0x00401c90 addiu t8, zero, -1                    |         t8 = -1;
    0x00401c94 b 0x401ca0                            |         goto label_1;
    0x00401c98 nop                                   |         
                                                     |     }
    0x00401c9c move t8, zero                         |     t8 = 0;
                                                     | label_1:
    0x00401ca0 move v0, t8                           |     v0 = t8;
    0x00401ca4 lw t8, -0x7ec8(gp)                    |     t8 = *((gp - 8114));
    0x00401ca8 lw v1, 0x3c(fp)                       |     v1 = *(arg_3ch);
    0x00401cac lw t8, (t8)                           |     t8 = *(t8);
                                                     |     if (v1 != t8) {
    0x00401cb0 beq v1, t8, 0x401cc8                  |         
    0x00401cb4 nop                                   |         
    0x00401cb8 lw t8, -0x7f0c(gp)                    |         t8 = sym.imp.__stack_chk_fail;
    0x00401cbc move t9, t8                           |         t9 = t8;
    0x00401cc0 jalr t9                               |         t9 ();
    0x00401cc4 nop                                   |         
                                                     |     }
    0x00401cc8 move sp, fp                           |     
    0x00401ccc lw ra, 0x4c(sp)                       |     ra = *(var_4ch);
    0x00401cd0 lw fp, 0x48(sp)                       |     fp = *(var_48h);
    0x00401cd4 lw s1, 0x44(sp)                       |     s1 = *(var_44h);
    0x00401cd8 lw s0, 0x40(sp)                       |     s0 = *(var_40h);
    0x00401cdc addiu sp, sp, 0x50                    |     
    0x00401ce0 jr ra                                 |     return v1;
    0x00401ce4 nop                                   |     
                                                     | }
    ; assembly                                               | /* r2dec pseudo code output */
                                                             | /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/ble_advertise @ 0x40399c */
                                                             | #include <stdint.h>
                                                             |  
    ; (fcn) sym.cmd_send_advertising_data_int__int_ ()       | void cmd_send_advertising_data_int_int_ () {
                                                             |     /* cmd_send_advertising_data(int, int) */
    0x0040399c lui gp, 2                                     |     
    0x004039a0 addiu gp, gp, -0x597c                         |     
    0x004039a4 addu gp, gp, t9                               |     gp += t9;
    0x004039a8 addiu sp, sp, -0x80                           |     
    0x004039ac sw ra, 0x7c(sp)                               |     *(var_7ch) = ra;
    0x004039b0 sw fp, 0x78(sp)                               |     *(var_78h) = fp;
    0x004039b4 sw s1, 0x74(sp)                               |     *(var_74h) = s1;
    0x004039b8 sw s0, 0x70(sp)                               |     *(var_70h) = s0;
    0x004039bc move fp, sp                                   |     fp = sp;
    0x004039c0 sw gp, 0x18(sp)                               |     *(var_18h) = gp;
    0x004039c4 sw a0, 0x24(fp)                               |     *(arg_24h) = a0;
    0x004039c8 sw a1, 0x20(fp)                               |     *(arg_20h) = a1;
    0x004039cc lw t8, -0x7ec8(gp)                            |     t8 = *((gp - 8114));
    0x004039d0 lw t8, (t8)                                   |     t8 = *(t8);
    0x004039d4 sw t8, 0x6c(fp)                               |     *(arg_6ch) = t8;
    0x004039d8 lw t8, 0x20(fp)                               |     t8 = *(arg_20h);
                                                             |     if (t8 < 0) {
    0x004039dc bgez t8, 0x403a04                             |         
    0x004039e0 nop                                           |         
    0x004039e4 move a0, zero                                 |         a0 = 0;
    0x004039e8 lw t8, -0x7ef8(gp)                            |         t8 = sym.imp.hci_get_route;
    0x004039ec move t9, t8                                   |         t9 = t8;
    0x004039f0 jalr t9                                       |         t9 ();
    0x004039f4 nop                                           |         
    0x004039f8 lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x004039fc move t8, v0                                   |         t8 = v0;
    0x00403a00 sw t8, 0x20(fp)                               |         *(arg_20h) = t8;
                                                             |     }
    0x00403a04 lw a0, 0x20(fp)                               |     a0 = *(arg_20h);
    0x00403a08 lw t8, -0x7f80(gp)                            |     t8 = sym.imp.hci_open_dev;
    0x00403a0c move t9, t8                                   |     t9 = t8;
    0x00403a10 jalr t9                                       |     t9 ();
    0x00403a14 nop                                           |     
    0x00403a18 lw gp, 0x18(fp)                               |     gp = *(arg_18h);
    0x00403a1c move t8, v0                                   |     t8 = v0;
    0x00403a20 sw t8, 0x2c(fp)                               |     *(arg_2ch) = t8;
    0x00403a24 lw t8, 0x2c(fp)                               |     t8 = *(arg_2ch);
                                                             |     if (t8 < 0) {
    0x00403a28 bgez t8, 0x403a58                             |         
    0x00403a2c nop                                           |         
    0x00403a30 lw t8, -0x7fdc(gp)                            |         t8 = *(gp);
                                                             |         /* str.Could_not_open_device */
    0x00403a34 addiu a0, t8, 0x4d94                          |         a0 = t8 + 0x4d94;
    0x00403a38 lw t8, -0x7f38(gp)                            |         t8 = sym.imp.perror;
    0x00403a3c move t9, t8                                   |         t9 = t8;
    0x00403a40 jalr t9                                       |         t9 ();
    0x00403a44 nop                                           |         
    0x00403a48 lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x00403a4c addiu t8, zero, -1                            |         t8 = -1;
    0x00403a50 b 0x403c7c                                    |         goto label_0;
    0x00403a54 nop                                           |         
                                                             |     }
    0x00403a58 addiu t8, fp, 0x4c                            |     t8 = fp + 0x4c;
    0x00403a5c move a0, t8                                   |     a0 = t8;
    0x00403a60 move a1, zero                                 |     a1 = 0;
    0x00403a64 addiu a2, zero, 0x20                          |     a2 = 0x20;
    0x00403a68 lw t8, -0x7f34(gp)                            |     t8 = sym.imp.memset;
    0x00403a6c move t9, t8                                   |     t9 = t8;
    0x00403a70 jalr t9                                       |     t9 ();
    0x00403a74 nop                                           |     
    0x00403a78 lw gp, 0x18(fp)                               |     gp = *(arg_18h);
    0x00403a7c addiu v0, fp, 0x4c                            |     v0 = fp + 0x4c;
    0x00403a80 addiu t8, fp, 0x4c                            |     t8 = fp + 0x4c;
    0x00403a84 addiu t8, t8, 1                               |     t8++;
    0x00403a88 move a0, v0                                   |     a0 = v0;
    0x00403a8c move a1, t8                                   |     a1 = t8;
    0x00403a90 lw t8, -0x7fb8(gp)                            |     t8 = sym.generate_set_advertising_data_unsigned_char__unsigned_char_;
    0x00403a94 move t9, t8                                   |     t9 = t8;
    0x00403a98 jalr t9                                       |     t9 ();
    0x00403a9c nop                                           |     
    0x00403aa0 lw gp, 0x18(fp)                               |     gp = *(arg_18h);
    0x00403aa4 move t8, v0                                   |     t8 = v0;
    0x00403aa8 sw t8, 0x30(fp)                               |     *(arg_30h) = t8;
    0x00403aac lw t8, 0x30(fp)                               |     t8 = *(arg_30h);
                                                             |     if (t8 < 0) {
    0x00403ab0 bgez t8, 0x403af4                             |         
    0x00403ab4 nop                                           |         
    0x00403ab8 lw t8, -0x7f10(gp)                            |         t8 = *((gp - 8132));
    0x00403abc lw t8, (t8)                                   |         t8 = *(t8);
    0x00403ac0 lw v0, -0x7fdc(gp)                            |         v0 = *(gp);
                                                             |         /* str.Cant_generate_advertising_data._n */
    0x00403ac4 addiu a0, v0, 0x4f88                          |         a0 = v0 + 0x4f88;
    0x00403ac8 addiu a1, zero, 1                             |         a1 = 1;
    0x00403acc addiu a2, zero, 0x21                          |         a2 = 0x21;
    0x00403ad0 move a3, t8                                   |         a3 = t8;
    0x00403ad4 lw t8, -0x7ecc(gp)                            |         t8 = sym.imp.fwrite;
    0x00403ad8 move t9, t8                                   |         t9 = t8;
    0x00403adc jalr t9                                       |         t9 ();
    0x00403ae0 nop                                           |         
    0x00403ae4 lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x00403ae8 addiu t8, zero, -1                            |         t8 = -1;
    0x00403aec b 0x403c7c                                    |         goto label_0;
    0x00403af0 nop                                           |         
                                                             |     }
    0x00403af4 addiu t8, fp, 0x34                            |     t8 = fp + 0x34;
    0x00403af8 move a0, t8                                   |     a0 = t8;
    0x00403afc move a1, zero                                 |     a1 = 0;
    0x00403b00 addiu a2, zero, 0x18                          |     a2 = 0x18;
    0x00403b04 lw t8, -0x7f34(gp)                            |     t8 = sym.imp.memset;
    0x00403b08 move t9, t8                                   |     t9 = t8;
    0x00403b0c jalr t9                                       |     t9 ();
    0x00403b10 nop                                           |     
    0x00403b14 lw gp, 0x18(fp)                               |     gp = *(arg_18h);
    0x00403b18 addiu t8, zero, 8                             |     t8 = 8;
    0x00403b1c sh t8, 0x34(fp)                               |     *(arg_34h) = t8;
    0x00403b20 addiu t8, zero, 8                             |     t8 = 8;
    0x00403b24 sh t8, 0x36(fp)                               |     *(arg_36h) = t8;
    0x00403b28 addiu t8, fp, 0x4c                            |     t8 = fp + 0x4c;
    0x00403b2c sw t8, 0x3c(fp)                               |     *(arg_3ch) = t8;
    0x00403b30 addiu t8, zero, 0x20                          |     t8 = 0x20;
    0x00403b34 sw t8, 0x40(fp)                               |     *(arg_40h) = t8;
    0x00403b38 addiu t8, fp, 0x2b                            |     t8 = fp + 0x2b;
    0x00403b3c sw t8, 0x44(fp)                               |     *(arg_44h) = t8;
    0x00403b40 addiu t8, zero, 1                             |     t8 = 1;
    0x00403b44 sw t8, 0x48(fp)                               |     *(arg_48h) = t8;
    0x00403b48 addiu t8, fp, 0x34                            |     t8 = fp + 0x34;
    0x00403b4c lw a0, 0x2c(fp)                               |     a0 = *(arg_2ch);
    0x00403b50 move a1, t8                                   |     a1 = t8;
    0x00403b54 addiu a2, zero, 0x3e8                         |     a2 = 0x3e8;
    0x00403b58 lw t8, -0x7f84(gp)                            |     t8 = sym.imp.hci_send_req;
    0x00403b5c move t9, t8                                   |     t9 = t8;
    0x00403b60 jalr t9                                       |     t9 ();
    0x00403b64 nop                                           |     
    0x00403b68 lw gp, 0x18(fp)                               |     gp = *(arg_18h);
    0x00403b6c move t8, v0                                   |     t8 = v0;
    0x00403b70 sw t8, 0x30(fp)                               |     *(arg_30h) = t8;
    0x00403b74 lw a0, 0x2c(fp)                               |     a0 = *(arg_2ch);
    0x00403b78 lw t8, -0x7ec0(gp)                            |     t8 = sym.imp.hci_close_dev;
    0x00403b7c move t9, t8                                   |     t9 = t8;
    0x00403b80 jalr t9                                       |     t9 ();
    0x00403b84 nop                                           |     
    0x00403b88 lw gp, 0x18(fp)                               |     gp = *(arg_18h);
    0x00403b8c lw t8, 0x30(fp)                               |     t8 = *(arg_30h);
                                                             |     if (t8 < 0) {
    0x00403b90 bgez t8, 0x403c2c                             |         
    0x00403b94 nop                                           |         
    0x00403b98 lw t8, -0x7f10(gp)                            |         t8 = *((gp - 8132));
    0x00403b9c lw s1, (t8)                                   |         s1 = *(t8);
    0x00403ba0 lw t8, -0x7ec4(gp)                            |         t8 = sym.imp.__errno_location;
    0x00403ba4 move t9, t8                                   |         t9 = t8;
    0x00403ba8 jalr t9                                       |         t9 ();
    0x00403bac nop                                           |         
    0x00403bb0 lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x00403bb4 move t8, v0                                   |         t8 = v0;
    0x00403bb8 lw t8, (t8)                                   |         t8 = *(t8);
    0x00403bbc move a0, t8                                   |         a0 = t8;
    0x00403bc0 lw t8, -0x7f6c(gp)                            |         t8 = sym.imp.strerror;
    0x00403bc4 move t9, t8                                   |         t9 = t8;
    0x00403bc8 jalr t9                                       |         t9 ();
    0x00403bcc nop                                           |         
    0x00403bd0 lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x00403bd4 move s0, v0                                   |         s0 = v0;
    0x00403bd8 lw t8, -0x7ec4(gp)                            |         t8 = sym.imp.__errno_location;
    0x00403bdc move t9, t8                                   |         t9 = t8;
    0x00403be0 jalr t9                                       |         t9 ();
    0x00403be4 nop                                           |         
    0x00403be8 lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x00403bec move t8, v0                                   |         t8 = v0;
    0x00403bf0 lw t8, (t8)                                   |         t8 = *(t8);
    0x00403bf4 sw t8, 0x10(sp)                               |         *(var_10h) = t8;
    0x00403bf8 move a0, s1                                   |         a0 = s1;
    0x00403bfc lw t8, -0x7fdc(gp)                            |         t8 = *(gp);
                                                             |         /* str.Cant_send_advertising_data_on_hci_d:__s___d__n */
    0x00403c00 addiu a1, t8, 0x4fac                          |         a1 = t8 + 0x4fac;
    0x00403c04 lw a2, 0x20(fp)                               |         a2 = *(arg_20h);
    0x00403c08 move a3, s0                                   |         a3 = s0;
    0x00403c0c lw t8, -0x7f40(gp)                            |         t8 = sym.imp.fprintf
    0x00403c10 move t9, t8                                   |         t9 = t8;
    0x00403c14 jalr t9                                       |         t9 ();
    0x00403c18 nop                                           |         
    0x00403c1c lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x00403c20 addiu t8, zero, -1                            |         t8 = -1;
    0x00403c24 b 0x403c7c                                    |         goto label_0;
    0x00403c28 nop                                           |         
                                                             |     }
    0x00403c2c lbu t8, 0x2b(fp)                              |     t8 = *(arg_2bh);
                                                             |     if (t8 != 0) {
    0x00403c30 beqz t8, 0x403c78                             |         
    0x00403c34 nop                                           |         
    0x00403c38 lw t8, -0x7f10(gp)                            |         t8 = *((gp - 8132));
    0x00403c3c lw v0, (t8)                                   |         v0 = *(t8);
    0x00403c40 lbu t8, 0x2b(fp)                              |         t8 = *(arg_2bh);
    0x00403c44 move a0, v0                                   |         a0 = v0;
    0x00403c48 lw v0, -0x7fdc(gp)                            |         v0 = *(gp);
                                                             |         /* str.LE_set_advertising_data_on_hci_d_returned_status__d_n */
    0x00403c4c addiu a1, v0, 0x4fdc                          |         a1 = v0 + 0x4fdc;
    0x00403c50 lw a2, 0x20(fp)                               |         a2 = *(arg_20h);
    0x00403c54 move a3, t8                                   |         a3 = t8;
    0x00403c58 lw t8, -0x7f40(gp)                            |         t8 = sym.imp.fprintf
    0x00403c5c move t9, t8                                   |         t9 = t8;
    0x00403c60 jalr t9                                       |         t9 ();
    0x00403c64 nop                                           |         
    0x00403c68 lw gp, 0x18(fp)                               |         gp = *(arg_18h);
    0x00403c6c addiu t8, zero, -1                            |         t8 = -1;
    0x00403c70 b 0x403c7c                                    |         goto label_0;
    0x00403c74 nop                                           |         
                                                             |     }
    0x00403c78 move t8, zero                                 |     t8 = 0;
                                                             | label_0:
    0x00403c7c move v0, t8                                   |     v0 = t8;
    0x00403c80 lw t8, -0x7ec8(gp)                            |     t8 = *((gp - 8114));
    0x00403c84 lw v1, 0x6c(fp)                               |     v1 = *(arg_6ch);
    0x00403c88 lw t8, (t8)                                   |     t8 = *(t8);
                                                             |     if (v1 != t8) {
    0x00403c8c beq v1, t8, 0x403ca4                          |         
    0x00403c90 nop                                           |         
    0x00403c94 lw t8, -0x7f0c(gp)                            |         t8 = sym.imp.__stack_chk_fail;
    0x00403c98 move t9, t8                                   |         t9 = t8;
    0x00403c9c jalr t9                                       |         t9 ();
    0x00403ca0 nop                                           |         
                                                             |     }
    0x00403ca4 move sp, fp                                   |     
    0x00403ca8 lw ra, 0x7c(sp)                               |     ra = *(var_7ch);
    0x00403cac lw fp, 0x78(sp)                               |     fp = *(var_78h);
    0x00403cb0 lw s1, 0x74(sp)                               |     s1 = *(var_74h);
    0x00403cb4 lw s0, 0x70(sp)                               |     s0 = *(var_70h);
    0x00403cb8 addiu sp, sp, 0x80                            |     
    0x00403cbc jr ra                                         |     return v1;
    0x00403cc0 nop                                           |     
                                                             | }
    ; assembly                                           | /* r2dec pseudo code output */
                                                         | /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/ble_advertise @ 0x402d3c */
                                                         | #include <stdint.h>
                                                         |  
    ; (fcn) sym.cmd_send_scan_response_int__int_ ()      | void cmd_send_scan_response_int_int_ () {
                                                         |     /* cmd_send_scan_response(int, int) */
    0x00402d3c lui gp, 2                                 |     
    0x00402d40 addiu gp, gp, -0x4d1c                     |     
    0x00402d44 addu gp, gp, t9                           |     gp += t9;
    0x00402d48 addiu sp, sp, -0x80                       |     
    0x00402d4c sw ra, 0x7c(sp)                           |     *(var_7ch) = ra;
    0x00402d50 sw fp, 0x78(sp)                           |     *(var_78h) = fp;
    0x00402d54 sw s1, 0x74(sp)                           |     *(var_74h) = s1;
    0x00402d58 sw s0, 0x70(sp)                           |     *(var_70h) = s0;
    0x00402d5c move fp, sp                               |     fp = sp;
    0x00402d60 sw gp, 0x18(sp)                           |     *(var_18h) = gp;
    0x00402d64 sw a0, 0x24(fp)                           |     *(arg_24h) = a0;
    0x00402d68 sw a1, 0x20(fp)                           |     *(arg_20h) = a1;
    0x00402d6c lw t8, -0x7ec8(gp)                        |     t8 = *((gp - 8114));
    0x00402d70 lw t8, (t8)                               |     t8 = *(t8);
    0x00402d74 sw t8, 0x6c(fp)                           |     *(arg_6ch) = t8;
    0x00402d78 lw t8, 0x20(fp)                           |     t8 = *(arg_20h);
                                                         |     if (t8 < 0) {
    0x00402d7c bgez t8, 0x402da4                         |         
    0x00402d80 nop                                       |         
    0x00402d84 move a0, zero                             |         a0 = 0;
    0x00402d88 lw t8, -0x7ef8(gp)                        |         t8 = sym.imp.hci_get_route;
    0x00402d8c move t9, t8                               |         t9 = t8;
    0x00402d90 jalr t9                                   |         t9 ();
    0x00402d94 nop                                       |         
    0x00402d98 lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x00402d9c move t8, v0                               |         t8 = v0;
    0x00402da0 sw t8, 0x20(fp)                           |         *(arg_20h) = t8;
                                                         |     }
    0x00402da4 lw a0, 0x20(fp)                           |     a0 = *(arg_20h);
    0x00402da8 lw t8, -0x7f80(gp)                        |     t8 = sym.imp.hci_open_dev;
    0x00402dac move t9, t8                               |     t9 = t8;
    0x00402db0 jalr t9                                   |     t9 ();
    0x00402db4 nop                                       |     
    0x00402db8 lw gp, 0x18(fp)                           |     gp = *(arg_18h);
    0x00402dbc move t8, v0                               |     t8 = v0;
    0x00402dc0 sw t8, 0x2c(fp)                           |     *(arg_2ch) = t8;
    0x00402dc4 lw t8, 0x2c(fp)                           |     t8 = *(arg_2ch);
                                                         |     if (t8 < 0) {
    0x00402dc8 bgez t8, 0x402df8                         |         
    0x00402dcc nop                                       |         
    0x00402dd0 lw t8, -0x7fdc(gp)                        |         t8 = *(gp);
                                                         |         /* str.Could_not_open_device */
    0x00402dd4 addiu a0, t8, 0x4d94                      |         a0 = t8 + 0x4d94;
    0x00402dd8 lw t8, -0x7f38(gp)                        |         t8 = sym.imp.perror;
    0x00402ddc move t9, t8                               |         t9 = t8;
    0x00402de0 jalr t9                                   |         t9 ();
    0x00402de4 nop                                       |         
    0x00402de8 lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x00402dec addiu t8, zero, -1                        |         t8 = -1;
    0x00402df0 b 0x40301c                                |         goto label_0;
    0x00402df4 nop                                       |         
                                                         |     }
    0x00402df8 addiu t8, fp, 0x4c                        |     t8 = fp + 0x4c;
    0x00402dfc move a0, t8                               |     a0 = t8;
    0x00402e00 move a1, zero                             |     a1 = 0;
    0x00402e04 addiu a2, zero, 0x20                      |     a2 = 0x20;
    0x00402e08 lw t8, -0x7f34(gp)                        |     t8 = sym.imp.memset;
    0x00402e0c move t9, t8                               |     t9 = t8;
    0x00402e10 jalr t9                                   |     t9 ();
    0x00402e14 nop                                       |     
    0x00402e18 lw gp, 0x18(fp)                           |     gp = *(arg_18h);
    0x00402e1c addiu v0, fp, 0x4c                        |     v0 = fp + 0x4c;
    0x00402e20 addiu t8, fp, 0x4c                        |     t8 = fp + 0x4c;
    0x00402e24 addiu t8, t8, 1                           |     t8++;
    0x00402e28 move a0, v0                               |     a0 = v0;
    0x00402e2c move a1, t8                               |     a1 = t8;
    0x00402e30 lw t8, -0x7fc8(gp)                        |     t8 = sym.generate_scan_response_data_unsigned_char__unsigned_char_;
    0x00402e34 move t9, t8                               |     t9 = t8;
    0x00402e38 jalr t9                                   |     t9 ();
    0x00402e3c nop                                       |     
    0x00402e40 lw gp, 0x18(fp)                           |     gp = *(arg_18h);
    0x00402e44 move t8, v0                               |     t8 = v0;
    0x00402e48 sw t8, 0x30(fp)                           |     *(arg_30h) = t8;
    0x00402e4c lw t8, 0x30(fp)                           |     t8 = *(arg_30h);
                                                         |     if (t8 < 0) {
    0x00402e50 bgez t8, 0x402e94                         |         
    0x00402e54 nop                                       |         
    0x00402e58 lw t8, -0x7f10(gp)                        |         t8 = *((gp - 8132));
    0x00402e5c lw t8, (t8)                               |         t8 = *(t8);
    0x00402e60 lw v0, -0x7fdc(gp)                        |         v0 = *(gp);
                                                         |         /* str.Cant_generate_scan_response_data._n */
    0x00402e64 addiu a0, v0, 0x4ec4                      |         a0 = v0 + 0x4ec4;
    0x00402e68 addiu a1, zero, 1                         |         a1 = 1;
    0x00402e6c addiu a2, zero, 0x23                      |         a2 = 0x23;
    0x00402e70 move a3, t8                               |         a3 = t8;
    0x00402e74 lw t8, -0x7ecc(gp)                        |         t8 = sym.imp.fwrite;
    0x00402e78 move t9, t8                               |         t9 = t8;
    0x00402e7c jalr t9                                   |         t9 ();
    0x00402e80 nop                                       |         
    0x00402e84 lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x00402e88 addiu t8, zero, -1                        |         t8 = -1;
    0x00402e8c b 0x40301c                                |         goto label_0;
    0x00402e90 nop                                       |         
                                                         |     }
    0x00402e94 addiu t8, fp, 0x34                        |     t8 = fp + 0x34;
    0x00402e98 move a0, t8                               |     a0 = t8;
    0x00402e9c move a1, zero                             |     a1 = 0;
    0x00402ea0 addiu a2, zero, 0x18                      |     a2 = 0x18;
    0x00402ea4 lw t8, -0x7f34(gp)                        |     t8 = sym.imp.memset;
    0x00402ea8 move t9, t8                               |     t9 = t8;
    0x00402eac jalr t9                                   |     t9 ();
    0x00402eb0 nop                                       |     
    0x00402eb4 lw gp, 0x18(fp)                           |     gp = *(arg_18h);
    0x00402eb8 addiu t8, zero, 8                         |     t8 = 8;
    0x00402ebc sh t8, 0x34(fp)                           |     *(arg_34h) = t8;
    0x00402ec0 addiu t8, zero, 9                         |     t8 = 9;
    0x00402ec4 sh t8, 0x36(fp)                           |     *(arg_36h) = t8;
    0x00402ec8 addiu t8, fp, 0x4c                        |     t8 = fp + 0x4c;
    0x00402ecc sw t8, 0x3c(fp)                           |     *(arg_3ch) = t8;
    0x00402ed0 addiu t8, zero, 0x20                      |     t8 = 0x20;
    0x00402ed4 sw t8, 0x40(fp)                           |     *(arg_40h) = t8;
    0x00402ed8 addiu t8, fp, 0x2b                        |     t8 = fp + 0x2b;
    0x00402edc sw t8, 0x44(fp)                           |     *(arg_44h) = t8;
    0x00402ee0 addiu t8, zero, 1                         |     t8 = 1;
    0x00402ee4 sw t8, 0x48(fp)                           |     *(arg_48h) = t8;
    0x00402ee8 addiu t8, fp, 0x34                        |     t8 = fp + 0x34;
    0x00402eec lw a0, 0x2c(fp)                           |     a0 = *(arg_2ch);
    0x00402ef0 move a1, t8                               |     a1 = t8;
    0x00402ef4 addiu a2, zero, 0x3e8                     |     a2 = 0x3e8;
    0x00402ef8 lw t8, -0x7f84(gp)                        |     t8 = sym.imp.hci_send_req;
    0x00402efc move t9, t8                               |     t9 = t8;
    0x00402f00 jalr t9                                   |     t9 ();
    0x00402f04 nop                                       |     
    0x00402f08 lw gp, 0x18(fp)                           |     gp = *(arg_18h);
    0x00402f0c move t8, v0                               |     t8 = v0;
    0x00402f10 sw t8, 0x30(fp)                           |     *(arg_30h) = t8;
    0x00402f14 lw a0, 0x2c(fp)                           |     a0 = *(arg_2ch);
    0x00402f18 lw t8, -0x7ec0(gp)                        |     t8 = sym.imp.hci_close_dev;
    0x00402f1c move t9, t8                               |     t9 = t8;
    0x00402f20 jalr t9                                   |     t9 ();
    0x00402f24 nop                                       |     
    0x00402f28 lw gp, 0x18(fp)                           |     gp = *(arg_18h);
    0x00402f2c lw t8, 0x30(fp)                           |     t8 = *(arg_30h);
                                                         |     if (t8 < 0) {
    0x00402f30 bgez t8, 0x402fcc                         |         
    0x00402f34 nop                                       |         
    0x00402f38 lw t8, -0x7f10(gp)                        |         t8 = *((gp - 8132));
    0x00402f3c lw s1, (t8)                               |         s1 = *(t8);
    0x00402f40 lw t8, -0x7ec4(gp)                        |         t8 = sym.imp.__errno_location;
    0x00402f44 move t9, t8                               |         t9 = t8;
    0x00402f48 jalr t9                                   |         t9 ();
    0x00402f4c nop                                       |         
    0x00402f50 lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x00402f54 move t8, v0                               |         t8 = v0;
    0x00402f58 lw t8, (t8)                               |         t8 = *(t8);
    0x00402f5c move a0, t8                               |         a0 = t8;
    0x00402f60 lw t8, -0x7f6c(gp)                        |         t8 = sym.imp.strerror;
    0x00402f64 move t9, t8                               |         t9 = t8;
    0x00402f68 jalr t9                                   |         t9 ();
    0x00402f6c nop                                       |         
    0x00402f70 lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x00402f74 move s0, v0                               |         s0 = v0;
    0x00402f78 lw t8, -0x7ec4(gp)                        |         t8 = sym.imp.__errno_location;
    0x00402f7c move t9, t8                               |         t9 = t8;
    0x00402f80 jalr t9                                   |         t9 ();
    0x00402f84 nop                                       |         
    0x00402f88 lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x00402f8c move t8, v0                               |         t8 = v0;
    0x00402f90 lw t8, (t8)                               |         t8 = *(t8);
    0x00402f94 sw t8, 0x10(sp)                           |         *(var_10h) = t8;
    0x00402f98 move a0, s1                               |         a0 = s1;
    0x00402f9c lw t8, -0x7fdc(gp)                        |         t8 = *(gp);
                                                         |         /* str.Cant_send_scan_response_data_on_hci_d:__s___d__n */
    0x00402fa0 addiu a1, t8, 0x4ee8                      |         a1 = t8 + 0x4ee8;
    0x00402fa4 lw a2, 0x20(fp)                           |         a2 = *(arg_20h);
    0x00402fa8 move a3, s0                               |         a3 = s0;
    0x00402fac lw t8, -0x7f40(gp)                        |         t8 = sym.imp.fprintf
    0x00402fb0 move t9, t8                               |         t9 = t8;
    0x00402fb4 jalr t9                                   |         t9 ();
    0x00402fb8 nop                                       |         
    0x00402fbc lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x00402fc0 addiu t8, zero, -1                        |         t8 = -1;
    0x00402fc4 b 0x40301c                                |         goto label_0;
    0x00402fc8 nop                                       |         
                                                         |     }
    0x00402fcc lbu t8, 0x2b(fp)                          |     t8 = *(arg_2bh);
                                                         |     if (t8 != 0) {
    0x00402fd0 beqz t8, 0x403018                         |         
    0x00402fd4 nop                                       |         
    0x00402fd8 lw t8, -0x7f10(gp)                        |         t8 = *((gp - 8132));
    0x00402fdc lw v0, (t8)                               |         v0 = *(t8);
    0x00402fe0 lbu t8, 0x2b(fp)                          |         t8 = *(arg_2bh);
    0x00402fe4 move a0, v0                               |         a0 = v0;
    0x00402fe8 lw v0, -0x7fdc(gp)                        |         v0 = *(gp);
                                                         |         /* str.LE_set_advertise_enable_on_hci_d_returned_status__d_n */
    0x00402fec addiu a1, v0, 0x4dd8                      |         a1 = v0 + 0x4dd8;
    0x00402ff0 lw a2, 0x20(fp)                           |         a2 = *(arg_20h);
    0x00402ff4 move a3, t8                               |         a3 = t8;
    0x00402ff8 lw t8, -0x7f40(gp)                        |         t8 = sym.imp.fprintf
    0x00402ffc move t9, t8                               |         t9 = t8;
    0x00403000 jalr t9                                   |         t9 ();
    0x00403004 nop                                       |         
    0x00403008 lw gp, 0x18(fp)                           |         gp = *(arg_18h);
    0x0040300c addiu t8, zero, -1                        |         t8 = -1;
    0x00403010 b 0x40301c                                |         goto label_0;
    0x00403014 nop                                       |         
                                                         |     }
    0x00403018 move t8, zero                             |     t8 = 0;
                                                         | label_0:
    0x0040301c move v0, t8                               |     v0 = t8;
    0x00403020 lw t8, -0x7ec8(gp)                        |     t8 = *((gp - 8114));
    0x00403024 lw v1, 0x6c(fp)                           |     v1 = *(arg_6ch);
    0x00403028 lw t8, (t8)                               |     t8 = *(t8);
                                                         |     if (v1 != t8) {
    0x0040302c beq v1, t8, 0x403044                      |         
    0x00403030 nop                                       |         
    0x00403034 lw t8, -0x7f0c(gp)                        |         t8 = sym.imp.__stack_chk_fail;
    0x00403038 move t9, t8                               |         t9 = t8;
    0x0040303c jalr t9                                   |         t9 ();
    0x00403040 nop                                       |         
                                                         |     }
    0x00403044 move sp, fp                               |     
    0x00403048 lw ra, 0x7c(sp)                           |     ra = *(var_7ch);
    0x0040304c lw fp, 0x78(sp)                           |     fp = *(var_78h);
    0x00403050 lw s1, 0x74(sp)                           |     s1 = *(var_74h);
    0x00403054 lw s0, 0x70(sp)                           |     s0 = *(var_70h);
    0x00403058 addiu sp, sp, 0x80                        |     
    0x0040305c jr ra                                     |     return v1;
    0x00403060 nop                                       |     
                                                         | }
    ; assembly                               | /* r2dec pseudo code output */
                                             | /* /logs/firmware/patool_extraction/DUMP/mtdblock8_unblob_extracted/mtdblock8_extract/0-9650176.squashfs_v4_le_extract/sbin/ble_advertise @ 0x4016a0 */
                                             | #include <stdint.h>
                                             |  
    ; (fcn) sym.cmd_up_int__int_ ()          | void cmd_up_int_int_ () {
                                             |     /* cmd_up(int, int) */
    0x004016a0 lui gp, 2                     |     
    0x004016a4 addiu gp, gp, -0x3680         |     
    0x004016a8 addu gp, gp, t9               |     gp += t9;
    0x004016ac addiu sp, sp, -0x40           |     
    0x004016b0 sw ra, 0x3c(sp)               |     *(var_3ch) = ra;
    0x004016b4 sw fp, 0x38(sp)               |     *(var_38h) = fp;
    0x004016b8 sw s1, 0x34(sp)               |     *(var_34h) = s1;
    0x004016bc sw s0, 0x30(sp)               |     *(var_30h) = s0;
    0x004016c0 move fp, sp                   |     fp = sp;
    0x004016c4 sw gp, 0x18(sp)               |     *(var_18h) = gp;
    0x004016c8 sw a0, 0x24(fp)               |     *(arg_24h) = a0;
    0x004016cc sw a1, 0x20(fp)               |     *(arg_20h) = a1;
    0x004016d0 lw t8, -0x7ec8(gp)            |     t8 = *((gp - 8114));
    0x004016d4 lw t8, (t8)                   |     t8 = *(t8);
    0x004016d8 sw t8, 0x2c(fp)               |     *(arg_2ch) = t8;
    0x004016dc lui v0, 4                     |     v0 = 0x40000;
    0x004016e0 lui t8, 0x8000                |     t8 = 0x800048c9;
    0x004016e4 ori t8, t8, 0x48c9            |     
    0x004016e8 or t8, v0, t8                 |     t8 = v0 | t8;
    0x004016ec lw a0, 0x24(fp)               |     a0 = *(arg_24h);
    0x004016f0 move a1, t8                   |     a1 = t8;
    0x004016f4 lw a2, 0x20(fp)               |     a2 = *(arg_20h);
    0x004016f8 lw t8, -0x7ee4(gp)            |     t8 = sym.imp.ioctl;
    0x004016fc move t9, t8                   |     t9 = t8;
    0x00401700 jalr t9                       |     t9 ();
    0x00401704 nop                           |     
    0x00401708 lw gp, 0x18(fp)               |     gp = *(arg_18h);
    0x0040170c move t8, v0                   |     t8 = v0;
    0x00401710 srl t8, t8, 0x1f              |     t8 >>= 0x1f;
    0x00401714 andi t8, t8, 0xff             |     t8 &= 0xff;
                                             |     if (t8 != 0) {
    0x00401718 beqz t8, 0x4017e8             |         
    0x0040171c nop                           |         
    0x00401720 lw t8, -0x7ec4(gp)            |         t8 = sym.imp.__errno_location;
    0x00401724 move t9, t8                   |         t9 = t8;
    0x00401728 jalr t9                       |         t9 ();
    0x0040172c nop                           |         
    0x00401730 lw gp, 0x18(fp)               |         gp = *(arg_18h);
    0x00401734 move t8, v0                   |         t8 = v0;
    0x00401738 lw v0, (t8)                   |         v0 = *(t8);
    0x0040173c addiu t8, zero, 0x95          |         t8 = 0x95;
                                             |         if (v0 == t8) {
    0x00401740 bne v0, t8, 0x401754          |             
    0x00401744 nop                           |             
    0x00401748 move t8, zero                 |             t8 = 0;
    0x0040174c b 0x4017ec                    |             goto label_0;
    0x00401750 nop                           |             
                                             |         }
    0x00401754 lw t8, -0x7f10(gp)            |         t8 = *((gp - 8132));
    0x00401758 lw s1, (t8)                   |         s1 = *(t8);
    0x0040175c lw t8, -0x7ec4(gp)            |         t8 = sym.imp.__errno_location;
    0x00401760 move t9, t8                   |         t9 = t8;
    0x00401764 jalr t9                       |         t9 ();
    0x00401768 nop                           |         
    0x0040176c lw gp, 0x18(fp)               |         gp = *(arg_18h);
    0x00401770 move t8, v0                   |         t8 = v0;
    0x00401774 lw t8, (t8)                   |         t8 = *(t8);
    0x00401778 move a0, t8                   |         a0 = t8;
    0x0040177c lw t8, -0x7f6c(gp)            |         t8 = sym.imp.strerror;
    0x00401780 move t9, t8                   |         t9 = t8;
    0x00401784 jalr t9                       |         t9 ();
    0x00401788 nop                           |         
    0x0040178c lw gp, 0x18(fp)               |         gp = *(arg_18h);
    0x00401790 move s0, v0                   |         s0 = v0;
    0x00401794 lw t8, -0x7ec4(gp)            |         t8 = sym.imp.__errno_location;
    0x00401798 move t9, t8                   |         t9 = t8;
    0x0040179c jalr t9                       |         t9 ();
    0x004017a0 nop                           |         
    0x004017a4 lw gp, 0x18(fp)               |         gp = *(arg_18h);
    0x004017a8 move t8, v0                   |         t8 = v0;
    0x004017ac lw t8, (t8)                   |         t8 = *(t8);
    0x004017b0 sw t8, 0x10(sp)               |         *(var_10h) = t8;
    0x004017b4 move a0, s1                   |         a0 = s1;
    0x004017b8 lw t8, -0x7fdc(gp)            |         t8 = *(gp);
                                             |         /* str.Cant_init_device_hci_d:__s___d__n */
    0x004017bc addiu a1, t8, 0x4d70          |         a1 = t8 + 0x4d70;
    0x004017c0 lw a2, 0x20(fp)               |         a2 = *(arg_20h);
    0x004017c4 move a3, s0                   |         a3 = s0;
    0x004017c8 lw t8, -0x7f40(gp)            |         t8 = sym.imp.fprintf
    0x004017cc move t9, t8                   |         t9 = t8;
    0x004017d0 jalr t9                       |         t9 ();
    0x004017d4 nop                           |         
    0x004017d8 lw gp, 0x18(fp)               |         gp = *(arg_18h);
    0x004017dc addiu t8, zero, -1            |         t8 = -1;
    0x004017e0 b 0x4017ec                    |         goto label_0;
    0x004017e4 nop                           |         
                                             |     }
    0x004017e8 move t8, zero                 |     t8 = 0;
                                             | label_0:
    0x004017ec move v0, t8                   |     v0 = t8;
    0x004017f0 lw t8, -0x7ec8(gp)            |     t8 = *((gp - 8114));
    0x004017f4 lw v1, 0x2c(fp)               |     v1 = *(arg_2ch);
    0x004017f8 lw t8, (t8)                   |     t8 = *(t8);
                                             |     if (v1 != t8) {
    0x004017fc beq v1, t8, 0x401814          |         
    0x00401800 nop                           |         
    0x00401804 lw t8, -0x7f0c(gp)            |         t8 = sym.imp.__stack_chk_fail;
    0x00401808 move t9, t8                   |         t9 = t8;
    0x0040180c jalr t9                       |         t9 ();
    0x00401810 nop                           |         
                                             |     }
    0x00401814 move sp, fp                   |     
    0x00401818 lw ra, 0x3c(sp)               |     ra = *(var_3ch);
    0x0040181c lw fp, 0x38(sp)               |     fp = *(var_38h);
    0x00401820 lw s1, 0x34(sp)               |     s1 = *(var_34h);
    0x00401824 lw s0, 0x30(sp)               |     s0 = *(var_30h);
    0x00401828 addiu sp, sp, 0x40            |     
    0x0040182c jr ra                         |     return v1;
    0x00401830 nop                           |     
                                             | }

[*] Function fprintf used 9 times ble_advertise