
fmtsame:.string "%d and %d are the same!\n"
fmtdiff:.string	"%d and %d are different!\n"

//-isEqual()--------------------------------------------------------
	.balign 4			// word align instructions
isEqual:
	stp	x29, x30, [sp, -16]!	// store frame record, allocate memory
	mov	x29, sp			// update FP = SP

	cmp	w0, w1			// compare two numbers
	b.ne	diff			// if #1 =/= #2, goto diff

same:	mov	w0, 0			// w0 == w1, set return to 0 (TRUE)
	b	return

diff:	mov	w0, 1			// #1 =/= #2, set return to 1 (FALSE)

return:	ldp	x29, x30, [sp], 16	// restore FP, LR
	ret				// return control to calling function



	.global main
//-MAIN()-----------------------------------------------------------
main:	stp	x29, x30, [sp, -16]!
	mov	x29, sp

	// Make up two numbers
	mov	w19, 43
	mov	w20, 34

	// Put numbers into w0-w7 as input parameters
	// Here we just have two params, so we use two registers
	mov	w0, w19
	mov	w1, w20

	// Call function. If equal, w0 = 0. If false, w0 = 1.
	bl	isEqual

	// Check the result
	cmp	w0, 0
	b.ne	notEqual

equal:	adrp	x0, fmtsame		// Set "equal" string format
	add	x0, x0, :lo12:fmtsame
	b	done

notEqual:
	adrp	x0, fmtdiff		// Set "not equal" string format
	add	x0, x0, :lo12:fmtdiff

done:	mov	w1, w19			// pass first number to printf
	mov	w2, w20			// pass second number to printf
	bl printf			// print the result

	mov	w0, 0			// return 0 to main
	ldp	x29, x30, [sp], 16	// restore frame record
	ret				// return control to OS
