// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/graphics/backends/bitmapbackend.cpp
// Function: smooth::GUI::BitmapBackend::SetBackgroundColor(smooth::GUI::Color const&)
S::Int S::GUI::BitmapBackend::SetBackgroundColor(const Color &iColor)
{
	if (depth != 32) return Success();

	Color	 color = iColor.ConvertTo(Color::RGB);

	Point	 point;

	for (point.y = 0; point.y < size.cy; point.y++)
	{
		for (point.x = 0; point.x < size.cx; point.x++)
		{
			Color	 pixel = GetPixel(point);

			if (pixel.GetAlpha() != 255)
			{
				Color	 result = Color((pixel.GetRed()   * pixel.GetAlpha() + color.GetRed()   * (255 - pixel.GetAlpha())) / 255,
							(pixel.GetGreen() * pixel.GetAlpha() + color.GetGreen() * (255 - pixel.GetAlpha())) / 255,
							(pixel.GetBlue()  * pixel.GetAlpha() + color.GetBlue()  * (255 - pixel.GetAlpha())) / 255);

				SetPixel(point, 255 << 24 | result);
			}
		}
	}

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movsbl 0xa(%rax), %eax
cmpl $0x20, %eax
je 0x6cc3c
leaq -0x28(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x5ca80
movq -0xa8(%rbp), %rdi
callq 0x59680
movl %eax, -0x9c(%rbp)
jmp 0x6cc0b
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5a410
jmp 0x6ceab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5a410
jmp 0x6ceb7
movq -0x18(%rbp), %rsi
leaq -0x48(%rbp), %rdi
xorl %edx, %edx
callq 0x5c5e0
leaq -0x50(%rbp), %rdi
callq 0x5b530
movl $0x0, -0x4c(%rbp)
movq -0x98(%rbp), %rcx
movl -0x4c(%rbp), %eax
cmpl 0x14(%rcx), %eax
jge 0x6ce53
movl $0x0, -0x50(%rbp)
movq -0x98(%rbp), %rcx
movl -0x50(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x6ce43
movq -0x98(%rbp), %rsi
movq (%rsi), %rax
leaq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq *0x60(%rax)
leaq -0x60(%rbp), %rdi
callq 0x5bac0
cmpl $0xff, %eax
je 0x6ce33
leaq -0x60(%rbp), %rdi
callq 0x59f20
movl %eax, -0xd4(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5bac0
movl %eax, %ecx
movl -0xd4(%rbp), %eax
imull %ecx, %eax
movl %eax, -0xcc(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x59f20
movl %eax, -0xd0(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5bac0
movl -0xd0(%rbp), %ecx
movl %eax, %esi
movl -0xcc(%rbp), %eax
movl $0xff, %edx
subl %esi, %edx
imull %edx, %ecx
addl %ecx, %eax
movl $0xff, %ecx
cltd
idivl %ecx
movl %eax, -0xb4(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5d920
movl %eax, -0xc8(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5bac0
movl %eax, %ecx
movl -0xc8(%rbp), %eax
imull %ecx, %eax
movl %eax, -0xc0(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5d920
movl %eax, -0xc4(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5bac0
movl -0xc4(%rbp), %ecx
movl %eax, %esi
movl -0xc0(%rbp), %eax
movl $0xff, %edx
subl %esi, %edx
imull %edx, %ecx
addl %ecx, %eax
movl $0xff, %ecx
cltd
idivl %ecx
movl %eax, -0xac(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5b650
movl %eax, -0xbc(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5bac0
movl %eax, %ecx
movl -0xbc(%rbp), %eax
imull %ecx, %eax
movl %eax, -0xb0(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5b650
movl %eax, -0xb8(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5bac0
movl -0xb8(%rbp), %ecx
movl -0xb4(%rbp), %esi
movl %eax, %edi
movl -0xb0(%rbp), %eax
movl $0xff, %edx
subl %edi, %edx
imull %edx, %ecx
addl %ecx, %eax
movl $0xff, %ecx
cltd
idivl %ecx
movl -0xac(%rbp), %edx
movl %eax, %ecx
leaq -0x70(%rbp), %rdi
xorl %r8d, %r8d
callq 0x5a6b0
leaq -0x70(%rbp), %rdi
callq 0x59210
movq %rax, %rsi
orq $-0x1000000, %rsi       # imm = 0xFF000000
leaq -0x80(%rbp), %rdi
xorl %edx, %edx
callq 0x59be0
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
leaq -0x50(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq *0x58(%rax)
jmp 0x6ce35
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x6cc75
jmp 0x6ce45
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x6cc5b
leaq -0x90(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x5ca80
movq -0xe0(%rbp), %rdi
callq 0x59680
movl %eax, -0xd8(%rbp)
jmp 0x6ce7a
movl -0xd8(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5a410
jmp 0x6ceab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5a410
jmp 0x6ceb7
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0