	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	_fwrite]
;
; Line 10:	{
;
_fwrite:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+014H]
	MOV	EDI,DWORD [EBP+010H]
;
; Line 11:		int len = size * count,i;
;
	MOV	EAX,DWORD [EBP+0CH]
	IMUL	EAX,EDI
	MOV	DWORD [EBP+0FFFFFFFCH],EAX
;
; Line 12:		if (stream->token != 0x444c) {
;
	MOVSX	EAX,WORD [ESI+01DH]
	CMP	EAX,0444CH
	JE	SHORT	L_1
;
; Line 13:			errno = _dos_errno = 2       ;
;
	MOV	DWORD [__dos_errno],02H
	MOV	DWORD [_errno],02H
;
; Line 14:			return 0;
;
	MOV	EAX,00H
	JMP	L_3
L_1:
;
; Line 16:		if (!(stream->flags & 0x0002                   )) {
;
	MOV	EAX,DWORD [ESI+04H]
	AND	EAX,BYTE 02H
	JNE	SHORT	L_4
;
; Line 17:			stream->flags |= 0x0010                   ;
;
	BTS	DWORD [ESI+04H],04H
;
; Line 18:			errno = 14       ;
;
	MOV	DWORD [_errno],0EH
;
; Line 19:			return 0;
;
	MOV	EAX,00H
	JMP	L_3
L_4:
	MOV	EBX,00H
	JMP	L_8
L_6:
;
; Line 22:			if (putc(*((unsigned char *)buf)++,stream) == (-1)             )
;
	PUSH	ESI
	MOV	EAX,DWORD [EBP+08H]
	INC	DWORD [EBP+08H]
	MOVZX	EAX,BYTE [EAX+00H]
	PUSH	EAX
	CALL	_putc
	ADD	ESP,BYTE 08H
	CMP	EAX,BYTE 0FFFFFFFFH
	JNE	SHORT	L_10
;
; Line 23:				return i / size;
;
	MOV	EAX,EBX
	SUB	EDX,EDX
	DIV	DWORD [EBP+0CH]
	JMP	L_3
L_10:
;
; Line 21:		for (i=0; i < len; i++)
;
L_7:
	INC	EBX
L_8:
	CMP	EBX,DWORD [EBP+0FFFFFFFCH]
	JL	NEAR	L_6
L_9:
;
; Line 24:		return count;
;
	MOV	EAX,EDI
L_3:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	_putc]

SECTION _DATA
[EXTERN	__dos_errno]
[EXTERN	_errno]
