program TestRand {
	section module {
 		std
	}
	section data {
		int rax = 0
		int rbx = 0
		int r9 = 0
		string str_0 = "negative: "
		string str_1 = "below 320: "
		string str_2 = "first 20 rand mod 640:"
		string str_3 = " "
		string str_4 = ""
		string str_5 = "done"
		string fmt_int = "%lld "
		string fmt_str = "%s "
		string newline = "\n"
		int i = 0
		int v = 0
		int neg_count = 0
		int half_count = 0
	}
	section code {
	start:
		mov neg_count, 0
		mov half_count, 0
		mov i, 0
	FOR_0:
		cmp i, 99
		jg ENDFOR_1
		invoke rand
		return rbx
		mov v, rbx
		mod v, 640
		cmp v, 0
		jge ELSE_3
		add neg_count, 1
	ELSE_3:
		cmp v, 320
		jge ELSE_7
		add half_count, 1
	ELSE_7:
	FOR_CONTINUE_2:
		add i, 1
		jmp FOR_0
	ENDFOR_1:
		print fmt_str, str_0
		print fmt_int, neg_count
		print newline
		print fmt_str, str_1
		print fmt_int, half_count
		print newline
		print fmt_str, str_2
		print newline
		mov i, 0
	FOR_11:
		cmp i, 19
		jg ENDFOR_12
		invoke rand
		return r9
		mod r9, 640
		mov v, r9
		print fmt_int, v
		print fmt_str, str_3
	FOR_CONTINUE_13:
		add i, 1
		jmp FOR_11
	ENDFOR_12:
		print fmt_str, str_4
		print newline
		print fmt_str, str_5
		print newline
		done
	}
}