// File: /workspace/github_c_makefile_star2_O2/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 0x350a2(%rip), %rbx     # 0x5c6d8
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3140
testq %r14, %r14
je 0x277b9
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
movq %r15, %rdx
callq 0x42ba
cmpq $0x62564f46, %rax       # imm = 0x62564F46
jne 0x277b9
movq $0x62564f46, 0x35063(%rip) # imm = 0x62564F46
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x416a
movw %ax, 0x35054(%rip)      # 0x5c6e2
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x416a
movw %ax, 0x35039(%rip)      # 0x5c6e0
pushq $0x10
popq %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4410
testq %rax, %rax
je 0x276c6
movups (%rax), %xmm0
movups %xmm0, 0x3501e(%rip)    # 0x5c6e4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x42ba
movq %rax, 0x35019(%rip)     # 0x5c6f8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x42ba
movq %rax, 0x35008(%rip)     # 0x5c700
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x42ba
movq %rax, 0x34ff7(%rip)     # 0x5c708
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x42ba
movq %rax, 0x34fe6(%rip)     # 0x5c710
cmpw $0x0, 0x34fae(%rip)     # 0x5c6e0
je 0x277bb
pushq $0x20
popq %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4410
testq %rax, %rax
je 0x27762
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x34fcd(%rip)    # 0x5c728
movups %xmm0, 0x34fb6(%rip)    # 0x5c718
pushq $0x20
popq %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4410
testq %rax, %rax
je 0x2778c
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x34fc3(%rip)    # 0x5c748
movups %xmm0, 0x34fac(%rip)    # 0x5c738
movl $0x80, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4410
testq %rax, %rax
je 0x277bb
leaq 0x34fae(%rip), %rdi     # 0x5c758
movl $0x80, %edx
movq %rax, %rsi
callq 0x31c0
jmp 0x277bb
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq