// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/print.c
// Function: hexdump
void
hexdump(FILE *inptr,unsigned long offset,unsigned long size,
        unsigned long max_to_print,int width,int indent,
        int subindent)
{
    char *data,*next;
    int bytes = 0;
    int printed = 0;
    int etc = 0;
    unsigned long remaining,readlength;
    int i;
    int chpr = 0;

    if(inptr)
    {
        if((size > 0L) && (max_to_print > 0L))
        {
            if(size > MAXBUFLEN)
                readlength = MAXBUFLEN;
            else
                readlength = size;

            /* Always read in multiples of "width" if doing multiple  */
            /* reads.                                                 */
            if(size > readlength)
                readlength = (readlength / width) * width;
            if(size < max_to_print)
                max_to_print = size;

            if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1))
            {
                chpr += printf(" seek failed to offset %lu to print hex/ascii dump",offset);
                chpr = newline(chpr);
                why(stdout);
                return;
            }
            while((printed < max_to_print) && (data = (char *)read_bytes(inptr,readlength,HERE)))
            {
                if(feof(inptr) || ferror(inptr))
                {
                    clearerr(inptr);
                    setcharsprinted(chpr);
                    break;
                }
                if(max_to_print < readlength)
                {
                    readlength = max_to_print;
                    ++etc;
                }

                bytes = 0;
                while(bytes < readlength)
                {
                    next = data;
                    remaining = readlength - bytes;

                    /* start address of each line                     */
                    print_tag_address(ENTRY|APP_ENTRY,offset + printed,
                                        indent + SUBINDENT," ");
                    extraindent(subindent); 

                    /* This is the hex part                           */
                    for(i = 0; i < width; ++i)
                    {
                        if(i && ((i % 4) == 0))
                            putchar(' ');
                        if(i < remaining)
                            chpr += printf("%02x ",(unsigned int)(*data++ & 0xff));
                        else
                            chpr += printf("   ");
                    }

                    /* Now do it again for the ascii side             */
                    chpr += printf(" |");
                    remaining = readlength - bytes;
                    for(i = 0; i < width; ++i,++next,++bytes,++printed)
                    {
                        if(i >= remaining)      /* pad at the end     */
                            putchar(' ');
                        else if(isprint(*next))
                            putchar(*next);
                        else
                            putchar('.');  /* can't win 'em all  */
                        ++chpr;
                    }
                    if(printed < max_to_print)
                        chpr += printf("|\n");  /* every line except the last */
                    else
                        chpr += printf("|");
                }
                if((max_to_print - printed) < readlength)
                    readlength = max_to_print - printed;
            }
            if(etc)     /* didn't print the whole chunk...            */
                chpr += printf(" etc...");
        }
    }
    else
        printred(" INTERNAL ERROR: no input file to hexdump()\n");
    setcharsprinted(chpr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x60(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x8e49
cmpq $0x0, -0x18(%rbp)
jbe 0x8e47
cmpq $0x0, -0x20(%rbp)
jbe 0x8e47
cmpq $0x2000, -0x18(%rbp)    # imm = 0x2000
jbe 0x8b14
movq $0x2000, -0x58(%rbp)    # imm = 0x2000
jmp 0x8b1c
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x58(%rbp), %rax
jbe 0x8b3f
movq -0x58(%rbp), %rax
movslq -0x24(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movslq -0x24(%rbp), %rcx
imulq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8b51
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x10(%rbp)
je 0x8ba7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
cmpl $-0x1, %eax
jne 0x8ba7
movq -0x10(%rbp), %rsi
leaq 0x5be27(%rip), %rdi     # 0x649a2
movb $0x0, %al
callq 0x3110
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %edi
callq 0x1ef50
movl %eax, -0x60(%rbp)
movq 0x6e42e(%rip), %rax     # 0x76fc8
movq (%rax), %rdi
callq 0x20840
jmp 0x8e5d
jmp 0x8ba9
movslq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x61(%rbp)
jae 0x8bd8
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x47a0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x8be4
jmp 0x8e2b
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x8c00
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x8c16
movq -0x8(%rbp), %rdi
callq 0x31a0
movl -0x60(%rbp), %edi
callq 0x1ff00
jmp 0x8e2b
movq -0x20(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x8c31
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x3c(%rbp)
movslq -0x3c(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x8e06
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rsi
movslq -0x40(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
addl $0x2, %edx
movl $0x4103333, %edi        # imm = 0x4103333
leaq 0x5b4fd(%rip), %rcx     # 0x64177
callq 0x5ed0
movl 0x10(%rbp), %edi
callq 0xb970
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x8d12
cmpl $0x0, -0x5c(%rbp)
je 0x8cb6
movl -0x5c(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x8cb6
movl $0x20, %edi
callq 0x3050
movslq -0x5c(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x8cee
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movsbl (%rax), %esi
andl $0xff, %esi
leaq 0x5bcf6(%rip), %rdi     # 0x649d5
movb $0x0, %al
callq 0x3110
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x8d02
leaq 0x5b479(%rip), %rdi     # 0x6416e
movb $0x0, %al
callq 0x3110
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x8d04
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x8c8e
leaq 0x5bcc2(%rip), %rdi     # 0x649db
movb $0x0, %al
callq 0x3110
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x8dcd
movslq -0x5c(%rbp), %rax
cmpq -0x50(%rbp), %rax
jb 0x8d5e
movl $0x20, %edi
callq 0x3050
jmp 0x8d98
callq 0x32c0
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x8d8c
movq -0x38(%rbp), %rax
movsbl (%rax), %edi
callq 0x3050
jmp 0x8d96
movl $0x2e, %edi
callq 0x3050
jmp 0x8d98
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x8d3c
movslq -0x40(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8ded
leaq 0x5bc00(%rip), %rdi     # 0x649de
movb $0x0, %al
callq 0x3110
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x8e01
leaq 0x5bbe8(%rip), %rdi     # 0x649dc
movb $0x0, %al
callq 0x3110
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x8c38
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
subq %rcx, %rax
cmpq -0x58(%rbp), %rax
jae 0x8e26
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x58(%rbp)
jmp 0x8ba9
cmpl $0x0, -0x44(%rbp)
je 0x8e45
leaq 0x5bba9(%rip), %rdi     # 0x649e1
movb $0x0, %al
callq 0x3110
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x8e47
jmp 0x8e55
leaq 0x5bb99(%rip), %rdi     # 0x649e9
callq 0x6860
movl -0x60(%rbp), %edi
callq 0x1ff00
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)