	SECTION _TEXT CLASS=CODE USE32
	SECTION _DATA CLASS=DATA USE32
	SECTION _BSS  CLASS=BSS USE32
	SECTION _CONST  CLASS=CONST USE32
	SECTION _STRING  CLASS=STRING USE32
	SECTION cstartup CLASS=INITDATA USE32
	SECTION crundown CLASS=EXITDATA USE32
	SECTION cppinit  CLASS=CPPINIT USE32
	SECTION cppexit  CLASS=CPPEXIT USE32
	GROUP DGROUP _DATA _BSS _CONST _STRING

SECTION _TEXT
[GLOBAL	_realloc]
;
; Line 8:	{
;
_realloc:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+08H]
;
; Line 9:		char *ptr = malloc(size);
;
	PUSH	DWORD [EBP+0CH]
	CALL	_malloc
	POP	ECX
	MOV	EDI,EAX
;
; Line 10:		if (ptr && buf) {							 
;
	TEST	EDI,EDI
	JE	NEAR	L_1
	TEST	ESI,ESI
	JE	NEAR	L_1
;
; Line 11:			int oldsize = (((FREELIST *)buf)-1)->size - sizeof(size_t);
;
	MOV	EBX,DWORD [ESI+00H+0FFFFFFF8H]
	SUB	EBX,BYTE 04H
;
; Line 12:			if (oldsize > size)
;
	CMP	EBX,DWORD [EBP+0CH]
	JBE	SHORT	L_3
;
; Line 13:				oldsize = size ;
;
	MOV	EBX,DWORD [EBP+0CH]
L_3:
;
; Line 14:			memcpy(ptr,buf,oldsize);
;
	MOV	ECX,EBX
	PUSH	ESI
	PUSH	EDI
	CLD
	REPNZ	MOVSB
	POP	EDI
	POP	ESI
;
; Line 15:			free(buf);
;
	PUSH	ESI
	CALL	_free
	POP	ECX
;
; Line 16:		}
;
L_1:
;
; Line 17:		return ptr;
;
	MOV	EAX,EDI
L_5:
	POP	EDI
	POP	ESI
	POP	EBX
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	_free]
[EXTERN	_malloc]
