// File: /workspace/github_c_makefile_star2_O1/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, 0x54913(%rip)    # 0x594b8
movq $0x0, 0x54918(%rip) # 0x594c8
testq %rdi, %rdi
je 0x4ca9
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
callq 0x31a0
testl %eax, %eax
jne 0x4ca4
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x4ca4
movzwl %bx, %ebx
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x4574
movw %ax, 0x548be(%rip)      # 0x594b8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl %ebx, %esi
callq 0x4574
movw %ax, 0x548aa(%rip)      # 0x594ba
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl %ebx, %esi
callq 0x46cc
movq %rax, 0x5489a(%rip)     # 0x594c0
movl $0x4, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4832
testq %rax, %rax
je 0x4c6e
movq %rax, %r14
movzwl 0x54873(%rip), %edi     # 0x594ba
callq 0x15f20
cltq
movq 0x5486b(%rip), %rcx     # 0x594c0
imulq %rcx, %rax
cmpq $0x5, %rax
jb 0x4c72
cmpl $0x4d4d, %ebx           # imm = 0x4D4D
jne 0x4c98
movl (%r14), %eax
bswapl %eax
jmp 0x4c9b
xorl %eax, %eax
jmp 0x4c9d
movq $0x0, 0x5484b(%rip) # 0x594c8
movzwl 0x54836(%rip), %eax     # 0x594ba
cmpl $0x8, %eax
ja 0x4c5f
movl $0xc6, %edx
btl %eax, %edx
jae 0x4cb1
movq (%r14), %rax
jmp 0x4c9d
movl (%r14), %eax
movl %eax, %eax
movq %rax, 0x54824(%rip)     # 0x594c8
popq %rbx
popq %r14
popq %r15
leaq 0x54808(%rip), %rax     # 0x594b8
retq
movl $0x108, %edx            # imm = 0x108
btl %eax, %edx
jae 0x4c5f
movzwl (%r14), %eax
cmpq $0x1, %rcx
jne 0x4cda
cmpl $0x4d4d, %ebx           # imm = 0x4D4D
jne 0x4cd5
movzwl (%r14), %eax
rolw $0x8, %ax
movzwl %ax, %eax
jmp 0x4c9d
cmpl $0x4d4d, %ebx           # imm = 0x4D4D
jne 0x4cea
movzwl (%r14), %eax
rolw $0x8, %ax
movzwl %ax, %ecx
movq %rcx, 0x547d4(%rip)     # 0x594c8
cmpl $0x4d4d, %ebx           # imm = 0x4D4D
jne 0x4d13
movzbl 0x3(%r14), %eax
movzbl 0x2(%r14), %edx
shll $0x18, %edx
shll $0x10, %eax
orl %edx, %eax
orq %rcx, %rax
jmp 0x4c9d
movzwl 0x2(%r14), %eax
shll $0x10, %ecx
orq %rax, %rcx
movq %rcx, %rax
jmp 0x4c9d