// File: /workspace/github_c_makefile_star2_O3/hfiguiere[P]exifprobe/print.c
// Function: print_user_comment
void
print_user_comment(FILE *inptr,unsigned long count,unsigned long offset,
                                                unsigned short byteorder)
{
    char *data;
    int i;
    int chpr = 0;

    /* The first 8 bytes identify the character code                  */

    if(PRINT_ENTRY)
    {
        if(PRINT_SECTION)
            chpr += printf("length %lu+8: (CC=",count - 8);
        if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1))
        {
            chpr += printf("seek failed to offset %lu to process user comment)",offset);
            chpr = newline(chpr);
        }
        else if((data = (char *)read_bytes(inptr,8UL,HERE)))
        {
            if(offset == HERE)
                offset = ftell(inptr);  /* need to return after check     */
            if((data[0] == 0) || (strncmp(data,"ASCII",5) == 0))
            {
                if(PRINT_SECTION)
                {
                    if(data[0] == 0)
                        chpr += printf("undefined");
                    else
                    {
                        for(i = 0; i < 8; ++i)
                        {
                            if(data[i] && isascii(data[i]))
                            {
                                (void)putchar(data[i]);
                                chpr++;
                            }
                        }
                    }
                    (void)putchar(')');
                    chpr++;
                    chpr += printf(" = ");
                }
                i = 8;
                if(PRINT_SECTION)
                {
                    /* check for all nulls                                   */
                    for( ; i < count; ++i)
                    {
                        if(fgetc(inptr) != '\0')
                            break;
                    }
                }
                if(i == count)
                    chpr += printf(" (%lu nulls)",count - 8);
                else
                {
                    /* check for all spaces                               */
                    if(fseek(inptr,offset + 8,SEEK_SET))
                    {
                        chpr += printf(" re-seek to comment offset %lu failed ",offset + 8);
                        chpr = newline(chpr);
                        why(stdout);
                    }
                    else
                    {
                        i = 8;
                        for( ; i < count; ++i)
                        {
                            if(fgetc(inptr) != ' ')
                                break;
                        }
                        if(i >= count)
                            chpr += printf("(%d spaces)",i - 8);
                        else
                        {
                            if(fseek(inptr,offset + i,SEEK_SET))
                            {
                                chpr += printf(" re-seek to comment offset %lu failed ",offset + 8);
                                why(stdout);
                            }
                            else
                            {
                                chpr++;
                                /* note that the above loop strips leading spaces */
                                if((i > 20) && (PRINT_SECTION))
                                    chpr += printf("(%d spaces)",i - 8);
                                print_ascii(inptr,count - i,offset + i);
                            }
                        }
                    }
                }
                if((LIST_MODE))
                {
                    chpr += printf(" # CC='");
                    if(data[0])
                    {
                        for(i = 0; i < 8; ++i)
                        {
                            if(data[i] && isascii(data[i]))
                            {
                                (void)putchar(data[i]);
                                chpr++;
                            }
                        }
                        putchar('\''); ++chpr;
                    }
                    else
                        chpr += printf("undefined'");
                }
            }
            else if(strncmp(data,"UNICODE",5) == 0)
            {
                if((PRINT_SECTION))
                {
                    for(i = 0; i < 8; ++i)
                    {
                        if(data[i] && isascii(data[i]))
                        {
                            (void)putchar(data[i]);
                            chpr++;
                        }
                    }
                }
                print_unicode(inptr,count - 8,HERE,byteorder);
                if((LIST_MODE))
                {
                    chpr += printf(" # CC='");
                    if(data[0])
                    {
                        for(i = 0; i < 8; ++i)
                        {
                            if(data[i] && isascii(data[i]))
                            {
                                (void)putchar(data[i]);
                                chpr++;
                            }
                        }
                        putchar('\''); ++chpr;
                    }
                    else
                        chpr += printf("undefined'");
                }
            }
            else
            {
                chpr = newline(chpr);
                hexdump(inptr,offset,count,count,16,0,SUBINDENT);
                chpr = newline(chpr);
            }
        }
        setcharsprinted(chpr);
    }
}

// Assembly:
leaq 0x5126d(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
je 0x6f87
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
xorl %ebx, %ebx
btl $0x12, %eax
jae 0x6f52
leaq -0x8(%r15), %rsi
leaq 0x3a935(%rip), %rdi     # 0x4187e
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r13
jne 0x6f88
movl $0x8, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0x4865
testq %rax, %rax
je 0x72b5
movq %rax, %r14
movq %r12, %rdi
callq 0x3190
movq %rax, %r13
jmp 0x6fbc
retq
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3210
cmpl $-0x1, %eax
je 0x704c
movl $0x8, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0x4865
movq %rax, %r14
testq %rax, %rax
je 0x72b5
cmpb $0x0, (%r14)
je 0x7028
leaq 0x3a8fb(%rip), %rsi     # 0x418c4
movl $0x5, %edx
movq %r14, %rdi
callq 0x3090
testl %eax, %eax
je 0x706d
leaq 0x3a6c8(%rip), %rsi     # 0x416ad
movl $0x5, %edx
movq %r14, %rdi
callq 0x3090
testl %eax, %eax
je 0x7090
movl %ebx, %edi
callq 0x1707a
movl %eax, %ebx
movl $0x2, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r15, %rcx
movl $0x10, %r8d
xorl %r9d, %r9d
callq 0x7480
movl %ebx, %edi
jmp 0x7061
leaq 0x51151(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x707e
leaq 0x41e2d(%rip), %rdi     # 0x48e69
xorl %eax, %eax
callq 0x3120
addl %ebx, %eax
movl %eax, %ebx
jmp 0x713d
leaq 0x3a83e(%rip), %rdi     # 0x41891
movq %r13, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %edi
callq 0x1707a
movl %eax, %ebx
jmp 0x72b5
leaq 0x5110c(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
jne 0x7122
cmpq $0x9, %r15
setae %sil
movl $0x8, %eax
jmp 0x71a3
leaq 0x510e9(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x70b9
xorl %r13d, %r13d
movsbl (%r14,%r13), %edi
testl %edi, %edi
jle 0x70b0
callq 0x3060
incl %ebx
incq %r13
cmpq $0x8, %r13
jne 0x70a0
addq $-0x8, %r15
movzwl %bp, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %r15, %rsi
callq 0x734b
leaq 0x510a9(%rip), %rax     # 0x58180
movzwl 0x2(%rax), %eax
testl $0x104, %eax            # imm = 0x104
jne 0x72b5
leaq 0x3a81d(%rip), %rdi     # 0x4190a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
cmpb $0x0, (%r14)
je 0x72a3
xorl %ebx, %ebx
movsbl (%r14,%rbx), %edi
testl %edi, %edi
jle 0x7114
callq 0x3060
incl %ebp
incq %rbx
cmpq $0x8, %rbx
jne 0x7104
jmp 0x7293
xorl %ebp, %ebp
movsbl (%r14,%rbp), %edi
testl %edi, %edi
jle 0x7134
callq 0x3060
incl %ebx
incq %rbp
cmpq $0x8, %rbp
jne 0x7124
movl $0x29, %edi
callq 0x3060
leaq 0x4345a(%rip), %rdi     # 0x4a5a8
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
incl %ebx
leaq 0x51020(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
sete %cl
cmpq $0x9, %r15
setae %sil
setb %dl
movl $0x8, %eax
orb %cl, %dl
jne 0x71a3
movb %sil, 0xf(%rsp)
movl $0x8, %ebp
movq %r12, %rdi
callq 0x3150
testl %eax, %eax
jne 0x719c
incq %rbp
cmpq %rbp, %r15
jne 0x7185
movq %r15, %rbp
movl %ebp, %eax
movb 0xf(%rsp), %sil
cmpq %r15, %rax
jne 0x71c2
addq $-0x8, %r15
leaq 0x3a717(%rip), %rdi     # 0x418ca
movq %r15, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x724a
movb %sil, 0xf(%rsp)
leaq 0x8(%r13), %rbp
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
je 0x7209
leaq 0x3a6f4(%rip), %rdi     # 0x418d7
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %edi
callq 0x1707a
movl %eax, %ebx
movq 0x50dc9(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
callq 0x17ef7
jmp 0x724e
xorl %esi, %esi
movq %rbp, 0x10(%rsp)
cmpb $0x0, 0xf(%rsp)
je 0x723c
movl $0x8, %ebp
movq %r12, %rdi
callq 0x3150
cmpl $0x20, %eax
jne 0x72ca
incq %rbp
cmpq %rbp, %r15
jne 0x721c
addl $-0x8, %r15d
movl %r15d, %esi
leaq 0x3a6bb(%rip), %rdi     # 0x418fe
xorl %eax, %eax
callq 0x3120
addl %ebx, %eax
movl %eax, %ebx
leaq 0x50f2b(%rip), %rax     # 0x58180
movzwl 0x2(%rax), %eax
testl $0x104, %eax            # imm = 0x104
jne 0x72b5
leaq 0x3a6a3(%rip), %rdi     # 0x4190a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
cmpb $0x0, (%r14)
je 0x72a3
xorl %ebx, %ebx
movsbl (%r14,%rbx), %edi
testl %edi, %edi
jle 0x728a
callq 0x3060
incl %ebp
incq %rbx
cmpq $0x8, %rbx
jne 0x727a
movl $0x27, %edi
callq 0x3060
incl %ebp
movl %ebp, %ebx
jmp 0x72b5
leaq 0x3a668(%rip), %rdi     # 0x41912
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %ebp, %ebx
movl %ebx, %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17a82
addq %rbp, %r13
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
je 0x730b
leaq 0x3a5f2(%rip), %rdi     # 0x418d7
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
movq 0x50ccc(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
callq 0x17ef7
movl %ebp, %ebx
jmp 0x724e
incl %ebx
cmpq $0x15, %rbp
jb 0x7335
leaq 0x50e66(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x7335
leal -0x8(%rbp), %esi
leaq 0x3a5d4(%rip), %rdi     # 0x418fe
xorl %eax, %eax
callq 0x3120
addl %ebx, %eax
movl %eax, %ebx
subq %rbp, %r15
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x77d6
jmp 0x724e