// File: /workspace/github_cpp_makefile_star2_O2/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, (%rsp)
movq %rcx, 0x8(%rsp)
movl %edx, %ebx
movq %rdi, %r14
movl 0x10(%rdi), %eax
leaq 0x18(%rsp), %r13
andq $0x0, (%r13)
movl %esi, %ebp
movl %eax, 0x8(%r13)
pushq $0x1
popq %r15
movl %r15d, 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
andq $0x0, (%r13)
movl %r15d, 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 0x9fa8(%rip), %xmm0     # 0x11010
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 %r15d, 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 %r15d, (%r13)
movq 0x10(%r14), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
paddd 0x9f4c(%rip), %xmm0     # 0x11020
movq %xmm0, 0x4(%r13)
movl %r15d, 0xc(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x6060
movl 0x10(%r14), %r12d
movq 0x8(%rsp), %rdi
callq 0x7200
movl %r12d, %ecx
subl %eax, %ecx
sarl %ecx
leaq 0x4(%rsp), %rax
movl %ecx, (%rax)
addl $-0x2, %r12d
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, (%r13)
movl %r12d, 0x8(%r13)
movl $0x12, 0xc(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x6060
movl %r15d, 0xc(%r13)
movl $0x5, 0x4(%r13)
movl %ebx, %r15d
leaq 0xa838(%rip), %rax      # 0x11980
movzbl (%r15,%rax), %r12d
movq %r14, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x6060
movl $0x6, 0x4(%r13)
leaq 0xa916(%rip), %rax      # 0x11a80
movzbl (%r15,%rax), %r15d
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x6060
movl $0xc, 0x4(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x6060
movl $0xd, 0x4(%r13)
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x6060
movl $0xff, %r8d
movl (%rsp), %ecx
andl %r8d, %ecx
andl %ebx, %r8d
pushq $0x2
popq %rdx
movq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
movq %r14, %r9
callq 0x7221
leaq 0x14(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x6280
movl (%r15), %esi
cmpl $-0x1, %esi
je 0x71f1
movq %r14, %rdi
movl %ebp, %edx
movl %ebx, %ecx
callq 0xb8c7
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq