哪位大虾能讲解一下一个简单c++源程序的对应汇编代码语句
大家好,哪位高手能详细讲解一下下面的c++代码所对应的汇编代码,最好能每一句都讲解,小弟新手还望指教,不胜感激!/*main.cpp文件如下所示*/
int b[10];
main()
{
int c[10]={0,2,3};
//short b;
//short c;
//cout<<&b<<" "<<&c<<endl;
//cout<<sizeof(mystruct)<<endl;
}
/*对应的main.asm文件如下所示*/
TITLE E:\Program Files\Microsoft Visual Studio\MyProjects\myasm\main.cpp
.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS ENDS
$$TYPES SEGMENT BYTE USE32 'DEBTYP'
$$TYPES ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
; COMDAT _main
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
PUBLIC ?b@@3PAHA ; b
_BSS SEGMENT
?b@@3PAHA DD 0aH DUP (?) ; b
_BSS ENDS
PUBLIC _main
; COMDAT _main
_TEXT SEGMENT
_c$ = -40
_main PROC NEAR ; COMDAT
; 4 : {
push ebp
mov ebp, esp
sub esp, 104 ; 00000068H
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-104]
mov ecx, 26 ; 0000001aH
mov eax, -858993460 ; ccccccccH
rep stosd
; 5 : int c[10]={0,2,3};
mov DWORD PTR _c$[ebp], 0
mov DWORD PTR _c$[ebp+4], 2
mov DWORD PTR _c$[ebp+8], 3
mov ecx, 7
xor eax, eax
lea edi, DWORD PTR _c$[ebp+12]
rep stosd
; 6 : //short b;
; 7 : //short c;
; 8 : //cout<<&b<<" "<<&c<<endl;
; 9 : //cout<<sizeof(mystruct)<<endl;
; 10 : }
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
END