// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/unsupported.c
// Function: get_fmt
static void get_fmt(deark *c, struct fmtinfo_struct *fmti)
{
	u8 b[32];

	de_zeromem(fmti, sizeof(struct fmtinfo_struct));

	de_read(b, 0, sizeof(b));

	if(!de_memcmp(b, "\x42\x5a\x68", 3) &&
		!de_memcmp(&b[4], "\x31\x41\x59\x26\x53\x59", 6) )
	{
		fmti->confidence = 90;
		fmti->descr = "a bzip2-compressed file";
		return;
	}

	if(!de_memcmp(b, "7z\xbc\xaf\x27\x1c", 6)) {
		fmti->confidence = 90;
		fmti->descr = "a 7z file";
		return;
	}

	// Note - Make sure BSAVE has lower confidence.
	if(!de_memcmp(b, "\xfd\x37\x7a\x58\x5a\x00", 6)) {
		fmti->confidence = 90;
		fmti->descr = "an xz-compressed file";
		return;
	}

	if(!de_memcmp(b, "LZIP", 4)) {
		fmti->confidence = 50;
		fmti->descr = "an lzip-compressed file";
		return;
	}

	if(!de_memcmp(b, "<?xpacket", 9)) {
		fmti->confidence = 20;
		fmti->descr = "an XMP file";
		return;
	}

	if(!de_memcmp(b, "ISc(", 4)) {
		fmti->confidence = 40;
		fmti->descr = "an InstallShield CAB file";
		return;
	}

	if(b[0]=='H' && b[1]=='P' && b[2]=='H' && b[3]=='P' &&
		b[4]=='4' && (b[5]=='8' || b[5]=='9'))
	{
		fmti->confidence = 90;
		fmti->descr = "a non-GROB HP-48/49 file";
		return;
	}

	if(!de_memcmp(b, "%PDF-", 5)) {
		fmti->confidence = 90;
		fmti->descr = "a PDF file";
		return;
	}

	if(!de_memcmp(b, "\x7f" "ELF", 4)) {
		fmti->confidence = 40;
		fmti->descr = "an ELF binary";
		return;
	}

	if(!de_memcmp(b, "\xff" "WPC", 4)) {
		fmti->confidence = 40;
		fmti->descr = "a WordPerfect document";
		return;
	}

	if((!de_memcmp(b, "StuffIt", 7)) && (b[7]=='!' || b[7]=='?')) {
		fmti->confidence = 90;
		fmti->descr = "a StuffIt X archive";
		return;
	}

	if(!de_memcmp(b, "ICE!", 4) ||
		!de_memcmp(b, "Ice!", 4))
	{
		fmti->confidence = 75;
		fmti->descr = "a Pack-Ice compressed file";
		return;
	}

	// Note - Make sure Atari CAS has lower confidence.
	if(!de_memcmp(b, "FUJIFILMCCD-RAW", 15)) {
		fmti->confidence = 100;
		fmti->descr = "a Fujifilm RAF file";
		return;
	}

	if(!de_memcmp(b, "AutoCAD Slide\r\n\x1a", 16)) {
		fmti->confidence = 100;
		fmti->descr = "an AutoCAD Slide file";
		return;
	}

	if(!de_memcmp(b, "Top!", 4)) {
		// A format often found alongside RISC OS Draw files
		fmti->confidence = 9;
		fmti->descr = "an ArtWorks image";
		return;
	}

	if(!de_memcmp(b, "CPT", 3) &&
		(b[3]>='7' && b[3]<='9') &&
		!de_memcmp(&b[4], "FILE", 4))
	{
		fmti->confidence = 91;
		fmti->descr = "a Corel Photo-Paint image";
		return;
	}

	if(!de_memcmp(b, (const void*)"Creative Voice File\x1a", 20)) {
		fmti->confidence = 90;
		fmti->descr = "a Creative Voice audio file";
		return;
	}

	// We're not trying to detect every HTML file, but we want to make sure
	// we can detect the ones we generate.
	if(!de_memcmp(b, "<!DOCTYPE html", 14) ||
		!de_memcmp(b, "\xef\xbb\xbf<!DOCTYPE html", 17) ||
		!de_memcmp(b, "<html", 5))
	{
		fmti->confidence = 20;
		fmti->descr = "an HTML file";
		return;
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
pxor %xmm0, %xmm0
movdqu %xmm0, (%rsi)
movq 0x18(%rdi), %rdi
movq %rsp, %r14
movl $0x20, %ecx
movq %r14, %rsi
xorl %edx, %edx
callq 0xee8d4
movl $0x5a42, %eax           # imm = 0x5A42
xorl (%r14), %eax
movzbl 0x2(%r14), %ecx
xorl $0x68, %ecx
orw %ax, %cx
jne 0xd1537
movl $0x26594131, %eax       # imm = 0x26594131
xorl 0x4(%rsp), %eax
movzwl 0x8(%rsp), %ecx
xorl $0x5953, %ecx           # imm = 0x5953
orl %eax, %ecx
je 0xd15bf
movl $0xafbc7a37, %eax       # imm = 0xAFBC7A37
xorl (%rsp), %eax
movzwl 0x4(%rsp), %ecx
xorl $0x1c27, %ecx           # imm = 0x1C27
orl %eax, %ecx
je 0xd157b
movl $0x587a37fd, %eax       # imm = 0x587A37FD
xorl (%rsp), %eax
movzwl 0x4(%rsp), %ecx
xorl $0x5a, %ecx
orl %eax, %ecx
je 0xd1584
movl (%rsp), %edx
cmpl $0x50495a4c, %edx       # imm = 0x50495A4C
jne 0xd158d
leaq 0x6edcc(%rip), %rcx     # 0x140340
movl $0x32, %eax
jmp 0xd15cb
leaq 0x6ed9e(%rip), %rcx     # 0x140320
jmp 0xd15c6
leaq 0x6ed9f(%rip), %rcx     # 0x14032a
jmp 0xd15c6
movabsq $0x656b636170783f3c, %rax # imm = 0x656B636170783F3C
xorq (%rsp), %rax
movzbl 0x8(%rsp), %ecx
xorq $0x74, %rcx
orq %rax, %rcx
je 0xd15d9
movl $0x28, %eax
cmpl $0x28635349, %edx       # imm = 0x28635349
jne 0xd15e7
leaq 0x6edb1(%rip), %rcx     # 0x14036e
jmp 0xd15cb
leaq 0x6ed3b(%rip), %rcx     # 0x140301
movl $0x5a, %eax
movl %eax, (%rbx)
movq %rcx, 0x8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
retq
leaq 0x6ed82(%rip), %rcx     # 0x140362
movl $0x14, %eax
jmp 0xd15cb
movl %edx, %esi
shrl $0x18, %esi
movl %edx, %ecx
andl $0xffffff, %ecx         # imm = 0xFFFFFF
cmpl $0x485048, %ecx         # imm = 0x485048
jne 0xd161d
cmpl $0x50, %esi
jne 0xd161d
cmpb $0x34, 0x4(%rsp)
jne 0xd161d
movb 0x5(%rsp), %cl
andb $-0x2, %cl
cmpb $0x38, %cl
jne 0xd161d
leaq 0x6ed6d(%rip), %rcx     # 0x140388
jmp 0xd15c6
movl $0x46445025, %ecx       # imm = 0x46445025
xorl (%rsp), %ecx
movzbl 0x4(%rsp), %edi
xorl $0x2d, %edi
orl %ecx, %edi
je 0xd164a
cmpl $0x464c457f, %edx       # imm = 0x464C457F
je 0xd1656
cmpl $0x435057ff, %edx       # imm = 0x435057FF
jne 0xd1662
leaq 0x6ed78(%rip), %rcx     # 0x1403c0
jmp 0xd15cb
leaq 0x6ed56(%rip), %rcx     # 0x1403a7
jmp 0xd15c6
leaq 0x6ed55(%rip), %rcx     # 0x1403b2
jmp 0xd15cb
movl $0x66757453, %eax       # imm = 0x66757453
xorl (%rsp), %eax
movl $0x74496666, %ecx       # imm = 0x74496666
xorl 0x3(%rsp), %ecx
orl %eax, %ecx
je 0xd16f4
leaq 0x6ed75(%rip), %rcx     # 0x1403f3
movl $0x4b, %eax
cmpl $0x21454349, %edx       # imm = 0x21454349
je 0xd15cb
cmpl $0x21656349, %edx       # imm = 0x21656349
je 0xd15cb
movabsq $0x4d4c4946494a5546, %rcx # imm = 0x4D4C4946494A5546
xorq (%rsp), %rcx
movabsq $0x5741522d4443434d, %rdi # imm = 0x5741522D4443434D
xorq 0x7(%rsp), %rdi
movl $0x64, %eax
orq %rcx, %rdi
je 0xd1717
movdqa (%rsp), %xmm0
pcmpeqb 0x6eb61(%rip), %xmm0    # 0x140230
pmovmskb %xmm0, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0xd1723
cmpl $0x21706f54, %edx       # imm = 0x21706F54
jne 0xd172f
leaq 0x6ed6f(%rip), %rcx     # 0x140459
movl $0x9, %eax
jmp 0xd15cb
movzbl 0x7(%rsp), %eax
leaq 0x6ecdf(%rip), %rcx     # 0x1403df
cmpl $0x21, %eax
je 0xd15c6
cmpl $0x3f, %eax
je 0xd15c6
jmp 0xd1677
leaq 0x6ed00(%rip), %rcx     # 0x14041e
jmp 0xd15cb
leaq 0x6ed19(%rip), %rcx     # 0x140443
jmp 0xd15cb
movl $0x5043, %eax           # imm = 0x5043
xorl (%rsp), %eax
movzbl 0x2(%rsp), %ecx
xorl $0x54, %ecx
orw %ax, %cx
jne 0xd1769
addb $-0x37, %sil
cmpb $0x2, %sil
ja 0xd1769
cmpl $0x454c4946, 0x4(%rsp)  # imm = 0x454C4946
jne 0xd1769
leaq 0x6ed10(%rip), %rcx     # 0x14046f
movl $0x5b, %eax
jmp 0xd15cb
movdqa (%rsp), %xmm0
movd 0x10(%rsp), %xmm1
pcmpeqb 0x6eac4(%rip), %xmm1    # 0x140240
pcmpeqb 0x6eacc(%rip), %xmm0    # 0x140250
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0xd1817
movabsq $0x505954434f44213c, %rax # imm = 0x505954434F44213C
xorq (%rsp), %rax
movabsq $0x6c6d746820455059, %rdx # imm = 0x6C6D746820455059
xorq 0x6(%rsp), %rdx
leaq 0x6ed02(%rip), %rcx     # 0x1404bd
orq %rax, %rdx
je 0xd15e0
movdqa (%rsp), %xmm0
movzbl 0x10(%rsp), %eax
movd %eax, %xmm1
pcmpeqb 0x6ea86(%rip), %xmm0    # 0x140260
pcmpeqb 0x6ea8e(%rip), %xmm1    # 0x140270
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0xd15e0
movl $0x6d74683c, %eax       # imm = 0x6D74683C
xorl (%rsp), %eax
movzbl 0x4(%rsp), %edx
xorl $0x6c, %edx
orl %eax, %edx
movl $0x14, %eax
jne 0xd15d1
jmp 0xd15cb
leaq 0x6ec6b(%rip), %rcx     # 0x140489
jmp 0xd15c6
nop