define(comment)

comment(minimum(1 = output register, 2 = input register, 3 = input register))
define(`minimum',
	`mov	$1, $3
	cmp	$2, $3
	b.gt	done
	mov	$1, $2
done:')


fmt1:	.string "Between %d and %d, %d is smaller.\n"

	.balign 4			// word align instructions
	.global main			// make main() global to call from OS
main:	stp	x29, x30, [sp, -16]!	// store frame record, allocate stack memory
	mov	x29, sp			// update FP = SP

	mov	x19, 3			// make up a number
	mov	x20, 5			// make up another number

	adrp	x0, fmt1		// 1st arg: print format
	add	x0, x0, :lo12:fmt1	// load lower 12 bits of print format
	mov	x1, x19			// 2nd arg: 1st number
	mov	x2, x20			// 3rd arg: 2nd number

	// start #minimum#
	minimum(x3, x19, x20)		// 4th arg: x3 = min(x19, x20)
	// end #minimum#

	bl	printf			// Print result

	mov	w0, 0
	ldp	x29, x30, [sp], -16
	ret
