我正试图逆向设计这个神秘功能.此函数返回一个整数,并将struct节点作为参数
#include "mystery.h"
int mystery(struct e4_struct *s){}
Run Code Online (Sandbox Code Playgroud)
头文件是一个简单的结构声明
struct my_struct {
int a;
int b;
};
Run Code Online (Sandbox Code Playgroud)
我试图逆向工程的组件是
400596: 8b 07 mov (%rdi),%eax
400598: 8d 04 40 lea (%rax,%rax,2),%eax
40059b: 89 07 mov %eax,(%rdi)
40059d: 83 47 04 07 addl $0x7,0x4(%rdi)
4005a1: c3 retq
Run Code Online (Sandbox Code Playgroud)
到目前为止,我认为功能如下:
int mystery(struct m_struct *s){
int i = s->a;
i = 3*i;
int j = s->b;
j += 7;
return i;
}
Run Code Online (Sandbox Code Playgroud)
但这不正确.我不明白究竟mov %eax,(%rdi)是什么以及函数最终返回的是什么因为它应该返回和整数.