         Edinburgh IMP77 Compiler - Version 8.4
    1 %begin
		.Ltext0:
				.align	2
		ONE.7709:
		.LFB187:
		.LVL13:
				sub	sp, sp, #1344
				stp	x29, x30, [sp]
				add	x29, sp, 0
				stp	x19, x20, [sp, 16]
				stp	x21, x22, [sp, 32]
				adrp	x2, :got:__stack_chk_guard
				ldr	x2, [x2, #:got_lo12:__stack_chk_guard]
				ldr	x3, [x2]
				str	x3, [x29, 1336]
				mov	x3,0
    2
				bl	_imp_initialise
		.LVL14:
		.LBB44:
		.LBB45:
				adrp	x0, :got:_imp_OutStream
				ldr	x0, [x0, #:got_lo12:_imp_OutStream]
				str	wzr, [x0]
				adrp	x0, :got:_imp_outfile
				ldr	x0, [x0, #:got_lo12:_imp_outfile]
				ldr	x1, [x0, 8]
				adrp	x0, :got:_imp_OutFile
				ldr	x0, [x0, #:got_lo12:_imp_OutFile]
				str	x1, [x0]
				adrp	x22, .LANCHOR1
				add	x22, x22, :lo12:.LANCHOR1
				mov	x0, x22
				bl	check_outstream
		.LVL15:
		.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
				add	x21, x29, 1080
				mov	x19, 256
				mov	x2, x19
				add	x1, x22, 24
				mov	x0, x21
				bl	memcpy
		.LVL16:
				add	x20, x29, 312
				mov	x2, x19
				mov	x1, x21
				mov	x0, x20
				bl	memcpy
		.LVL17:
				mov	x2, x19
				mov	x1, x20
				mov	x0, x21
				bl	memcpy
		.LVL18:
		.LBE46:
		.LBB47:
		.LBB48:
				add	x20, x29, 48
				mov	x2, x19
				mov	x1, x21
				mov	x0, x20
				bl	memcpy
		.LVL19:
				mov	x0, x20
				bl	_imp_printstring
		.LVL20:
		.LBE48:
		.LBE47:
		.LBB49:
		.LBB50:
				bl	_imp_newline
		.LVL21:
		.LBE50:
		.LBE49:
		.LBB51:
		.LBB52:
		.LBB53:
		.LBB54:
   10     css
   11     printstring("end %SPEC test"); newline
				add	x21, x29, 824
				mov	x2, x19
				add	x1, x22, 280
				mov	x0, x21
				bl	memcpy
		.LVL24:
				add	x22, x29, 568
				mov	x2, x19
				mov	x1, x21
				mov	x0, x22
				bl	memcpy
		.LVL25:
				mov	x2, x19
				mov	x1, x22
				mov	x0, x21
				bl	memcpy
		.LVL26:
		.LBE57:
		.LBB58:
		.LBB59:
				mov	x2, x19
				mov	x1, x21
				mov	x0, x20
				bl	memcpy
		.LVL27:
				mov	x0, x20
				bl	_imp_printstring
		.LVL28:
		.LBE59:
		.LBE58:
		.LBB60:
		.LBB61:
				bl	_imp_newline
		.LVL29:
		.LBE61:
		.LBE60:
		.LBB62:
		.LBB63:
				mov	w0, 0
				bl	exit
		.LVL30:
		.LBE63:
		.LBE62:
		.LFE185:
				.section	.rodata
				.align	3
				.set	.LANCHOR1,. + 0
		__PRETTY_FUNCTION__.7293:
				.string	"_imp_SELECTOUTPUT"
				.zero	6
		.LC0:
				.byte	16
				.string	"start %SPEC test"
				.zero	238
		.LC1:
				.byte	14
				.string	"end %SPEC test"
				.zero	240
				.bss
				.align	2
				.set	.LANCHOR0,. + 0
		CALLCOUNT.7715:
				.zero	4
		.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:
				stp	x29, x30, [sp, -48]!
				add	x29, sp, 0
				stp	x20, x21, [sp, 24]
		.LVL1:
   22             %integer a1,b1,c1,d1
   23             %owninteger callcount
   24
   25             %begin
   26                 a1 = p1
   27                 b1 = 2*p1
				lsl	w20, w0, 1
		.LVL2:
   28                 c1 = 3*p1
				add	w21, w20, w0
		.LVL3:
   29                 callcount = callcount + 1
				adrp	x2, .LANCHOR0
				ldr	w1, [x2, #:lo12:.LANCHOR0]
				add	w1, w1, 1
				str	w1, [x2, #:lo12:.LANCHOR0]
		.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
				cmp	w1, 9
				bgt	.L4
				str	x19, [x29, 16]
		.LVL4:
		.LBB20:
		.LBB21:
   35             %result = d1
				b	.L1
		.LFE187:
				.align	2
				.global	main
		main:
		.LFB185:
   36         %end
				ldr	x19, [x29, 16]
		.L1:
				ldp	x20, x21, [sp, 24]
		.LVL10:
				ldp	x29, x30, [sp], 48
				ret
		.LVL11:
		.L4:
   37
   38         b = 3
				mov	w0, -1
		.LVL12:
		.L2:
		.L3:
   39
   40         %integerfn three(%integer p1,p2,p3)
   41             %integer a3,b3
   42             a3 = one(p1)
				bl	ONE.7709
		.LVL5:
				mov	w19, w0
		.LVL6:
		.LBB22:
		.LBB23:
				mov	w0, 3
				bl	ONE.7709
		.LVL22:
		.LBB55:
		.LBB56:
				mov	w0, 13
				bl	ONE.7709
		.LVL23:
		.LBE56:
		.LBE55:
		.LBE54:
		.LBE53:
		.LBE52:
		.LBE51:
		.LBB57:
   43             b3 = two(p2,p3)
   44             %result = a3 + b3
				add	w0, w19, w0
		.LVL9:
		.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)
				add	w0, w20, w21
		.LVL7:
				bl	ONE.7709
		.LVL8:
		.LBE23:
		.LBE22:
   53         %end
?B2 unused
?A2 unused
   54
   55     %end
   56
   57 %endofprogram
   39 Statements compiled
