	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	_strdup]
;
; Line 9:	{
;
_strdup:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	MOV	ESI,DWORD [EBP+08H]
;
; Line 10:		char *rv = malloc(strlen(string)+1);
;
	PUSH	EDI
	MOV	EDI,ESI
	CLD
	SUB	EAX,EAX
	MOV	ECX,0FFFFFFFFH
	REPNZ	SCASB
	NOT	ECX
	DEC	ECX
	MOV	EAX,ECX
	POP	EDI
	INC	EAX
	PUSH	EAX
	CALL	_malloc
	POP	ECX
	MOV	EBX,EAX
;
; Line 11:	  if (rv)
;
	TEST	EBX,EBX
	JE	NEAR	L_1
;
; Line 12:		  strcpy(rv,string);
;
	PUSH	ESI
	PUSH	EDI
	MOV	EDI,EBX
	XCHG	ESI,EDI
	CLD
	PUSH	EDI
	SUB	EAX,EAX
	MOV	ECX,0FFFFFFFFH
	REPNZ	SCASB
	NOT	ECX
	MOV	EAX,ECX
	POP	EDI
	XCHG	ESI,EDI
	REPNZ	MOVSB
	POP	EDI
	POP	ESI
L_1:
;
; Line 13:	  return rv;
;
	MOV	EAX,EBX
L_3:
	POP	ESI
	POP	EBX
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	_malloc]
