// File: mdpkh[P]retro6k/src/main.cpp
// Function: PaintWindow(SDL_Surface*, unsigned int, unsigned int, char const*, unsigned int)
void PaintWindow(SDL_Surface* win, unsigned int bg, unsigned int acc, const char* title, unsigned int tc)
{
	SDL_Rect boxrect;
	boxrect = { 0, 0, win->w, 1 };
	SDL_FillRect(win, &boxrect, bg);
	boxrect.y = win->h - 1;
	SDL_FillRect(win, &boxrect, bg);
	boxrect = { 0, 0, 1, win->h };
	SDL_FillRect(win, &boxrect, bg);
	boxrect.x = win->w - 1;
	SDL_FillRect(win, &boxrect, bg);
	boxrect = { 2, 19, win->w - 4, win->h - 21 };
	SDL_FillRect(win, &boxrect, bg);
	boxrect = { 1, 19, 1, win->h - 20 };
	SDL_FillRect(win, &boxrect, acc);
	boxrect.x = win->w - 2;
	SDL_FillRect(win, &boxrect, acc);
	boxrect = { 1, win->h - 2, win->w - 2, 1 };
	SDL_FillRect(win, &boxrect, acc);
	int tx0 = (win->w - TextWidth(title)) >> 1;
	boxrect = { 1, 1, win->w - 2, 18 };
	SDL_FillRect(win, &boxrect, acc);
	boxrect.h = 1;
	boxrect.y = 5;
	SDL_FillRect(win, &boxrect, darkercolor[acc]);
	boxrect.y = 6;
	SDL_FillRect(win, &boxrect, lightercolor[acc]);
	boxrect.y = 12;
	SDL_FillRect(win, &boxrect, darkercolor[acc]);
	boxrect.y = 13;
	SDL_FillRect(win, &boxrect, lightercolor[acc]);
	DrawText(title, tx0, 2, tc, acc, win);
	uint32_t k;
	SDL_GetColorKey(win, &k);
	if (k != 0xffffffff)
		RoundWinCorners(win, k, bg, acc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x34(%rbp)
movl $0x1, -0x30(%rbp)
movq -0x3c(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x34(%rbp), %rax
movq %rax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x1, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x4c(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x44(%rbp), %rax
movq %rax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0x2, -0x5c(%rbp)
movl $0x13, -0x58(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x4, %eax
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
subl $0x15, %eax
movl %eax, -0x50(%rbp)
movq -0x5c(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x54(%rbp), %rax
movq %rax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0x1, -0x6c(%rbp)
movl $0x13, -0x68(%rbp)
movl $0x1, -0x64(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
subl $0x14, %eax
movl %eax, -0x60(%rbp)
movq -0x6c(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x64(%rbp), %rax
movq %rax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x2, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0x1, -0x7c(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
subl $0x2, %eax
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x2, %eax
movl %eax, -0x74(%rbp)
movl $0x1, -0x70(%rbp)
movq -0x7c(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x74(%rbp), %rax
movq %rax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8ec0
movl %eax, %ecx
movl -0x98(%rbp), %eax
subl %ecx, %eax
sarl %eax
movl %eax, -0x80(%rbp)
movl $0x1, -0x90(%rbp)
movl $0x1, -0x8c(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x2, %eax
movl %eax, -0x88(%rbp)
movl $0x12, -0x84(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0x1, -0x20(%rbp)
movl $0x5, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x17a15(%rip), %rax     # 0x20800
movzbl (%rax,%rcx), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0x6, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x17af1(%rip), %rax     # 0x20900
movzbl (%rax,%rcx), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0xc, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x179cd(%rip), %rax     # 0x20800
movzbl (%rax,%rcx), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movl $0xd, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x17aa9(%rip), %rax     # 0x20900
movzbl (%rax,%rcx), %edx
leaq -0x2c(%rbp), %rsi
callq 0x7060
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
movb %al, %cl
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %r9
leaq -0x80(%rbp), %rsi
movl $0x2, %edx
movzbl %cl, %ecx
movzbl %al, %r8d
callq 0x8f10
movq -0x8(%rbp), %rdi
leaq -0x94(%rbp), %rsi
callq 0x7300
cmpl $-0x1, -0x94(%rbp)
je 0x8eb7
movq -0x8(%rbp), %rdi
movl -0x94(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
callq 0xfe90
addq $0xa0, %rsp
popq %rbp
retq