func:     &nbs...

发布于 2022-03-03 17:06:28

func:
        mov     ecx, eax
        lea     edx, [ecx+1]
loop:
        mov     al, [ecx]
        inc     ecx
        test    al, al
        jnz     loop
        sub     ecx, edx
        mov     eax, ecx
        ret


reverse:
        mov     ebp, eax eax为输入的参数1
        mov     edi, edx edx为输入的参数2
        mov     esi, ebx ebx为输入的参数3

        mov     eax, ebp
        call    func
        push    eax

        xor     ebx, ebx
        xor     ecx, ecx
        xor     ebp, ebp
        jmp     label4

label1:
        lea     eax, [ebp*4]
        add     eax, edi
        mov     eax, [eax]
        cmp     eax, ecx
        jbe     label2

        mov     ebx, ecx
        mov     ecx, eax
        jmp     label3

label2:
        cmp     eax, ebx
        jbe     label3

        mov     ebx, eax

label3:
        inc     ebp

label4:
        cmp     ebp, esi
        jb      label1
        pop     eax
        add     eax, ebx
        add     eax, ecx
        ret

以上为汇编码的两个函数func和reverse,分析这两个函数并编写等价的C代码函数
关注者
0
被浏览
36
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看