[*] Binary protection state of pcregrep
Partial RELRO No Canary found NX disabled No PIE No RPATH No RUNPATH No Symbols
[*] Function printf tear down of pcregrep
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/56048-12514271.gzip_extract/gzip.uncompressed_extract/5243916-15068666.gzip_extract/gzip.uncompressed_extract/usr/bin/pcregrep @ 0x13ea4 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00013ea4 () | void fcn_00013ea4 (uint32_t arg1, int32_t arg2) {
| char * dest;
| int32_t var_ch;
| r0 = arg1;
| r1 = arg2;
0x00013ea4 cmp r0, 0x63 |
0x00013ea8 push {r0, r1, r2, r4, r5, r6, r7, r8, sb, lr} |
0x00013eac mov r4, r1 | r4 = r1;
| if (r0 == 0x63) {
0x00013eb0 beq 0x1419c | goto label_8;
| }
0x00013eb4 mov r2, r0 | r2 = r0;
| if (r0 > 0x63) {
0x00013eb8 bgt 0x14010 | goto label_9;
| }
0x00013ebc cmp r0, 0x46 |
| if (r0 == 0x46) {
0x00013ec0 beq 0x141ac | goto label_10;
| }
| if (r0 > 0x46) {
0x00013ec4 bgt 0x13fb4 | goto label_11;
| }
0x00013ec8 cmn r0, 0xb |
| if (r0 == 0xb) {
0x00013ecc beq 0x140cc | goto label_12;
| }
| if (r0 > 0xb) {
0x00013ed0 bgt 0x13f08 | goto label_13;
| }
0x00013ed4 cmn r0, 0x10 |
0x00013ed8 ldr r3, [pc, 0x390] | r3 = *(0x1426c);
| if (r0 == 0x10) {
0x00013edc beq 0x14184 | goto label_14;
| }
0x00013ee0 cmn r0, 0xc |
| if (r0 != 0xc) {
0x00013ee4 moveq r2, 1 | r2 = 1;
| }
| if (r0 != 0xc) {
0x00013ee8 streq r2, [r3, 0x40] | *((r3 + 0x40)) = r2;
| }
| if (r0 == 0xc) {
0x00013eec beq 0x1403c | goto label_1;
| }
| do {
| label_0:
0x00013ef0 ldr r3, [pc, 0x37c] | r3 = *(0x14270);
0x00013ef4 ldr r1, [pc, 0x37c] | r1 = stderr;
0x00013ef8 ldr r0, [r3] | r0 = *(0x14270);
0x00013efc bl 0x10d34 | r0 = fprintf (r0, r1, r2, r3)
0x00013f00 bl 0x13d18 | fcn_00013d18 ();
0x00013f04 b 0x13fb0 | goto label_15;
| label_13:
0x00013f08 cmn r0, 0xa |
| if (r0 == 0xa) {
0x00013f0c beq 0x14170 | goto label_16;
| }
0x00013f10 cmn r0, 4 |
0x00013f14 bne 0x13ef0 |
| } while (r0 != 4);
0x00013f18 ldr r0, [pc, 0x35c] | r0 = "pcregrep: Unknown option -%c\n";
0x00013f1c bl 0x10cd4 | puts ("pcregrep: Unknown option -%c\n");
0x00013f20 ldr r0, [pc, 0x358] | r0 = "Usage:_pcregrep__OPTION_...__PATTERN___FILE1_FILE2_..._";
0x00013f24 bl 0x10cd4 | puts ("Usage:_pcregrep__OPTION_...__PATTERN___FILE1_FILE2_..._");
0x00013f28 ldr r0, [pc, 0x354] | r0 = "Search_for_PATTERN_in_each_FILE_or_standard_input.";
0x00013f2c bl 0x10cd4 | puts ("Search_for_PATTERN_in_each_FILE_or_standard_input.");
0x00013f30 ldr r0, [pc, 0x350] | r0 = "PATTERN must be present if neither -e nor -f is used.";
0x00013f34 bl 0x10cd4 | puts ("PATTERN must be present if neither -e nor -f is used.");
0x00013f38 ldr r0, [pc, 0x34c] | r0 = "\"-\" can be used as a file name to mean STDIN.";
0x00013f3c bl 0x10cd4 | puts ("\"-\" can be used as a file name to mean STDIN.");
0x00013f40 ldr r0, [pc, 0x348] | r0 = "All files are read as plain files, without any interpretation.\n";
0x00013f44 bl 0x10cd4 | puts ("All files are read as plain files, without any interpretation.\n");
0x00013f48 ldr r0, [pc, 0x344] | r0 = "Example: pcregrep -i 'hello.*world' menu.h main.c\n";
0x00013f4c bl 0x10cd4 | puts ("Example: pcregrep -i 'hello.*world' menu.h main.c\n");
0x00013f50 ldr r4, [pc, 0x340] | r4 = "Options:";
0x00013f54 ldr r7, [pc, 0x340] | r7 = *(0x14298);
0x00013f58 ldr r8, [pc, 0x340] | r8 = "___________________________";
0x00013f5c ldr sb, [pc, 0x340] | sb = "_s____s";
| label_2:
0x00013f60 ldr r5, [r4, 4] | r5 = *((r4 + 4));
0x00013f64 cmp r5, 0 |
| if (r5 != 0) {
0x00013f68 bne 0x140dc | goto label_17;
| }
0x00013f6c ldr r0, [pc, 0x334] | r0 = "_s____s";
0x00013f70 bl 0x10cd4 | puts ("_s____s");
0x00013f74 mov r1, 0x5000 | r1 = 0x5000;
0x00013f78 ldr r0, [pc, 0x32c] | r0 = "Numbers_may_be_followed_by_K_or_M__e.g.___buffer_size100K.";
0x00013f7c bl 0x10c80 | printf ("Numbers_may_be_followed_by_K_or_M__e.g.___buffer_size100K.", r1)
0x00013f80 ldr r0, [pc, 0x328] | r0 = "The default value for --buffer-size is %d.\n";
0x00013f84 bl 0x10cd4 | puts ("The default value for --buffer-size is %d.\n");
0x00013f88 ldr r0, [pc, 0x324] | r0 = "When reading patterns or file names from a file, trailing white";
0x00013f8c bl 0x10cd4 | puts ("When reading patterns or file names from a file, trailing white");
0x00013f90 mov r1, 0x2000 | r1 = 0x2000;
0x00013f94 ldr r0, [pc, 0x31c] | r0 = "space is removed and blank lines are ignored.";
0x00013f98 bl 0x10c80 | printf ("space is removed and blank lines are ignored.", r1)
0x00013f9c ldr r0, [pc, 0x318] | r0 = "The maximum size of any pattern is %d bytes.\n";
0x00013fa0 bl 0x10cd4 | puts ("The maximum size of any pattern is %d bytes.\n");
0x00013fa4 ldr r0, [pc, 0x314] | r0 = "\nWith no FILEs, read standard input. If fewer than two FILEs given, assume -h.";
0x00013fa8 bl 0x10cd4 | puts ("\nWith no FILEs, read standard input. If fewer than two FILEs given, assume -h.");
| label_7:
0x00013fac mov r0, 0 | r0 = 0;
| label_15:
0x00013fb0 bl 0x127c8 | r0 = fcn_000127c8 (r0);
| label_11:
0x00013fb4 cmp r0, 0x4c |
| if (r0 == 0x4c) {
0x00013fb8 beq 0x141f4 | goto label_18;
| }
| if (r0 > 0x4c) {
0x00013fbc bgt 0x13fe0 | goto label_19;
| }
0x00013fc0 cmp r0, 0x48 |
| if (r0 == 0x48) {
0x00013fc4 beq 0x141c0 | goto label_20;
| }
0x00013fc8 cmp r0, 0x49 |
| if (r0 != 0x49) {
0x00013fcc ldreq r3, [pc, 0x29c] | r3 = *(0x00014270);
| }
| if (r0 == 0x49) {
0x00013fd0 moveq r2, 1 | r2 = 1;
| goto label_21;
| }
| if (r0 != 0x49) {
| label_21:
0x00013fd4 bne 0x13ef0 | goto label_0;
| }
| label_4:
0x00013fd8 str r2, [r3, 0x44] | *((r3 + 0x44)) = r2;
0x00013fdc b 0x1403c | goto label_1;
| label_19:
0x00013fe0 cmp r0, 0x56 |
| if (r0 == 0x56) {
0x00013fe4 beq 0x14250 | goto label_22;
| }
0x00013fe8 cmp r0, 0x61 |
0x00013fec ldr r3, [pc, 0x27c] | r3 = *(0x1426c);
| if (r0 == 0x61) {
0x00013ff0 beq 0x14194 | goto label_23;
| }
0x00013ff4 cmp r0, 0x4d |
| if (r0 != 0x4d) {
0x00013ff8 bne 0x13ef0 | goto label_0;
| }
0x00013ffc mov r2, 1 | r2 = 1;
0x00014000 orr r4, r1, 0x40000 | r4 = r1 | 0x40000;
0x00014004 str r2, [r3, 0x48] | *((r3 + 0x48)) = r2;
0x00014008 orr r4, r4, 2 | r4 |= 2;
0x0001400c b 0x1403c | goto label_1;
| label_9:
0x00014010 cmp r0, 0x71 |
| if (r0 == 0x71) {
0x00014014 beq 0x1420c | goto label_24;
| }
| if (r0 > 0x71) {
0x00014018 bgt 0x1407c | goto label_25;
| }
0x0001401c cmp r0, 0x6c |
| if (r0 == 0x6c) {
0x00014020 beq 0x141dc | goto label_26;
| }
| if (r0 > 0x6c) {
0x00014024 bgt 0x14048 | goto label_27;
| }
0x00014028 cmp r0, 0x68 |
| if (r0 == 0x68) {
0x0001402c beq 0x141d0 | goto label_28;
| }
0x00014030 cmp r0, 0x69 |
| if (r0 == 0x69) {
0x00014034 orreq r4, r1, 1 | r4 = r1 | 1;
| goto label_29;
| }
| if (r0 != 0x69) {
| label_29:
0x00014038 bne 0x13ef0 | goto label_0;
| }
| label_1:
0x0001403c mov r0, r4 | r0 = r4;
0x00014040 add sp, sp, 0xc |
0x00014044 pop {r4, r5, r6, r7, r8, sb, pc} |
| label_27:
0x00014048 cmp r0, 0x6e |
0x0001404c ldr r5, [pc, 0x21c] | r5 = *(0x1426c);
| if (r0 == 0x6e) {
0x00014050 beq 0x14200 | goto label_30;
| }
0x00014054 cmp r0, 0x6f |
| if (r0 != 0x6f) {
0x00014058 bne 0x13ef0 | goto label_0;
| }
0x0001405c ldr r1, [r5, 0x94] | r1 = *((r5 + 0x94));
0x00014060 mov r0, 0 | r0 = 0;
0x00014064 bl 0x12a88 | fcn_00012a88 (r0, r1);
0x00014068 ldr r3, [r5, 0x60] | r3 = *((r5 + 0x60));
0x0001406c cmp r3, 0 |
0x00014070 str r0, [r5, 0x94] | *((r5 + 0x94)) = r0;
| if (r3 != 0) {
0x00014074 streq r0, [r5, 0x60] | *((r5 + 0x60)) = r0;
| }
0x00014078 b 0x1403c | goto label_1;
| label_25:
0x0001407c cmp r0, 0x75 |
0x00014080 ldr r3, [pc, 0x1e8] | r3 = *(0x1426c);
| if (r0 == 0x75) {
0x00014084 beq 0x14228 | goto label_31;
| }
| if (r0 > 0x75) {
0x00014088 bgt 0x140a8 | goto label_32;
| }
0x0001408c cmp r0, 0x72 |
| if (r0 == 0x72) {
0x00014090 beq 0x1421c | goto label_33;
| }
0x00014094 cmp r0, 0x73 |
| if (r0 != 0x73) {
0x00014098 moveq r2, 1 | r2 = 1;
| }
| if (r0 == 0x73) {
0x0001409c streq r2, [r3, 0x7c] | *((r3 + 0x7c)) = r2;
| goto label_34;
| }
| if (r0 == 0x73) {
| label_34:
0x000140a0 beq 0x1403c | goto label_1;
| }
0x000140a4 b 0x13ef0 | goto label_0;
| label_32:
0x000140a8 cmp r0, 0x77 |
| if (r0 == 0x77) {
0x000140ac beq 0x14244 | goto label_35;
| }
| if (r0 < 0x77) {
0x000140b0 blt 0x14238 | goto label_36;
| }
0x000140b4 cmp r0, 0x78 |
| if (r0 != 0x78) {
0x000140b8 ldreq r2, [r3, 0x90] | r2 = *((r3 + 0x90));
| }
| if (r0 == 0x78) {
0x000140bc orreq r2, r2, 2 | r2 |= 2;
| goto label_37;
| }
| if (r0 != 0x78) {
| label_37:
0x000140c0 bne 0x13ef0 | goto label_0;
| }
| label_6:
0x000140c4 str r2, [r3, 0x90] | *((r3 + 0x90)) = r2;
0x000140c8 b 0x1403c | goto label_1;
| label_12:
0x000140cc ldr r3, [pc, 0x19c] | r3 = *(0x1426c);
0x000140d0 mov r2, 1 | r2 = 1;
0x000140d4 str r2, [r3, 0x5c] | *((r3 + 0x5c)) = r2;
0x000140d8 b 0x1403c | goto label_1;
| label_17:
0x000140dc ldr r6, [r4, 0xc] | r6 = *((r4 + 0xc));
0x000140e0 mov r1, 0x5f | r1 = 0x5f;
0x000140e4 mov r0, r6 | r0 = r6;
0x000140e8 bl 0x10e54 | r0 = strchr (r0, r1);
0x000140ec cmp r0, 0 |
| if (r0 != 0) {
0x000140f0 bne 0x14134 | goto label_38;
| }
0x000140f4 cmp r5, 0 |
| if (r5 <= 0) {
0x000140f8 ble 0x14160 | goto label_39;
| }
0x000140fc ldrb r3, [r6] | r3 = *(r6);
0x00014100 cmp r3, 0 |
| if (r3 != 0) {
0x00014104 bne 0x1413c | goto label_40;
| }
0x00014108 mov r1, r5 | r1 = r5;
0x0001410c ldr r0, [pc, 0x1b0] | r0 = "Exit_status_is_0_if_any_matches__1_if_no_matches__and_2_if_trouble.";
0x00014110 bl 0x10c80 | r0 = printf ("Exit_status_is_0_if_any_matches__1_if_no_matches__and_2_if_trouble.", r1)
| do {
0x00014114 rsb r0, r0, 0x1f | r0 = 0x1f - r0;
0x00014118 cmp r0, 1 |
| if (r0 < 1) {
0x0001411c movge r1, r0 | r1 = r0;
| }
0x00014120 ldr r3, [r4, 0x10] | r3 = *((r4 + 0x10));
0x00014124 mov r2, r7 | r2 = r7;
| if (r0 >= 1) {
0x00014128 movlt r1, 1 | r1 = 1;
| }
0x0001412c mov r0, r8 | r0 = r8;
0x00014130 bl 0x10c80 | printf (r0, r1, r2, r3)
| label_38:
0x00014134 add r4, r4, 0x14 | r4 += 0x14;
0x00014138 b 0x13f60 | goto label_2;
| label_40:
0x0001413c mov r2, r5 | r2 = r5;
0x00014140 ldr r1, [pc, 0x180] | r1 = " -%c";
0x00014144 add r0, sp, 4 | r0 += dest;
0x00014148 bl 0x10dd0 | sprintf (r0, " -%c", r2)
| label_3:
0x0001414c ldr r2, [r4, 0xc] | r2 = *((r4 + 0xc));
0x00014150 add r1, sp, 4 | r1 += dest;
0x00014154 mov r0, sb | r0 = sb;
0x00014158 bl 0x10c80 | printf (r0, r1, r2)
0x0001415c b 0x14114 |
| } while (1);
| label_39:
0x00014160 ldr r1, [pc, 0x164] | r1 = "-%c,";
0x00014164 add r0, sp, 4 | r0 += dest;
0x00014168 bl 0x10c74 | strcpy (r0, "-%c,");
0x0001416c b 0x1414c | goto label_3;
| label_16:
0x00014170 ldr r3, [pc, 0xf8] | r3 = *(0x1426c);
0x00014174 mov r2, 1 | r2 = 1;
0x00014178 str r2, [r3, 0x1c] | *((r3 + 0x1c)) = r2;
0x0001417c str r2, [r3, 0x58] | *((r3 + 0x58)) = r2;
0x00014180 b 0x1403c | goto label_1;
| label_14:
0x00014184 ldr r2, [r3, 0x8c] | r2 = *((r3 + 0x8c));
0x00014188 bic r2, r2, 1 | r2 = BIT_MASK (r2, 1);
0x0001418c str r2, [r3, 0x8c] | *((r3 + 0x8c)) = r2;
0x00014190 b 0x1403c | goto label_1;
| label_23:
0x00014194 mov r2, 2 | r2 = 2;
0x00014198 b 0x13fd8 | goto label_4;
| label_8:
0x0001419c ldr r3, [pc, 0xcc] | r3 = *(0x1426c);
0x000141a0 mov r2, 1 | r2 = 1;
0x000141a4 str r2, [r3, 0x50] | *((r3 + 0x50)) = r2;
0x000141a8 b 0x1403c | goto label_1;
| label_10:
0x000141ac ldr r2, [pc, 0xbc] | r2 = *(0x1426c);
0x000141b0 ldr r3, [r2, 0x90] | r3 = *(0x142fc);
0x000141b4 orr r3, r3, 4 | r3 |= 4;
0x000141b8 str r3, [r2, 0x90] | *((r2 + 0x90)) = r3;
0x000141bc b 0x1403c | goto label_1;
| label_20:
0x000141c0 ldr r3, [pc, 0x108] | r3 = "___";
0x000141c4 mov r2, 4 | r2 = 4;
| do {
| label_5:
0x000141c8 str r2, [r3, 8] | *((r3 + 8)) = r2;
0x000141cc b 0x1403c | goto label_1;
| label_28:
0x000141d0 ldr r3, [pc, 0xf8] | r3 = "___";
0x000141d4 mov r2, 0 | r2 = 0;
0x000141d8 b 0x141c8 |
| } while (1);
| label_26:
0x000141dc ldr r3, [pc, 0x8c] | r3 = *(0x1426c);
0x000141e0 mov r2, 1 | r2 = 1;
0x000141e4 str r2, [r3, 0x6c] | *((r3 + 0x6c)) = r2;
0x000141e8 ldr r3, [pc, 0xe0] | r3 = "___";
0x000141ec mov r2, 2 | r2 = 2;
0x000141f0 b 0x141c8 | goto label_5;
| label_18:
0x000141f4 ldr r3, [pc, 0xd4] | r3 = "___";
0x000141f8 mov r2, 3 | r2 = 3;
0x000141fc b 0x141c8 | goto label_5;
| label_30:
0x00014200 mov r3, 1 | r3 = 1;
0x00014204 str r3, [r5, 0x1c] | *((r5 + 0x1c)) = r3;
0x00014208 b 0x1403c | goto label_1;
| label_24:
0x0001420c ldr r3, [pc, 0x5c] | r3 = *(0x1426c);
0x00014210 mov r2, 1 | r2 = 1;
0x00014214 str r2, [r3, 0x4c] | *((r3 + 0x4c)) = r2;
0x00014218 b 0x1403c | goto label_1;
| label_33:
0x0001421c mov r2, 2 | r2 = 2;
0x00014220 str r2, [r3, 0x70] | *((r3 + 0x70)) = r2;
0x00014224 b 0x1403c | goto label_1;
| label_31:
0x00014228 mov r2, 1 | r2 = 1;
0x0001422c orr r4, r1, 0x800 | r4 = r1 | 0x800;
0x00014230 str r2, [r3, 4] | *((r3 + 4)) = r2;
0x00014234 b 0x1403c | goto label_1;
| label_36:
0x00014238 mov r2, 1 | r2 = 1;
0x0001423c str r2, [r3, 0x14] | *((r3 + 0x14)) = r2;
0x00014240 b 0x1403c | goto label_1;
| label_35:
0x00014244 ldr r2, [r3, 0x90] | r2 = *((r3 + 0x90));
0x00014248 orr r2, r2, 1 | r2 |= 1;
0x0001424c b 0x140c4 | goto label_6;
| label_22:
0x00014250 ldr r3, [pc, 0x7c] | r3 = "_standard_input_";
0x00014254 ldr r4, [r3] | r4 = "_standard_input_";
0x00014258 bl 0x10d28 | pcre_version ();
0x0001425c ldr r1, [pc, 0x74] | r1 = stdout;
0x00014260 mov r2, r0 | r2 = r0;
0x00014264 mov r0, r4 | r0 = r4;
0x00014268 bl 0x10d34 | fprintf (r0, r1, r2)
0x0001426c b 0x13fac | goto label_7;
| }
[*] Function printf used 9 times pcregrep