	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
;
; Line 11:	{
;
_mbinit:
;
; Line 12:		repeat = 0;
;
	MOV	DWORD [_repeat],00H
;
; Line 13:		curparms = phidefaults;
;
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD _phidefaults
	MOV	EDI,DWORD _curparms
	CLD
	MOV	ECX,02H
	REP	MOVSD
	MOVSW
	MOVSB
	POP	EDI
	POP	ESI
;
; Line 14:	}
;
	RET
;
; Line 16:	{
;
_parsechar:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 08H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD _curparms
;
; Line 19:		*len = 0;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],00H
	JMP	L_1
L_3:
;
; Line 21:			if (**buf == 0)
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+00H]
	MOVZX	EAX,BYTE [EAX+00H]
	TEST	EAX,EAX
	JNE	SHORT	L_4
;
; Line 22:				return 0;
;
	MOV	EAX,00H
	JMP	L_6
L_4:
;
; Line 23:			if (repeat) {
;
	CMP	DWORD [_repeat],BYTE 00H
	JE	NEAR	L_7
;
; Line 24:				repeat--;
;
	DEC	DWORD [_repeat]
;
; Line 25:				rv = curparms.cwb + (curparms.bank << 7) 
;
	MOVSX	EAX,BYTE [ESI+05H]
	SAL	EAX,07H
	MOVSX	ECX,BYTE [ESI+06H]
	ADD	ECX,EAX
	MOVSX	EAX,BYTE [ESI+04H]
	SAL	EAX,0BH
	ADD	ECX,EAX
	MOVSX	EAX,BYTE [ESI+03H]
	SAL	EAX,010H
	ADD	ECX,EAX
	MOVSX	EAX,BYTE [ESI+02H]
	SAL	EAX,014H
	ADD	ECX,EAX
	MOVSX	EAX,BYTE [ESI+01H]
	SAL	EAX,018H
	ADD	ECX,EAX
	MOVSX	EAX,BYTE [ESI+00H]
	SAL	EAX,01CH
	ADD	ECX,EAX
	MOV	DWORD [EBP+0FFFFFFFCH],ECX
;
; Line 29:				break;
;
	JMP	L_2
L_7:
;
; Line 31:			temp = *(*buf)++;                                                    
;
	MOV	EAX,DWORD [EBP+08H]
	PUSH	DWORD [EAX+00H]
	INC	DWORD [EAX+00H]
	POP	EAX
	MOV	BL,BYTE [EAX+00H]
;
; Line 32:			(*len)++;
;
	MOV	EAX,DWORD [EBP+0CH]
	INC	DWORD [EAX+00H]
;
; Line 33:			if (temp & 0x80) {
;
	MOVZX	EBX,BL
	MOV	EAX,EBX
	AND	EAX,080H
	JE	NEAR	L_9
;
; Line 34:				char grp = temp & 0x70;
;
	MOV	AL,BL
	AND	AL,BYTE 070H
	MOV	BYTE [EBP+0FFFFFFFBH],AL
;
; Line 35:				switch (grp) {
;
	MOV	AL,BYTE [EBP+0FFFFFFFBH]
	CMP	AL,BYTE 040H
	JE	NEAR	L_17
	JG	NEAR	L_21
	CMP	AL,BYTE 020H
	JE	NEAR	L_15
	JG	SHORT	L_22
	CMP	AL,BYTE 010H
	JE	NEAR	L_14
	JG	NEAR	L_11
	CMP	AL,BYTE 00H
	JE	NEAR	L_13
	JMP	L_11
L_22:
	CMP	AL,BYTE 030H
	JE	NEAR	L_16
	JMP	L_11
L_21:
	CMP	AL,BYTE 060H
	JE	NEAR	L_19
	JG	SHORT	L_23
	CMP	AL,BYTE 050H
	JE	NEAR	L_18
	JMP	L_11
L_23:
	CMP	AL,BYTE 070H
	JE	NEAR	L_20
	JMP	L_11
L_13:
;
; Line 37:								int repeatlevel = 0;
;
	MOV	EDI,00H
;
; Line 38:								(*buf)--;
;
	MOV	EAX,DWORD [EBP+08H]
	DEC	DWORD [EAX+00H]
;
; Line 39:								(*len)--;
;
	MOV	EAX,DWORD [EBP+0CH]
	DEC	DWORD [EAX+00H]
	JMP	L_24
L_26:
;
; Line 41:									(*len)++;
;
	MOV	EAX,DWORD [EBP+0CH]
	INC	DWORD [EAX+00H]
;
; Line 42:									(*buf)++;
;
	MOV	EAX,DWORD [EBP+08H]
	INC	DWORD [EAX+00H]
;
; Line 43:									repeat += ((temp & 0x0f)<<(repeatlevel++ * 4)) +1;
;
	MOVZX	EBX,BL
	MOV	EAX,EBX
	AND	EAX,BYTE 0FH
	MOV	ECX,EDI
	INC	EDI
	SAL	ECX,02H
	SAL	EAX,CL
	INC	EAX
	ADD	DWORD [_repeat],EAX
;
; Line 44:								}
;
L_24:
;
; Line 40:								while (((temp = **buf)& 0xf0) == 0x80) {
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+00H]
	MOVZX	EBX,BYTE [EAX+00H]
	MOV	EAX,EBX
	AND	EAX,0F0H
	CMP	EAX,080H
	JE	NEAR	L_26
L_25:
;
; Line 45:								repeat++;
;
	INC	DWORD [_repeat]
;
; Line 46:							}
;
;
; Line 47:							break;
;
	JMP	L_12
L_14:
;
; Line 49:							curparms.bank = temp & 0x0f;
;
	MOV	AL,BL
	AND	AL,BYTE 0FH
	MOV	BYTE [ESI+05H],AL
;
; Line 50:							break;
;
	JMP	L_12
L_15:
L_16:
;
; Line 53:							curparms.attrib = temp & 0x1f;
;
	MOV	AL,BL
	AND	AL,BYTE 01FH
	MOV	BYTE [ESI+04H],AL
;
; Line 54:							break;
;
	JMP	L_12
L_17:
;
; Line 56:							curparms.fgc = temp & 0x0f;
;
	MOV	AL,BL
	AND	AL,BYTE 0FH
	MOV	BYTE [ESI+03H],AL
;
; Line 57:							break;
;
	JMP	L_12
L_18:
;
; Line 59:							curparms.bgc = temp & 0x0f;
;
	MOV	AL,BL
	AND	AL,BYTE 0FH
	MOV	BYTE [ESI+02H],AL
;
; Line 60:							break;
;
	JMP	L_12
L_19:
;
; Line 62:							curparms.style = temp & 0x0f;
;
	MOV	AL,BL
	AND	AL,BYTE 0FH
	MOV	BYTE [ESI+01H],AL
;
; Line 63:							break;
;
	JMP	L_12
L_20:
;
; Line 65:							curparms.size = temp & 0x0f;
;
	MOV	AL,BL
	AND	AL,BYTE 0FH
	MOV	BYTE [ESI+00H],AL
;
; Line 66:							break;
;
L_11:
L_12:
;
; Line 68:			}
;
	JMP	L_10
L_9:
;
; Line 70:				if (temp)
;
	TEST	BL,BL
	JE	SHORT	L_27
;
; Line 71:					curparms.cwb = temp;
;
	MOV	BYTE [ESI+06H],BL
L_27:
;
; Line 72:				if (temp & 0x60) {
;
	MOVZX	EBX,BL
	MOV	EAX,EBX
	AND	EAX,BYTE 060H
	JE	NEAR	L_29
;
; Line 73:					rv = temp + (curparms.bank << 7)
;
	MOVSX	EAX,BYTE [ESI+05H]
	SAL	EAX,07H
	MOVZX	EBX,BL
	ADD	EAX,EBX
	MOVSX	ECX,BYTE [ESI+04H]
	SAL	ECX,0BH
	ADD	EAX,ECX
	MOVSX	ECX,BYTE [ESI+03H]
	SAL	ECX,010H
	ADD	EAX,ECX
	MOVSX	ECX,BYTE [ESI+02H]
	SAL	ECX,014H
	ADD	EAX,ECX
	MOVSX	ECX,BYTE [ESI+01H]
	SAL	ECX,018H
	ADD	EAX,ECX
	MOVSX	ECX,BYTE [ESI+00H]
	SAL	ECX,01CH
	ADD	EAX,ECX
	MOV	DWORD [EBP+0FFFFFFFCH],EAX
;
; Line 77:				}
;
	JMP	L_30
L_29:
;
; Line 79:					rv = temp;
;
	MOVZX	EBX,BL
	MOV	DWORD [EBP+0FFFFFFFCH],EBX
;
; Line 80:					if (temp == 0x0a)
;
	MOVZX	EBX,BL
	CMP	EBX,BYTE 0AH
	JNE	NEAR	L_31
;
; Line 81:						curparms = phidefaults;
;
	LEA	EAX,[ESI+00H]
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD _phidefaults
	MOV	EDI,EAX
	CLD
	MOV	ECX,02H
	REP	MOVSD
	MOVSW
	MOVSB
	POP	EDI
	POP	ESI
L_31:
;
; Line 82:				}
;
L_30:
;
; Line 83:				break;
;
	JMP	L_2
L_10:
;
; Line 85:		}
;
L_1:
;
; Line 20:		while (1) {
;
	JMP	L_3
L_2:
;
; Line 86:		return(rv);
;
	MOV	EAX,DWORD [EBP+0FFFFFFFCH]
L_6:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_mbtowc]
;
; Line 89:	{
;
_mbtowc:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
;
; Line 90:		size_t len=0;
;
	MOV	DWORD [EBP+0FFFFFFFCH],00H
;
; Line 91:		*pwchar = parsechar(&s,&len);
;
	LEA	EAX,[EBP+0FFFFFFFCH]
	PUSH	EAX
	LEA	EAX,[EBP+0CH]
	PUSH	EAX
	CALL	_parsechar
	ADD	ESP,BYTE 08H
	MOV	ECX,DWORD [EBP+08H]
	MOV	DWORD [ECX+00H],EAX
;
; Line 92:		if (len <= n)
;
	MOV	EAX,DWORD [EBP+0FFFFFFFCH]
	CMP	EAX,DWORD [EBP+010H]
	JA	SHORT	L_33
;
; Line 93:			return len;
;
	MOV	EAX,DWORD [EBP+0FFFFFFFCH]
	JMP	L_35
L_33:
;
; Line 95:			return -1;
;
	MOV	EAX,0FFFFFFFFH
L_34:
;
; Line 96:	}
;
L_35:
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_mblen]
;
; Line 98:	{
;
_mblen:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
	PUSH	EBX
	LEA	EBX,[EBP+08H]
;
; Line 99:		size_t len=0;
;
	MOV	DWORD [EBP+0FFFFFFFCH],00H
;
; Line 100:		if (!s) {
;
	CMP	DWORD [EBX+00H],BYTE 00H
	JNE	NEAR	L_36
;
; Line 101:			curparms = phidefaults;
;
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD _phidefaults
	MOV	EDI,DWORD _curparms
	CLD
	MOV	ECX,02H
	REP	MOVSD
	MOVSW
	MOVSB
	POP	EDI
	POP	ESI
;
; Line 102:			repeat = 0;
;
	MOV	DWORD [_repeat],00H
;
; Line 103:			return 0;
;
	MOV	EAX,00H
	JMP	L_38
L_36:
;
; Line 105:		if (repeat)
;
	CMP	DWORD [_repeat],BYTE 00H
	JE	SHORT	L_39
;
; Line 106:			return 0;
;
	MOV	EAX,00H
	JMP	L_38
L_39:
;
; Line 107:		if ((*s & 0xf0) == 0x80) {
;
	MOV	EAX,DWORD [EBX+00H]
	MOVSX	EAX,BYTE [EAX+00H]
	AND	EAX,0F0H
	CMP	EAX,080H
	JNE	NEAR	L_41
	JMP	L_43
L_45:
;
; Line 109:				len++;
;
	INC	DWORD [EBP+0FFFFFFFCH]
L_43:
;
; Line 108:			while ((*s++ & 0xf0) == 0x80)
;
	MOV	EAX,DWORD [EBX+00H]
	INC	DWORD [EBX+00H]
	MOVSX	EAX,BYTE [EAX+00H]
	AND	EAX,0F0H
	CMP	EAX,080H
	JE	SHORT	L_45
L_44:
;
; Line 110:		}
;
	JMP	L_42
L_41:
;
; Line 112:			parsechar(&s,&len);
;
	LEA	EAX,[EBP+0FFFFFFFCH]
	PUSH	EAX
	PUSH	EBX
	CALL	_parsechar
	ADD	ESP,BYTE 08H
L_42:
;
; Line 113:		if (len <=n)
;
	MOV	EAX,DWORD [EBP+0FFFFFFFCH]
	CMP	EAX,DWORD [EBP+0CH]
	JA	SHORT	L_46
;
; Line 114:			return len;
;
	MOV	EAX,DWORD [EBP+0FFFFFFFCH]
	JMP	L_38
L_46:
;
; Line 115:		return - 1;
;
	MOV	EAX,0FFFFFFFFH
L_38:
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_mbstowcs]
;
; Line 119:	{
;
_mbstowcs:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EDI,DWORD [EBP+08H]
;
; Line 121:		size_t len=0;
;
	MOV	DWORD [EBP+0FFFFFFFCH],00H
;
; Line 122:		wchar_t cchar = 1;
;
	MOV	ESI,01H
;
; Line 123:		if (!mbs) {
;
	CMP	DWORD [EBP+0CH],BYTE 00H
	JNE	NEAR	L_48
;
; Line 124:			curparms = phidefaults;
;
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD _phidefaults
	MOV	EDI,DWORD _curparms
	CLD
	MOV	ECX,02H
	REP	MOVSD
	MOVSW
	MOVSB
	POP	EDI
	POP	ESI
;
; Line 125:			repeat = 0;
;
	MOV	DWORD [_repeat],00H
;
; Line 126:			return 0;
;
	MOV	EAX,00H
	JMP	L_50
L_48:
	MOV	EBX,00H
	JMP	L_53
L_51:
;
; Line 129:			*pwcs++ = cchar = parsechar(&mbs,&len);
;
	LEA	EAX,[EBP+0FFFFFFFCH]
	PUSH	EAX
	LEA	EAX,[EBP+0CH]
	PUSH	EAX
	CALL	_parsechar
	ADD	ESP,BYTE 08H
	MOV	ESI,EAX
	MOV	ECX,EDI
	ADD	EDI,BYTE 04H
	MOV	DWORD [ECX+00H],EAX
;
; Line 128:		for (i=0; (i < n-1) && ((cchar & 0xff) != 0); i++)
;
L_52:
	INC	EBX
L_53:
	MOV	EAX,DWORD [EBP+010H]
	DEC	EAX
	CMP	EBX,EAX
	JGE	SHORT	L_55
	MOVZX	EAX,DH
	TEST	EAX,EAX
	JNE	NEAR	L_51
L_55:
L_54:
;
; Line 130:		if (i < n-1)
;
	MOV	EAX,DWORD [EBP+010H]
	DEC	EAX
	CMP	EBX,EAX
	JGE	SHORT	L_56
;
; Line 131:			*pwcs++ = 0;
;
	MOV	EAX,EDI
	ADD	EDI,BYTE 04H
	MOV	DWORD [EAX+00H],00H
L_56:
;
; Line 132:		return i;
;
	MOV	EAX,EBX
L_50:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET

SECTION _DATA

_phidefaults	DB	04H,00H,0FH,00H,00H,00H,07FH
	RESB	04H
SECTION _BSS

_curparms	RESB	0BH

_repeat	RESB	04H
SECTION cstartup
	DD	_mbinit,120
