// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/maker_generic.c
// Function: invalid_ifd_entry
int
invalid_ifd_entry(FILE *inptr,unsigned long offset,unsigned long segment_size,
                    int nentries,unsigned short byteorder)
{
    struct ifd_entry *entry_ptr;
    int invalid = 0;

    if(inptr && offset && byteorder)
    {
        /* Read an entry at the given offset and see if has a valid   */
        /* type, and non-zero count.                                  */
        entry_ptr = read_ifd_entry(inptr,byteorder,offset);
        if((entry_ptr->value_type == 0) || (entry_ptr->value_type > DOUBLE) ||
            ferror(inptr) || feof(inptr))
                ++invalid;
        else if(entry_ptr->count == 0)
                ++invalid;
        
        /* If there is more than one entry, and the first appears     */
        /* valid, check the second entry.                             */
        /* If there is only one entry, and it appears valid, make     */
        /* sure that it's size fits within the note. This size check  */
        /* can fail on multi-entry notes when moronic makers write a  */
        /* thumbnail offset, then write the thumbnail outside the     */
        /* note...so we don't check size for multi.                   */
        if(nentries > 1)
        {
            if(invalid == 0)    /* double check                           */
            {
                entry_ptr = read_ifd_entry(inptr,byteorder,HERE);
                if((entry_ptr->value_type == 0) || (entry_ptr->value_type > DOUBLE) ||
                    ferror(inptr) || feof(inptr))
                        ++invalid;
                else if(entry_ptr->count == 0)
                        ++invalid;
            }
        }
        else if(entry_ptr->count > segment_size)
            ++invalid;
    }
    else
        ++invalid;
    return(invalid);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %r8w, %ax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movw %ax, -0x1e(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x28050
cmpq $0x0, -0x10(%rbp)
je 0x28050
movzwl -0x1e(%rbp), %eax
cmpl $0x0, %eax
je 0x28050
movq -0x8(%rbp), %rdi
movw -0x1e(%rbp), %ax
movq -0x10(%rbp), %rdx
movzwl %ax, %esi
callq 0x4c60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x27f97
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0xc, %eax
jg 0x27f97
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x27f97
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x27fa2
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x27fb8
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x27fb6
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x27fb8
cmpl $0x1, -0x1c(%rbp)
jle 0x28035
cmpl $0x0, -0x2c(%rbp)
jne 0x28033
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0x1e(%rbp), %esi
callq 0x4c60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x28010
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0xc, %eax
jg 0x28010
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x28010
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x2801b
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x28031
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2802f
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x28031
jmp 0x28033
jmp 0x2804e
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x18(%rbp), %rax
jbe 0x2804c
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2804e
jmp 0x28059
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)