	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
;
; Line 7:	static void subVector(int *v1, int *v2,
;
_subVector:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EBX,DWORD [EBP+01CH]
	MOV	ESI,DWORD [EBP+014H]
	MOV	EDI,DWORD [EBP+010H]
L_2:
;
; Line 9:	{
;
;
; Line 10:	*v1 = *v2 = -1;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],0FFFFFFFFH
	MOV	EAX,DWORD [EBP+08H]
	MOV	DWORD [EAX+00H],0FFFFFFFFH
;
; Line 11:	if (within(o1, t1, t2))    {
;
	CMP	DWORD [EBP+018H],EDI
	JL	SHORT	L_3
	CMP	DWORD [EBP+018H],ESI
	JG	SHORT	L_3
;
; Line 12:	*v1 = o1;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	ECX,DWORD [EBP+018H]
	MOV	DWORD [EAX+00H],ECX
;
; Line 13:	if (within(o2, t1, t2))
;
	CMP	EBX,EDI
	JL	SHORT	L_5
	CMP	EBX,ESI
	JG	SHORT	L_5
;
; Line 14:	*v2 = o2;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],EBX
	JMP	SHORT	L_6
L_5:
;
; Line 16:	*v2 = t2;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],ESI
L_6:
	JMP	SHORT	L_4
L_3:
;
; Line 18:	else if (within(o2, t1, t2))    {
;
	CMP	EBX,EDI
	JL	SHORT	L_7
	CMP	EBX,ESI
	JG	SHORT	L_7
;
; Line 19:	*v2 = o2;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],EBX
;
; Line 20:	if (within(o1, t1, t2))
;
	CMP	DWORD [EBP+018H],EDI
	JL	SHORT	L_9
	CMP	DWORD [EBP+018H],ESI
	JG	SHORT	L_9
;
; Line 21:	*v1 = o1;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	ECX,DWORD [EBP+018H]
	MOV	DWORD [EAX+00H],ECX
	JMP	SHORT	L_10
L_9:
;
; Line 23:	*v1 = t1;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	DWORD [EAX+00H],EDI
L_10:
	JMP	SHORT	L_8
L_7:
;
; Line 25:	else if (within(t1, o1, o2))    {
;
	CMP	EDI,DWORD [EBP+018H]
	JL	SHORT	L_11
	CMP	EDI,EBX
	JG	SHORT	L_11
;
; Line 26:	*v1 = t1;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	DWORD [EAX+00H],EDI
;
; Line 27:	if (within(t2, o1, o2))
;
	CMP	ESI,DWORD [EBP+018H]
	JL	SHORT	L_13
	CMP	ESI,EBX
	JG	SHORT	L_13
;
; Line 28:	*v2 = t2;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],ESI
	JMP	SHORT	L_14
L_13:
;
; Line 30:	*v2 = o2;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],EBX
L_14:
	JMP	SHORT	L_12
L_11:
;
; Line 32:	else if (within(t2, o1, o2))    {
;
	CMP	ESI,DWORD [EBP+018H]
	JL	SHORT	L_15
	CMP	ESI,EBX
	JG	SHORT	L_15
;
; Line 33:	*v2 = t2;
;
	MOV	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EAX+00H],ESI
;
; Line 34:	if (within(t1, o1, o2))
;
	CMP	EDI,DWORD [EBP+018H]
	JL	SHORT	L_17
	CMP	EDI,EBX
	JG	SHORT	L_17
;
; Line 35:	*v1 = t1;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	DWORD [EAX+00H],EDI
	JMP	SHORT	L_18
L_17:
;
; Line 37:	*v1 = o1;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	ECX,DWORD [EBP+018H]
	MOV	DWORD [EAX+00H],ECX
L_18:
L_15:
L_12:
L_8:
L_4:
;
; Line 39:	}
;
L_1:
	POP	EDI
	POP	ESI
	POP	EBX
	POP	EBP
	RET
[GLOBAL	_subRectangle]
;
; Line 43:	RECT subRectangle(RECT r1, RECT r2)
;
_subRectangle:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 014H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	LEA	ESI,[EBP-010H]
	LEA	EDI,[EBP+0CH]
	LEA	EBX,[EBP+01CH]
L_21:
;
; Line 44:	{
;
;
; Line 45:	RECT r = {0,0,0,0};
;
	LEA	EAX,[ESI+00H]
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD L_19
	MOV	EDI,EAX
	PUSH	ES
	PUSH	SS
	POP	ES
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	ES
	POP	EDI
	POP	ESI
;
; Line 46:	subVector((int *) &RectLeft(r), (int *) &RectRight(r),
;
	PUSH	DWORD [SS:EBX+08H]
	PUSH	DWORD [SS:EBX+00H]
	PUSH	DWORD [SS:EDI+08H]
	PUSH	DWORD [SS:EDI+00H]
	MOV	EAX,ESI
	ADD	EAX,BYTE 08H
	PUSH	EAX
	PUSH	ESI
	CALL	_subVector
	ADD	ESP,BYTE 018H
;
; Line 49:	subVector((int *) &RectTop(r), (int *) &RectBottom(r),
;
	PUSH	DWORD [SS:EBX+0CH]
	PUSH	DWORD [SS:EBX+04H]
	PUSH	DWORD [SS:EDI+0CH]
	PUSH	DWORD [SS:EDI+04H]
	MOV	EAX,ESI
	ADD	EAX,BYTE 0CH
	PUSH	EAX
	MOV	EAX,ESI
	ADD	EAX,BYTE 04H
	PUSH	EAX
	CALL	_subVector
	ADD	ESP,BYTE 018H
;
; Line 52:	if (RectRight(r) == -1 || RectTop(r) == -1)
;
	CMP	DWORD [SS:ESI+08H],BYTE 0FFFFFFFFH
	JE	SHORT	L_24
	CMP	DWORD [SS:ESI+04H],BYTE 0FFFFFFFFH
	JNE	SHORT	L_22
L_24:
;
; Line 53:	RectRight(r) =
;
	MOV	DWORD [SS:ESI+0CH],00H
	MOV	DWORD [SS:ESI+04H],00H
	MOV	DWORD [SS:ESI+00H],00H
	MOV	DWORD [SS:ESI+08H],00H
L_22:
;
; Line 57:	return r;
;
	MOV	EAX,DWORD [EBP+08H]
	PUSH	ESI
	PUSH	EDI
	LEA	EDI,[EAX+00H]
	PUSH	DS
	PUSH	SS
	PUSH	SS
	POP	ES
	POP	DS
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	DS
	POP	EDI
	POP	ESI
	MOV	EAX,DWORD [EBP+08H]
L_20:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_ClientRect]
;
; Line 61:	RECT ClientRect(void *wnd)
;
_ClientRect:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 014H
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+0CH]
	LEA	EDI,[EBP-010H]
L_26:
;
; Line 62:	{
;
;
; Line 65:	RectLeft(rc) = GetClientLeft((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,04000H
	JE	SHORT	L_27
	MOV	EAX,01H
	JMP	SHORT	L_28
L_27:
	MOV	EAX,00H
L_28:
	ADD	EAX,DWORD [ESI+0CH]
	MOV	DWORD [SS:EDI+00H],EAX
;
; Line 66:	RectTop(rc) = GetClientTop((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,0100H
	JE	SHORT	L_29
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,BYTE 08H
	JE	SHORT	L_29
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,010000H
	JE	SHORT	L_29
	MOV	EAX,03H
	JMP	SHORT	L_30
L_29:
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,0100H
	JE	SHORT	L_34
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,BYTE 08H
	JNE	SHORT	L_33
L_34:
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,0100H
	JE	SHORT	L_31
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,010000H
	JE	SHORT	L_31
L_33:
	MOV	EAX,02H
	JMP	SHORT	L_32
L_31:
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,014108H
	JE	SHORT	L_35
	MOV	EAX,01H
	JMP	SHORT	L_36
L_35:
	MOV	EAX,00H
L_36:
L_32:
L_30:
	ADD	EAX,DWORD [ESI+010H]
	MOV	DWORD [SS:EDI+04H],EAX
;
; Line 67:	RectRight(rc) = GetClientRight((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,04000H
	JE	SHORT	L_37
	MOV	EAX,01H
	JMP	SHORT	L_38
L_37:
	MOV	EAX,00H
L_38:
	MOV	ECX,DWORD [ESI+014H]
	SUB	ECX,EAX
	MOV	DWORD [SS:EDI+08H],ECX
;
; Line 68:	RectBottom(rc) = GetClientBottom((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,08000H
	JE	SHORT	L_39
	MOV	EAX,01H
	JMP	SHORT	L_40
L_39:
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,04000H
	JE	SHORT	L_41
	MOV	EAX,01H
	JMP	SHORT	L_42
L_41:
	MOV	EAX,00H
L_42:
L_40:
	MOV	ECX,DWORD [ESI+018H]
	SUB	ECX,EAX
	MOV	DWORD [SS:EDI+0CH],ECX
;
; Line 69:	return rc;
;
	MOV	EAX,DWORD [EBP+08H]
	PUSH	ESI
	PUSH	EDI
	LEA	ESI,[EDI+00H]
	LEA	EDI,[EAX+00H]
	PUSH	DS
	PUSH	SS
	PUSH	SS
	POP	ES
	POP	DS
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	DS
	POP	EDI
	POP	ESI
	MOV	EAX,DWORD [EBP+08H]
L_25:
	POP	EDI
	POP	ESI
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_RelativeWindowRect]
;
; Line 74:	RECT RelativeWindowRect(void *wnd, RECT rc)
;
_RelativeWindowRect:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+0CH]
	LEA	EDI,[EBP+010H]
L_44:
;
; Line 75:	{
;
;
; Line 76:	RectLeft(rc) -= GetLeft((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+0CH]
	SUB	DWORD [SS:EDI+00H],EAX
;
; Line 77:	RectRight(rc) -= GetLeft((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+0CH]
	SUB	DWORD [SS:EDI+08H],EAX
;
; Line 78:	RectTop(rc) -= GetTop((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+010H]
	SUB	DWORD [SS:EDI+04H],EAX
;
; Line 79:	RectBottom(rc) -= GetTop((WINDOW)wnd);
;
	MOV	EAX,DWORD [ESI+010H]
	SUB	DWORD [SS:EDI+0CH],EAX
;
; Line 80:	return rc;
;
	MOV	EAX,DWORD [EBP+08H]
	PUSH	ESI
	PUSH	EDI
	LEA	ESI,[EDI+00H]
	LEA	EDI,[EAX+00H]
	PUSH	DS
	PUSH	SS
	PUSH	SS
	POP	ES
	POP	DS
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	DS
	POP	EDI
	POP	ESI
	MOV	EAX,DWORD [EBP+08H]
L_43:
	POP	EDI
	POP	ESI
	POP	EBP
	RET
[GLOBAL	_ClipRectangle]
;
; Line 84:	RECT ClipRectangle(void *wnd, RECT rc)
;
_ClipRectangle:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 034H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+0CH]
	LEA	EDI,[EBP-030H]
	LEA	EBX,[EBP+010H]
L_46:
;
; Line 85:	{
;
;
; Line 87:	RectLeft(sr) = RectTop(sr) = 0;
;
	MOV	DWORD [SS:EDI+04H],00H
	MOV	DWORD [SS:EDI+00H],00H
;
; Line 88:	RectRight(sr) = SCREENWIDTH-1;
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	EDX,ECX
	MOV	FS,DX
	MOVSX	EAX,BYTE [FS:EAX+00H]
	MOVZX	EAX,AL
	DEC	EAX
	MOV	DWORD [SS:EDI+08H],EAX
;
; Line 89:	RectBottom(sr) = SCREENHEIGHT-1;
;
	CALL	_isVGA
	TEST	EAX,EAX
	JNE	SHORT	L_49
	CALL	_isEGA
	TEST	EAX,EAX
	JE	SHORT	L_47
L_49:
	MOV	EAX,084H
	MOVZX	ECX,WORD [___seg0040]
	MOV	EDX,ECX
	MOV	FS,DX
	MOVSX	EAX,BYTE [FS:EAX+00H]
	INC	EAX
	JMP	SHORT	L_48
L_47:
	MOV	EAX,019H
L_48:
	DEC	EAX
	MOV	DWORD [SS:EDI+0CH],EAX
;
; Line 90:	if (!TestAttribute((WINDOW)wnd, NOCLIP))
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,0800H
	JNE	SHORT	L_50
	JMP	SHORT	L_52
L_54:
;
; Line 92:	rc = subRectangle(rc, ClientRect(wnd));
;
	PUSH	ESI
	LEA	EAX,[EBP-020H]
	PUSH	EAX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	PUSH	DWORD [EAX+00H+0CH]
	PUSH	DWORD [EAX+00H+08H]
	PUSH	DWORD [EAX+00H+04H]
	PUSH	DWORD [EAX+00H+00H]
	PUSH	DWORD [SS:EBX+00H+0CH]
	PUSH	DWORD [SS:EBX+00H+08H]
	PUSH	DWORD [SS:EBX+00H+04H]
	PUSH	DWORD [SS:EBX+00H+00H]
	PUSH	EBX
	CALL	_subRectangle
	ADD	ESP,BYTE 024H
L_52:
;
; Line 91:	while ((wnd = GetParent((WINDOW)wnd)) != NULL)
;
	MOV	ESI,DWORD [ESI+03CH]
	TEST	ESI,ESI
	JNE	SHORT	L_54
L_53:
L_50:
;
; Line 93:	return subRectangle(rc, sr);
;
	PUSH	DWORD [SS:EDI+00H+0CH]
	PUSH	DWORD [SS:EDI+00H+08H]
	PUSH	DWORD [SS:EDI+00H+04H]
	PUSH	DWORD [SS:EDI+00H+00H]
	PUSH	DWORD [SS:EBX+00H+0CH]
	PUSH	DWORD [SS:EBX+00H+08H]
	PUSH	DWORD [SS:EBX+00H+04H]
	PUSH	DWORD [SS:EBX+00H+00H]
	LEA	EAX,[EBP-010H]
	PUSH	EAX
	CALL	_subRectangle
	ADD	ESP,BYTE 024H
	MOV	ECX,EAX
	MOV	EAX,DWORD [EBP+08H]
	PUSH	ESI
	PUSH	EDI
	LEA	ESI,[ECX+00H]
	LEA	EDI,[EAX+00H]
	PUSH	SS
	POP	ES
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	EDI
	POP	ESI
	MOV	EAX,DWORD [EBP+08H]
L_45:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
SECTION _DATA

L_19	DD	00H,00H,00H,00H
SECTION _CONST

SECTION _TEXT
[EXTERN	_isEGA]
[EXTERN	_isVGA]
[EXTERN	___seg0040]
