// File: /workspace/github_c_makefile_star2_O1/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 0x512cf(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
je 0x6fb8
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
xorl %r14d, %r14d
btl $0x12, %eax
jae 0x6ef6
leaq -0x8(%r15), %rsi
leaq 0x3a992(%rip), %rdi     # 0x4187e
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r13
je 0x6f16
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3210
cmpl $-0x1, %eax
je 0x6ff3
movl %ebx, 0x10(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x8, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0x4832
testq %rax, %rax
je 0x72b6
movq %rax, %rbx
cmpq %rbp, %r13
jne 0x6f4d
movq %r12, %rdi
callq 0x3190
movq %rax, %r13
movb (%rbx), %bpl
testb %bpl, %bpl
je 0x6fb9
leaq 0x3a968(%rip), %rsi     # 0x418c4
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3090
testl %eax, %eax
je 0x6fb9
leaq 0x3a739(%rip), %rsi     # 0x416ad
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3090
testl %eax, %eax
je 0x7017
movl %r14d, %edi
callq 0x16b56
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 0x7446
movl %ebx, %edi
jmp 0x700a
retq
leaq 0x511c0(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x70d8
testb %bpl, %bpl
je 0x70a6
xorl %ebp, %ebp
movsbl (%rbx,%rbp), %edi
testl %edi, %edi
jle 0x6fe5
callq 0x3060
incl %r14d
incq %rbp
cmpq $0x8, %rbp
jne 0x6fd5
jmp 0x70ba
leaq 0x3a897(%rip), %rdi     # 0x41891
movq %r13, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movl %eax, %r14d
jmp 0x72b6
leaq 0x51162(%rip), %rbp     # 0x58180
testb $0x4, 0x2(%rbp)
je 0x7041
xorl %r13d, %r13d
movsbl (%rbx,%r13), %edi
testl %edi, %edi
jle 0x7038
callq 0x3060
incl %r14d
incq %r13
cmpq $0x8, %r13
jne 0x7027
addq $-0x8, %r15
movzwl 0x10(%rsp), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %r15, %rsi
callq 0x730f
movzwl 0x2(%rbp), %eax
testl $0x104, %eax            # imm = 0x104
jne 0x72b6
leaq 0x3a89a(%rip), %rdi     # 0x4190a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r14d, %ebp
cmpb $0x0, (%rbx)
je 0x72a2
xorl %r14d, %r14d
movsbl (%rbx,%r14), %edi
testl %edi, %edi
jle 0x7098
callq 0x3060
incl %ebp
incq %r14
cmpq $0x8, %r14
jne 0x7088
jmp 0x7291
leaq 0x41d7c(%rip), %rdi     # 0x48e29
xorl %eax, %eax
callq 0x3120
addl %r14d, %eax
movl %eax, %r14d
movl $0x29, %edi
callq 0x3060
leaq 0x4349d(%rip), %rdi     # 0x4a568
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
incl %r14d
leaq 0x510a1(%rip), %rbp     # 0x58180
testb $0x4, 0x2(%rbp)
sete %cl
cmpq $0x9, %r15
setb %dl
movl $0x8, %eax
orb %cl, %dl
jne 0x711b
movl $0x8, %ebp
movq %r12, %rdi
callq 0x3150
testl %eax, %eax
jne 0x7112
incq %rbp
cmpq %rbp, %r15
jne 0x70fb
movq %r15, %rbp
movl %ebp, %eax
leaq 0x51065(%rip), %rbp     # 0x58180
cmpq %r15, %rax
jne 0x7140
addq $-0x8, %r15
leaq 0x3a79f(%rip), %rdi     # 0x418ca
movq %r15, %rsi
xorl %eax, %eax
callq 0x3120
addl %r14d, %eax
movl %eax, %r14d
jmp 0x7252
leaq 0x8(%r13), %rsi
movq %r12, %rdi
movq %rsi, 0x10(%rsp)
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
je 0x718c
leaq 0x3a779(%rip), %rdi     # 0x418d7
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movl %eax, %r14d
movq 0x50e49(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
callq 0x179a5
jmp 0x7252
movl $0x8, %ebp
cmpq $0x9, %r15
setae %al
jb 0x7235
movb %al, 0x8(%rsp)
movq %r12, %rdi
callq 0x3150
movl $0x8, %ebp
cmpl $0x20, %eax
jne 0x71e7
movl $0x9, %eax
subq %r15, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
addq %rbp, %rax
cmpq $0x8, %rax
je 0x7232
movq %r12, %rdi
callq 0x3150
incq %rbp
cmpl $0x20, %eax
je 0x71c1
cmpq %r15, %rbp
setb 0x8(%rsp)
cmpb $0x0, 0x8(%rsp)
je 0x7235
addq %rbp, %r13
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
je 0x72cc
leaq 0x3a6ca(%rip), %rdi     # 0x418d7
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r14d, %ebp
movq 0x50da3(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
callq 0x179a5
movl %ebp, %r14d
jmp 0x724b
movl %r15d, %ebp
addl $-0x8, %ebp
leaq 0x3a6bf(%rip), %rdi     # 0x418fe
movl %ebp, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x50f2e(%rip), %rbp     # 0x58180
movzwl 0x2(%rbp), %eax
testl $0x104, %eax            # imm = 0x104
jne 0x72b6
leaq 0x3a6a6(%rip), %rdi     # 0x4190a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r14d, %ebp
cmpb $0x0, (%rbx)
je 0x72a2
xorl %r14d, %r14d
movsbl (%rbx,%r14), %edi
testl %edi, %edi
jle 0x7288
callq 0x3060
incl %ebp
incq %r14
cmpq $0x8, %r14
jne 0x7278
movl $0x27, %edi
callq 0x3060
incl %ebp
movl %ebp, %r14d
jmp 0x72b6
leaq 0x3a669(%rip), %rdi     # 0x41912
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
addl %ebp, %r14d
movl %r14d, %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17530
incl %r14d
cmpq $0x15, %rbp
jb 0x72f9
leaq 0x50ea4(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x72f9
leal -0x8(%rbp), %esi
leaq 0x3a612(%rip), %rdi     # 0x418fe
xorl %eax, %eax
callq 0x3120
addl %r14d, %eax
movl %eax, %r14d
subq %rbp, %r15
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x7793
jmp 0x724b