// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x7383a(%rip), %rdi     # 0x784b8
xorl %esi, %esi
movl $0x18, %edx
callq 0x3130
cmpq $0x0, -0x8(%rbp)
je 0x4eab
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x4eab
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x4eab
movq -0x8(%rbp), %rdi
movw -0xa(%rbp), %ax
movq -0x18(%rbp), %rdx
movzwl %ax, %esi
callq 0x4480
movw %ax, 0x737e4(%rip)      # 0x784b8
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4480
movw %ax, 0x737cd(%rip)      # 0x784ba
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4610
movq %rax, 0x737ba(%rip)     # 0x784c0
movq -0x8(%rbp), %rdi
movl $0x4, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x47a0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x4e9e
movzwl 0x7378b(%rip), %edi     # 0x784ba
callq 0x1dbf0
cltq
imulq 0x73782(%rip), %rax     # 0x784c0
cmpq $0x4, %rax
jbe 0x4d5d
movq -0x20(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x4990
movq %rax, 0x73770(%rip)     # 0x784c8
jmp 0x4e9c
movq $0x0, 0x73760(%rip) # 0x784c8
movzwl 0x7374b(%rip), %eax     # 0x784ba
movl %eax, -0x24(%rbp)
decl %eax
subl $0x2, %eax
jb 0x4e74
jmp 0x4d7f
movl -0x24(%rbp), %eax
subl $0x3, %eax
je 0x4dc3
jmp 0x4d89
movl -0x24(%rbp), %eax
subl $0x4, %eax
je 0x4e84
jmp 0x4d97
movl -0x24(%rbp), %eax
addl $-0x6, %eax
subl $0x2, %eax
jb 0x4e74
jmp 0x4da8
movl -0x24(%rbp), %eax
subl $0x8, %eax
je 0x4dc3
jmp 0x4db2
movl -0x24(%rbp), %eax
subl $0x9, %eax
je 0x4e84
jmp 0x4e86
cmpq $0x1, 0x736f5(%rip)     # 0x784c0
jne 0x4de9
movq -0x20(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x4ec0
movzwl %ax, %eax
movq %rax, 0x736e4(%rip)     # 0x784c8
jmp 0x4e72
movq -0x20(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x4ec0
movzwl %ax, %eax
movq %rax, 0x736c8(%rip)     # 0x784c8
movzwl -0xa(%rbp), %eax
cmpl $0x4d4d, %eax           # imm = 0x4D4D
jne 0x4e39
movq -0x20(%rbp), %rdi
addq $0x2, %rdi
movzwl -0xa(%rbp), %esi
callq 0x4ec0
movzwl %ax, %eax
andq $0xffff, %rax           # imm = 0xFFFF
shlq $0x10, %rax
orq 0x73698(%rip), %rax     # 0x784c8
movq %rax, 0x73691(%rip)     # 0x784c8
jmp 0x4e70
movq -0x20(%rbp), %rdi
addq $0x2, %rdi
movzwl -0xa(%rbp), %esi
callq 0x4ec0
movzwl %ax, %eax
andl $0xffff, %eax           # imm = 0xFFFF
cltq
movq 0x7366d(%rip), %rcx     # 0x784c8
andq $0xffff, %rcx           # imm = 0xFFFF
shlq $0x10, %rcx
orq %rcx, %rax
movq %rax, 0x73658(%rip)     # 0x784c8
jmp 0x4e72
jmp 0x4e9a
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x73646(%rip)     # 0x784c8
jmp 0x4e9a
jmp 0x4e86
movq -0x20(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x4990
movq %rax, 0x7362e(%rip)     # 0x784c8
jmp 0x4e9c
jmp 0x4ea9
movq $0x0, 0x7361f(%rip) # 0x784c8
jmp 0x4eab
leaq 0x73606(%rip), %rax     # 0x784b8
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)