// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/widgets/basic/progressbar.cpp
// Function: smooth::GUI::Progressbar::CreateGradient(smooth::GUI::Size const&)
S::Void S::GUI::Progressbar::CreateGradient(const Size &gSize)
{
	gradient.CreateBitmap(gSize - Size(2, 2));
	gradientDirection = IsRightToLeft();

	Color	 startColor = IsRightToLeft() ? Setup::GradientEndColor : Setup::GradientStartColor;
	Color	 endColor   = IsRightToLeft() ? Setup::GradientStartColor : Setup::GradientEndColor;

	Int	 rs	    = startColor.GetRed();
	Int	 gs	    = startColor.GetGreen();
	Int	 bs	    = startColor.GetBlue();
	Float	 rp	    = ((Float) (endColor.GetRed() - rs)) / ((subtype == OR_HORZ) ? (gSize.cx - 2) : (gSize.cy - 2));
	Float	 gp	    = ((Float) (endColor.GetGreen() - gs)) / ((subtype == OR_HORZ) ? (gSize.cx - 2) : (gSize.cy - 2));
	Float	 bp	    = ((Float) (endColor.GetBlue() - bs)) / ((subtype == OR_HORZ) ? (gSize.cx - 2) : (gSize.cy - 2));

	if (subtype == OR_HORZ)
	{
		for (Int x = 0; x < gSize.cx - 2; x++)
		{
			for (Int y = 0; y < gSize.cy - 2; y++) gradient.SetPixel(Point(x, y), Color((Int) (rs + rp * x), (Int) (gs + gp * x), (Int) (bs + bp * x)));
		}
	}
	else
	{
		for (Int y = 0; y < gSize.cy - 2; y++)
		{
			for (Int x = 0; x < gSize.cx - 2; x++) gradient.SetPixel(Point(x, gSize.cy - 3 - y), Color((Int) (rs + rp * y), (Int) (gs + gp * y), (Int) (bs + bp * y)));
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r15
addq $0x5b8, %rdi            # imm = 0x5B8
movl (%rsi), %eax
movl 0x4(%rsi), %ecx
addl $-0x2, %eax
addl $-0x2, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movq %rdi, 0x48(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x57c20
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movb %al, 0x5c0(%r15)
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movq 0xf179c(%rip), %r12     # 0x16bf20
addq $0x8, %r12
movq 0xf1829(%rip), %r13     # 0x16bfb8
addq $0x8, %r13
movq (%r15), %rcx
testb %al, %al
movq %r13, %rax
cmovneq %r12, %rax
movl (%rax), %ebp
movq %r15, %rdi
callq *0x160(%rcx)
movl $0xff, %edi
movl %ebp, %edx
andl %edi, %edx
movl %ebp, %esi
shrl $0x8, %esi
andl %edi, %esi
shrl $0x10, %ebp
andl %edi, %ebp
testb %al, %al
cmoveq %r12, %r13
movl (%r13), %r8d
movl %r8d, %r10d
andl %edi, %r10d
subl %edx, %r10d
movzwl 0x1a0(%r15), %r9d
cmpw $0x1, %r9w
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
movl %ecx, %r11d
cmovel %eax, %r11d
addl $-0x2, %r11d
movl %r8d, %r15d
shrl $0x8, %r15d
andl %edi, %r15d
subl %esi, %r15d
shrl $0x10, %r8d
andl %edi, %r8d
subl %ebp, %r8d
cvtsi2sd %r10d, %xmm1
cvtsi2sd %r11d, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
cmpw $0x1, %r9w
jne 0x7a927
cmpl $0x3, %eax
jl 0x7aa12
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r14d, %r14d
movq %rsp, %r12
leaq 0x20(%rsp), %rbp
cmpl $0x3, %ecx
jl 0x7a913
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd 0x40(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x18(%rsp), %xmm1
cvttsd2si %xmm1, %eax
movsd 0x38(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rsp), %xmm1
cvttsd2si %xmm1, %ecx
mulsd 0x30(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %esi
shll $0x10, %esi
shll $0x8, %ecx
orl %eax, %ecx
orl %esi, %ecx
movslq %ecx, %r13
xorl %r15d, %r15d
movl %r14d, (%rsp)
movl %r15d, 0x4(%rsp)
movq %r13, 0x28(%rsp)
movl $0x0, 0x20(%rsp)
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x56080
incl %r15d
movl 0x4(%rbx), %ecx
leal -0x2(%rcx), %eax
cmpl %eax, %r15d
jl 0x7a8dd
movl (%rbx), %eax
incl %r14d
leal -0x2(%rax), %esi
cmpl %esi, %r14d
jl 0x7a884
jmp 0x7aa12
cmpl $0x3, %ecx
jl 0x7aa12
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x50(%rsp)
xorl %r13d, %r13d
movq %rsp, %r12
leaq 0x20(%rsp), %r14
cmpl $0x3, %eax
jl 0x7aa03
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0x40(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rsp), %xmm1
cvttsd2si %xmm1, %eax
movsd 0x38(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x8(%rsp), %xmm1
cvttsd2si %xmm1, %ecx
mulsd 0x30(%rsp), %xmm0
addsd 0x50(%rsp), %xmm0
cvttsd2si %xmm0, %esi
shll $0x10, %esi
shll $0x8, %ecx
orl %eax, %ecx
orl %esi, %ecx
movslq %ecx, %rax
movq %rax, 0x18(%rsp)
xorl %r15d, %r15d
movl 0x4(%rbx), %eax
subl %r13d, %eax
addl $-0x3, %eax
movl %r15d, (%rsp)
movl %eax, 0x4(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x28(%rsp)
movl $0x0, 0x20(%rsp)
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x56080
incl %r15d
movl (%rbx), %eax
leal -0x2(%rax), %ecx
cmpl %ecx, %r15d
jl 0x7a9c0
movl 0x4(%rbx), %ecx
incl %r13d
leal -0x2(%rcx), %esi
cmpl %esi, %r13d
jl 0x7a962
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)