// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/graphics/backends/surfacebackend.cpp
// Function: smooth::GUI::SurfaceBackend::Frame(smooth::GUI::Rect const&, short)
S::Int S::GUI::SurfaceBackend::Frame(const Rect &iRect, Short style)
{
	Rect	 rect = rightToLeft.TranslateRect(iRect);

	Point	 p1 = Point(rect.left,	    rect.top);
	Point	 p2 = Point(rect.right - 1, rect.top);
	Point	 p3 = Point(rect.left,	    rect.bottom - 1);
	Point	 p4 = Point(rect.right - 1, rect.bottom - 1);

	Long	 color1 = 0;
	Long	 color2 = 0;

	switch (style)
	{
		case FRAME_UP:
			color1 = Color(Math::Min(Setup::BackgroundColor.GetRed() + 64, 255), Math::Min(Setup::BackgroundColor.GetGreen() + 64, 255), Math::Min(Setup::BackgroundColor.GetBlue() + 64, 255));
			color2 = Color(Math::Max(Setup::BackgroundColor.GetRed() - 64, 0), Math::Max(Setup::BackgroundColor.GetGreen() - 64, 0), Math::Max(Setup::BackgroundColor.GetBlue() - 64, 0));

			break;
		case FRAME_DOWN:
			color1 = Color(Math::Max(Setup::BackgroundColor.GetRed() - 64, 0), Math::Max(Setup::BackgroundColor.GetGreen() - 64, 0), Math::Max(Setup::BackgroundColor.GetBlue() - 64, 0));
			color2 = Color(Math::Min(Setup::BackgroundColor.GetRed() + 64, 255), Math::Min(Setup::BackgroundColor.GetGreen() + 64, 255), Math::Min(Setup::BackgroundColor.GetBlue() + 64, 255));

			break;
	}

	Bool	 preRTL = rightToLeft.GetRightToLeft();

	rightToLeft.SetRightToLeft(False);

	StartPaint(rect);

	Line(p1, p2, color1);
	Line(p1, p3, color1);
	Line(p2, p4, color2);
	Line(p3, p4, color2);

	SetPixel(p4, color2);

	EndPaint();

	rightToLeft.SetRightToLeft(preRTL);

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebp
movq %rdi, %r14
leaq 0x28(%rdi), %r15
movq %r15, %rdi
callq 0x63296
movq %rax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
movl 0x44(%rsp), %ecx
movl %eax, 0x28(%rsp)
movl %ecx, 0x2c(%rsp)
decl %edx
movl %edx, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movl 0x4c(%rsp), %ecx
decl %ecx
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movl %edx, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
cmpl $0x1, %ebp
je 0x60d7a
xorl %eax, %eax
movl $0x0, %ecx
testl %ebp, %ebp
jne 0x60e09
movq 0x10b7e4(%rip), %rax    # 0x16c4d0
movl 0x8(%rax), %edx
movl $0xff, %r9d
movl %edx, %esi
andl %r9d, %esi
movl $0xbf, %r8d
cmpl %r8d, %esi
movl $0xbf, %r10d
cmovll %esi, %r10d
movl $0x40, %edi
addl %edi, %r10d
movl %edx, %eax
shrl $0x8, %eax
andl %r9d, %eax
cmpl %r8d, %eax
movl $0xbf, %ecx
cmovll %eax, %ecx
shrl $0x10, %edx
andl %r9d, %edx
cmpl %r8d, %edx
cmovll %edx, %r8d
shll $0x10, %r8d
addl $0x400000, %r8d         # imm = 0x400000
shll $0x8, %ecx
addl $0x4000, %ecx           # imm = 0x4000
orl %r10d, %ecx
orl %r8d, %ecx
cmpl $0x41, %esi
cmovll %edi, %esi
addl $-0x40, %esi
cmpl $0x41, %eax
cmovll %edi, %eax
cmpl $0x41, %edx
cmovll %edi, %edx
shll $0x10, %edx
addl $0xffc00000, %edx       # imm = 0xFFC00000
shll $0x8, %eax
addl $0xffffc000, %eax       # imm = 0xFFFFC000
jmp 0x60e05
movq 0x10b74f(%rip), %rax    # 0x16c4d0
movl 0x8(%rax), %edx
movl $0xff, %edi
movl %edx, %esi
andl %edi, %esi
cmpl $0x41, %esi
movl $0x40, %r8d
cmovgel %esi, %r8d
addl $-0x40, %r8d
movl %edx, %eax
shrl $0x8, %eax
andl %edi, %eax
cmpl $0x41, %eax
movl $0x40, %ecx
cmovgel %eax, %ecx
shrl $0x10, %edx
andl %edi, %edx
cmpl $0x41, %edx
movl $0x40, %edi
cmovgel %edx, %edi
movl $0x40, %r9d
shll $0x10, %edi
addl $0xffc00000, %edi       # imm = 0xFFC00000
shll $0x8, %ecx
addl $0xffffc000, %ecx       # imm = 0xFFFFC000
orl %r8d, %ecx
orl %edi, %ecx
movl $0xbf, %edi
cmpl %edi, %esi
cmovgel %edi, %esi
addl %r9d, %esi
cmpl %edi, %eax
cmovgel %edi, %eax
cmpl %edi, %edx
cmovgel %edi, %edx
shll $0x10, %edx
addl $0x400000, %edx         # imm = 0x400000
shll $0x8, %eax
addl $0x4000, %eax           # imm = 0x4000
orl %esi, %eax
orl %edx, %eax
movl %ecx, %ebx
movl %eax, %ebp
movq %r15, %rdi
callq 0x632d8
movb %al, 0xf(%rsp)
xorl %r13d, %r13d
movq %r15, %rdi
xorl %esi, %esi
callq 0x632d2
movq (%r14), %rax
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq *0x38(%rax)
movq %r15, 0x50(%rsp)
leaq 0x30(%rsp), %r15
movq %rbx, 0x8(%r15)
movl %r13d, (%r15)
movq (%r14), %rax
leaq 0x28(%rsp), %r12
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rcx
callq *0x60(%rax)
movq %rbx, 0x8(%r15)
movl %r13d, (%r15)
movq (%r14), %rax
leaq 0x20(%rsp), %r15
leaq 0x30(%rsp), %rbx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq *0x60(%rax)
movq %rbp, 0x8(%rbx)
movl %r13d, (%rbx)
movq (%r14), %rax
leaq 0x18(%rsp), %rbx
leaq 0x30(%rsp), %r12
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq *0x60(%rax)
movq %rbp, 0x8(%r12)
movl %r13d, (%r12)
movq (%r14), %rax
leaq 0x30(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq *0x60(%rax)
movq %rbp, 0x8(%r12)
movl %r13d, (%r12)
movq (%r14), %rax
leaq 0x30(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x58(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movzbl 0xf(%rsp), %esi
movq 0x50(%rsp), %rdi
callq 0x632d2
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop