// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/readfile.c
// Function: read_ulong
unsigned long
read_ulong(FILE *inptr,unsigned short byteorder,unsigned long offset)
{
    unsigned char rbuf[4];
    unsigned long curoffset;
    unsigned long 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 32bit integer at offset ");
            printf("%lu",offset);
        }
        else if(fread(rbuf,1,4,inptr) == 4)
            value = to_ulong(rbuf,byteorder);
        else
        {
            printred(" FAILED to read unsigned 32bit integer 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 $0x40, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x478e
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 0x4696
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
cmpl $-0x1, %eax
jne 0x4696
leaq 0x5fba4(%rip), %rdi     # 0x64221
callq 0x6860
movq -0x18(%rbp), %rsi
leaq 0x66813(%rip), %rdi     # 0x6aea0
movb $0x0, %al
callq 0x3110
jmp 0x46ff
leaq -0x1c(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x30c0
cmpq $0x4, %rax
jne 0x46c6
leaq -0x1c(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x4990
movq %rax, -0x30(%rbp)
jmp 0x46fd
leaq 0x5fb59(%rip), %rdi     # 0x64226
callq 0x6860
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x18(%rbp)
jne 0x46e5
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
leaq 0x667b0(%rip), %rdi     # 0x6aea0
movb $0x0, %al
callq 0x3110
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x46ff
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x4765
leaq 0x5fad5(%rip), %rdi     # 0x641e9
movb $0x0, %al
callq 0x3110
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %edi
callq 0x1ff00
movl $0x0, -0x34(%rbp)
callq 0x3060
movl (%rax), %edi
callq 0x32b0
movq %rax, %rdi
callq 0x6860
leaq 0x669d5(%rip), %rdi     # 0x6b120
movb $0x0, %al
callq 0x3110
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %edi
callq 0x1ef50
movl %eax, -0x34(%rbp)
jmp 0x478c
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x478a
leaq 0x5fa72(%rip), %rdi     # 0x641ec
callq 0x6860
movl -0x34(%rbp), %edi
callq 0x1ef50
movl %eax, -0x34(%rbp)
jmp 0x478c
jmp 0x478e
movl -0x34(%rbp), %edi
callq 0x1ff00
movq -0x30(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq