// File: mdpkh[P]retro6k/src/main.cpp
// Function: RoundWinCorners(SDL_Surface*, unsigned int, unsigned int, unsigned int)
void RoundWinCorners(SDL_Surface* destsurf, unsigned int key, unsigned int bg, unsigned int fg)
{
#define r0 wincornercliprect[i]
	for (int i = 0; i < NWINCORNERCLIPRECTS; ++i)
	{
		SDL_Rect r1 = wincornercliprect[i];
		SDL_Rect r2 = wincornercliprect[i];
		SDL_Rect r3 = wincornercliprect[i];
		r1.x = r3.x = destsurf->w - r0.x - r0.w;
		r2.y = r3.y = destsurf->h - r0.y - r0.h;
		SDL_FillRect(destsurf, &r0, key);
		SDL_FillRect(destsurf, &r1, key);
		SDL_FillRect(destsurf, &r2, key);
		SDL_FillRect(destsurf, &r3, key);
	}
#undef r0
#define r0 wincornerborder0rect[i]
	for (int i = 0; i < NWINCORNERBORDER0RECTS; ++i)
	{
		SDL_Rect r1 = wincornerborder0rect[i];
		SDL_Rect r2 = wincornerborder0rect[i];
		SDL_Rect r3 = wincornerborder0rect[i];
		r1.x = r3.x = destsurf->w - r0.x - r0.w;
		r2.y = r3.y = destsurf->h - r0.y - r0.h;
		SDL_FillRect(destsurf, &r0, bg);
		SDL_FillRect(destsurf, &r1, bg);
		SDL_FillRect(destsurf, &r2, bg);
		SDL_FillRect(destsurf, &r3, bg);
	}
#undef r0
#define r0 wincornerborder1rect[i]
	for (int i = 0; i < NWINCORNERBORDER1RECTS; ++i)
	{
		SDL_Rect r2 = wincornerborder1rect[i];
		SDL_Rect r3 = wincornerborder1rect[i];
		r3.x        = destsurf->w - r0.x - r0.w;
		r2.y = r3.y = destsurf->h - r0.y - r0.h;
		SDL_FillRect(destsurf, &r2, fg);
		SDL_FillRect(destsurf, &r3, fg);
	}
#undef r0
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x9, -0x18(%rbp)
jge 0xffe5
movslq -0x18(%rbp), %rcx
leaq 0x10b3c(%rip), %rax     # 0x20a00
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x10b1b(%rip), %rax     # 0x20a00
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x10afa(%rip), %rax     # 0x20a00
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movslq -0x18(%rbp), %rdx
leaq 0x10ad2(%rip), %rcx     # 0x20a00
shlq $0x4, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
movslq -0x18(%rbp), %rdx
leaq 0x10abe(%rip), %rcx     # 0x20a00
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
movl %eax, -0x48(%rbp)
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movslq -0x18(%rbp), %rdx
leaq 0x10a9c(%rip), %rcx     # 0x20a00
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movslq -0x18(%rbp), %rdx
leaq 0x10a87(%rip), %rcx     # 0x20a00
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x44(%rbp)
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movslq -0x18(%rbp), %rax
leaq 0x10a68(%rip), %rsi     # 0x20a00
shlq $0x4, %rax
addq %rax, %rsi
movl -0xc(%rbp), %edx
callq 0x7060
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x28(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x38(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x48(%rbp), %rsi
callq 0x7060
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xfeaf
movl $0x0, -0x4c(%rbp)
cmpl $0x8, -0x4c(%rbp)
jge 0x10122
movslq -0x4c(%rbp), %rcx
leaq 0x10a8f(%rip), %rax     # 0x20a90
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x5c(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x54(%rbp)
movslq -0x4c(%rbp), %rcx
leaq 0x10a6e(%rip), %rax     # 0x20a90
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x6c(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x64(%rbp)
movslq -0x4c(%rbp), %rcx
leaq 0x10a4d(%rip), %rax     # 0x20a90
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x7c(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x74(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movslq -0x4c(%rbp), %rdx
leaq 0x10a25(%rip), %rcx     # 0x20a90
shlq $0x4, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
movslq -0x4c(%rbp), %rdx
leaq 0x10a11(%rip), %rcx     # 0x20a90
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
movl %eax, -0x7c(%rbp)
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movslq -0x4c(%rbp), %rdx
leaq 0x109ef(%rip), %rcx     # 0x20a90
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movslq -0x4c(%rbp), %rdx
leaq 0x109da(%rip), %rcx     # 0x20a90
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x78(%rbp)
movl %eax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movslq -0x4c(%rbp), %rax
leaq 0x109bb(%rip), %rsi     # 0x20a90
shlq $0x4, %rax
addq %rax, %rsi
movl -0x10(%rbp), %edx
callq 0x7060
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq -0x5c(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq -0x6c(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq -0x7c(%rbp), %rsi
callq 0x7060
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xffec
movl $0x0, -0x80(%rbp)
cmpl $0x7, -0x80(%rbp)
jge 0x10228
movslq -0x80(%rbp), %rcx
leaq 0x109d2(%rip), %rax     # 0x20b10
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x88(%rbp)
movslq -0x80(%rbp), %rcx
leaq 0x109ab(%rip), %rax     # 0x20b10
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0xa0(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movslq -0x80(%rbp), %rdx
leaq 0x1097d(%rip), %rcx     # 0x20b10
shlq $0x4, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
movslq -0x80(%rbp), %rdx
leaq 0x10969(%rip), %rcx     # 0x20b10
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
movl %eax, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movslq -0x80(%rbp), %rdx
leaq 0x10947(%rip), %rcx     # 0x20b10
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movslq -0x80(%rbp), %rdx
leaq 0x10932(%rip), %rcx     # 0x20b10
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x9c(%rbp)
movl %eax, -0x8c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq -0x90(%rbp), %rsi
callq 0x7060
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq -0xa0(%rbp), %rsi
callq 0x7060
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x10129
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)