         Edinburgh IMP77 Compiler - Version 8.4
    1 %begin
				NO_APP
		.Ltext0:
				.align	2
		ONE.6006:
		.LFB187:
		.LVL12:
		 		link.w %fp,#-1024
		 		movem.l #14396,-(%sp)
    2
		 		move.l 12(%fp),-(%sp)
		 		move.l 8(%fp),-(%sp)
		 		jsr _imp_initialise
		.LVL13:
		.LBB44:
		.LBB45:
		 		clr.l _imp_OutStream
		 		move.l _imp_outfile+4,_imp_OutFile
		 		pea __PRETTY_FUNCTION__.5590
		 		jsr check_outstream
		.LVL14:
		.LBE45:
		.LBE44:
		.LBB46:
    3     ! An example program which uses a %routinespec and a call
    4     ! to the routine BEFORE actually the routine implementation
    5
    6     %routinespec css
    7
    8     selectoutput(0)
    9     printstring("start %SPEC test"); newline
		 		move.l %fp,%d3
		.LVL15:
		 		add.l #-256,%d3
		.LVL16:
		 		move.l #256,%d2
		 		move.l %d2,-(%sp)
		 		pea .LC0
		 		move.l %d3,-(%sp)
		 		lea memcpy,%a2
		 		jsr (%a2)
		.LVL17:
		 		move.l %fp,%d4
		.LVL18:
		 		add.l #-1024,%d4
		.LVL19:
		 		move.l %d2,-(%sp)
		 		move.l %d3,-(%sp)
		 		move.l %d4,-(%sp)
		 		jsr (%a2)
		.LVL20:
		 		lea (36,%sp),%sp
		 		move.l %d2,-(%sp)
		 		move.l %d4,-(%sp)
		 		move.l %d3,-(%sp)
		 		jsr (%a2)
		.LVL21:
		.LBE46:
		.LBB47:
		.LBB48:
		 		lea (-256,%sp),%sp
		 		move.l %sp,%d0
		 		move.l %d2,-(%sp)
		 		move.l %d3,-(%sp)
		 		move.l %d0,-(%sp)
		 		jsr (%a2)
		.LVL22:
		 		lea (12,%sp),%sp
		 		lea _imp_printstring,%a4
		 		jsr (%a4)
		.LVL23:
		.LBE48:
		.LBE47:
		.LBB49:
		.LBB50:
		 		lea (268,%sp),%sp
		 		lea _imp_newline,%a3
		 		jsr (%a3)
		.LVL24:
		.LBE50:
		.LBE49:
		.LBB51:
		.LBB52:
		.LBB53:
		.LBB54:
   10     css
   11     printstring("end %SPEC test"); newline
		 		add.l #-256,%d3
		 		move.l %d2,-(%sp)
		 		pea .LC1
		 		move.l %d3,-(%sp)
		 		jsr (%a2)
		.LVL27:
		 		add.l #256,%d4
		.LVL28:
		 		move.l %d2,-(%sp)
		 		move.l %d3,-(%sp)
		 		move.l %d4,-(%sp)
		 		jsr (%a2)
		.LVL29:
		 		lea (32,%sp),%sp
		 		move.l %d2,-(%sp)
		 		move.l %d4,-(%sp)
		 		move.l %d3,-(%sp)
		 		jsr (%a2)
		.LVL30:
		.LBE57:
		.LBB58:
		.LBB59:
		 		lea (-256,%sp),%sp
		 		move.l %sp,%d0
		 		move.l %d2,-(%sp)
		 		move.l %d3,-(%sp)
		 		move.l %d0,-(%sp)
		 		jsr (%a2)
		.LVL31:
		 		lea (12,%sp),%sp
		 		jsr (%a4)
		.LVL32:
		.LBE59:
		.LBE58:
		.LBB60:
		.LBB61:
		 		lea (268,%sp),%sp
		 		jsr (%a3)
		.LVL33:
		.LBE61:
		.LBE60:
		.LBB62:
		.LBB63:
		 		clr.l -(%sp)
		 		jsr exit
		.LVL34:
		.LBE63:
		.LBE62:
		.LFE185:
				.comm	CALLCOUNT.6012,4,2
				.section	.rodata
		__PRETTY_FUNCTION__.5590:
		 		.string	"_imp_SELECTOUTPUT"
		.Letext0:
   12
   13     %routine css
   14         %integer a,b,c
   15
   16         %integerfnspec three(%integer p1,p2,p3)
   17         %integerfnspec two(%integer p1,p2)
   18
   19         c = 5
   20
   21         %integerfn one(%integer p1)
		.LVL0:
		 		link.w %fp,#0
		 		movem.l #12336,-(%sp)
		 		move.l 8(%fp),%d0
		.LVL1:
   22             %integer a1,b1,c1,d1
   23             %owninteger callcount
   24
   25             %begin
   26                 a1 = p1
   27                 b1 = 2*p1
		 		move.l %d0,%d3
		 		add.l %d3,%d3
		.LVL2:
   28                 c1 = 3*p1
		 		move.l %d3,%a3
		 		add.l %d0,%a3
		.LVL3:
   29                 callcount = callcount + 1
		 		move.l CALLCOUNT.6012,%d1
		 		addq.l #1,%d1
		 		move.l %d1,CALLCOUNT.6012
		.LDL1:
   30             %end
   31
   32             ! Use callcount as a defence against repeated calls to routine 'three'
   33             ! which would cause a stack overflow.
   34             %if (callcount < 10) %then d1 = three(a1,b1,c1) %else d1 = -1
		 		moveq #9,%d2
		 		cmp.l %d1,%d2
		 		jlt .L4
		.LVL4:
		.LBB20:
		.LBB21:
   35             %result = d1
		 		jra .L1
		.LFE187:
				.section	.rodata
		.LC0:
		 		.byte	16
		 		.string	"start %SPEC test"
		 		.zero	238
		.LC1:
		 		.byte	14
		 		.string	"end %SPEC test"
		 		.zero	240
				.align	2
				.globl	main
		main:
		.LFB185:
   36         %end
		 		addq.l #8,%sp
		.L1:
		 		movem.l -16(%fp),#3084
		.LVL9:
		 		unlk %fp
		 		rts
		.LVL10:
		.L4:
   37
   38         b = 3
		 		moveq #-1,%d0
		.LVL11:
		.L2:
		.L3:
   39
   40         %integerfn three(%integer p1,p2,p3)
   41             %integer a3,b3
   42             a3 = one(p1)
		 		move.l %d0,-(%sp)
		 		lea ONE.6006,%a2
		 		jsr (%a2)
		.LVL5:
		 		move.l %d0,%d2
		.LVL6:
		.LBB22:
		.LBB23:
		 		pea 3.w
		 		lea ONE.6006,%a5
		 		jsr (%a5)
		.LVL25:
		.LBB55:
		.LBB56:
		 		pea 13.w
		 		jsr (%a5)
		.LVL26:
		.LBE56:
		.LBE55:
		.LBE54:
		.LBE53:
		.LBE52:
		.LBE51:
		.LBB57:
   43             b3 = two(p2,p3)
   44             %result = a3 + b3
		 		add.l %d2,%d0
		.LVL8:
		.LBE21:
		.LBE20:
   45         %end
   46
   47         a = three(b,c,b+c)
   48
   49         %integerfn two(%integer p1,p2)
   50             %integer a2,b2
   51
   52             %result = one(p1+p2)
		 		pea (%a3,%d3.l)
		 		jsr (%a2)
		.LVL7:
		.LBE23:
		.LBE22:
   53         %end
?B2 unused
?A2 unused
   54
   55     %end
   56
   57 %endofprogram
   39 Statements compiled
