	SECTION _TEXT align=1 CLASS=CODE USE32
	SECTION _DATA align=16 CLASS=DATA USE32
	SECTION _BSS align=16 CLASS=BSS USE32
	SECTION _CONST align=16 CLASS=CONST USE32
	SECTION _STRING align=4 CLASS=STRING USE32
	SECTION cstartup align=4 CLASS=INITDATA USE32
	SECTION crundown align=4 CLASS=EXITDATA USE32
	SECTION cppinit  align=4 CLASS=CPPINIT USE32
	SECTION cppexit  align=4 CLASS=CPPEXIT USE32
	GROUP DGROUP _DATA _BSS _CONST _STRING

SECTION _TEXT
[GLOBAL	_OpenHelpFile]
;
; Line 21:	FILE *OpenHelpFile(const char *fn, const char *md)
;
_OpenHelpFile:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 050H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD _fi
	MOV	EDI,DWORD _HelpTree
L_3:
;
; Line 22:	{
;
;
; Line 28:	BuildFileName(helpname, fn, ".hlp");
;
	PUSH	DWORD L_1
	PUSH	DWORD [EBP+08H]
	LEA	EAX,[EBP-044H]
	PUSH	EAX
	CALL	_BuildFileName
	ADD	ESP,BYTE 0CH
;
; Line 29:	if ((fi = fopen(helpname, md)) == NULL)
;
	PUSH	DWORD [EBP+0CH]
	LEA	EAX,[EBP-044H]
	PUSH	EAX
	CALL	_fopen
	ADD	ESP,BYTE 08H
	MOV	DWORD [ESI+00H],EAX
	TEST	EAX,EAX
	JNE	SHORT	L_4
;
; Line 30:	return NULL;
;
	MOV	EAX,00H
	JMP	NEAR	L_2
L_4:
;
; Line 31:	if (HelpTree == NULL)	{
;
	CMP	DWORD [EDI+00H],BYTE 00H
	JNE	NEAR	L_6
;
; Line 33:	fread(&bytectr, sizeof bytectr, 1, fi);
;
	PUSH	DWORD [ESI+00H]
	PUSH	BYTE 01H
	PUSH	BYTE 04H
	PUSH	DWORD _bytectr
	CALL	_fread
	ADD	ESP,BYTE 010H
;
; Line 35:	fread(&treect, sizeof treect, 1, fi);
;
	PUSH	DWORD [ESI+00H]
	PUSH	BYTE 01H
	PUSH	BYTE 04H
	LEA	EAX,[EBP-048H]
	PUSH	EAX
	CALL	_fread
	ADD	ESP,BYTE 010H
;
; Line 37:	fread(&root, sizeof root, 1, fi);
;
	PUSH	DWORD [ESI+00H]
	PUSH	BYTE 01H
	PUSH	BYTE 04H
	PUSH	DWORD _root
	CALL	_fread
	ADD	ESP,BYTE 010H
;
; Line 38:	HelpTree = calloc(treect-256, sizeof(struct htr));
;
	PUSH	BYTE 08H
	MOV	EAX,DWORD [EBP-048H]
	SUB	EAX,0100H
	PUSH	EAX
	CALL	_calloc
	ADD	ESP,BYTE 08H
	MOV	DWORD [EDI+00H],EAX
;
; Line 39:	if (HelpTree != NULL)	{
;
	CMP	DWORD [EDI+00H],BYTE 00H
	JE	SHORT	L_8
	MOV	EBX,00H
	JMP	SHORT	L_12
L_10:
;
; Line 42:	fread(&HelpTree[i].left,  sizeof(int), 1, fi);
;
	PUSH	DWORD [ESI+00H]
	PUSH	BYTE 01H
	PUSH	BYTE 04H
	MOV	EAX,EBX
	SHL	EAX,03H
	ADD	EAX,DWORD [EDI+00H]
	ADD	EAX,BYTE 04H
	PUSH	EAX
	CALL	_fread
	ADD	ESP,BYTE 010H
;
; Line 43:	fread(&HelpTree[i].right, sizeof(int), 1, fi);
;
	PUSH	DWORD [ESI+00H]
	PUSH	BYTE 01H
	PUSH	BYTE 04H
	MOV	EAX,EBX
	SHL	EAX,03H
	ADD	EAX,DWORD [EDI+00H]
	PUSH	EAX
	CALL	_fread
	ADD	ESP,BYTE 010H
;
; Line 41:	for (i = 0; i < treect-256; i++)    {
;
L_11:
	INC	EBX
L_12:
	MOV	EAX,DWORD [EBP-048H]
	SUB	EAX,0100H
	CMP	EBX,EAX
	JL	SHORT	L_10
L_13:
L_8:
L_6:
;
; Line 47:	return fi;
;
	MOV	EAX,DWORD [ESI+00H]
L_2:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_GetHelpLine]
;
; Line 51:	void *GetHelpLine(char *line)
;
_GetHelpLine:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+08H]
	MOV	EDI,DWORD _in8
L_15:
;
; Line 52:	{
;
;
; Line 54:	*line = '\0';
;
	MOV	BYTE [ESI+00H],00H
	JMP	NEAR	L_16
L_18:
;
; Line 57:	h = root;
;
	MOV	EBX,DWORD [_root]
	JMP	SHORT	L_19
L_21:
;
; Line 61:	if (ct8 == 8)   {
;
	CMP	DWORD [_ct8],BYTE 08H
	JNE	SHORT	L_22
;
; Line 63:	if ((in8 = fgetc(fi)) == EOF)    {
;
	PUSH	DWORD [_fi]
	CALL	_fgetc
	POP	ECX
	MOV	DWORD [EDI+00H],EAX
	CMP	EAX,BYTE 0FFFFFFFFH
	JNE	SHORT	L_24
;
; Line 64:	*line = '\0';
;
	MOV	BYTE [ESI+00H],00H
;
; Line 65:	return NULL;
;
	MOV	EAX,00H
	JMP	SHORT	L_14
L_24:
;
; Line 67:	ct8 = 0;
;
	MOV	DWORD [_ct8],00H
L_22:
;
; Line 70:	if (in8 & 0x80)
;
	MOV	EAX,DWORD [EDI+00H]
	AND	EAX,080H
	JE	SHORT	L_26
;
; Line 71:	h = HelpTree[h-256].left;
;
	MOV	EAX,DWORD [_HelpTree]
	MOV	ECX,EBX
	SUB	ECX,0100H
	LEA	EAX,[EAX+ECX*8+00H]
	MOV	EBX,DWORD [EAX+04H]
	JMP	SHORT	L_27
L_26:
;
; Line 73:	h = HelpTree[h-256].right;
;
	MOV	EAX,DWORD [_HelpTree]
	MOV	ECX,EBX
	SUB	ECX,0100H
	MOV	EBX,DWORD [EAX+ECX*8+00H]
L_27:
;
; Line 75:	in8 <<= 1;
;
	SAL	DWORD [EDI+00H],01H
;
; Line 76:	ct8++;
;
	INC	DWORD [_ct8]
L_19:
;
; Line 59:	while (h > 255)    {
;
	CMP	EBX,0FFH
	JG	SHORT	L_21
L_20:
;
; Line 79:	if (h == '\r')
;
	CMP	EBX,BYTE 0DH
	JE	SHORT	L_16
;
; Line 80:	continue;     
;
L_28:
;
; Line 82:	*line++ = h;
;
	MOV	EAX,ESI
	INC	ESI
	MOV	BYTE [EAX+00H],BL
;
; Line 84:	if (h == '\n')
;
	CMP	EBX,BYTE 0AH
	JE	SHORT	L_17
;
; Line 85:	break;
;
L_30:
L_16:
;
; Line 55:	while (TRUE)    {
;
	JMP	NEAR	L_18
L_17:
;
; Line 87:	*line = '\0';     
;
	MOV	BYTE [ESI+00H],00H
;
; Line 88:	return line;
;
	MOV	EAX,ESI
L_14:
	POP	EDI
	POP	ESI
	POP	EBX
	POP	EBP
	RET
[GLOBAL	_HelpFilePosition]
;
; Line 92:	void HelpFilePosition(long *offset, int *bit)
;
_HelpFilePosition:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	ESI
	MOV	ESI,DWORD [EBP+08H]
L_33:
;
; Line 93:	{
;
;
; Line 94:	*offset = ftell(fi);
;
	PUSH	DWORD [_fi]
	CALL	_ftell
	POP	ECX
	MOV	DWORD [ESI+00H],EAX
;
; Line 95:	if (ct8 < 8)
;
	CMP	DWORD [_ct8],BYTE 08H
	JGE	SHORT	L_34
;
; Line 96:	--*offset;
;
	DEC	DWORD [ESI+00H]
L_34:
;
; Line 97:	*bit = ct8;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	ECX,DWORD [_ct8]
	MOV	DWORD [EAX+00H],ECX
;
; Line 98:	}
;
L_32:
	POP	ESI
	POP	EBP
	RET
[GLOBAL	_SeekHelpLine]
;
; Line 101:	void SeekHelpLine(long offset, int bit)
;
_SeekHelpLine:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	MOV	EBX,DWORD [EBP+0CH]
L_40:
;
; Line 102:	{
;
;
; Line 103:	int fs = fseek(fi, offset, 0);
;
	PUSH	BYTE 00H
	PUSH	DWORD [EBP+08H]
	PUSH	DWORD [_fi]
	CALL	_fseek
	ADD	ESP,BYTE 0CH
	MOV	ESI,EAX
;
; Line 104:	assert(fs == 0);
;
	TEST	ESI,ESI
	JNE	SHORT	L_41
	MOV	EAX,00H
	JMP	SHORT	L_42
L_41:
	PUSH	DWORD L_38
	PUSH	BYTE 00H
	PUSH	BYTE 068H
	PUSH	DWORD L_37
	PUSH	DWORD L_36
	CALL	___assertfail
	ADD	ESP,BYTE 014H
L_42:
;
; Line 105:	ct8 = bit;
;
	MOV	DWORD [_ct8],EBX
;
; Line 106:	if (ct8 < 8)    {
;
	CMP	DWORD [_ct8],BYTE 08H
	JGE	SHORT	L_43
;
; Line 107:	in8 = fgetc(fi);
;
	PUSH	DWORD [_fi]
	CALL	_fgetc
	POP	ECX
	MOV	DWORD [_in8],EAX
;
; Line 108:	in8 <<= bit;
;
	MOV	ECX,EBX
	SAL	DWORD [_in8],CL
L_43:
;
; Line 110:	}
;
L_39:
	POP	ESI
	POP	EBX
	POP	EBP
	RET
SECTION _STRING
L_38:
	DB	066H,073H,020H,03DH,03DH,020H,030H,00H
L_37:
	DB	043H,03AH,05CH,074H,06FH,06FH,06CH,073H,05CH,063H,063H,05CH
	DB	064H,066H,06CH,061H,074H,05CH,064H,066H,06CH,061H,074H,05CH
	DB	044H,045H,043H,04FH,04DH,050H,02EH,043H,00H
L_36:
	DB	041H,073H,073H,065H,072H,074H,069H,06FH,06EH,020H,066H,061H
	DB	069H,06CH,065H,064H,00H
L_1:
	DB	02EH,068H,06CH,070H,00H
SECTION _DATA

_ct8	DD	08H
SECTION _BSS

_in8	RESB	04H

_fi	RESB	04H

_bytectr	RESB	04H
[GLOBAL	_HelpTree]

_HelpTree	RESB	04H

_root	RESB	04H
SECTION _CONST

SECTION _TEXT
[EXTERN	_BuildFileName]
[EXTERN	_ftell]
[EXTERN	_calloc]
[EXTERN	_fread]
[EXTERN	_fseek]
[EXTERN	_fgetc]
[EXTERN	_fopen]
[EXTERN	___assertfail]
