// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
xorl %r13d, %r13d
leaq 0x6ae8(%rip), %r12      # 0x13c50
leaq (%r12,%r13), %rsi
movdqu (%r13,%r12), %xmm0
movdqa %xmm0, 0x10(%rsp)
movdqa %xmm0, (%rsp)
movdqa %xmm0, 0x20(%rsp)
movl 0x10(%r14), %eax
subl 0x8(%r13,%r12), %eax
movl %eax, 0x20(%rsp)
movl %eax, 0x10(%rsp)
movl 0x4(%r13,%r12), %eax
addl 0xc(%r13,%r12), %eax
movl 0x14(%r14), %ecx
subl %eax, %ecx
movl %ecx, 0x24(%rsp)
movl %ecx, 0x4(%rsp)
movq %r14, %rdi
movl %r15d, %edx
callq 0x6060
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
movl %r15d, %edx
callq 0x6060
movq %r14, %rdi
movq %rsp, %rsi
movl %r15d, %edx
callq 0x6060
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
movl %r15d, %edx
callq 0x6060
addq $0x10, %r13
cmpq $0x90, %r13
jne 0xd168
xorl %r15d, %r15d
leaq 0x6adf(%rip), %r12      # 0x13ce0
leaq 0x20(%rsp), %r13
leaq (%r12,%r15), %rsi
movups (%r15,%r12), %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movaps %xmm0, 0x20(%rsp)
movq 0x10(%r14), %xmm0
movq (%r15,%r12), %xmm1
movq 0x8(%r15,%r12), %xmm2
paddd %xmm1, %xmm2
psubd %xmm2, %xmm0
movd %xmm0, 0x10(%rsp)
movq %xmm0, 0x20(%rsp)
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, 0x4(%rsp)
movq %r14, %rdi
movl %ebp, %edx
callq 0x6060
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
movl %ebp, %edx
callq 0x6060
movq %r14, %rdi
movq %rsp, %rsi
movl %ebp, %edx
callq 0x6060
movq %r14, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x6060
addq $0x10, %r15
cmpq $0x80, %r15
jne 0xd206
xorl %r13d, %r13d
leaq 0x6ac3(%rip), %rbp      # 0x13d60
leaq 0x10(%rsp), %r15
movq %rsp, %r12
movups (%r13,%rbp), %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq 0x10(%r14), %xmm0
movq (%r13,%rbp), %xmm1
movq 0x8(%r13,%rbp), %xmm2
paddd %xmm1, %xmm2
psubd %xmm2, %xmm0
movq %xmm0, (%rsp)
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, 0x14(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x6060
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x6060
addq $0x10, %r13
cmpq $0x70, %r13
jne 0xd2a5
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq