【android 逆向】arm if

#include <stdio.h>

void if1(int n){	//if else语句
	if(n < 10){
		printf("the number less than 10\n");
	} else {
		printf("the number greater than or equal to 10\n");
	}
}

void if2(int n){		//多重if else语句
	if(n < 16){
		printf("he is a boy\n");
	} else if(n < 30){
		printf("he is a young man\n");
	} else if(n < 45){
		printf("he is a strong man\n");
	} else{
		printf("he is an old man\n");
	}
}

int main(int argc, char* argv[]){
	if1(5);
	if2(35);
	return 0;
}

.text:00008570
.text:00008570 
.text:00008570
.text:00008570 if2                                     ; CODE XREF: main+10↓p
.text:00008570 ; __unwind {
.text:00008570                 CMP     R0, #0xF
.text:00008574                 BLE     loc_85A0        ; if arg0 <= 15 跳转
.text:00008578                 CMP     R0, #0x1D
.text:0000857C                 BLE     loc_85AC        ; if arg0 <= 16+13 =29
.text:00008580                 CMP     R0, #0x2C ; ','
.text:00008584                 BLE     loc_8594        ; if arg0 <= 44
.text:00008588                 LDR     R0, =(aHeIsAnOldMan - 0x8594) ; "he is an old man"
.text:0000858C                 ADD     R0, PC, R0      ; "he is an old man"
.text:00008590                 B       puts
.text:00008594 ; ---------------------------------------------------------------------------
.text:00008594
.text:00008594 loc_8594                                ; CODE XREF: if2+14↑j
.text:00008594                 LDR     R0, =(aHeIsAStrongMan - 0x85A0) ; "he is a strong man"
.text:00008598                 ADD     R0, PC, R0      ; "he is a strong man"
.text:0000859C                 B       puts
.text:000085A0 ; ---------------------------------------------------------------------------
.text:000085A0
.text:000085A0 loc_85A0                                ; CODE XREF: if2+4↑j
.text:000085A0                 LDR     R0, =(aHeIsABoy - 0x85AC) ; "he is a boy"
.text:000085A4                 ADD     R0, PC, R0      ; "he is a boy"
.text:000085A8                 B       puts
.text:000085AC ; ---------------------------------------------------------------------------
.text:000085AC
.text:000085AC loc_85AC                                ; CODE XREF: if2+C↑j
.text:000085AC                 LDR     R0, =(aHeIsAYoungMan - 0x85B8) ; "he is a young man"
.text:000085B0                 ADD     R0, PC, R0      ; "he is a young man"
.text:000085B4                 B       puts
.text:000085B4 ; End of function if2
.text:000085B4
.text:000085B4 ; ---------------------------------------------------------------------------
.text:000085B8 off_85B8        DCD aHeIsAnOldMan - 0x8594
.text:000085B8                                         ; DATA XREF: if2+18↑r
.text:000085B8                                         ; "he is an old man"
.text:000085BC off_85BC        DCD aHeIsAStrongMan - 0x85A0
.text:000085BC                                         ; DATA XREF: if2:loc_8594↑r
.text:000085BC                                         ; "he is a strong man"
.text:000085C0 off_85C0        DCD aHeIsABoy - 0x85AC  ; DATA XREF: if2:loc_85A0↑r
.text:000085C0                                         ; "he is a boy"
.text:000085C4 off_85C4        DCD aHeIsAYoungMan - 0x85B8
.text:000085C4                                         ; DATA XREF: if2:loc_85AC↑r
.text:000085C4 ; } // starts at 8570                   ; "he is a young man"
.text:000085C8
.text:000085C8 ; =============== S U B R O U T I N E =======================================
.text:000085C8
.text:000085C8
.text:000085C8 if1                                     ; CODE XREF: main+8↓p
.text:000085C8 ; __unwind {
.text:000085C8                 CMP     R0, #9
.text:000085CC                 BLE     loc_85DC        ; if arg0 <= 9 跳转
.text:000085D0                 LDR     R0, =(aTheNumberGreat - 0x85DC) ; "the number greater than or equal to 10"
.text:000085D4                 ADD     R0, PC, R0      ; "the number greater than or equal to 10"
.text:000085D8                 B       puts
.text:000085DC ; ---------------------------------------------------------------------------
.text:000085DC
.text:000085DC loc_85DC                                ; CODE XREF: if1+4↑j
.text:000085DC                 LDR     R0, =(aTheNumberLessT - 0x85E8) ; "the number less than 10"
.text:000085E0                 ADD     R0, PC, R0      ; "the number less than 10"
.text:000085E4                 B       puts
.text:000085E4 ; End of function if1
.text:000085E4
.text:000085E4 ; ---------------------------------------------------------------------------
.text:000085E8 off_85E8        DCD aTheNumberGreat - 0x85DC
.text:000085E8                                         ; DATA XREF: if1+8↑r
.text:000085E8                                         ; "the number greater than or equal to 10"
.text:000085EC off_85EC        DCD aTheNumberLessT - 0x85E8
.text:000085EC                                         ; DATA XREF: if1:loc_85DC↑r
.text:000085EC ; } // starts at 85C8                   ; "the number less than 10"
.text:000085F0
.text:000085F0 ; =============== S U B R O U T I N E =======================================
.text:000085F0
.text:000085F0
.text:000085F0 ; int __cdecl main(int argc, const char **argv, const char **envp)
.text:000085F0 main                                    ; CODE XREF: j_main↑j
.text:000085F0 ; __unwind {
.text:000085F0                 PUSH    {R4,LR}
.text:000085F4                 MOV     R0, #5
.text:000085F8                 BL      if1             ; if1
.text:000085FC                 MOV     R0, #0x23 ; '#' ; 35
.text:00008600                 BL      if2             ; if2
.text:00008604                 MOV     R0, #0
.text:00008608                 POP     {R4,PC}
.text:00008608 ; } // starts at 85F0
.text:00008608 ; End of function main
posted @ 2022-03-19 11:13  明月照江江  阅读(48)  评论(0编辑  收藏  举报