// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/readfile.c
// Function: read_ushort
unsigned short
read_ushort(FILE *inptr,unsigned short byteorder,unsigned long offset)
{
    unsigned char rbuf[2];
    unsigned long curoffset;
    unsigned short value = 0;
    int chpr = 0;

    if(inptr)
    {
        clearerr(inptr);
        curoffset = ftell(inptr);
        if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1))
        {
            printred(" SEEK FAILED to read unsigned short at offset ");
            printf("%lu",offset);
        }
        else if(fread(rbuf,1,sizeof(unsigned short),inptr) == sizeof(unsigned short))
            value = to_ushort(rbuf,byteorder);
        else
        {
            printred(" FAILED to read unsigned short value at offset ");
            if(offset == HERE)
                offset = curoffset;
            chpr += printf("%lu",offset);
        }
        if(ferror(inptr))
        {
            chpr += printf(" (");
            setcharsprinted(chpr);
            chpr = 0;
            printred(strerror(errno));
            chpr += printf(")");
            chpr = newline(chpr);
        }
        else if(feof(inptr))
        {
            printred(" (EOF)");
            chpr = newline(chpr);
        }
    }
    setcharsprinted(chpr);
    return(value);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq %rdx, -0x18(%rbp)
movw $0x0, -0x2a(%rbp)
movl $0x0, -0x30(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x45fc
movq -0x8(%rbp), %rdi
callq 0x31a0
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x28(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x18(%rbp)
je 0x4504
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
cmpl $-0x1, %eax
jne 0x4504
leaq 0x5fc9f(%rip), %rdi     # 0x6418a
callq 0x6860
movq -0x18(%rbp), %rsi
leaq 0x669a5(%rip), %rdi     # 0x6aea0
movb $0x0, %al
callq 0x3110
jmp 0x456d
leaq -0x1a(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %esi
movl $0x2, %edx
callq 0x30c0
cmpq $0x2, %rax
jne 0x4534
leaq -0x1a(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x4ec0
movw %ax, -0x2a(%rbp)
jmp 0x456b
leaq 0x5fc7e(%rip), %rdi     # 0x641b9
callq 0x6860
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x18(%rbp)
jne 0x4553
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
leaq 0x66942(%rip), %rdi     # 0x6aea0
movb $0x0, %al
callq 0x3110
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x456d
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x45d3
leaq 0x5fc67(%rip), %rdi     # 0x641e9
movb $0x0, %al
callq 0x3110
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %edi
callq 0x1ff00
movl $0x0, -0x30(%rbp)
callq 0x3060
movl (%rax), %edi
callq 0x32b0
movq %rax, %rdi
callq 0x6860
leaq 0x66b67(%rip), %rdi     # 0x6b120
movb $0x0, %al
callq 0x3110
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %edi
callq 0x1ef50
movl %eax, -0x30(%rbp)
jmp 0x45fa
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x45f8
leaq 0x5fc04(%rip), %rdi     # 0x641ec
callq 0x6860
movl -0x30(%rbp), %edi
callq 0x1ef50
movl %eax, -0x30(%rbp)
jmp 0x45fa
jmp 0x45fc
movl -0x30(%rbp), %edi
callq 0x1ff00
movw -0x2a(%rbp), %ax
addq $0x30, %rsp
popq %rbp
retq
nop