; Listing generated by Microsoft (R) Optimizing Compiler Version 13.10.3077 

	TITLE	.\ArraySum.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 ?MySub@@YAXXZ
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
;	COMDAT ?ArraySum@@YAHQAHH@Z
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
;	COMDAT _main
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
sxdata	SEGMENT DWORD USE32 'SXDATA'
sxdata	ENDS
FLAT	GROUP _DATA, CONST, _BSS
	ASSUME	CS: FLAT, DS: FLAT, SS: FLAT
endif

INCLUDELIB LIBCD
INCLUDELIB OLDNAMES

PUBLIC	?MySub@@YAXXZ					; MySub
PUBLIC	__real@3ff3333333333333
EXTRN	__RTC_InitBase:NEAR
EXTRN	__RTC_Shutdown:NEAR
EXTRN	@_RTC_CheckStackVars@8:NEAR
EXTRN	__fltused:NEAR
;	COMDAT rtc$IMZ
; File c:\data\asmbook5\examples\ch12\visualcpp\arraysum\arraysum.cpp
rtc$IMZ	SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
rtc$IMZ	ENDS
;	COMDAT rtc$TMZ
rtc$TMZ	SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ	ENDS
;	COMDAT __real@3ff3333333333333
CONST	SEGMENT
__real@3ff3333333333333 DQ 03ff3333333333333r	; 1.2
; Function compile flags: /Odt /RTCsu /ZI
CONST	ENDS
;	COMDAT ?MySub@@YAXXZ
_TEXT	SEGMENT
_c$ = -64						; size = 8
_name$ = -48						; size = 20
_B$ = -20						; size = 4
_A$ = -5						; size = 1
?MySub@@YAXXZ PROC NEAR					; MySub, COMDAT

; 3    : {

	push	ebp
	mov	ebp, esp
	sub	esp, 260				; 00000104H
	push	ebx
	push	esi
	push	edi
	lea	edi, DWORD PTR [ebp-260]
	mov	ecx, 65					; 00000041H
	mov	eax, -858993460				; ccccccccH
	rep stosd

; 4    : 	char A = 'A';

	mov	BYTE PTR _A$[ebp], 65			; 00000041H

; 5    : 	int B = 10;

	mov	DWORD PTR _B$[ebp], 10			; 0000000aH

; 6    : 	char name[20];
; 7    : 	name[0] = 'B';

	mov	BYTE PTR _name$[ebp], 66		; 00000042H

; 8    : 	double c = 1.2;

	fld	QWORD PTR __real@3ff3333333333333
	fstp	QWORD PTR _c$[ebp]

; 9    : }

	push	edx
	mov	ecx, ebp
	push	eax
	lea	edx, DWORD PTR $L306
	call	@_RTC_CheckStackVars@8
	pop	eax
	pop	edx
	pop	edi
	pop	esi
	pop	ebx
	mov	esp, ebp
	pop	ebp
	ret	0
$L306:
	DD	1
	DD	$L305
$L305:
	DD	-48					; ffffffd0H
	DD	20					; 00000014H
	DD	$L304
$L304:
	DB	110					; 0000006eH
	DB	97					; 00000061H
	DB	109					; 0000006dH
	DB	101					; 00000065H
	DB	0
?MySub@@YAXXZ ENDP					; MySub
_TEXT	ENDS
PUBLIC	?ArraySum@@YAHQAHH@Z				; ArraySum
; Function compile flags: /Odt /RTCsu /ZI
;	COMDAT ?ArraySum@@YAHQAHH@Z
_TEXT	SEGMENT
_i$279 = -20						; size = 4
_sum$ = -8						; size = 4
_array$ = 8						; size = 4
_count$ = 12						; size = 4
?ArraySum@@YAHQAHH@Z PROC NEAR				; ArraySum, COMDAT

; 13   : {

	push	ebp
	mov	ebp, esp
	sub	esp, 216				; 000000d8H
	push	ebx
	push	esi
	push	edi
	lea	edi, DWORD PTR [ebp-216]
	mov	ecx, 54					; 00000036H
	mov	eax, -858993460				; ccccccccH
	rep stosd

; 14   : 	int sum = 0;

	mov	DWORD PTR _sum$[ebp], 0

; 15   : 
; 16   : 	for(int i = 0; i < count; i++)

	mov	DWORD PTR _i$279[ebp], 0
	jmp	SHORT $L280
$L281:
	mov	eax, DWORD PTR _i$279[ebp]
	add	eax, 1
	mov	DWORD PTR _i$279[ebp], eax
$L280:
	mov	eax, DWORD PTR _i$279[ebp]
	cmp	eax, DWORD PTR _count$[ebp]
	jge	SHORT $L282

; 17   : 	  sum += array[i];

	mov	eax, DWORD PTR _i$279[ebp]
	mov	ecx, DWORD PTR _array$[ebp]
	mov	edx, DWORD PTR _sum$[ebp]
	add	edx, DWORD PTR [ecx+eax*4]
	mov	DWORD PTR _sum$[ebp], edx
	jmp	SHORT $L281
$L282:

; 18   : 	
; 19   : 	return sum;

	mov	eax, DWORD PTR _sum$[ebp]

; 20   : }

	pop	edi
	pop	esi
	pop	ebx
	mov	esp, ebp
	pop	ebp
	ret	0
?ArraySum@@YAHQAHH@Z ENDP				; ArraySum
_TEXT	ENDS
PUBLIC	_main
EXTRN	__RTC_CheckEsp:NEAR
; Function compile flags: /Odt /RTCsu /ZI
;	COMDAT _main
_TEXT	SEGMENT
_sum$ = -216						; size = 4
_Array$ = -204						; size = 200
_main	PROC NEAR					; COMDAT

; 24   : {

	push	ebp
	mov	ebp, esp
	sub	esp, 412				; 0000019cH
	push	ebx
	push	esi
	push	edi
	lea	edi, DWORD PTR [ebp-412]
	mov	ecx, 103				; 00000067H
	mov	eax, -858993460				; ccccccccH
	rep stosd

; 25   : 	int Array[50];
; 26   : 
; 27   : 	int sum = ArraySum( Array, 50 );

	push	50					; 00000032H
	lea	eax, DWORD PTR _Array$[ebp]
	push	eax
	call	?ArraySum@@YAHQAHH@Z			; ArraySum
	add	esp, 8
	mov	DWORD PTR _sum$[ebp], eax

; 28   : 
; 29   : 
; 30   : }

	xor	eax, eax
	push	edx
	mov	ecx, ebp
	push	eax
	lea	edx, DWORD PTR $L317
	call	@_RTC_CheckStackVars@8
	pop	eax
	pop	edx
	pop	edi
	pop	esi
	pop	ebx
	add	esp, 412				; 0000019cH
	cmp	ebp, esp
	call	__RTC_CheckEsp
	mov	esp, ebp
	pop	ebp
	ret	0
$L317:
	DD	1
	DD	$L316
$L316:
	DD	-204					; ffffff34H
	DD	200					; 000000c8H
	DD	$L315
$L315:
	DB	65					; 00000041H
	DB	114					; 00000072H
	DB	114					; 00000072H
	DB	97					; 00000061H
	DB	121					; 00000079H
	DB	0
_main	ENDP
_TEXT	ENDS
END
