// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/dosbackup.c
// Function: de_identify_dosbackup20
static int de_identify_dosbackup20(deark *c)
{
	u8 b0;
	u8 b;
	u8 fnlen;
	UI seq_num;
	UI n;
	i64 nulpos;

	if(c->infile->len<128) return 0;
	b0 = de_getbyte(0);
	if(b0!=0 && b0!=0xff) return 0;

	// first letter of filename
	b = de_getbyte(5);
	if(b!='\\' && b!='/') return 0;

	seq_num = (UI)de_getu16le(1);
	if(seq_num==0 || seq_num>255) return 0;

	n = (UI)de_getu16le(3); // unknown bytes, expecting 0
	if(n!=0) return 0;

	// len seems to include the trailing NUL
	fnlen = de_getbyte(83);
	if(fnlen<3 || fnlen>78) return 0;
	nulpos = 5+(i64)fnlen-1;

	// last letter of filename
	b = de_getbyte(nulpos-1);
	if(b<33) return 0;

	// Expecting zeros from the filename trailing NUL, until the fn
	// length byte.
	if(!dbuf_is_all_zeroes(c->infile, nulpos, 83-nulpos)) return 0;

	// Expecting zeroes to fill out the 128-byte header.
	if(!dbuf_is_all_zeroes(c->infile, 84, 44)) return 0;

	return (b0==0xff && seq_num==1) ? 45 : 29;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x80, 0x18(%rax)
jge 0x6c6ea
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165060
movb %al, -0x11(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
je 0x6c71e
movzbl -0x11(%rbp), %eax
cmpl $0xff, %eax
je 0x6c71e
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x5, %esi
callq 0x165060
movb %al, -0x12(%rbp)
movzbl -0x12(%rbp), %eax
cmpl $0x5c, %eax
je 0x6c751
movzbl -0x12(%rbp), %eax
cmpl $0x2f, %eax
je 0x6c751
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x1, %esi
callq 0x165280
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x6c775
cmpl $0xff, -0x18(%rbp)
jbe 0x6c781
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x3, %esi
callq 0x165280
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x6c7a8
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x53, %esi
callq 0x165060
movb %al, -0x13(%rbp)
movzbl -0x13(%rbp), %eax
cmpl $0x3, %eax
jl 0x6c7cf
movzbl -0x13(%rbp), %eax
cmpl $0x4e, %eax
jle 0x6c7db
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movzbl -0x13(%rbp), %eax
addq $0x5, %rax
subq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
subq $0x1, %rsi
callq 0x165060
movb %al, -0x12(%rbp)
movzbl -0x12(%rbp), %eax
cmpl $0x21, %eax
jge 0x6c815
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
movl $0x53, %edx
subq -0x28(%rbp), %rdx
callq 0x169d30
cmpl $0x0, %eax
jne 0x6c83d
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x54, %esi
movl $0x2c, %edx
callq 0x169d30
cmpl $0x0, %eax
jne 0x6c862
movl $0x0, -0x4(%rbp)
jmp 0x6c893
movzbl -0x11(%rbp), %ecx
xorl %eax, %eax
cmpl $0xff, %ecx
movb %al, -0x29(%rbp)
jne 0x6c87d
cmpl $0x1, -0x18(%rbp)
sete %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %dl
movl $0x1d, %eax
movl $0x2d, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)