// File: /workspace/github_c_makefile_star2_O2/hfiguiere[P]exifprobe/readfile.c
// Function: read_ifd_entry
struct ifd_entry *
read_ifd_entry(FILE *inptr,unsigned short byteorder,unsigned long offset)
{
    static struct ifd_entry entry;
    unsigned char *value;

    memset(&entry,0,sizeof(struct ifd_entry));
    if(inptr && !feof(inptr) && !ferror(inptr))
    {
        entry.tag = read_ushort(inptr,byteorder,offset);
        entry.value_type = read_ushort(inptr,byteorder,HERE);
        entry.count = read_ulong(inptr,byteorder,HERE);
        value = read_bytes(inptr,4,HERE);
        if(value)
        {
            if((value_type_size(entry.value_type) * entry.count) > 4)
                entry.value = to_ulong(value,byteorder);    /* offset */
            else    /* actual value(s)                                */
            {
                entry.value = 0L;
                switch(entry.value_type)
                {
                    case SSHORT: 
                    case SHORT:
                        if(entry.count == 1)
                            entry.value = to_ushort(value,byteorder);
                        else
                        {
                            entry.value = to_ushort(value,byteorder);
                            if(byteorder == TIFF_MOTOROLA)
                                entry.value |= (((unsigned long)to_ushort(value + 2,byteorder) & 0xffff) << 16);
                            else
                                entry.value = (to_ushort(value + 2,byteorder) & 0xffff) |
                                    ((entry.value & 0xffff) << 16);
                        }
                        break;
                    case BYTE:
                    case SBYTE:
                    case UNDEFINED:
                    case ASCII:
                        entry.value = *(unsigned long *)value;
                        break;
                    case LONG:
                    case SLONG:
                    default:
                        entry.value = to_ulong(value,byteorder);
                        break;
                }
            }
        }
        else
            entry.value = 0L;
    }
    return(&entry);
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x53d44(%rip)    # 0x584b8
andq $0x0, 0x53d4c(%rip)     # 0x584c8
testq %rdi, %rdi
je 0x4873
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
callq 0x31a0
testl %eax, %eax
jne 0x4869
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x4869
movzwl %bx, %ebp
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x416a
movw %ax, 0x53cf0(%rip)      # 0x584b8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl %ebp, %esi
callq 0x416a
movw %ax, 0x53cdc(%rip)      # 0x584ba
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl %ebp, %esi
callq 0x42ba
movq %rax, 0x53ccc(%rip)     # 0x584c0
pushq $0x4
popq %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4410
testq %rax, %rax
je 0x483d
movq %rax, %r14
movzwl 0x53ca7(%rip), %edi     # 0x584ba
callq 0x155c8
movslq %eax, %rcx
movq 0x53c9e(%rip), %rax     # 0x584c0
imulq %rax, %rcx
cmpq $0x5, %rcx
jb 0x4841
movl (%r14), %ecx
cmpw $0x4d4d, %bx            # imm = 0x4D4D
movl %ecx, %eax
bswapl %eax
cmovnel %ecx, %eax
jmp 0x4862
xorl %eax, %eax
jmp 0x4862
andq $0x0, 0x53c7f(%rip)     # 0x584c8
movzwl 0x53c6a(%rip), %ecx     # 0x584ba
cmpl $0x8, %ecx
ja 0x482c
movl $0xc6, %edx
btl %ecx, %edx
jae 0x487b
movq (%r14), %rax
movq %rax, 0x53c5f(%rip)     # 0x584c8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
leaq 0x53c3e(%rip), %rax     # 0x584b8
retq
movl $0x108, %edx            # imm = 0x108
btl %ecx, %edx
jae 0x482c
movzwl (%r14), %ecx
movl %ecx, %edx
rolw $0x8, %dx
cmpw $0x4d4d, %bx            # imm = 0x4D4D
cmovnel %ecx, %edx
movzwl %dx, %ecx
movq %rcx, 0x53c27(%rip)     # 0x584c8
cmpq $0x1, %rax
je 0x4869
movzwl 0x2(%r14), %eax
cmpw $0x4d4d, %bx            # imm = 0x4D4D
jne 0x48bc
rolw $0x8, %ax
shll $0x10, %eax
jmp 0x48bf
shll $0x10, %ecx
orq %rcx, %rax
jmp 0x4862