// File: /workspace/github_c_makefile_star2_O3/hfiguiere[P]exifprobe/x3f.c
// Function: read_x3fheader
struct x3f_header *
read_x3fheader(FILE *inptr,unsigned long offset)
{
    static struct x3f_header header;
    struct x3f_header *headerptr = NULL;
    unsigned long xmagic;
    unsigned char *bytearray;

    memset(&header,0,sizeof(struct x3f_header));
    if(inptr)
    {
        xmagic = read_ulong(inptr,TIFF_INTEL,offset);
        if(xmagic == PROBE_X3FMAGIC)
        {
            header.magic = xmagic;
            header.version_major = read_ushort(inptr,TIFF_INTEL,HERE);
            header.version_minor = read_ushort(inptr,TIFF_INTEL,HERE);
            bytearray = read_bytes(inptr,16,HERE);
            if(bytearray)
                memcpy(header.unique_id,bytearray,16);
            header.mark_bits = read_ulong(inptr,TIFF_INTEL,HERE);
            header.image_width = read_ulong(inptr,TIFF_INTEL,HERE);
            header.image_height = read_ulong(inptr,TIFF_INTEL,HERE);
            header.image_rotation = read_ulong(inptr,TIFF_INTEL,HERE);
            if(header.version_minor >= 1)
            {
                /* this is a string, e.g. "AUTO\0"                    */
                bytearray = read_bytes(inptr,32,HERE);
                if(bytearray)
                    memcpy(header.white_balance,bytearray,32);
                bytearray = read_bytes(inptr,32,HERE);
                if(bytearray)
                    memcpy(header.extended_data_types,bytearray,32);
                bytearray = read_bytes(inptr,128,HERE);
                if(bytearray)
                    memcpy(header.extended_data_values,bytearray,128);
            }
            headerptr = &header;
        }
    }
    return(headerptr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x34ac2(%rip), %rbx     # 0x5d6d8
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3140
testq %r14, %r14
je 0x28d9f
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
movq %r15, %rdx
callq 0x4707
cmpq $0x62564f46, %rax       # imm = 0x62564F46
jne 0x28d9f
movq $0x62564f46, 0x34a83(%rip) # imm = 0x62564F46
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x45af
movw %ax, 0x34a74(%rip)      # 0x5d6e2
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x45af
movw %ax, 0x34a59(%rip)      # 0x5d6e0
movl $0x10, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4865
testq %rax, %rax
je 0x28ca8
movups (%rax), %xmm0
movups %xmm0, 0x34a3c(%rip)    # 0x5d6e4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x4707
movq %rax, 0x34a37(%rip)     # 0x5d6f8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x4707
movq %rax, 0x34a26(%rip)     # 0x5d700
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x4707
movq %rax, 0x34a15(%rip)     # 0x5d708
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x4707
movq %rax, 0x34a04(%rip)     # 0x5d710
cmpw $0x0, 0x349cc(%rip)     # 0x5d6e0
je 0x28da1
movl $0x20, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4865
testq %rax, %rax
je 0x28d46
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x349e9(%rip)    # 0x5d728
movups %xmm0, 0x349d2(%rip)    # 0x5d718
movl $0x20, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4865
testq %rax, %rax
je 0x28d72
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x349dd(%rip)    # 0x5d748
movups %xmm0, 0x349c6(%rip)    # 0x5d738
movl $0x80, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4865
testq %rax, %rax
je 0x28da1
leaq 0x349c8(%rip), %rdi     # 0x5d758
movl $0x80, %edx
movq %rax, %rsi
callq 0x31c0
jmp 0x28da1
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq