.globl	stkarg
.globl	saexit
	.text
				.globl	mkroom
mkroom:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	pvnum,r1
	asl	r1
	mov	r1,temp
	mov	pvarpt,r1
	sub	temp,r1
	mov	r1,ndefpt
	mov	idlen,r1
	jsr	pc,bumpff
	mov	ndefpt,r1
	mov	r1,srcpt
	add	idlen,r1
	mov	r1,dstpt
	mov	ffpt,r1
	sub	ndefpt,r1
	sub	idlen,r1
	jsr	pc,_bmove
	mov	stakpt,dbugpt
mkloop:	mov	dbugpt,r1
	mov	16.(r1),r1
	mov	r1,tempsw
	cmp	r1,$1.
	jeq	mrmac
	mov	dbugpt,r1
	add	$8.,r1
	mov	r1,tempt
	jsr	pc,corect
	mov	dbugpt,r1
	add	$28.,r1
	mov	r1,tempt
	jsr	pc,corect
	tst	tempsw
	jeq	mrexit
	mov	dbugpt,r1
	add	$24.,r1
	mov	r1,tempt
	jsr	pc,corect
	cmp	tempsw,$2.
	jne	mkr1
	mov	dbugpt,r1
	mov	6.(r1),tempt
	jbr	mkr2
mkr1:	mov	dbugpt,r1
	mov	2.(r1),dbugpt
	jbr	mkloop
mrmac:	mov	dbugpt,r1
	mov	4.(r1),tempt
mkr2:
	sub	$2.,tempt
	tst	*tempt
	jeq	mkr1
	jsr	pc,corect
	jbr	mkr2
mrexit:
	add	idlen,pvarpt
	add	idlen,inffpt
	jmp	*9b
				.globl	opexit
opexit:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	jsr	pc,unopdb
	jsr	pc,unsdb
	jmp	*9b
				.globl	prarg
prarg:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	mhshpt,hashpt
	jsr	pc,setpts
	mov	idpt,r1
	dec	r1
	mov	r1,spt
	mov	idpt,r1
	add	idlen,r1
	mov	r1,stoppt
	mov	insw,r1
	bic	$177777-6.,r1
	mov	r1,dbugsw
	cmp	r1,insw
	jeq	prgex
/delete spaces
	jsr	pc,gsatom
	jmp	prgex
	mov	idpt,r1
	dec	r1
	mov	r1,spt
prg1:
	dec	stoppt
	cmpb	*stoppt,$sprep
	jeq	prg1
	inc	stoppt
prgex:	jsr	pc,prscan
	jmp	*9b
				.globl	prscan
prscan:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	clr	ohsw
	clr	skval
	mov	$1.,linect
	clr	labpt
	jmp	*9b
				.globl	ressp
ressp:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	bespt,spt
	clr	bespt
	cmp	bindic,exclmk
	jeq	resex
	mov	beslin,linect
	tst	bindic
	jeq	resret
	jmp	*9b
/exclusive delimiter
resex:	clr	idlen
	clr	bindic
	mov	idpt,r1
	dec	r1
	mov	r1,spt
	cmpb	*idpt,$nlrep
	jne	resret
	dec	linect
resret:	add	$4*1.,9b
	jmp	*9b
				.globl	sbstpl
sbstpl:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	clr	bestpl
	tst	oplev
	jeq	gl23
	mov	$8.,bestpl
gl23:
	tst	skval
	jeq	gl24
	mov	$6.,bestpl
gl24:	jmp	*9b
				.globl	setpts
setpts:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	argno,r1
	mul	$4.,r1
	mov	r1,temp
	cmp	insw,$6.
	jne	gl25
	add	$2.,temp
gl25:	mov	dbugpt,r1
	sub	temp,r1
	mov	(r1),idpt
	mov	dbugpt,r1
	sub	temp,r1
	sub	$2.,r1
	mov	(r1),r1
	sub	idpt,r1
	mov	r1,idlen
	jmp	*9b
				.globl	sklab
sklab:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	labpt,chanpt
skloop:
	tst	chanpt
	jne	gl26
	add	$4*1.,9b
	jmp	*9b
gl26:	mov	chanpt,r1
	cmp	2.(r1),meval
	jne	el9
	add	$4.,chanpt
	jmp	*9b
el9:
	mov	*chanpt,chanpt
	jbr	skloop
				.globl	smsksw
smsksw:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	hashpt,r1
	mov	72.(r1),r1
	com	glbwsw
	bic	glbwsw,r1
	com	glbwsw
	mov	r1,masksw
	jmp	*9b
				.globl	stkhsh
stkhsh:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$1.,ohsw
	mov	$74.,r1
	jsr	pc,declf
	mov	hashpt,srcpt
	mov	lfpt,r1
	mov	r1,hashpt
	mov	r1,dstpt
	mov	$74.,r1
	jsr	pc,_fmove
	jmp	*9b
				.globl	subchk
subchk:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	meval,r1
	/mul	$1.,r1*****
	mov	r1,meval
	cmp	r1,optyp
	jgt	subnul
	tst	meval
	jgt	gl27
	add	optyp,meval
gl27:
	cmp	meval,sqnum
	jle	subnul
	jmp	*9b
/mcsub has null value
subnul:	clr	idlen
/go to label in code to perform insert
	jbr	fnctex
				.globl	tesdel
tesdel:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$6.,insw
	jsr	pc,setpts
	clr	meval
	mov	parnm,r1
	jsr	pc,loschn
	jmp	macerr
chn4:	mov	chanpt,r1
	jsr	pc,cmpare
	jmp	tdcnt
	jmp	*9b
tdcnt:	inc	meval
	jsr	pc,loechn
	jmp	chn4
	jbr	macerr
				.globl	tebest
tebest:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	idpt,tidpt
	mov	spt,tspt
	mov	linect,tlinct
	mov	idlen,r1
	inc	r1
	bic	$1,r1
	mov	r1,idlen
	mov	infopt,r1
	sub	idlen,r1
	sub	$4.,r1
	mov	r1,fndpt
tbswit:
	cmp	*infopt,spcsmk
	jne	el10
	add	$2.,infopt
	jsr	pc,gargch
	jmp	tbsw1
tbsw1:
	dec	spt
el10:	mov	infopt,r1
	jsr	pc,tewith
	jmp	tbwith
	cmp	indic,exclmk
	jne	tb1
/exclusive delimiter
	cmp	bindic,exclmk
	jne	tb3
	jbr	tb2
/not exclusive delimiter
tb1:
	cmp	bindic,exclmk
	jeq	tebex
tb2:
	cmp	bespt,spt
	jhis	tebex
tb3:
	tst	htabpt
	jne	el11
/secondary delimiter case
	mov	$5.,bestpl
	jbr	update
el11:	add	$2.,infopt
	tst	*infopt
	jne	notstp
/case of stop marker
	tst	level
	jne	tebex
	tst	skval
	jne	gl29
	tst	skiplv
	jeq	tebex
gl29:
	mov	$9.,bestpl
	jbr	update
notstp:	mov	*infopt,r1
	com	masksw
	bic	masksw,r1
	com	masksw
	mov	r1,tempsw
	tst	r1
	jeq	tebex
	mov	*infopt,r1
	mov	r1,type
	cmp	r1,$3.
	jne	gl30
	cmp	masksw,$1.
	jeq	tebex
gl30:	mov	chanpt,r1
	jsr	pc,ckvaly
	jmp	tebex
	add	$2.,infopt
	mov	type,bestpl
update:
	mov	fndpt,bfndpt
	mov	infopt,binfpt
	mov	indic,bindic
	mov	spt,bespt
	mov	linect,beslin
tebex:
	mov	tidpt,idpt
	mov	tspt,r1
	mov	r1,spt
	sub	idpt,r1
	inc	r1
	mov	r1,idlen
	mov	tlinct,linect
	jmp	*9b
/composite name
tbwith:	jsr	pc,advnce
	jmp	tebex
	dec	spt
	jsr	pc,gtatom
	cmpb	*idpt,$sprep
	jne	gl31
	cmp	indic,wthsmk
	jeq	tbwith
gl31:	mov	infopt,r1
	jsr	pc,cmpare
	jmp	tebex
	jbr	tbswit
				.globl	tewith
tewith:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	*parnm,r1
	mov	r1,indic
	cmp	r1,withmk
	jeq	gl32
	cmp	indic,wthsmk
	jne	gl33
gl32:	jmp	*9b
gl33:	add	$4*1.,9b
	jmp	*9b
				.globl	unopdb
unopdb:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	inffpt,ffpt
	dec	level
	mov	oplev,r1
	dec	r1
	mov	r1,oplev
	tst	r1
	jne	gl34
	jmp	*9b
gl34:	mov	topspt,r1
	mov	r1,tempt
	mov	r1,srcpt
	mov	$topspt,dstpt
	mov	$18.,r1
	jsr	pc,_fmove
	mov	tempt,r1
	add	$18.,r1
	mov	r1,lfpt
	jmp	*9b
				.globl	unsdb
unsdb:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	cmp	dbugsw,$1.
	jne	gl35
	dec	level
gl35:	mov	stakpt,r1
	mov	r1,tempt
	mov	r1,srcpt
	mov	$argct,dstpt
	mov	$36.,r1
	jsr	pc,_fmove
	mov	tempt,r1
	add	$36.,r1
	mov	r1,lfpt
/delete text of call if in source text
	tst	level
	jne	unsdex
	inc	spt
	mov	ffpt,r1
	sub	spt,r1
	mov	r1,temp
	tst	r1
	jeq	gl36
	mov	spt,srcpt
	mov	inffpt,dstpt
	mov	temp,r1
	jsr	pc,_fmove
gl36:	mov	inffpt,r1
	dec	r1
	mov	r1,spt
	mov	inffpt,r1
	add	temp,r1
	mov	r1,ffpt
unsdex:	jmp	*9b
/the linkroutine
				.globl	stkarg
stkarg:	mov	(sp)+,linkpt
	mov	$3.,insw
	jsr	pc,prarg
	clr	arglen
	jbr	bsnext
/when arg has been stacked control returns here
saexit:
	mov	topspt,lfpt
	mov	ffpt,r1
	mov	r1,stoppt
	sub	arglen,r1
	mov	r1,eriapt
	dec	r1
	mov	r1,spt
	mov	$5.,dbugsw
	jmp	*linkpt
/input 453,output 361, 19.2% optimalized
