object GameUI {
	section object {
		BlockTypes, PieceUnit, GridUnit
	}
	section module {
 		sdl,
		std,
		string
	}
	section data {
		int rax = 0
		int rbx = 0
		int rcx = 0
		int rdx = 0
		int rsi = 0
		int rdi = 0
		int r8 = 0
		int r9 = 0
		int r10 = 0
		int r11 = 0
		int r12 = 0
		int r13 = 0
		int r14 = 0
		int r15 = 0
		int _ir0 = 0
		ptr _tmpptr0 = null
		ptr _tmpptr1 = null
		string str_0 = "img/font.ttf"
		string str_1 = "MasterPiece [MXVM Pascal]"
		string str_2 = "Warning: Could not load font"
		string str_3 = "Score: "
		string str_4 = "Lines: "
		string str_5 = "Game Paused - Press P to Continue"
		string str_6 = "GAME OVER - Press Enter"
		string str_7 = "Lines Until Speed Increase: "
		string str_8 = "=)>"
		string str_9 = "Arrow keys to change, Enter to apply, Esc to return"
		string str_10 = "MasterPiece is written in MXVM Pascal / SDL"
		string str_11 = "This program is free."
		string str_12 = "Press Escape to Return"
		string str_13 = "High Scores"
		string str_14 = "Your Score: "
		string str_15 = "Press Enter to continue..."
		string str_16 = "img/block_yellow.bmp"
		string str_17 = "img/block_orange.bmp"
		string str_18 = "img/block_ltblue.bmp"
		string str_19 = "img/block_dblue.bmp"
		string str_20 = "img/block_purple.bmp"
		string str_21 = "img/block_pink.bmp"
		string str_22 = "img/block_gray.bmp"
		string str_23 = "img/block_red.bmp"
		string str_24 = "img/block_green.bmp"
		string str_25 = "img/block_clear.bmp"
		string str_26 = "img/intro.bmp"
		string str_27 = "img/start.bmp"
		string str_28 = "img/cursor.bmp"
		string str_29 = "img/gamebg.bmp"
		string str_30 = "Failed to load intro texture"
		string str_31 = "Failed to load start texture"
		string str_32 = "Failed to load gamebg texture"
		string fmt_str = "%s "
		string newline = "\n"
		int window_id = 0
		int renderer_id = 0
		int target_id = 0
		int font_id = 0
		int tex_intro = 0
		int tex_start = 0
		int tex_cursor = 0
		int tex_bg = 0
		ptr block_tex = null
		int current_screen = 0
		int cursor_pos = 0
		int intro_wait = 0
		int paused = 0
		int opt_lines = 0
		int opt_fullscr = 0
		int opt_cursor = 0
		ptr score_buf = null
		int RenderStart_cx = 0
		int RenderStart_cy = 0
		int DrawBoard_r = 0
		int DrawBoard_c = 0
		int DrawBoard_val = 0
		int DrawBoard_bx = 0
		int DrawBoard_by = 0
		int DrawBoard_flash_phase = 0
		int DrawBoard_orig = 0
		int DrawPiece_bx = 0
		int DrawPiece_by = 0
		int DrawNext_ny = 0
		ptr RenderOptions_lines_str = null
		ptr RenderOptions_fs_str = null
		int __funcret_LoadTextures = 0
	}
	section code {
	function PROC_UNIT_INIT:
		alloc block_tex, 8, 11
		ret
	function PROC_InitSDL:
		invoke init
		mov rcx, 100
		mov rdx, 100
		mov rsi, 1440
		mov rdi, 1080
		mov r8, 0
		invoke create_window, str_1, rcx, rdx, rsi, rdi, r8
		return rbx
		mov window_id, rbx
		mov rcx, 0
		sub rcx, 1
		mov rsi, 0
		invoke create_renderer, window_id, rcx, rsi
		return rdx
		mov renderer_id, rdx
		mov rsi, 640
		mov rdi, 480
		invoke create_render_target, renderer_id, rsi, rdi
		return rcx
		mov target_id, rcx
		invoke init_text
		mov rdi, 14
		invoke load_font, str_0, rdi
		return rsi
		mov font_id, rsi
		mov rdi, 0
		sub rdi, 1
		cmp font_id, rdi
		jne ELSE_0
		print fmt_str, str_2
		print newline
	ELSE_0:
		mov current_screen, 0
		mov cursor_pos, 0
		mov intro_wait, 0
		mov paused, 0
		mov opt_lines, 10
		mov opt_fullscr, 0
		mov opt_cursor, 0
	PROC_END_InitSDL:
		ret
	function PROC_ShutdownSDL:
		cmp target_id, 0
		jl ELSE_4
		invoke destroy_render_target, target_id
	ELSE_4:
		invoke quit_text
		invoke destroy_renderer, renderer_id
		invoke destroy_window, window_id
		invoke quit
	PROC_END_ShutdownSDL:
		ret
	function PROC_BeginFrame:
		invoke set_render_target, renderer_id, target_id
		mov rbx, 0
		mov rcx, 0
		mov rdx, 0
		mov rsi, 255
		invoke set_draw_color, renderer_id, rbx, rcx, rdx, rsi
		invoke clear, renderer_id
	PROC_END_BeginFrame:
		ret
	function PROC_EndFrame:
		mov rbx, 1440
		mov rcx, 1080
		invoke present_scaled, renderer_id, target_id, rbx, rcx
	PROC_END_EndFrame:
		ret
	function PROC_RenderIntro:
		call PROC_BeginFrame
		mov rbx, 0
		sub rbx, 1
		mov rcx, 0
		sub rcx, 1
		mov rdx, 0
		sub rdx, 1
		mov rsi, 0
		sub rsi, 1
		mov rdi, 0
		mov r8, 0
		mov r9, 640
		mov r10, 480
		invoke render_texture, renderer_id, tex_intro, rbx, rcx, rdx, rsi, rdi, r8, r9, r10
		call PROC_EndFrame
		add intro_wait, 1
		cmp intro_wait, 180
		jle ELSE_8
		mov current_screen, 1
		mov intro_wait, 0
	ELSE_8:
	PROC_END_RenderIntro:
		ret
	function PROC_RenderStart:
		push RenderStart_cx
		push RenderStart_cy
		call PROC_BeginFrame
		pop RenderStart_cy
		pop RenderStart_cx
		mov rbx, 0
		sub rbx, 1
		mov rcx, 0
		sub rcx, 1
		mov rdx, 0
		sub rdx, 1
		mov rsi, 0
		sub rsi, 1
		mov rdi, 0
		mov r8, 0
		mov r9, 640
		mov r10, 480
		invoke render_texture, renderer_id, tex_start, rbx, rcx, rdx, rsi, rdi, r8, r9, r10
		mov RenderStart_cx, 250
		cmp cursor_pos, 0
		jne ELSE_12
		mov RenderStart_cy, 170
		jmp ENDIF_13
	ELSE_12:
		cmp cursor_pos, 1
		jne ELSE_16
		mov RenderStart_cy, 240
		jmp ENDIF_17
	ELSE_16:
		cmp cursor_pos, 2
		jne ELSE_20
		mov RenderStart_cy, 310
		jmp ENDIF_21
	ELSE_20:
		mov RenderStart_cy, 380
	ENDIF_21:
	ENDIF_17:
	ENDIF_13:
		cmp tex_cursor, 0
		jl ELSE_24
		mov rdi, 0
		sub rdi, 1
		mov r8, 0
		sub r8, 1
		mov r9, 0
		sub r9, 1
		mov r10, 0
		sub r10, 1
		mov r11, 64
		mov r12, 64
		invoke render_texture, renderer_id, tex_cursor, rdi, r8, r9, r10, RenderStart_cx, RenderStart_cy, r11, r12
	ELSE_24:
		push rbx
		push rcx
		push rdx
		push rsi
		push RenderStart_cx
		push RenderStart_cy
		call PROC_EndFrame
		pop RenderStart_cy
		pop RenderStart_cx
		pop rsi
		pop rdx
		pop rcx
		pop rbx
	PROC_END_RenderStart:
		ret
	function PROC_DrawBoard:
		mov DrawBoard_r, 0
	FOR_28:
		cmp DrawBoard_r, 16
		jg ENDFOR_29
		mov DrawBoard_c, 0
	FOR_31:
		cmp DrawBoard_c, 7
		jg ENDFOR_32
		mov GridUnit.rbx, DrawBoard_c
		mov GridUnit.rcx, DrawBoard_r
		push DrawBoard_r
		push DrawBoard_c
		push DrawBoard_val
		push DrawBoard_bx
		push DrawBoard_by
		push DrawBoard_flash_phase
		push DrawBoard_orig
		call GridUnit.FUNC_GridGet
		pop DrawBoard_orig
		pop DrawBoard_flash_phase
		pop DrawBoard_by
		pop DrawBoard_bx
		pop DrawBoard_val
		pop DrawBoard_c
		pop DrawBoard_r
		mov rbx, GridUnit.rax
		mov DrawBoard_val, rbx
		cmp DrawBoard_val, 10
		jne ELSE_34
		mov rdx, DrawBoard_c
		mul rdx, 32
		mov rsi, 185
		add rsi, rdx
		mov DrawBoard_bx, rsi
		mov rdi, DrawBoard_r
		mul rdi, 16
		mov r8, 95
		add r8, rdi
		mov DrawBoard_by, r8
		push rbx
		push rcx
		push rdx
		push rsi
		push rdi
		push r8
		mov GridUnit.rbx, DrawBoard_c
		mov GridUnit.rcx, DrawBoard_r
		push DrawBoard_r
		push DrawBoard_c
		push DrawBoard_val
		push DrawBoard_bx
		push DrawBoard_by
		push DrawBoard_flash_phase
		push DrawBoard_orig
		call GridUnit.FUNC_GridGetFlash
		pop DrawBoard_orig
		pop DrawBoard_flash_phase
		pop DrawBoard_by
		pop DrawBoard_bx
		pop DrawBoard_val
		pop DrawBoard_c
		pop DrawBoard_r
		pop r8
		pop rdi
		pop rsi
		pop rdx
		pop rcx
		pop rbx
		mov r9, GridUnit.rax
		mod r9, 6
		mov DrawBoard_flash_phase, r9
		cmp DrawBoard_flash_phase, 3
		jge ELSE_38
		push rbx
		push rcx
		push rdx
		push rsi
		push rdi
		push r8
		mov GridUnit.rbx, DrawBoard_c
		mov GridUnit.rcx, DrawBoard_r
		push DrawBoard_r
		push DrawBoard_c
		push DrawBoard_val
		push DrawBoard_bx
		push DrawBoard_by
		push DrawBoard_flash_phase
		push DrawBoard_orig
		call GridUnit.FUNC_GridGetOriginal
		pop DrawBoard_orig
		pop DrawBoard_flash_phase
		pop DrawBoard_by
		pop DrawBoard_bx
		pop DrawBoard_val
		pop DrawBoard_c
		pop DrawBoard_r
		pop r8
		pop rdi
		pop rsi
		pop rdx
		pop rcx
		pop rbx
		mov r9, GridUnit.rax
		mov DrawBoard_orig, r9
		cmp DrawBoard_orig, 0
		jle ELSE_42
		cmp DrawBoard_orig, 10
		jg ELSE_42
		mov r9, DrawBoard_orig
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 32
		mov r15, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, DrawBoard_bx, DrawBoard_by, r14, r15
	ELSE_42:
		jmp ENDIF_39
	ELSE_38:
		invoke rand
		return r9
		mod r9, 256
		invoke rand
		return r10
		mod r10, 256
		invoke rand
		return r11
		mod r11, 256
		mov r12, 255
		invoke set_draw_color, renderer_id, r9, r10, r11, r12
		mov r9, 32
		mov r10, 16
		invoke fill_rect, renderer_id, DrawBoard_bx, DrawBoard_by, r9, r10
	ENDIF_39:
		jmp ENDIF_35
	ELSE_34:
		cmp DrawBoard_val, 0
		jle ELSE_50
		cmp DrawBoard_val, 10
		jg ELSE_50
		mov r9, DrawBoard_c
		mul r9, 32
		mov r10, 185
		add r10, r9
		mov DrawBoard_bx, r10
		mov r9, DrawBoard_r
		mul r9, 16
		mov r10, 95
		add r10, r9
		mov DrawBoard_by, r10
		mov r9, DrawBoard_val
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 32
		mov r15, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, DrawBoard_bx, DrawBoard_by, r14, r15
	ELSE_50:
	ENDIF_35:
	FOR_CONTINUE_33:
		add DrawBoard_c, 1
		jmp FOR_31
	ENDFOR_32:
	FOR_CONTINUE_30:
		add DrawBoard_r, 1
		jmp FOR_28
	ENDFOR_29:
	PROC_END_DrawBoard:
		ret
	function PROC_DrawPiece:
		cmp GridUnit.game_over, 1
		jne ELSE_58
		jmp PROC_END_DrawPiece
	ELSE_58:
		mov rdx, PieceUnit.piece_x1
		mov rsi, rdx
		mul rsi, 32
		mov DrawPiece_bx, 185
		add DrawPiece_bx, rsi
		mov r8, PieceUnit.piece_y1
		mov r9, r8
		mul r9, 16
		mov r10, 95
		add r10, r9
		mov DrawPiece_by, r10
		mov r9, PieceUnit.piece_c1
		cmp r9, 0
		jle ELSE_62
		mov r9, PieceUnit.piece_c1
		cmp r9, 10
		jg ELSE_62
		mov r9, PieceUnit.piece_c1
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 32
		mov r15, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, DrawPiece_bx, DrawPiece_by, r14, r15
	ELSE_62:
		mov r9, PieceUnit.piece_x2
		mul r9, 32
		mov r10, 185
		add r10, r9
		mov DrawPiece_bx, r10
		mov r9, PieceUnit.piece_y2
		mul r9, 16
		mov r10, 95
		add r10, r9
		mov DrawPiece_by, r10
		mov r9, PieceUnit.piece_c2
		cmp r9, 0
		jle ELSE_70
		mov r9, PieceUnit.piece_c2
		cmp r9, 10
		jg ELSE_70
		mov r9, PieceUnit.piece_c2
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 32
		mov r15, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, DrawPiece_bx, DrawPiece_by, r14, r15
	ELSE_70:
		mov r9, PieceUnit.piece_x3
		mul r9, 32
		mov r10, 185
		add r10, r9
		mov DrawPiece_bx, r10
		mov r9, PieceUnit.piece_y3
		mul r9, 16
		mov r10, 95
		add r10, r9
		mov DrawPiece_by, r10
		mov r9, PieceUnit.piece_c3
		cmp r9, 0
		jle ELSE_78
		mov r9, PieceUnit.piece_c3
		cmp r9, 10
		jg ELSE_78
		mov r9, PieceUnit.piece_c3
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 32
		mov r15, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, DrawPiece_bx, DrawPiece_by, r14, r15
	ELSE_78:
	PROC_END_DrawPiece:
		ret
	function PROC_DrawNext:
		mov DrawNext_ny, 200
		cmp PieceUnit.next_c1, 0
		jle ELSE_86
		cmp PieceUnit.next_c1, 10
		jg ELSE_86
		mov r8, PieceUnit.next_c1
		mov r9, r8
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 510
		mov r15, 32
		mov _ir0, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, r14, DrawNext_ny, r15, _ir0
	ELSE_86:
		mov r9, DrawNext_ny
		add r9, 16
		mov DrawNext_ny, r9
		mov r9, PieceUnit.next_c2
		cmp r9, 0
		jle ELSE_94
		mov r9, PieceUnit.next_c2
		cmp r9, 10
		jg ELSE_94
		mov r9, PieceUnit.next_c2
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 510
		mov r15, 32
		mov _ir0, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, r14, DrawNext_ny, r15, _ir0
	ELSE_94:
		mov r9, DrawNext_ny
		add r9, 16
		mov DrawNext_ny, r9
		mov r9, PieceUnit.next_c3
		cmp r9, 0
		jle ELSE_102
		mov r9, PieceUnit.next_c3
		cmp r9, 10
		jg ELSE_102
		mov r9, PieceUnit.next_c3
		load r10, block_tex, r9, 8
		mov r9, 0
		sub r9, 1
		mov r11, 0
		sub r11, 1
		mov r12, 0
		sub r12, 1
		mov r13, 0
		sub r13, 1
		mov r14, 510
		mov r15, 32
		mov _ir0, 16
		invoke render_texture, renderer_id, r10, r9, r11, r12, r13, r14, DrawNext_ny, r15, _ir0
	ELSE_102:
	PROC_END_DrawNext:
		ret
	function PROC_DrawScore:
		mov rbx, GridUnit.score
		invoke inttostr, rbx
		return _tmpptr0
		invoke strlen, str_3
		return rcx
		invoke strlen, _tmpptr0
		return rdx
		mov rsi, rcx
		add rsi, rdx
		add rsi, 1
		alloc _tmpptr1, 1, rsi
		invoke strncpy, _tmpptr1, str_3, rcx
		invoke strncat, _tmpptr1, _tmpptr0, rdx
		mov score_buf, _tmpptr1
		free _tmpptr0
		cmp font_id, 0
		jl ELSE_110
		mov rdx, 200
		mov rsi, 60
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		mov r10, 255
		invoke draw_text, renderer_id, font_id, score_buf, rdx, rsi, rdi, r8, r9, r10
	ELSE_110:
		mov rdx, GridUnit.lines
		invoke inttostr, rdx
		return _tmpptr0
		invoke strlen, str_4
		return rsi
		invoke strlen, _tmpptr0
		return rdi
		mov r8, rsi
		add r8, rdi
		add r8, 1
		alloc _tmpptr1, 1, r8
		invoke strncpy, _tmpptr1, str_4, rsi
		invoke strncat, _tmpptr1, _tmpptr0, rdi
		mov score_buf, _tmpptr1
		free _tmpptr0
		cmp font_id, 0
		jl ELSE_114
		mov rdi, 310
		mov r8, 60
		mov r9, 255
		mov r10, 255
		mov r11, 255
		mov r12, 255
		invoke draw_text, renderer_id, font_id, score_buf, rdi, r8, r9, r10, r11, r12
	ELSE_114:
	PROC_END_DrawScore:
		ret
	function PROC_RenderGame:
		call PROC_BeginFrame
		mov rbx, 0
		sub rbx, 1
		mov rcx, 0
		sub rcx, 1
		mov rdx, 0
		sub rdx, 1
		mov rsi, 0
		sub rsi, 1
		mov rdi, 0
		mov r8, 0
		mov r9, 640
		mov r10, 480
		invoke render_texture, renderer_id, tex_bg, rbx, rcx, rdx, rsi, rdi, r8, r9, r10
		call PROC_DrawBoard
		call PROC_DrawPiece
		call PROC_DrawNext
		call PROC_DrawScore
		cmp paused, 1
		jne ELSE_118
		cmp font_id, 0
		jl ELSE_122
		mov rdx, 20
		mov rsi, 20
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		mov r10, 255
		invoke draw_text, renderer_id, font_id, str_5, rdx, rsi, rdi, r8, r9, r10
	ELSE_122:
	ELSE_118:
		mov rdx, GridUnit.game_over
		cmp rdx, 1
		jne ELSE_126
		cmp font_id, 0
		jl ELSE_130
		mov r8, 200
		mov r9, 240
		mov r10, 255
		mov r11, 255
		mov r12, 255
		mov r13, 255
		invoke draw_text, renderer_id, font_id, str_6, r8, r9, r10, r11, r12, r13
	ELSE_130:
	ELSE_126:
		push rbx
		push rcx
		push rdx
		push rsi
		push rdi
		call PROC_EndFrame
		pop rdi
		pop rsi
		pop rdx
		pop rcx
		pop rbx
	PROC_END_RenderGame:
		ret
	function PROC_RenderOptions:
		push RenderOptions_lines_str
		push RenderOptions_fs_str
		call PROC_BeginFrame
		pop RenderOptions_fs_str
		pop RenderOptions_lines_str
		mov rbx, 0
		sub rbx, 1
		mov rcx, 0
		sub rcx, 1
		mov rdx, 0
		sub rdx, 1
		mov rsi, 0
		sub rsi, 1
		mov rdi, 0
		mov r8, 0
		mov r9, 640
		mov r10, 480
		invoke render_texture, renderer_id, tex_start, rbx, rcx, rdx, rsi, rdi, r8, r9, r10
		mov rbx, 0
		mov rcx, 0
		mov rdx, 0
		mov rsi, 255
		invoke set_draw_color, renderer_id, rbx, rcx, rdx, rsi
		mov rbx, 35
		mov rcx, 82
		mov rdx, 586
		mov rsi, 370
		invoke fill_rect, renderer_id, rbx, rcx, rdx, rsi
		invoke inttostr, opt_lines
		return _tmpptr0
		invoke strlen, str_7
		return rbx
		invoke strlen, _tmpptr0
		return rcx
		mov rdx, rbx
		add rdx, rcx
		add rdx, 1
		alloc _tmpptr1, 1, rdx
		invoke strncpy, _tmpptr1, str_7, rbx
		invoke strncat, _tmpptr1, _tmpptr0, rcx
		mov RenderOptions_lines_str, _tmpptr1
		free _tmpptr0
		cmp font_id, 0
		jl ELSE_134
		mov rcx, 70
		mov rdx, 90
		mov rsi, 255
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		invoke draw_text, renderer_id, font_id, RenderOptions_lines_str, rcx, rdx, rsi, rdi, r8, r9
		mov rcx, 40
		mov rdx, 90
		mov rsi, 255
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		invoke draw_text, renderer_id, font_id, str_8, rcx, rdx, rsi, rdi, r8, r9
		mov rcx, 60
		mov rdx, 300
		mov rsi, 255
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		invoke draw_text, renderer_id, font_id, str_9, rcx, rdx, rsi, rdi, r8, r9
	ELSE_134:
		push rbx
		push RenderOptions_lines_str
		push RenderOptions_fs_str
		call PROC_EndFrame
		pop RenderOptions_fs_str
		pop RenderOptions_lines_str
		pop rbx
	PROC_END_RenderOptions:
		ret
	function PROC_RenderCredits:
		call PROC_BeginFrame
		mov rbx, 0
		sub rbx, 1
		mov rcx, 0
		sub rcx, 1
		mov rdx, 0
		sub rdx, 1
		mov rsi, 0
		sub rsi, 1
		mov rdi, 0
		mov r8, 0
		mov r9, 640
		mov r10, 480
		invoke render_texture, renderer_id, tex_start, rbx, rcx, rdx, rsi, rdi, r8, r9, r10
		mov rbx, 0
		mov rcx, 0
		mov rdx, 0
		mov rsi, 255
		invoke set_draw_color, renderer_id, rbx, rcx, rdx, rsi
		mov rbx, 35
		mov rcx, 82
		mov rdx, 586
		mov rsi, 370
		invoke fill_rect, renderer_id, rbx, rcx, rdx, rsi
		cmp font_id, 0
		jl ELSE_138
		mov rcx, 40
		mov rdx, 100
		mov rsi, 255
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		invoke draw_text, renderer_id, font_id, str_10, rcx, rdx, rsi, rdi, r8, r9
		mov rcx, 40
		mov rdx, 120
		mov rsi, 255
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		invoke draw_text, renderer_id, font_id, str_11, rcx, rdx, rsi, rdi, r8, r9
		mov rcx, 40
		mov rdx, 140
		mov rsi, 255
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		invoke draw_text, renderer_id, font_id, str_12, rcx, rdx, rsi, rdi, r8, r9
	ELSE_138:
		push rbx
		call PROC_EndFrame
		pop rbx
	PROC_END_RenderCredits:
		ret
	function PROC_RenderHighScores:
		call PROC_BeginFrame
		mov rbx, 0
		sub rbx, 1
		mov rcx, 0
		sub rcx, 1
		mov rdx, 0
		sub rdx, 1
		mov rsi, 0
		sub rsi, 1
		mov rdi, 0
		mov r8, 0
		mov r9, 640
		mov r10, 480
		invoke render_texture, renderer_id, tex_start, rbx, rcx, rdx, rsi, rdi, r8, r9, r10
		mov rbx, 0
		mov rcx, 0
		mov rdx, 0
		mov rsi, 255
		invoke set_draw_color, renderer_id, rbx, rcx, rdx, rsi
		mov rbx, 35
		mov rcx, 82
		mov rdx, 586
		mov rsi, 370
		invoke fill_rect, renderer_id, rbx, rcx, rdx, rsi
		cmp font_id, 0
		jl ELSE_142
		mov rcx, 45
		mov rdx, 90
		mov rsi, 255
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		invoke draw_text, renderer_id, font_id, str_13, rcx, rdx, rsi, rdi, r8, r9
		mov rcx, GridUnit.score
		invoke inttostr, rcx
		return _tmpptr0
		invoke strlen, str_14
		return rdx
		invoke strlen, _tmpptr0
		return rsi
		mov rdi, rdx
		add rdi, rsi
		add rdi, 1
		alloc _tmpptr1, 1, rdi
		invoke strncpy, _tmpptr1, str_14, rdx
		invoke strncat, _tmpptr1, _tmpptr0, rsi
		mov score_buf, _tmpptr1
		free _tmpptr0
		mov rdx, 45
		mov rsi, 120
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		mov r10, 255
		invoke draw_text, renderer_id, font_id, score_buf, rdx, rsi, rdi, r8, r9, r10
		mov rdx, 280
		mov rsi, 120
		mov rdi, 255
		mov r8, 255
		mov r9, 255
		mov r10, 255
		invoke draw_text, renderer_id, font_id, str_15, rdx, rsi, rdi, r8, r9, r10
	ELSE_142:
		push rbx
		push rcx
		call PROC_EndFrame
		pop rcx
		pop rbx
	PROC_END_RenderHighScores:
		ret
	function PROC_RenderFrame:
		cmp current_screen, 0
		jne ELSE_146
		push rbx
		call PROC_RenderIntro
		pop rbx
		jmp ENDIF_147
	ELSE_146:
		cmp current_screen, 1
		jne ELSE_150
		push rbx
		push rcx
		call PROC_RenderStart
		pop rcx
		pop rbx
		jmp ENDIF_151
	ELSE_150:
		cmp current_screen, 2
		jne ELSE_154
		push rbx
		push rcx
		push rdx
		call PROC_RenderGame
		pop rdx
		pop rcx
		pop rbx
		jmp ENDIF_155
	ELSE_154:
		cmp current_screen, 3
		jne ELSE_158
		push rbx
		push rcx
		push rdx
		push rsi
		call PROC_RenderOptions
		pop rsi
		pop rdx
		pop rcx
		pop rbx
		jmp ENDIF_159
	ELSE_158:
		cmp current_screen, 4
		jne ELSE_162
		push rbx
		push rcx
		push rdx
		push rsi
		push rdi
		call PROC_RenderCredits
		pop rdi
		pop rsi
		pop rdx
		pop rcx
		pop rbx
		jmp ENDIF_163
	ELSE_162:
		cmp current_screen, 5
		jne ELSE_166
		push rbx
		push rcx
		push rdx
		push rsi
		push rdi
		push r8
		call PROC_RenderHighScores
		pop r8
		pop rdi
		pop rsi
		pop rdx
		pop rcx
		pop rbx
	ELSE_166:
	ENDIF_163:
	ENDIF_159:
	ENDIF_155:
	ENDIF_151:
	ENDIF_147:
	PROC_END_RenderFrame:
		ret
	function FUNC_LoadTextures:
		mov __funcret_LoadTextures, 0
		invoke load_texture, renderer_id, str_16
		return rbx
		cmp 1, 0
		jl IDX_OOB_171
		cmp 1, 10
		jg IDX_OOB_171
		jmp IDX_OK_170
	IDX_OOB_171:
		exit 1
	IDX_OK_170:
		mov rcx, 1
		store rbx, block_tex, rcx, 8
		invoke load_texture, renderer_id, str_17
		return rcx
		cmp 2, 0
		jl IDX_OOB_173
		cmp 2, 10
		jg IDX_OOB_173
		jmp IDX_OK_172
	IDX_OOB_173:
		exit 1
	IDX_OK_172:
		mov rdx, 2
		store rcx, block_tex, rdx, 8
		invoke load_texture, renderer_id, str_18
		return rdx
		cmp 3, 0
		jl IDX_OOB_175
		cmp 3, 10
		jg IDX_OOB_175
		jmp IDX_OK_174
	IDX_OOB_175:
		exit 1
	IDX_OK_174:
		mov rsi, 3
		store rdx, block_tex, rsi, 8
		invoke load_texture, renderer_id, str_19
		return rsi
		cmp 4, 0
		jl IDX_OOB_177
		cmp 4, 10
		jg IDX_OOB_177
		jmp IDX_OK_176
	IDX_OOB_177:
		exit 1
	IDX_OK_176:
		mov rdi, 4
		store rsi, block_tex, rdi, 8
		invoke load_texture, renderer_id, str_20
		return rdi
		cmp 5, 0
		jl IDX_OOB_179
		cmp 5, 10
		jg IDX_OOB_179
		jmp IDX_OK_178
	IDX_OOB_179:
		exit 1
	IDX_OK_178:
		mov r8, 5
		store rdi, block_tex, r8, 8
		invoke load_texture, renderer_id, str_21
		return r8
		cmp 6, 0
		jl IDX_OOB_181
		cmp 6, 10
		jg IDX_OOB_181
		jmp IDX_OK_180
	IDX_OOB_181:
		exit 1
	IDX_OK_180:
		mov r9, 6
		store r8, block_tex, r9, 8
		invoke load_texture, renderer_id, str_22
		return r9
		cmp 7, 0
		jl IDX_OOB_183
		cmp 7, 10
		jg IDX_OOB_183
		jmp IDX_OK_182
	IDX_OOB_183:
		exit 1
	IDX_OK_182:
		mov r10, 7
		store r9, block_tex, r10, 8
		invoke load_texture, renderer_id, str_23
		return r9
		cmp 8, 0
		jl IDX_OOB_185
		cmp 8, 10
		jg IDX_OOB_185
		jmp IDX_OK_184
	IDX_OOB_185:
		exit 1
	IDX_OK_184:
		mov r10, 8
		store r9, block_tex, r10, 8
		invoke load_texture, renderer_id, str_24
		return r9
		cmp 9, 0
		jl IDX_OOB_187
		cmp 9, 10
		jg IDX_OOB_187
		jmp IDX_OK_186
	IDX_OOB_187:
		exit 1
	IDX_OK_186:
		mov r10, 9
		store r9, block_tex, r10, 8
		invoke load_texture, renderer_id, str_25
		return r9
		cmp 10, 0
		jl IDX_OOB_189
		cmp 10, 10
		jg IDX_OOB_189
		jmp IDX_OK_188
	IDX_OOB_189:
		exit 1
	IDX_OK_188:
		mov r10, 10
		store r9, block_tex, r10, 8
		invoke load_texture, renderer_id, str_26
		return r9
		mov tex_intro, r9
		invoke load_texture, renderer_id, str_27
		return r9
		mov tex_start, r9
		mov r10, 255
		mov r11, 0
		mov r12, 255
		invoke load_texture_color_key_rgb, renderer_id, str_28, r10, r11, r12
		return r9
		mov tex_cursor, r9
		invoke load_texture, renderer_id, str_29
		return r9
		mov tex_bg, r9
		mov r9, 0
		sub r9, 1
		cmp tex_intro, r9
		jne ELSE_190
		print fmt_str, str_30
		print newline
		mov __funcret_LoadTextures, 1
		jmp FUNC_END_LoadTextures
	ELSE_190:
		mov r9, 0
		sub r9, 1
		cmp tex_start, r9
		jne ELSE_194
		print fmt_str, str_31
		print newline
		mov __funcret_LoadTextures, 1
		jmp FUNC_END_LoadTextures
	ELSE_194:
		mov r9, 0
		sub r9, 1
		cmp tex_bg, r9
		jne ELSE_198
		print fmt_str, str_32
		print newline
		mov __funcret_LoadTextures, 1
		jmp FUNC_END_LoadTextures
	ELSE_198:
	FUNC_END_LoadTextures:
		mov rax, __funcret_LoadTextures
		ret
	}
}