// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, 0xc(%rsp)
movq %rcx, (%rsp)
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl 0x10(%rdi), %eax
xorl %r15d, %r15d
leaq 0x18(%rsp), %r13
movq %r15, (%r13)
movl %eax, 0x8(%r13)
movl $0x1, %r12d
movl %r12d, 0xc(%r13)
movq %r13, %rsi
movl %ebp, %edx
callq 0x6060
movl 0x14(%r14), %eax
decl %eax
movl %eax, 0x4(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x6060
movl 0x14(%r14), %eax
movq %r15, (%r13)
movl %r12d, 0x8(%r13)
movl %eax, 0xc(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x6060
movl 0x10(%r14), %eax
decl %eax
movl %eax, (%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x6060
movabsq $0x1300000002, %rax     # imm = 0x1300000002
movq %rax, (%r13)
movq 0x10(%r14), %xmm0
paddd 0xb4ff(%rip), %xmm0     # 0x13090
movq %xmm0, 0x8(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x6060
movl 0x14(%r14), %eax
addl $-0x14, %eax
movabsq $0x1300000001, %rcx     # imm = 0x1300000001
movq %rcx, (%r13)
movl %r12d, 0x8(%r13)
movl %eax, 0xc(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x6060
movl 0x10(%r14), %eax
addl $-0x2, %eax
movl %eax, (%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x6060
movl %r12d, (%r13)
movq 0x10(%r14), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
paddd 0xb4a3(%rip), %xmm0     # 0x130a0
movq %xmm0, 0x4(%r13)
movl %r12d, 0xc(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x6060
movl 0x10(%r14), %eax
movq (%rsp), %rcx
movb (%rcx), %sil
testb %sil, %sil
je 0x7c54
movq (%rsp), %rcx
incq %rcx
xorl %r15d, %r15d
leaq 0xc5cb(%rip), %rdx      # 0x14200
movzbl %sil, %esi
movl %esi, %edi
shll $0x5, %edi
leaq (%rdi,%rsi,2), %rsi
movzbl (%rdx,%rsi), %esi
addl %esi, %r15d
movb (%rcx), %sil
incq %rcx
testb %sil, %sil
jne 0x7c35
movl %eax, %ecx
subl %r15d, %ecx
sarl %ecx
leaq 0x10(%rsp), %rdx
movl %ecx, (%rdx)
addl $-0x2, %eax
movabsq $0x100000001, %rcx      # imm = 0x100000001
leaq 0x18(%rsp), %r12
movq %rcx, (%r12)
movl %eax, 0x8(%r12)
movl $0x12, 0xc(%r12)
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x6060
movl $0x1, 0xc(%r12)
movl $0x5, 0x4(%r12)
movl %ebx, %r13d
leaq 0xbda1(%rip), %rax      # 0x13a50
movzbl (%r13,%rax), %r15d
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x6060
movl $0x6, 0x4(%r12)
leaq 0xbe7d(%rip), %rax      # 0x13b50
movzbl (%r13,%rax), %r13d
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x6060
movl $0xc, 0x4(%r12)
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x6060
movl $0xd, 0x4(%r12)
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x6060
movl $0xff, %r8d
movl 0xc(%rsp), %ecx
andl %r8d, %ecx
andl %ebx, %r8d
movq (%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x2, %edx
movq %r14, %r9
callq 0x7d9f
leaq 0x14(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x6260
movl (%r15), %esi
cmpl $-0x1, %esi
je 0x7d5f
movq %r14, %rdi
movl %ebp, %edx
movl %ebx, %ecx
callq 0xd146
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq