// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/process.c
// Function: forward_scan_for_eoi
unsigned long
forward_scan_for_eoi(FILE *inptr,unsigned long start_of_data,
                            unsigned long end_of_section,char *prefix,int indent)
{
    int highbyte,lobyte;
    unsigned long eoi_offset = 0UL;
    unsigned long tagloc;
    int chpr = 0;

    if(inptr && (fseek(inptr,start_of_data,SEEK_SET) != -1))
    {
        if(Debug & JPEG_EOI_DEBUG)
            printf("DEBUG: start scan at %lu\n",start_of_data);
        while(((highbyte = fgetc(inptr)) != EOF) && (highbyte != EOF) && (ftell(inptr) < end_of_section))
        {
            if(highbyte != JPEG_HIBYTE)
                continue;
            tagloc = ftell(inptr) - 1;
            lobyte = fgetc(inptr);
            if(lobyte == EOI_LOBYTE)
            {
                eoi_offset = tagloc;
                if(Debug & JPEG_EOI_DEBUG)
                {
                    if(!(LIST_MODE) && (PRINT_SEGMENT))
                    {
                        print_tag_address(SEGMENT,eoi_offset,indent + SMALLINDENT,prefix);
                        PUSHCOLOR(RED);
                        putindent(2);
                        chpr += printf("possible JPEG_EOI found at %lu",eoi_offset);
                    }
                    POPCOLOR();
                    chpr = newline(chpr);
                }
                break;
            }
        }
    }
    if(Debug & JPEG_EOI_DEBUG)
        printf("DEBUG: end scan at %lu\n",ftell(inptr));
    return(eoi_offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x44(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1a6dd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
cmpl $-0x1, %eax
je 0x1a6dd
leaq 0x620fb(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1a5d1
movq -0x10(%rbp), %rsi
leaq 0x4d13f(%rip), %rdi     # 0x67709
movb $0x0, %al
callq 0x3110
jmp 0x1a5d3
movq -0x8(%rbp), %rdi
callq 0x3140
movl %eax, %ecx
movl %ecx, -0x28(%rbp)
xorl %eax, %eax
cmpl $-0x1, %ecx
movb %al, -0x45(%rbp)
je 0x1a609
xorl %eax, %eax
cmpl $-0x1, -0x28(%rbp)
movb %al, -0x45(%rbp)
je 0x1a609
movq -0x8(%rbp), %rdi
callq 0x3180
cmpq -0x18(%rbp), %rax
setb %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x1a615
jmp 0x1a6db
cmpl $0xff, -0x28(%rbp)
je 0x1a620
jmp 0x1a5d3
movq -0x8(%rbp), %rdi
callq 0x3180
subq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3140
movl %eax, -0x2c(%rbp)
cmpl $0xd9, -0x2c(%rbp)
jne 0x1a6d6
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq 0x62057(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1a6d4
leaq 0x5cb16(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
je 0x1a6c9
leaq 0x5cb00(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x80000, %rax          # imm = 0x80000
cmpq $0x0, %rax
je 0x1a6c9
movq -0x38(%rbp), %rsi
movl -0x24(%rbp), %edx
addl $0x2, %edx
movq -0x20(%rbp), %rcx
movl $0x80000, %edi          # imm = 0x80000
callq 0x5ed0
movl $0x2, %edi
callq 0x60e0
movq -0x38(%rbp), %rsi
leaq 0x4d067(%rip), %rdi     # 0x67723
movb $0x0, %al
callq 0x3110
addl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %edi
callq 0x1ef50
movl %eax, -0x44(%rbp)
jmp 0x1a6db
jmp 0x1a5d3
jmp 0x1a6dd
leaq 0x61fcc(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1a708
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, %rsi
leaq 0x4d041(%rip), %rdi     # 0x67742
movb $0x0, %al
callq 0x3110
movq -0x38(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)