 14.2.   ,    14.1

Constructor	proc 	near		; CODE XREF: main+11 p
;  . ,        
;   .

 	push	esi		
 	mov	esi, ecx		
 	push	offset aConstructor 	; "Constructor\n"
 	call	printf		
 	add	esp, 4		
 	mov	eax, esi		
 	pop	esi		
 	retn
Constructor	endp			

Destructor	proc near		; CODE XREF: __destructor+6 p
;  . ,    ,    
;   .
 	push	offset aDestructor 	; "Destructor\n"
 	call	printf
 	pop	ecx
 	retn	
Destructor	endp

demo	proc	near			; CODE XREF: main+1E p
;   demo
 	push	offset aMyclass		; "MyClass\n"
 	call	printf		
 	pop	ecx		
 	retn			
demo	endp		


main	proc	near			; CODE XREF: start+AF p
 	push	esi		
 	push	1		
 	call	??2@YAPAXI@Z		; operator new(uint)
	 add	esp, 4		
 	;     ,
 	; ,   

 	test	eax, eax		
 	jz	short loc_0_40105A		
 	;      .
 	;  :   jump.
 	;     XOR ESI,ESI,    
	; .       
	; ,      ,   
 	;      . , 
 	;       !
 	; , ,   XOR ESI,ESI,   
 	; !      .

 	mov	ecx, eax		
 	;   this			

 	call	Constructor		
 	;    , . .      
	; .

 	mov	esi, eax		
 	jmp	short loc_0_40105C		

loc_0_40105A:				; CODE XREF: main+D j
 	xor	esi, esi		
 	;    ,      
 	; .			
 	; :     , ,
 	;      

loc_0_40105C:				; CODE XREF: main+18 j
 	mov	ecx, esi		
 	;   this			
				
 	call	demo		
 	;    

 	test	esi, esi		
 	jz	short loc_0_401070		
 	;   this  NULL.      
 	; ,       (     
 	; ,    ).  ,
 	;     ,   - 

 	push	1		
 	;     (  delete)

 	mov	ecx, esi		
 	;   this			

 	call	__destructor		
 	;  			
				
loc_0_401070:				; CODE XREF: main+25 j
 	pop	esi		
 	retn			
main	endp		


__destructor	proc near		; CODE XREF: main+2B p
;  .  ,    
;    ,   delete (     ,   
; ).

arg_0 = byte ptr  8		
 	push	ebp		
 	mov	ebp, esp		
 	push	esi		
 	mov	esi, ecx		
 	call	Destructor		
 	;   ,  

 	test	[ebp+arg_0], 1		
 	jz	short loc_0_40109A		
 	push	esi		
 	call	??3@YAXPAX@Z		; operator delete(void *)
 	add	esp, 4		
 	;  ,   


loc_0_40109A:	; CODE XREF: __destructor+F j
 	mov	eax, esi		
 	pop	esi		
 	pop	ebp		
 	retn	4		
__destructor	endp			
