// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/graphics/imageloader/imageloader.cpp
// Function: smooth::GUI::ImageLoader::Load(smooth::Buffer<unsigned char> const&, short)
S::GUI::Bitmap S::GUI::ImageLoader::Load(const Buffer<UnsignedByte> &buffer, Short format)
{
	/* Auto-detect image format.
	 */
	if (format == IMAGE_FORMAT_AUTO) format = DetectImageFormat(buffer);

	/* Create image loader.
	 */
	ImageLoader	*loader = NIL;

	if	(format == IMAGE_FORMAT_PCI)  loader = new ImageLoaderPCI(buffer);
	else if (format == IMAGE_FORMAT_PNG)  loader = new ImageLoaderPNG(buffer);
	else if (format == IMAGE_FORMAT_JPEG) loader = new ImageLoaderJPEG(buffer);
	else if (format == IMAGE_FORMAT_WEBP) loader = new ImageLoaderWebP(buffer);

	if (loader == NIL) return NIL;

	Bitmap	 bitmap = loader->Load();

	delete loader;

	return bitmap;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x40(%rbp)
movw %dx, %ax
movq %rdi, %rcx
movq %rcx, -0x38(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movswl -0x12(%rbp), %eax
cmpl $-0x1, %eax
jne 0x70df8
movq -0x10(%rbp), %rdi
callq 0x70b60
movw %ax, -0x12(%rbp)
movq $0x0, -0x20(%rbp)
movswl -0x12(%rbp), %eax
cmpl $0x0, %eax
jne 0x70e54
movl $0x48, %edi
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rsi
callq 0x71850
jmp 0x70e28
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x70f4d
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x48, %esi
callq 0x595b0
jmp 0x70fb2
movswl -0x12(%rbp), %eax
cmpl $0x1, %eax
jne 0x70ea8
movl $0x48, %edi
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rsi
callq 0x71e30
jmp 0x70e7c
movq -0x50(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x70f4b
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x48, %esi
callq 0x595b0
jmp 0x70fb2
movswl -0x12(%rbp), %eax
cmpl $0x2, %eax
jne 0x70ef9
movl $0x48, %edi
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rsi
callq 0x71290
jmp 0x70ed0
movq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x70f49
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x48, %esi
callq 0x595b0
jmp 0x70fb2
movswl -0x12(%rbp), %eax
cmpl $0x3, %eax
jne 0x70f47
movl $0x48, %edi
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rsi
callq 0x72930
jmp 0x70f21
movq -0x60(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x70f47
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x48, %esi
callq 0x595b0
jmp 0x70fb2
jmp 0x70f49
jmp 0x70f4b
jmp 0x70f4d
cmpq $0x0, -0x20(%rbp)
jne 0x70f61
movq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x5d4a0
jmp 0x70fa8
movb $0x0, -0x2d(%rbp)
movq -0x20(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x5b7e0
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x70f93
movq -0x68(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movb $0x1, -0x2d(%rbp)
testb $0x1, -0x2d(%rbp)
jne 0x70fa6
movq -0x40(%rbp), %rdi
callq 0x5de40
jmp 0x70fa8
movq -0x38(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x5b6b0
nopl (%rax,%rax)