// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/graphics/imageloader/imageloader.cpp
// Function: smooth::GUI::DetectImageFormat(smooth::Buffer<unsigned char> const&)
static Short DetectImageFormat(const Buffer<UnsignedByte> &buffer)
		{
			Short	 format = IMAGE_FORMAT_AUTO;

			if (buffer.Size() < 12) return format;

			if	(buffer[ 0] == 0x50 && buffer[ 1] == 0x43 &&
				 buffer[ 2] == 0x49 && buffer[ 3] == 0x46) format = IMAGE_FORMAT_PCI;
			else if (buffer[ 0] == 0xFF && buffer[ 1] == 0xD8) format = IMAGE_FORMAT_JPEG;
			else if (buffer[ 0] == 0x89 && buffer[ 1] == 0x50 &&
				 buffer[ 2] == 0x4E && buffer[ 3] == 0x47 &&
				 buffer[ 4] == 0x0D && buffer[ 5] == 0x0A &&
				 buffer[ 6] == 0x1A && buffer[ 7] == 0x0A) format = IMAGE_FORMAT_PNG;
			else if (buffer[ 0] == 0x52 && buffer[ 1] == 0x49 &&
				 buffer[ 2] == 0x46 && buffer[ 3] == 0x46 &&
				 buffer[ 8] == 0x57 && buffer[ 9] == 0x45 &&
				 buffer[10] == 0x42 && buffer[11] == 0x50) format = IMAGE_FORMAT_WEBP;

			return format;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movw $0xffff, -0x12(%rbp)    # imm = 0xFFFF
movq -0x10(%rbp), %rdi
callq 0x71140
cmpl $0xc, %eax
jge 0x70b8d
movw -0x12(%rbp), %ax
movw %ax, -0x2(%rbp)
jmp 0x70db0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x50, %eax
jne 0x70bed
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x43, %eax
jne 0x70bed
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x49, %eax
jne 0x70bed
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x46, %eax
jne 0x70bed
movw $0x0, -0x12(%rbp)
jmp 0x70da8
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0xff, %eax
jne 0x70c25
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0xd8, %eax
jne 0x70c25
movw $0x2, -0x12(%rbp)
jmp 0x70da6
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x89, %eax
jne 0x70ce7
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x50, %eax
jne 0x70ce7
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x4e, %eax
jne 0x70ce7
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x47, %eax
jne 0x70ce7
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0xd, %eax
jne 0x70ce7
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x70ce7
movq -0x10(%rbp), %rdi
movl $0x6, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x1a, %eax
jne 0x70ce7
movq -0x10(%rbp), %rdi
movl $0x7, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x70ce7
movw $0x1, -0x12(%rbp)
jmp 0x70da4
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x52, %eax
jne 0x70da2
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x49, %eax
jne 0x70da2
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x46, %eax
jne 0x70da2
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x46, %eax
jne 0x70da2
movq -0x10(%rbp), %rdi
movl $0x8, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x57, %eax
jne 0x70da2
movq -0x10(%rbp), %rdi
movl $0x9, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x45, %eax
jne 0x70da2
movq -0x10(%rbp), %rdi
movl $0xa, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x42, %eax
jne 0x70da2
movq -0x10(%rbp), %rdi
movl $0xb, %esi
callq 0x71160
movzbl %al, %eax
cmpl $0x50, %eax
jne 0x70da2
movw $0x3, -0x12(%rbp)
jmp 0x70da4
jmp 0x70da6
jmp 0x70da8
movw -0x12(%rbp), %ax
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)