// File: /workspace/github_c_makefile_star2_O1/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
leaq 0x5b8(%rdi), %r14
movl (%rsi), %eax
movl 0x4(%rsi), %ecx
addl $-0x2, %eax
leaq 0x4(%rsi), %rdx
movq %rdx, 0x8(%rsp)
addl $-0x2, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
movq %r14, %rdi
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 0xf24a3(%rip), %r13     # 0x16cf20
addq $0x8, %r13
movq 0xf2530(%rip), %r12     # 0x16cfb8
addq $0x8, %r12
movq (%r15), %rcx
testb %al, %al
movq %r12, %rax
cmovneq %r13, %rax
movl (%rax), %ebp
movq %r15, %rdi
callq *0x160(%rcx)
movl $0xff, %esi
movl %ebp, %ecx
andl %esi, %ecx
movl %ebp, %edx
shrl $0x8, %edx
andl %esi, %edx
shrl $0x10, %ebp
andl %esi, %ebp
testb %al, %al
cmoveq %r13, %r12
movl (%r12), %eax
movl %eax, %edi
andl %esi, %edi
subl %ecx, %edi
movzwl 0x1a0(%r15), %r8d
cmpw $0x1, %r8w
movq 0x8(%rsp), %r9
cmoveq %rbx, %r9
movl (%r9), %r9d
addl $-0x2, %r9d
movl %eax, %r10d
shrl $0x8, %r10d
andl %esi, %r10d
subl %edx, %r10d
shrl $0x10, %eax
andl %esi, %eax
subl %ebp, %eax
cvtsi2sd %edi, %xmm1
cvtsi2sd %r9d, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %r10d, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x48(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
cmpw $0x1, %r8w
jne 0x7ac24
cmpl $0x3, (%rbx)
jl 0x7ad21
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %r13d, %r13d
leaq 0x10(%rsp), %r12
leaq 0x30(%rsp), %rbp
cmpl $0x3, 0x4(%rbx)
jl 0x7ac0e
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0x50(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x28(%rsp), %xmm1
cvttsd2si %xmm1, %eax
movsd 0x48(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x20(%rsp), %xmm1
cvttsd2si %xmm1, %ecx
mulsd 0x40(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %esi
shll $0x10, %esi
shll $0x8, %ecx
orl %eax, %ecx
orl %esi, %ecx
movslq %ecx, %rax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movl %r13d, 0x10(%rsp)
movl %r15d, 0x14(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x30(%rsp)
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x56080
incl %r15d
movl 0x4(%rbx), %eax
addl $-0x2, %eax
cmpl %eax, %r15d
jl 0x7abd6
incl %r13d
movl (%rbx), %eax
addl $-0x2, %eax
cmpl %eax, %r13d
jl 0x7ab77
jmp 0x7ad21
cmpl $0x3, 0x4(%rbx)
jl 0x7ad21
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %r13d, %r13d
leaq 0x10(%rsp), %r12
leaq 0x30(%rsp), %rdx
cmpl $0x3, (%rbx)
jl 0x7ad0f
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0x50(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x28(%rsp), %xmm1
cvttsd2si %xmm1, %eax
movsd 0x48(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x20(%rsp), %xmm1
cvttsd2si %xmm1, %ecx
mulsd 0x40(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %esi
shll $0x10, %esi
shll $0x8, %ecx
orl %eax, %ecx
orl %esi, %ecx
movslq %ecx, %rax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movl 0x4(%rbx), %eax
subl %r13d, %eax
addl $-0x3, %eax
movl %r15d, 0x10(%rsp)
movl %eax, 0x14(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x30(%rsp)
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rbp
movq %r14, %rbx
movq %rdx, %r14
callq 0x56080
movq %r14, %rdx
movq %rbx, %r14
movq %rbp, %rbx
incl %r15d
movl (%rbp), %eax
addl $-0x2, %eax
cmpl %eax, %r15d
jl 0x7acc0
incl %r13d
movl 0x4(%rbx), %eax
addl $-0x2, %eax
cmpl %eax, %r13d
jl 0x7ac62
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq