// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/graphics/backends/surfacebackend.cpp
// Function: smooth::GUI::SurfaceBackend::Bar(smooth::GUI::Point const&, smooth::GUI::Point const&, int)
S::Int S::GUI::SurfaceBackend::Bar(const Point &iP1, const Point &iP2, Int orientation)
{
	Point	 p1 = rightToLeft.TranslatePoint(iP1);
	Point	 p2 = rightToLeft.TranslatePoint(iP2);

	if (rightToLeft.GetRightToLeft())
	{
		if (orientation == OR_HORZ) { p1 = rightToLeft.TranslatePoint(iP2);	p2 = rightToLeft.TranslatePoint(iP1); }
		if (orientation == OR_VERT) { p1 -= Point(2, 0);			p2 -= Point(2, 0); }
	}

	Bool	 preRTL = rightToLeft.GetRightToLeft();

	rightToLeft.SetRightToLeft(False);

	if (orientation == OR_HORZ)
	{
		Line(p1, p2, Color(Math::Max(Setup::BackgroundColor.GetRed() - 64, 0), Math::Max(Setup::BackgroundColor.GetGreen() - 64, 0), Math::Max(Setup::BackgroundColor.GetBlue() - 64, 0)));
		p1.y++;
		p2.y++;
		Line(p1, p2, Color(Math::Min(Setup::BackgroundColor.GetRed() + 64, 255), Math::Min(Setup::BackgroundColor.GetGreen() + 64, 255), Math::Min(Setup::BackgroundColor.GetBlue() + 64, 255)));
	}
	else if (orientation == OR_VERT)
	{
		p2.y++;
		Line(p1, p2, Color(Math::Max(Setup::BackgroundColor.GetRed() - 64, 0), Math::Max(Setup::BackgroundColor.GetGreen() - 64, 0), Math::Max(Setup::BackgroundColor.GetBlue() - 64, 0)));
		p1.x++;
		p2.x++;
		Line(p1, p2, Color(Math::Min(Setup::BackgroundColor.GetRed() + 64, 255), Math::Min(Setup::BackgroundColor.GetGreen() + 64, 255), Math::Min(Setup::BackgroundColor.GetBlue() + 64, 255)));
	}

	rightToLeft.SetRightToLeft(preRTL);

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r15d
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %r14
leaq 0x28(%rdi), %rbx
movq %rbx, %rdi
callq 0x63272
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x63272
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
callq 0x632d8
testb %al, %al
je 0x61511
cmpl $0x2, %r15d
je 0x61507
cmpl $0x1, %r15d
jne 0x61511
movq %rbx, %rdi
movq %r13, %rsi
callq 0x63272
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x63272
movq %rax, 0x8(%rsp)
jmp 0x61511
addl $-0x2, 0x10(%rsp)
addl $-0x2, 0x8(%rsp)
movq %rbx, %rdi
callq 0x632d8
movl %eax, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x632d2
cmpl $0x2, %r15d
je 0x6162c
cmpl $0x1, %r15d
jne 0x6171c
movq 0x10af8d(%rip), %rax    # 0x16c4d0
movl 0x8(%rax), %eax
movb %bpl, 0x7(%rsp)
movl $0xff, %ebp
movl %eax, %ecx
andl %ebp, %ecx
cmpl $0x41, %ecx
movl $0x40, %edx
cmovll %edx, %ecx
addl $-0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %ebp, %esi
cmpl $0x41, %esi
cmovll %edx, %esi
shrl $0x10, %eax
andl %ebp, %eax
cmpl $0x41, %eax
cmovll %edx, %eax
shll $0x10, %eax
addl $0xffc00000, %eax       # imm = 0xFFC00000
shll $0x8, %esi
addl $0xffffc000, %esi       # imm = 0xFFFFC000
orl %ecx, %esi
orl %eax, %esi
leaq 0x18(%rsp), %r15
movq %rsi, 0x8(%r15)
xorl %eax, %eax
movl %eax, (%r15)
movq (%r14), %rax
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq *0x60(%rax)
incl 0x4(%r12)
incl 0x4(%r13)
movq 0x10af07(%rip), %rax    # 0x16c4d0
movl 0x8(%rax), %eax
movl %eax, %ecx
andl %ebp, %ecx
movl $0xbf, %edx
cmpl %edx, %ecx
cmovgel %edx, %ecx
addl $0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %ebp, %esi
cmpl %edx, %esi
cmovgel %edx, %esi
shrl $0x10, %eax
andl %ebp, %eax
movb 0x7(%rsp), %bpl
cmpl %edx, %eax
cmovgel %edx, %eax
shll $0x10, %eax
addl $0x400000, %eax         # imm = 0x400000
shll $0x8, %esi
addl $0x4000, %esi           # imm = 0x4000
orl %ecx, %esi
orl %eax, %esi
movq %rsi, 0x8(%r15)
xorl %eax, %eax
movl %eax, (%r15)
movq (%r14), %rax
leaq 0x18(%rsp), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
jmp 0x61719
leaq 0x8(%rsp), %r15
incl 0x4(%r15)
movq 0x10ae94(%rip), %rax    # 0x16c4d0
movl 0x8(%rax), %eax
movb %bpl, 0x7(%rsp)
movl $0xff, %ebp
movl %eax, %ecx
andl %ebp, %ecx
cmpl $0x41, %ecx
movl $0x40, %edx
cmovll %edx, %ecx
addl $-0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %ebp, %esi
cmpl $0x41, %esi
cmovll %edx, %esi
shrl $0x10, %eax
andl %ebp, %eax
cmpl $0x41, %eax
cmovll %edx, %eax
shll $0x10, %eax
addl $0xffc00000, %eax       # imm = 0xFFC00000
shll $0x8, %esi
addl $0xffffc000, %esi       # imm = 0xFFFFC000
orl %ecx, %esi
orl %eax, %esi
leaq 0x18(%rsp), %r13
movq %rsi, 0x8(%r13)
movl %r12d, (%r13)
movq (%r14), %rax
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq *0x60(%rax)
incl (%r12)
incl (%r15)
movq 0x10ae16(%rip), %rax    # 0x16c4d0
movl 0x8(%rax), %eax
movl %eax, %ecx
andl %ebp, %ecx
movl $0xbf, %edi
cmpl %edi, %ecx
cmovgel %edi, %ecx
addl $0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %ebp, %esi
cmpl %edi, %esi
cmovgel %edi, %esi
shrl $0x10, %eax
andl %ebp, %eax
movb 0x7(%rsp), %bpl
cmpl %edi, %eax
cmovgel %edi, %eax
shll $0x10, %eax
addl $0x400000, %eax         # imm = 0x400000
shll $0x8, %esi
addl $0x4000, %esi           # imm = 0x4000
orl %ecx, %esi
orl %eax, %esi
movq %rsi, 0x8(%r13)
xorl %eax, %eax
movl %eax, (%r13)
movq (%r14), %rax
leaq 0x18(%rsp), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x60(%rax)
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x632d2
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop