program TestGlobalProc2 {
	section module {
 
	}
	section data {
		int rax = 0
		int rbx = 0
		int rcx = 0
		int rdx = 0
		int rsi = 0
		int rdi = 0
		string str_0 = "before: moves="
		string str_1 = " row="
		string str_2 = " col="
		string str_3 = "after 1: moves="
		string str_4 = "after 2: moves="
		string str_5 = "after 3: moves="
		string fmt_int = "%lld "
		string fmt_str = "%s "
		string newline = "\n"
		int moves = 0
		int knight_row = 0
		int knight_col = 0
		ptr seq_row = null
		ptr seq_col = null
		int seq_count = 0
		int tour_over = 0
		int i = 0
		int next_move_nr = 0
		int next_move_nc = 0
	}
	section code {
	start:
		alloc seq_row, 8, 64
		alloc seq_col, 8, 64
		mov moves, 1
		mov seq_count, 64
		mov tour_over, 0
		mov knight_row, 0
		mov knight_col, 0
		mov i, 0
	FOR_0:
		cmp i, 63
		jg ENDFOR_1
		mov rbx, i
		div rbx, 8
		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 rcx, i
		store rbx, seq_row, rcx, 8
		mov rcx, i
		mod rcx, 8
		cmp i, 0
		jl IDX_OOB_6
		cmp i, 63
		jg IDX_OOB_6
		jmp IDX_OK_5
	IDX_OOB_6:
		exit 1
	IDX_OK_5:
		mov rdx, i
		store rcx, seq_col, rdx, 8
	FOR_CONTINUE_2:
		add i, 1
		jmp FOR_0
	ENDFOR_1:
		print fmt_str, str_0
		print fmt_int, moves
		print fmt_str, str_1
		print fmt_int, knight_row
		print fmt_str, str_2
		print fmt_int, knight_col
		print newline
		push rbx
		push rcx
		call PROC_next_move
		pop rcx
		pop rbx
		print fmt_str, str_3
		print fmt_int, moves
		print fmt_str, str_1
		print fmt_int, knight_row
		print fmt_str, str_2
		print fmt_int, knight_col
		print newline
		push rbx
		push rcx
		call PROC_next_move
		pop rcx
		pop rbx
		print fmt_str, str_4
		print fmt_int, moves
		print fmt_str, str_1
		print fmt_int, knight_row
		print fmt_str, str_2
		print fmt_int, knight_col
		print newline
		push rbx
		push rcx
		call PROC_next_move
		pop rcx
		pop rbx
		print fmt_str, str_5
		print fmt_int, moves
		print fmt_str, str_1
		print fmt_int, knight_row
		print fmt_str, str_2
		print fmt_int, knight_col
		print newline
		free seq_row
		free seq_col
		done
	function PROC_next_move:
		cmp moves, 65
		jl ELSE_7
		jmp PROC_END_next_move
	ELSE_7:
		cmp seq_count, 0
		jle ELSE_11
		mov rdx, moves
		load rsi, seq_row, rdx, 8
		mov next_move_nr, rsi
		mov rdx, moves
		load rdi, seq_col, rdx, 8
		mov next_move_nc, rdi
		mov knight_row, next_move_nr
		mov knight_col, next_move_nc
		add moves, 1
		cmp moves, 64
		jl ELSE_15
		mov tour_over, 1
	ELSE_15:
	ELSE_11:
	PROC_END_next_move:
		ret
	}
}