program TestGlobalProc3 {
	section module {
 
	}
	section data {
		int rax = 0
		int rbx = 0
		int rdx = 0
		int rsi = 0
		string str_0 = "before: moves="
		string str_1 = "after 1: moves="
		string str_2 = "after 2: moves="
		string fmt_int = "%lld "
		string fmt_str = "%s "
		string newline = "\n"
		int moves = 0
		int knight_row = 0
		ptr seq_row = null
		int seq_count = 0
		int i = 0
		int next_move_nr = 0
	}
	section code {
	start:
		alloc seq_row, 8, 64
		mov moves, 1
		mov seq_count, 64
		mov knight_row, 0
		mov i, 0
	FOR_0:
		cmp i, 63
		jg ENDFOR_1
		cmp i, 0
		jl IDX_OOB_4
		cmp i, 63
		jg IDX_OOB_4
		jmp IDX_OK_3
	IDX_OOB_4:
		exit 1
	IDX_OK_3:
		mov rbx, i
		store i, seq_row, rbx, 8
	FOR_CONTINUE_2:
		add i, 1
		jmp FOR_0
	ENDFOR_1:
		print fmt_str, str_0
		print fmt_int, moves
		print newline
		call PROC_next_move
		print fmt_str, str_1
		print fmt_int, moves
		print newline
		call PROC_next_move
		print fmt_str, str_2
		print fmt_int, moves
		print newline
		free seq_row
		done
	function PROC_next_move:
		cmp moves, 65
		jl ELSE_5
		jmp PROC_END_next_move
	ELSE_5:
		cmp seq_count, 0
		jle ELSE_9
		mov rdx, moves
		load rsi, seq_row, rdx, 8
		mov next_move_nr, rsi
		mov knight_row, next_move_nr
		add moves, 1
	ELSE_9:
	PROC_END_next_move:
		ret
	}
}