	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	_fgets]
;
; Line 4:	{
;
_fgets:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+08H]
	MOV	EDI,DWORD [EBP+010H]
;
; Line 5:		int i = 0,rv;
;
	MOV	DWORD [EBP+0FFFFFFFCH],00H
	JMP	L_1
L_3:
;
; Line 7:			rv = ((--((stream)->level) > 0) ? (unsigned char)(*(stream)->curp++) :     _fgetc (stream));
;
	DEC	DWORD [EDI+00H]
	CMP	DWORD [EDI+00H],BYTE 00H
	JLE	SHORT	L_4
	MOV	EAX,DWORD [EDI+015H]
	INC	DWORD [EDI+015H]
	MOVZX	EAX,BYTE [EAX+00H]
	JMP	L_5
L_4:
	PUSH	EDI
	CALL	__fgetc
	POP	ECX
L_5:
	MOV	EBX,EAX
;
; Line 8:			if (rv == (-1)             )
;
	CMP	EBX,BYTE 0FFFFFFFFH
	JE	NEAR	L_2
;
; Line 9:				break;
;
L_6:
;
; Line 10:			if (--num) {
;
	DEC	DWORD [EBP+0CH]
	CMP	DWORD [EBP+0CH],BYTE 00H
	JE	SHORT	L_8
;
; Line 11:				buf[i++] = (char)rv;
;
	MOV	EAX,DWORD [EBP+0FFFFFFFCH]
	INC	DWORD [EBP+0FFFFFFFCH]
	MOV	BYTE [ESI+EAX+00H],BL
;
; Line 12:				if (rv == '\n') 
;
	CMP	EBX,BYTE 0AH
	JE	SHORT	L_2
;
; Line 13:					break;
;
L_10:
;
; Line 14:			}
;
	JMP	L_9
L_8:
;
; Line 16:				break;
;
	JMP	L_2
L_9:
;
; Line 17:		}
;
L_1:
;
; Line 6:		while (1) {
;
	JMP	L_3
L_2:
;
; Line 18:		buf[i] = 0;
;
	MOV	EAX,DWORD [EBP+0FFFFFFFCH]
	MOV	BYTE [ESI+EAX+00H],00H
;
; Line 19:		if (rv == (-1)             )
;
	CMP	EBX,BYTE 0FFFFFFFFH
	JNE	SHORT	L_12
;
; Line 20:			return 0;
;
	MOV	EAX,00H
	JMP	L_14
L_12:
;
; Line 21:		else return buf;
;
	MOV	EAX,ESI
L_13:
;
; Line 22:	}
;
L_14:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	__fgetc]
