求将下面C语言翻译成汇编语言

#include <stdio.h>
int main()
{ int i=1,n=10,sum=0;

for(i=1;i<=n;i++)
{
sum=sum+i*i;

}
printf("sum=%d\n",sum);
return 0;
}

第1个回答  2012-09-14
.section__TEXT,__text,regular,pure_instructions
.globl_main
.align4, 0x90
_main:
Leh_func_begin1:
pushq%rbp
Ltmp0:
movq%rsp, %rbp
Ltmp1:
subq$32, %rsp
Ltmp2:
movl$1, -12(%rbp)
movl$10, -16(%rbp)
movl$0, -20(%rbp)
movl$1, -12(%rbp)
jmpLBB1_2
LBB1_1:
movl-12(%rbp), %eax
movl-12(%rbp), %ecx
imull%ecx, %eax
movl-20(%rbp), %ecx
addl%ecx, %eax
movl%eax, -20(%rbp)
movl-12(%rbp), %eax
addl$1, %eax
movl%eax, -12(%rbp)
LBB1_2:
movl-12(%rbp), %eax
movl-16(%rbp), %ecx
cmpl%ecx, %eax
jleLBB1_1
movl-20(%rbp), %eax
xorb%cl, %cl
leaqL_.str(%rip), %rdx
movq%rdx, %rdi
movl%eax, %esi
movb%cl, %al
callq_printf
movl$0, -8(%rbp)
movl-8(%rbp), %eax
movl%eax, -4(%rbp)
movl-4(%rbp), %eax
addq$32, %rsp
popq%rbp
ret
Leh_func_end1:
.section__TEXT,__cstring,cstring_literals
L_.str:
.asciz "sum=%d\n"
.section__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame0:
Lsection_eh_frame:
Leh_frame_common:
Lset0 = Leh_frame_common_end-Leh_frame_common_begin
.longLset0
Leh_frame_common_begin:
.long0
.byte1
.asciz "zR"
.byte1
.byte120
.byte16
.byte1
.byte16
.byte12
.byte7
.byte8
.byte144
.byte1
.align3
Leh_frame_common_end:
.globl_main.eh
_main.eh:
Lset1 = Leh_frame_end1-Leh_frame_begin1
.longLset1
Leh_frame_begin1:
Lset2 = Leh_frame_begin1-Leh_frame_common
.longLset2
Ltmp3:
.quadLeh_func_begin1-Ltmp3
Lset3 = Leh_func_end1-Leh_func_begin1
.quadLset3
.byte0
.byte4
Lset4 = Ltmp0-Leh_func_begin1
.longLset4
.byte14
.byte16
.byte134
.byte2
.byte4
Lset5 = Ltmp1-Ltmp0
.longLset5
.byte13
.byte6
.align3
Leh_frame_end1:
.subsections_via_symbols本回答被网友采纳
第2个回答  2012-09-15
求人不如求己,这是一个关于315无线发射和接收的测试程序,用汇编写的,自己整整,这不最终用C语言写出来了。

霍挚倪敖淑廷辞雍带爻柘茼蔚林玖谪毛缔单菜反
第3个回答  2012-09-14
你用的什么单片机啊

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网