// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x10(%rsp)
testq %rdi, %rdi
je 0x7129
movq %rcx, %r15
movq %rdx, %rcx
testq %rdx, %rdx
sete %al
testq %r15, %r15
sete %dl
xorl %ebx, %ebx
orb %al, %dl
jne 0x715f
movl %r8d, %r14d
movq %rsi, %r12
movl 0x80(%rsp), %eax
movl %eax, 0x28(%rsp)
movq %rcx, (%rsp)
cmpq $0x2001, %rcx           # imm = 0x2001
jb 0x6f03
movslq %r14d, %rsi
movl $0x2000, %r8d           # imm = 0x2000
movl $0x2000, %eax           # imm = 0x2000
xorl %edx, %edx
divq %rsi
subq %rdx, %r8
movq %r8, (%rsp)
cmpq %r15, %rcx
cmovbq %rcx, %r15
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r12
je 0x6f2d
movq %r12, %rsi
xorl %edx, %edx
movq %rdi, %rbx
callq 0x3210
movq %rbx, %rdi
cmpl $-0x1, %eax
je 0x7174
addl $0x2, 0x10(%rsp)
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
pushq $0x20
popq %rbp
xorl %r13d, %r13d
movl $0x0, 0xc(%rsp)
xorl %ebx, %ebx
movq %r12, 0x40(%rsp)
movq %r15, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
movl %r13d, 0x8(%rsp)
movslq %r13d, %rax
cmpq %rax, %r15
jbe 0x7148
movq %r15, %r13
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq (%rsp), %rsi
movq %rdi, %r15
callq 0x4410
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x7148
movq %r15, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x7139
movq %r15, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x7139
xorl %ecx, %ecx
movq (%rsp), %rax
cmpq %rax, %r13
setb %cl
movl %ecx, 0x24(%rsp)
cmovbq %r13, %rax
movq %rax, (%rsp)
movl $0x0, 0x14(%rsp)
movl 0x8(%rsp), %r13d
movslq 0x14(%rsp), %rax
movq (%rsp), %r15
movslq %r13d, %rsi
subq %rax, %r15
jbe 0x70fd
movl %r13d, 0x8(%rsp)
addq %r12, %rsi
movl $0x4103333, %edi        # imm = 0x4103333
movl 0x10(%rsp), %edx
leaq 0x38197(%rip), %rcx     # 0x3f196
callq 0x5100
movl 0x28(%rsp), %edi
callq 0x8f6f
xorl %r13d, %r13d
movq 0x18(%rsp), %r12
cmpq %r13, %r14
je 0x7064
testq %r13, %r13
sete %al
testb $0x3, %r13b
setne %cl
orb %al, %cl
jne 0x7032
movl %ebp, %edi
callq 0x3060
cmpq %r13, %r15
jbe 0x704f
movzbl (%r12), %esi
incq %r12
leaq 0x389c4(%rip), %rdi     # 0x3fa0a
xorl %eax, %eax
callq 0x3120
jmp 0x705d
leaq 0x38137(%rip), %rdi     # 0x3f18d
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
incq %r13
jmp 0x7015
leaq 0x389a5(%rip), %rdi     # 0x3fa10
xorl %eax, %eax
callq 0x3120
addl %r14d, 0x14(%rsp)
addl %r14d, %eax
movl %eax, 0x2c(%rsp)
xorl %r13d, %r13d
cmpq %r13, %r14
je 0x70b8
movl %ebp, %edi
cmpq %r13, %r15
jbe 0x70ae
callq 0x32d0
movq (%rax), %rcx
movq 0x18(%rsp), %rax
movsbl (%rax,%r13), %eax
movslq %eax, %rdx
testb $0x40, 0x1(%rcx,%rdx,2)
pushq $0x2e
popq %rdi
je 0x70ae
movl %eax, %edi
callq 0x3060
incq %r13
jmp 0x7081
movl 0x8(%rsp), %r13d
addl %r14d, %r13d
movl 0x2c(%rsp), %r15d
addl %ebx, %r15d
movslq %r13d, %rax
cmpq %rax, 0x30(%rsp)
leaq 0x3893a(%rip), %rdi     # 0x3fa11
leaq 0x38935(%rip), %rax     # 0x3fa13
cmovaq %rax, %rdi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r15d, %ebx
movq %r12, 0x18(%rsp)
movq 0x40(%rsp), %r12
jmp 0x6fd2
movl 0x24(%rsp), %eax
addl %eax, 0xc(%rsp)
movq 0x30(%rsp), %r15
movq %r15, %rax
subq %rsi, %rax
movq (%rsp), %rcx
cmpq %rcx, %rax
cmovbq %rax, %rcx
movq %rcx, (%rsp)
movq 0x38(%rsp), %rdi
jmp 0x6f5a
leaq 0x388ee(%rip), %rdi     # 0x3fa1e
callq 0x56e2
xorl %ebx, %ebx
jmp 0x715f
movq %r15, %rdi
callq 0x31b0
movl %ebx, %edi
callq 0x16a4f
cmpl $0x0, 0xc(%rsp)
je 0x715f
leaq 0x388c0(%rip), %rdi     # 0x3fa16
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %edi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16a4f
leaq 0x3885c(%rip), %rdi     # 0x3f9d7
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x160f7
movq 0x4fe35(%rip), %rax     # 0x56fc8
movq (%rax), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16e8c