	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	_fread]
;
; Line 9:	{
;
_fread:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 08H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+014H]
;
; Line 11:		int len = count * size,i;
;
	MOV	EAX,DWORD [EBP+010H]
	IMUL	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EBP+0FFFFFFFCH],EAX
;
; Line 12:		char *lbuf = buf;
;
	MOV	EDI,DWORD [EBP+08H]
;
; Line 13:		if (stream->token != 0x444c) {
;
	MOVSX	EAX,WORD [ESI+01DH]
	CMP	EAX,0444CH
	JE	SHORT	L_1
;
; Line 14:			errno = _dos_errno = 2       ;
;
	MOV	DWORD [__dos_errno],02H
	MOV	DWORD [_errno],02H
;
; Line 15:			return 0;
;
	MOV	EAX,00H
	JMP	L_3
L_1:
;
; Line 17:		if (!(stream->flags & 0x0001                   )) {
;
	MOV	EAX,DWORD [ESI+04H]
	AND	EAX,BYTE 01H
	JNE	SHORT	L_4
;
; Line 18:			stream->flags |= 0x0010                   ;
;
	BTS	DWORD [ESI+04H],04H
;
; Line 19:			errno = 2       ;
;
	MOV	DWORD [_errno],02H
;
; Line 20:			return 0;
;
	MOV	EAX,00H
	JMP	L_3
L_4:
	MOV	EBX,00H
	JMP	L_8
L_6:
;
; Line 23:			rv = ((--((stream)->level) > 0) ? (unsigned char)(*(stream)->curp++) :     _fgetc (stream));
;
	DEC	DWORD [ESI+00H]
	CMP	DWORD [ESI+00H],BYTE 00H
	JLE	SHORT	L_10
	MOV	EAX,DWORD [ESI+015H]
	INC	DWORD [ESI+015H]
	MOVZX	EAX,BYTE [EAX+00H]
	JMP	L_11
L_10:
	PUSH	ESI
	CALL	__fgetc
	POP	ECX
L_11:
	MOV	DWORD [EBP+0FFFFFFF8H],EAX
;
; Line 24:			if (rv == (-1)             )
;
	CMP	DWORD [EBP+0FFFFFFF8H],BYTE 0FFFFFFFFH
	JNE	SHORT	L_12
;
; Line 25:				return i / size;
;
	MOV	EAX,EBX
	SUB	EDX,EDX
	DIV	DWORD [EBP+0CH]
	JMP	L_3
L_12:
;
; Line 26:			*lbuf++ = (char) rv;
;
	MOV	EAX,DWORD [EBP+0FFFFFFF8H]
	MOV	ECX,EDI
	INC	EDI
	MOV	BYTE [ECX+00H],AL
;
; Line 27:		}
;
;
; Line 22:		for (i=0; i < len; i++) {
;
L_7:
	INC	EBX
L_8:
	CMP	EBX,DWORD [EBP+0FFFFFFFCH]
	JL	NEAR	L_6
L_9:
;
; Line 28:		return count;
;
	MOV	EAX,DWORD [EBP+010H]
L_3:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	__fgetc]

SECTION _DATA
[EXTERN	__dos_errno]
[EXTERN	_errno]
