// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
testq %rdi, %rdi
je 0x76ff
movq %rcx, %r14
movq %rdx, %rcx
testq %rdx, %rdx
sete %al
testq %r14, %r14
sete %dl
xorl %r12d, %r12d
orb %al, %dl
jne 0x7748
movq %rsi, %rbx
movq %rdi, %rbp
movl 0x80(%rsp), %eax
movl %eax, 0x28(%rsp)
movl $0x2000, %r15d          # imm = 0x2000
cmpq %r15, %rcx
cmovbq %rcx, %r15
cmpq $0x2001, %rcx           # imm = 0x2001
jb 0x74b4
movslq %r8d, %rsi
movq %r15, %rax
xorl %edx, %edx
divq %rsi
subq %rdx, %r15
cmpq %r14, %rcx
cmovbq %rcx, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rbx
movl %r8d, 0x10(%rsp)
je 0x74e5
movq %rbp, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3210
movl 0x10(%rsp), %r8d
cmpl $-0x1, %eax
je 0x775e
movq %r14, 0x20(%rsp)
addl $0x2, 0x18(%rsp)
movl %r8d, %r14d
xorl %r12d, %r12d
movl $0x0, 0x14(%rsp)
xorl %ecx, %ecx
movq %rbx, 0x38(%rsp)
movq %rbp, 0x30(%rsp)
movl %ecx, 0xc(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rbp, %rdi
movq %r15, %rsi
callq 0x4832
testq %rax, %rax
je 0x7730
movq %rax, %r13
movq %rbp, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x7720
movq %rbp, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x7720
movq 0x20(%rsp), %rax
cmpq %r15, %rax
adcl $0x0, 0x14(%rsp)
cmpq %r15, %rax
movq %r15, %rbp
cmovbq %rax, %rbp
testq %r15, %r15
je 0x76d6
xorl %r15d, %r15d
movl $0x0, 0x1c(%rsp)
movl 0xc(%rsp), %ecx
movq %rbp, 0x40(%rsp)
movl %ecx, 0xc(%rsp)
movslq %ecx, %rsi
addq %rbx, %rsi
movl $0x4103333, %edi        # imm = 0x4103333
movl 0x18(%rsp), %edx
leaq 0x39bff(%rip), %rcx     # 0x41196
callq 0x5605
leaq 0x50bdd(%rip), %rax     # 0x58180
testb $0x30, 0x3(%rax)
je 0x75b2
movl 0x28(%rsp), %edi
callq 0x5730
movq %rbp, %rbx
subq %r15, %rbx
cmpl $0x0, 0x10(%rsp)
jle 0x7617
xorl %r15d, %r15d
movq %r13, %rbp
testq %r15, %r15
sete %al
testb $0x3, %r15b
setne %cl
orb %al, %cl
jne 0x75e0
movl $0x20, %edi
callq 0x3060
cmpq %r15, %rbx
jbe 0x75fc
movzbl (%rbp), %esi
incq %rbp
leaq 0x3a417(%rip), %rdi     # 0x41a0a
xorl %eax, %eax
callq 0x3120
jmp 0x760a
leaq 0x39b8a(%rip), %rdi     # 0x4118d
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
incq %r15
cmpq %r15, %r14
jne 0x75c5
jmp 0x761a
movq %r13, %rbp
leaq 0x3a3ef(%rip), %rdi     # 0x41a10
xorl %eax, %eax
callq 0x3120
movl %eax, %r15d
movl 0x10(%rsp), %eax
testl %eax, %eax
jle 0x7687
addl %eax, %r15d
movl %r15d, 0x2c(%rsp)
addl %eax, 0x1c(%rsp)
xorl %r15d, %r15d
movl $0x20, %edi
cmpq %r15, %rbx
jbe 0x766b
callq 0x32d0
movq (%rax), %rcx
movsbl (%r13,%r15), %eax
movslq %eax, %rdx
testb $0x40, 0x1(%rcx,%rdx,2)
movl $0x2e, %edi
je 0x766b
movl %eax, %edi
callq 0x3060
incq %r15
cmpq %r15, %r14
jne 0x7642
movl 0xc(%rsp), %ecx
addl 0x10(%rsp), %ecx
movl 0x2c(%rsp), %r15d
jmp 0x768b
movl 0xc(%rsp), %ecx
addl %r12d, %r15d
movslq %ecx, %rax
cmpq %rax, 0x20(%rsp)
leaq 0x3a374(%rip), %rdi     # 0x41a11
leaq 0x3a36f(%rip), %rax     # 0x41a13
cmovaq %rax, %rdi
xorl %eax, %eax
movl %ecx, %ebx
callq 0x3120
movl %ebx, %ecx
movl %eax, %r12d
addl %r15d, %r12d
movslq 0x1c(%rsp), %r15
movq %rbp, %r13
movq 0x40(%rsp), %rbp
cmpq %r15, %rbp
movq 0x38(%rsp), %rbx
ja 0x757d
jmp 0x76da
movl 0xc(%rsp), %ecx
movslq %ecx, %rax
movq 0x20(%rsp), %rdx
movq %rdx, %r15
subq %rax, %r15
cmpq %rbp, %r15
cmovaeq %rbp, %r15
cmpq %rax, %rdx
movq 0x30(%rsp), %rbp
ja 0x7509
jmp 0x7730
leaq 0x39991(%rip), %rdi     # 0x41097
leaq 0x3a311(%rip), %rsi     # 0x41a1e
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x17530
jmp 0x7748
movq %rbp, %rdi
callq 0x31b0
movl %r12d, %edi
callq 0x17530
cmpl $0x0, 0x14(%rsp)
je 0x7748
leaq 0x3a2d8(%rip), %rdi     # 0x41a16
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl %r12d, %edi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17530
leaq 0x3a272(%rip), %rdi     # 0x419d7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x16b56
movq 0x5084b(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x179a5