|
发表于 2021-10-18 15:41:21
|
显示全部楼层
我没有看懂你的理解,我说一下我的理解吧
翻译成下面这样
- int *temp = start;
- start += 1;
- total += *temp;
复制代码
- #include <stdio.h>
- int main(void) {
- int array[] = {1, 2, 3};
- int *start = array;
- int total = 0;
- total += *start++;
- return 0;
- }
复制代码
- main:
- pushq %rbp
- .seh_pushreg %rbp
- movq %rsp, %rbp
- .seh_setframe %rbp, 0
- subq $64, %rsp
- .seh_stackalloc 64
- .seh_endprologue
- call __main
- # int array[] = {1, 2, 3};
- movl $1, -24(%rbp)
- movl $2, -20(%rbp)
- movl $3, -16(%rbp)
- # int *start = array;
- leaq -24(%rbp), %rax
- movq %rax, -8(%rbp)
- # int total = 0;
- movl $0, -12(%rbp)
- # total += *start++;
- movq -8(%rbp), %rax
- leaq 4(%rax), %rdx
- movq %rdx, -8(%rbp)
- movl (%rax), %eax
- addl %eax, -12(%rbp)
- # return 0;
- movl $0, %eax
- addq $64, %rsp
- popq %rbp
- ret
- .seh_endproc
复制代码
|
|