// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/readfile.c
// Function: read_ubyte
unsigned short
read_ubyte(FILE *inptr,unsigned long offset)
{
    unsigned char rbuf[1];
    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 byte at offset ");
            chpr += printf("%lu",offset);
        }
        else if(fread(rbuf,1,1,inptr) == 1)
            value = rbuf[0] & 0xff;
        else
        {
            if(offset == HERE)
                offset = curoffset;
            printred(" FAILED to read unsigned byte at offset ");
            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
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw $0x0, -0x22(%rbp)
movl $0x0, -0x28(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5095
movq -0x8(%rbp), %rdi
callq 0x31a0
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x20(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x10(%rbp)
je 0x4fa3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
cmpl $-0x1, %eax
jne 0x4fa3
leaq 0x5f26f(%rip), %rdi     # 0x641f3
callq 0x6860
movq -0x10(%rbp), %rsi
leaq 0x65f0c(%rip), %rdi     # 0x6aea0
movb $0x0, %al
callq 0x3110
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x5006
leaq -0x11(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x30c0
cmpq $0x1, %rax
jne 0x4fcd
movzbl -0x11(%rbp), %eax
andl $0xff, %eax
movw %ax, -0x22(%rbp)
jmp 0x5004
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x10(%rbp)
jne 0x4fe0
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x5f211(%rip), %rdi     # 0x641f8
callq 0x6860
movq -0x10(%rbp), %rsi
leaq 0x65ea9(%rip), %rdi     # 0x6aea0
movb $0x0, %al
callq 0x3110
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x5006
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x506c
leaq 0x5f1ce(%rip), %rdi     # 0x641e9
movb $0x0, %al
callq 0x3110
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %edi
callq 0x1ff00
movl $0x0, -0x28(%rbp)
callq 0x3060
movl (%rax), %edi
callq 0x32b0
movq %rax, %rdi
callq 0x6860
leaq 0x660ce(%rip), %rdi     # 0x6b120
movb $0x0, %al
callq 0x3110
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %edi
callq 0x1ef50
movl %eax, -0x28(%rbp)
jmp 0x5093
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x5091
leaq 0x5f16b(%rip), %rdi     # 0x641ec
callq 0x6860
movl -0x28(%rbp), %edi
callq 0x1ef50
movl %eax, -0x28(%rbp)
jmp 0x5093
jmp 0x5095
movl -0x28(%rbp), %edi
callq 0x1ff00
movw -0x22(%rbp), %ax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)