	.MODEL tiny, pascal, os_dos
	.486
	.CODE

	EXTRN putchar:NEAR
	EXTRN putstr:NEAR
	EXTRN puthex:NEAR
	EXTRN putword:NEAR
	EXTRN putint:NEAR
	EXTRN putcrlf:NEAR
	EXTRN getchar:NEAR
	EXTRN getch:NEAR
	EXTRN halt:NEAR
	EXTRN strlen:NEAR
	EXTRN getstr:NEAR

print	PROC NEAR
	LOCAL i:WORD

				; Line 15, Column 6
	mov	ax, 0
	mov	[i], ax
	mov	ax, 8
	push	ax
	mov	ax, 1
	pop	bx
	xchg	ax, bx
	sub	ax, bx
_For1:
	cmp	ax, [i]
	jc	_EndFor1
	push	ax
				; Line 16, Column 11
	mov	ax, [i]
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	push	ax
	call	putint
				; Line 17, Column 12
	mov	ax, 9
	push	ax
	call	putchar
_Next1:	inc	[i]
	pop	ax
	jmp	_For1
_EndFor1:
				; Line 19, Column 10
	call	putcrlf
_Exit:	ret
print	ENDP

sortup	PROC NEAR
	LOCAL i:WORD
	LOCAL t:WORD
	LOCAL flag:WORD

				; Line 25, Column 7
	mov	ax, 1
	mov	[flag], ax
				; Line 26, Column 8
_Next2:
	mov	ax, [flag]
	cmp	ax, 0
	jz	_WEnd2
				; Line 27, Column 9
	mov	ax, 0
	mov	[flag], ax
				; Line 28, Column 8
	mov	ax, 0
	mov	[i], ax
	mov	ax, 8
	push	ax
	mov	ax, 2
	pop	bx
	xchg	ax, bx
	sub	ax, bx
_For3:
	cmp	ax, [i]
	jc	_EndFor3
	push	ax
				; Line 29, Column 9
	mov	ax, [i]
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	push	ax
	mov	ax, [i]
	push	ax
	mov	ax, 1
	pop	bx
	add	ax, bx
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	pop	bx
	cmp	ax, bx
	setc	al
	xor	ah, ah
	cmp	ax, 0
	jz	_Else1
				; Line 30, Column 13
	mov	ax, 1
	mov	[flag], ax
				; Line 31, Column 10
	mov	ax, [i]
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	mov	[t], ax
				; Line 32, Column 10
	mov	ax, [i]
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	push	bx
	mov	ax, [i]
	push	ax
	mov	ax, 1
	pop	bx
	add	ax, bx
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	pop	bx
	mov	[bx], ax
				; Line 33, Column 10
	mov	ax, [i]
	push	ax
	mov	ax, 1
	pop	bx
	add	ax, bx
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	push	bx
	mov	ax, [t]
	pop	bx
	mov	[bx], ax
_Else1:
_EndIf1:
_Next3:	inc	[i]
	pop	ax
	jmp	_For3
_EndFor3:
	jmp	_Next2
_WEnd2:
_Exit:	ret
sortup	ENDP

sortdown	PROC NEAR
	LOCAL i:WORD
	LOCAL t:WORD
	LOCAL flag:WORD

				; Line 42, Column 7
	mov	ax, 1
	mov	[flag], ax
				; Line 43, Column 8
_Next4:
	mov	ax, [flag]
	cmp	ax, 0
	jz	_WEnd4
				; Line 44, Column 9
	mov	ax, 0
	mov	[flag], ax
				; Line 45, Column 8
	mov	ax, 0
	mov	[i], ax
	mov	ax, 8
	push	ax
	mov	ax, 2
	pop	bx
	xchg	ax, bx
	sub	ax, bx
_For5:
	cmp	ax, [i]
	jc	_EndFor5
	push	ax
				; Line 46, Column 9
	mov	ax, [i]
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	push	ax
	mov	ax, [i]
	push	ax
	mov	ax, 1
	pop	bx
	add	ax, bx
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	pop	bx
	cmp	bx, ax
	setc	al
	xor	ah, ah
	cmp	ax, 0
	jz	_Else2
				; Line 47, Column 13
	mov	ax, 1
	mov	[flag], ax
				; Line 48, Column 10
	mov	ax, [i]
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	mov	[t], ax
				; Line 49, Column 10
	mov	ax, [i]
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	push	bx
	mov	ax, [i]
	push	ax
	mov	ax, 1
	pop	bx
	add	ax, bx
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	mov	ax, [bx]
	pop	bx
	mov	[bx], ax
				; Line 50, Column 10
	mov	ax, [i]
	push	ax
	mov	ax, 1
	pop	bx
	add	ax, bx
	shl	ax, 1
	add	ax, OFFSET m
	mov	bx, ax
	push	bx
	mov	ax, [t]
	pop	bx
	mov	[bx], ax
_Else2:
_EndIf2:
_Next5:	inc	[i]
	pop	ax
	jmp	_For5
_EndFor5:
	jmp	_Next4
_WEnd4:
_Exit:	ret
sortdown	ENDP

main	PROC NEAR
				; Line 57, Column 8
	call	print
				; Line 58, Column 9
	call	sortup
				; Line 59, Column 8
	call	print
				; Line 60, Column 11
	call	sortdown
				; Line 61, Column 8
	call	print
_Exit:	ret
main	ENDP
	PUBLIC main

	INCLUDE var.asm

	END
