// File: /workspace/github_c_makefile_star2_O3/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 0x7742
movq %rcx, %rbp
movq %rdx, %rcx
testq %rdx, %rdx
sete %al
testq %rbp, %rbp
sete %dl
xorl %r13d, %r13d
orb %al, %dl
jne 0x778b
movq %rsi, %r14
movq %rdi, %r12
movl 0x80(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq %rcx, %r15
cmpq $0x2001, %rcx           # imm = 0x2001
jb 0x74ec
movslq %r8d, %rsi
movl $0x2000, %r15d          # imm = 0x2000
movl $0x2000, %eax           # imm = 0x2000
xorl %edx, %edx
divq %rsi
subq %rdx, %r15
cmpq %rbp, %rcx
cmovbq %rcx, %rbp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r14
movl %r8d, 0x8(%rsp)
je 0x751d
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3210
movl 0x8(%rsp), %r8d
cmpl $-0x1, %eax
je 0x77a1
movq %r14, 0x40(%rsp)
addl $0x2, 0x10(%rsp)
movl %r8d, %r14d
xorl %r13d, %r13d
movl $0x0, 0xc(%rsp)
movl $0x0, 0x4(%rsp)
movq %rbp, 0x30(%rsp)
movq %r12, 0x38(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %r15, %rsi
callq 0x4865
testq %rax, %rax
je 0x7773
movq %rax, %rbx
movq %r12, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x7763
movq %r12, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x7763
cmpq %r15, %rbp
adcl $0x0, 0xc(%rsp)
cmpq %r15, %rbp
movq %r15, %rax
cmovbq %rbp, %rax
movq %rax, 0x20(%rsp)
testq %r15, %r15
je 0x771b
xorl %r15d, %r15d
movl $0x0, 0x14(%rsp)
movslq 0x4(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rcx
leaq (%rax,%rcx), %rsi
movl $0x4103333, %edi        # imm = 0x4103333
movl 0x10(%rsp), %edx
leaq 0x39bc5(%rip), %rcx     # 0x41196
callq 0x55eb
leaq 0x50ba3(%rip), %rax     # 0x58180
testb $0x30, 0x3(%rax)
je 0x75ec
movl 0x2c(%rsp), %edi
callq 0x5716
cmpl $0x0, 0x8(%rsp)
jle 0x76ca
movq 0x20(%rsp), %r12
subq %r15, %r12
xorl %r15d, %r15d
movq %rbx, %rbp
testq %r15, %r15
sete %al
testb $0x3, %r15b
setne %cl
orb %al, %cl
jne 0x7620
movl $0x20, %edi
callq 0x3060
cmpq %r15, %r12
jbe 0x763c
movzbl (%rbp), %esi
incq %rbp
leaq 0x3a3d7(%rip), %rdi     # 0x41a0a
xorl %eax, %eax
callq 0x3120
jmp 0x764a
leaq 0x39b4a(%rip), %rdi     # 0x4118d
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
incq %r15
cmpq %r15, %r14
jne 0x7605
leaq 0x3a3b4(%rip), %rdi     # 0x41a10
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
jle 0x76da
addl %ecx, %eax
movl %eax, 0x18(%rsp)
addl %ecx, 0x14(%rsp)
xorl %r15d, %r15d
movl $0x20, %edi
cmpq %r15, %r12
jbe 0x76a0
callq 0x32d0
movq (%rax), %rcx
movsbl (%rbx,%r15), %eax
movslq %eax, %rdx
testb $0x40, 0x1(%rcx,%rdx,2)
movl $0x2e, %edi
je 0x76a0
movl %eax, %edi
callq 0x3060
incq %r15
cmpq %r15, %r14
jne 0x7678
movl 0x4(%rsp), %eax
addl 0x8(%rsp), %eax
movl %eax, 0x4(%rsp)
movslq %eax, %r12
movq %rbp, %rbx
movq 0x30(%rsp), %rbp
movl 0x18(%rsp), %eax
jmp 0x76e7
leaq 0x3a33f(%rip), %rdi     # 0x41a10
xorl %eax, %eax
callq 0x3120
jmp 0x76e2
movq %rbp, %rbx
movq 0x30(%rsp), %rbp
movq 0x18(%rsp), %r12
addl %eax, %r13d
cmpq %r12, %rbp
leaq 0x3a31d(%rip), %rdi     # 0x41a11
leaq 0x3a318(%rip), %rax     # 0x41a13
cmovaq %rax, %rdi
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movslq 0x14(%rsp), %r15
cmpq %r15, 0x20(%rsp)
ja 0x75ae
jmp 0x7720
movslq 0x4(%rsp), %r12
movq %rbp, %r15
subq %r12, %r15
movq 0x20(%rsp), %rax
cmpq %rax, %r15
cmovaeq %rax, %r15
cmpq %r12, %rbp
movq 0x38(%rsp), %r12
ja 0x7547
jmp 0x7773
leaq 0x3994e(%rip), %rdi     # 0x41097
leaq 0x3a2ce(%rip), %rsi     # 0x41a1e
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x17a82
jmp 0x778b
movq %r12, %rdi
callq 0x31b0
movl %r13d, %edi
callq 0x17a82
cmpl $0x0, 0xc(%rsp)
je 0x778b
leaq 0x3a295(%rip), %rdi     # 0x41a16
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17a82
leaq 0x3a22f(%rip), %rdi     # 0x419d7
movq %r14, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x1707a
movq 0x50808(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17ef7