// File: /workspace/github_c_makefile_star2_O1/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 0x35236(%rip), %rbx     # 0x5d6d8
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3140
testq %r14, %r14
je 0x2862b
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
movq %r15, %rdx
callq 0x46cc
cmpq $0x62564f46, %rax       # imm = 0x62564F46
jne 0x2862b
movq $0x62564f46, 0x351f7(%rip) # imm = 0x62564F46
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x4574
movw %ax, 0x351e8(%rip)      # 0x5d6e2
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x4574
movw %ax, 0x351cd(%rip)      # 0x5d6e0
movl $0x10, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4832
testq %rax, %rax
je 0x28534
movups (%rax), %xmm0
movups %xmm0, 0x351b0(%rip)    # 0x5d6e4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x46cc
movq %rax, 0x351ab(%rip)     # 0x5d6f8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x46cc
movq %rax, 0x3519a(%rip)     # 0x5d700
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x46cc
movq %rax, 0x35189(%rip)     # 0x5d708
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0x4949, %esi           # imm = 0x4949
callq 0x46cc
movq %rax, 0x35178(%rip)     # 0x5d710
cmpw $0x0, 0x35140(%rip)     # 0x5d6e0
je 0x2862d
movl $0x20, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4832
testq %rax, %rax
je 0x285d2
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x3515d(%rip)    # 0x5d728
movups %xmm0, 0x35146(%rip)    # 0x5d718
movl $0x20, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4832
testq %rax, %rax
je 0x285fe
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x35151(%rip)    # 0x5d748
movups %xmm0, 0x3513a(%rip)    # 0x5d738
movl $0x80, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x4832
testq %rax, %rax
je 0x2862d
leaq 0x3513c(%rip), %rdi     # 0x5d758
movl $0x80, %edx
movq %rax, %rsi
callq 0x31c0
jmp 0x2862d
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq