	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	_ungetc]
;
; Line 7:	{
;
_ungetc:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+0CH]
	MOV	EBX,DWORD [EBP+08H]
;
; Line 8:		if (stream->token != 0x444c) {
;
	MOVSX	EAX,WORD [ESI+01DH]
	CMP	EAX,0444CH
	JE	SHORT	L_1
;
; Line 9:			errno = _dos_errno = 2       ;
;
	MOV	DWORD [__dos_errno],02H
	MOV	DWORD [_errno],02H
;
; Line 10:			return (-1)             ;
;
	MOV	EAX,0FFFFFFFFH
	JMP	L_3
L_1:
;
; Line 12:		if (stream->buffer) {
;
	CMP	DWORD [ESI+011H],BYTE 00H
	JE	NEAR	L_4
;
; Line 13:			if ((stream->flags & 0x0080                   ) && stream->curp != stream->buffer) {
;
	MOV	EAX,DWORD [ESI+04H]
	AND	EAX,080H
	JE	NEAR	L_6
	MOV	EAX,DWORD [ESI+015H]
	CMP	EAX,DWORD [ESI+011H]
	JE	NEAR	L_6
;
; Line 14:				if (stream->level == stream->bsize) {
;
	MOV	EAX,DWORD [ESI+00H]
	CMP	EAX,DWORD [ESI+0DH]
	JNE	SHORT	L_8
;
; Line 15:					errno = _dos_errno = 28       ;
;
	MOV	DWORD [__dos_errno],01CH
	MOV	DWORD [_errno],01CH
;
; Line 16:					return (-1)             ;
;
	MOV	EAX,0FFFFFFFFH
	JMP	L_3
L_8:
;
; Line 18:				if (stream->curp == stream->buffer) {
;
	MOV	EAX,DWORD [ESI+015H]
	CMP	EAX,DWORD [ESI+011H]
	JNE	NEAR	L_10
;
; Line 20:					memmove (stream->buffer + (len = stream->bsize - stream->level), 
;
	PUSH	DWORD [ESI+00H]
	PUSH	DWORD [ESI+011H]
	MOV	EAX,DWORD [ESI+0DH]
	SUB	EAX,DWORD [ESI+00H]
	MOV	EDI,EAX
	ADD	EAX,DWORD [ESI+011H]
	PUSH	EAX
	CALL	_memmove
	ADD	ESP,BYTE 0CH
;
; Line 22:					stream->curp += len;
;
	ADD	DWORD [ESI+015H],EDI
;
; Line 23:				}
;
L_10:
;
; Line 24:			}
;
	JMP	L_7
L_6:
;
; Line 26:				if (fflush(stream))
;
	PUSH	ESI
	CALL	_fflush
	POP	ECX
	TEST	EAX,EAX
	JE	SHORT	L_12
;
; Line 27:					return (-1)             ;
;
	MOV	EAX,0FFFFFFFFH
	JMP	L_3
L_12:
;
; Line 28:				stream->flags |= 0x0080                   ;
;
	BTS	DWORD [ESI+04H],07H
;
; Line 29:		    stream->level = 0;
;
	MOV	DWORD [ESI+00H],00H
;
; Line 30:				stream->curp = stream->buffer+stream->bsize;
;
	MOV	EAX,DWORD [ESI+011H]
	ADD	EAX,DWORD [ESI+0DH]
	MOV	DWORD [ESI+015H],EAX
;
; Line 31:			}
;
L_7:
;
; Line 32:			stream->level++;
;
	INC	DWORD [ESI+00H]
;
; Line 33:			*--stream->curp = (char)c;
;
	DEC	DWORD [ESI+015H]
	MOV	EAX,DWORD [ESI+015H]
	MOV	BYTE [EAX+00H],BL
;
; Line 34:		}
;
	JMP	L_5
L_4:
;
; Line 36:			if (stream->hold) {
;
	CMP	BYTE [ESI+0CH],BYTE 00H
	JE	SHORT	L_14
;
; Line 37:				errno = _dos_errno = 28       ;
;
	MOV	DWORD [__dos_errno],01CH
	MOV	DWORD [_errno],01CH
;
; Line 38:				return (-1)             ;
;
	MOV	EAX,0FFFFFFFFH
	JMP	L_3
L_14:
;
; Line 40:			stream->hold = (char)c;
;
	MOV	BYTE [ESI+0CH],BL
;
; Line 41:		}
;
L_5:
;
; Line 42:		return c;
;
	MOV	EAX,EBX
L_3:
	POP	EDI
	POP	ESI
	POP	EBX
	POP	EBP
	RET
[GLOBAL	__ungetc]
;
; Line 45:	{
;
__ungetc:
	PUSH	EBP
	MOV	EBP,ESP
;
; Line 46:		return ungetc(c, stream);
;
	PUSH	DWORD [EBP+0CH]
	PUSH	DWORD [EBP+08H]
	CALL	_ungetc
	ADD	ESP,BYTE 08H
L_16:
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	_memmove]
[EXTERN	_fflush]

SECTION _DATA
[EXTERN	__dos_errno]
[EXTERN	_errno]
