// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/graphics/backends/surfacebackend.cpp
// Function: smooth::GUI::SurfaceBackend::PremultiplyAlpha(smooth::GUI::Bitmap&)
S::Int S::GUI::SurfaceBackend::PremultiplyAlpha(Bitmap &bitmap)
{
	if (bitmap.GetDepth() != 32) return Success();

	Point	 point;
	Size	 size = bitmap.GetSize();

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

			if (pixel.GetAlpha() != 255) bitmap.SetPixel(point, Color( pixel.GetRed()   * pixel.GetAlpha() / 255	    |
										  (pixel.GetGreen() * pixel.GetAlpha() / 255) <<  8 |
										  (pixel.GetBlue()  * pixel.GetAlpha() / 255) << 16 |
												      pixel.GetAlpha()	      << 24, Color::RGBA));
		}
	}

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5b190
movsbl %al, %eax
cmpl $0x20, %eax
je 0x6fc89
leaq -0x20(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x5ca80
movq -0x80(%rbp), %rdi
callq 0x59680
movl %eax, -0x74(%rbp)
jmp 0x6fc5b
movl -0x74(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5a410
jmp 0x6fe4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5a410
jmp 0x6fe5b
leaq -0x34(%rbp), %rdi
callq 0x5b530
movq -0x10(%rbp), %rdi
callq 0x5ce60
movq (%rax), %rax
movq %rax, -0x3c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x6fe00
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x6fdf0
movq -0x10(%rbp), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x34(%rbp), %rdx
callq 0x5a220
leaq -0x50(%rbp), %rdi
callq 0x5bac0
cmpl $0xff, %eax
je 0x6fde0
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x59f20
movl %eax, -0xa0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5bac0
movl %eax, %ecx
movl -0xa0(%rbp), %eax
imull %ecx, %eax
movl $0xff, %ecx
cltd
idivl %ecx
movl %eax, -0x98(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5d920
movl %eax, -0x9c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5bac0
movl %eax, %ecx
movl -0x9c(%rbp), %eax
imull %ecx, %eax
movl $0xff, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x98(%rbp), %eax
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5b650
movl %eax, -0x94(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5bac0
movl %eax, %ecx
movl -0x94(%rbp), %eax
imull %ecx, %eax
movl $0xff, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x90(%rbp), %eax
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, -0x8c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5bac0
movl %eax, %ecx
movl -0x8c(%rbp), %eax
shll $0x18, %ecx
orl %ecx, %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
movl $0x1, %edx
callq 0x59be0
movq -0x88(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x5a3d0
jmp 0x6fde2
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x6fcbc
jmp 0x6fdf2
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x6fca9
leaq -0x70(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x5ca80
movq -0xb0(%rbp), %rdi
callq 0x59680
movl %eax, -0xa4(%rbp)
jmp 0x6fe24
movl -0xa4(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5a410
jmp 0x6fe4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5a410
jmp 0x6fe5b
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)
nop