// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movl %ecx, %r12d
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, 0x20(%rsp)
leaq 0x28(%rdi), %rbx
movq %rbx, %rdi
callq 0x632a6
movq %rax, %r14
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x632a6
movq %rax, %r15
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x6330c
testb %al, %al
je 0x615ab
cmpl $0x2, %r12d
je 0x616db
cmpl $0x1, %r12d
jne 0x615ab
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x632a6
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x632a6
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x6330c
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x63306
jmp 0x615d3
movq %rbx, %rdi
callq 0x6330c
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x63306
cmpl $0x2, %r12d
je 0x616d4
cmpl $0x1, %r12d
jne 0x61804
movb %bpl, 0xf(%rsp)
movq 0x109ef1(%rip), %rax    # 0x16b4d0
movl 0x8(%rax), %eax
movl $0xff, %r14d
movl %eax, %ecx
andl %r14d, %ecx
cmpl $0x41, %ecx
movl $0x40, %edx
cmovbl %edx, %ecx
addl $-0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %r14d, %esi
cmpl $0x41, %esi
cmovbl %edx, %esi
shrl $0x10, %eax
andl %r14d, %eax
cmpl $0x41, %eax
cmovbl %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 0x28(%rsp), %r15
movq %rsi, 0x8(%r15)
xorl %eax, %eax
movl %eax, (%r15)
movq 0x20(%rsp), %rbp
movq (%rbp), %rax
leaq 0x18(%rsp), %r12
leaq 0x10(%rsp), %r13
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq *0x60(%rax)
incl 0x4(%r12)
incl 0x4(%r13)
movq 0x109e66(%rip), %rax    # 0x16b4d0
movl 0x8(%rax), %eax
movl %eax, %ecx
andl %r14d, %ecx
movl $0xbf, %edx
cmpl %edx, %ecx
cmovael %edx, %ecx
addl $0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %r14d, %esi
cmpl %edx, %esi
cmovael %edx, %esi
shrl $0x10, %eax
andl %r14d, %eax
cmpl %edx, %eax
cmovael %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 (%rbp), %rax
leaq 0x28(%rsp), %rcx
movq %rbp, %rdi
movb 0xf(%rsp), %bpl
movq %r12, %rsi
movq %r13, %rdx
callq *0x60(%rax)
jmp 0x61804
movb %bpl, 0xf(%rsp)
jmp 0x61702
addl $-0x2, %r14d
movl %r14d, 0x18(%rsp)
leal -0x2(%r15), %eax
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x6330c
movb %al, 0xf(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x63306
shrq $0x20, %r15
incl %r15d
movq 0x109dc0(%rip), %rax    # 0x16b4d0
movl 0x8(%rax), %eax
movl $0xff, %r14d
movl %eax, %ecx
andl %r14d, %ecx
cmpl $0x41, %ecx
movl $0x40, %edx
cmovbl %edx, %ecx
addl $-0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %r14d, %esi
cmpl $0x41, %esi
cmovbl %edx, %esi
shrl $0x10, %eax
andl %r14d, %eax
cmpl $0x41, %eax
cmovbl %edx, %eax
leaq 0x10(%rsp), %r12
movl %r15d, 0x4(%r12)
shll $0x10, %eax
addl $0xffc00000, %eax       # imm = 0xFFC00000
shll $0x8, %esi
addl $0xffffc000, %esi       # imm = 0xFFFFC000
orl %ecx, %esi
orl %eax, %esi
leaq 0x28(%rsp), %r15
movq %rsi, 0x8(%r15)
xorl %eax, %eax
movl %eax, (%r15)
movq 0x20(%rsp), %rbp
movq (%rbp), %rax
leaq 0x18(%rsp), %r13
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq *0x60(%rax)
incl (%r13)
incl (%r12)
movq 0x109d31(%rip), %rax    # 0x16b4d0
movl 0x8(%rax), %eax
movl %eax, %ecx
andl %r14d, %ecx
movl $0xbf, %edx
cmpl %edx, %ecx
cmovael %edx, %ecx
addl $0x40, %ecx
movl %eax, %esi
shrl $0x8, %esi
andl %r14d, %esi
cmpl %edx, %esi
cmovael %edx, %esi
shrl $0x10, %eax
andl %r14d, %eax
cmpl %edx, %eax
cmovael %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 (%rbp), %rax
leaq 0x28(%rsp), %rcx
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq *0x60(%rax)
movb 0xf(%rsp), %bpl
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x63306
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop