program PointerDemo {
	section module {
 
	}
	section data {
		int rax = 0
		int rbx = 0
		int rcx = 0
		int rsi = 0
		int rdi = 0
		int r8 = 0
		int r9 = 0
		ptr _tmpptr0 = null
		string str_0 = "=== Pointer Demo ==="
		string str_1 = "--- heap pointers ---"
		string str_2 = "--- address-of @ ---"
		string str_3 = "--- type alias PInt ---"
		string str_4 = "--- nil and reuse ---"
		string str_5 = "--- accumulator loop ---"
		string str_6 = "--- swap via @ ---"
		string str_7 = "=== done ==="
		string fmt_int = "%lld "
		string fmt_str = "%s "
		string newline = "\n"
		ptr hp = null
		ptr hp2 = null
		int score = 0
		int bonus = 0
		int total = 0
		ptr sp = null
		ptr maybe = null
		ptr acc = null
		int i = 0
	}
	section code {
	start:
		print fmt_str, str_0
		print newline
		print fmt_str, str_1
		print newline
		alloc hp, 8, 1
		free hp
		alloc hp2, 8, 1
		free hp2
		store 42, hp, 0, 1
		store 58, hp2, 0, 1
		load rbx, hp, 0, 1
		load rcx, hp2, 0, 1
		mov total, rbx
		add total, rcx
		load rsi, hp, 0, 1
		print fmt_int, rsi
		print newline
		load rdi, hp2, 0, 1
		print fmt_int, rdi
		print newline
		print fmt_int, total
		print newline
		free hp
		free hp2
		print fmt_str, str_2
		print newline
		mov score, 90
		mov bonus, 10
		lea _tmpptr0, score
		mov sp, _tmpptr0
		load r8, sp, 0, 1
		print fmt_int, r8
		print newline
		load r9, sp, 0, 1
		add r9, bonus
		store r9, sp, 0, 1
		print fmt_int, score
		print newline
		lea _tmpptr0, bonus
		mov sp, _tmpptr0
		store 25, sp, 0, 1
		print fmt_int, bonus
		print newline
		print fmt_str, str_3
		print newline
		alloc hp, 8, 1
		free hp
		store 256, hp, 0, 1
		load r9, hp, 0, 1
		mul r9, 2
		mov total, r9
		load r9, hp, 0, 1
		print fmt_int, r9
		print newline
		print fmt_int, total
		print newline
		free hp
		print fmt_str, str_4
		print newline
		mov maybe, 0
		alloc maybe, 8, 1
		free maybe
		store 999, maybe, 0, 1
		load r9, maybe, 0, 1
		print fmt_int, r9
		print newline
		free maybe
		mov maybe, 0
		print fmt_str, str_5
		print newline
		alloc acc, 8, 1
		free acc
		store 0, acc, 0, 1
		mov i, 1
	FOR_0:
		cmp i, 10
		jg ENDFOR_1
		load r9, acc, 0, 1
		add r9, i
		store r9, acc, 0, 1
	FOR_CONTINUE_2:
		add i, 1
		jmp FOR_0
	ENDFOR_1:
		load r9, acc, 0, 1
		print fmt_int, r9
		print newline
		free acc
		print fmt_str, str_6
		print newline
		mov score, 11
		mov bonus, 22
		print fmt_int, score
		print newline
		print fmt_int, bonus
		print newline
		lea _tmpptr0, score
		mov sp, _tmpptr0
		load r9, sp, 0, 1
		mov total, r9
		store bonus, sp, 0, 1
		lea _tmpptr0, bonus
		mov sp, _tmpptr0
		store total, sp, 0, 1
		print fmt_int, score
		print newline
		print fmt_int, bonus
		print newline
		print fmt_str, str_7
		print newline
		done
	}
}