// File: /workspace/github_cpp_makefile_star2_O1/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
movl 0x10(%r14), %eax
movl 0x14(%r14), %ecx
addl $-0x4, %eax
addl $-0x15, %ecx
movabsq $0x1300000002, %rdx     # imm = 0x1300000002
movq %rdx, (%r13)
movl %eax, 0x8(%r13)
movl %ecx, 0xc(%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 0x10(%r14), %eax
movl 0x14(%r14), %ecx
addl $-0x2, %ecx
addl $-0x2, %eax
movl %r12d, (%r13)
movl %ecx, 0x4(%r13)
movl %eax, 0x8(%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 0x7559
movq (%rsp), %rcx
incq %rcx
xorl %r15d, %r15d
leaq 0xcb76(%rip), %rdx      # 0x140b0
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 0x753a
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 0xc34c(%rip), %rax      # 0x13900
movzbl (%r13,%rax), %r15d
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x6060
movl $0x6, 0x4(%r12)
leaq 0xc428(%rip), %rax      # 0x13a00
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 0x76a4
leaq 0x14(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x6260
movl (%r15), %esi
cmpl $-0x1, %esi
je 0x7664
movq %r14, %rdi
movl %ebp, %edx
movl %ebx, %ecx
callq 0xcb34
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq