// File: /workspace/github_c_makefile_star2_O2/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 0x50876(%rip), %rax     # 0x57180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
je 0x6a24
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %rbp
xorl %r14d, %r14d
btl $0x12, %eax
jae 0x6950
leaq -0x8(%r13), %rsi
leaq 0x38f38(%rip), %rdi     # 0x3f87e
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rbx
je 0x6970
movq %rbp, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3210
cmpl $-0x1, %eax
je 0x6a4a
movl %r15d, 0x20(%rsp)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
pushq $0x8
popq %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rbp, %rdi
movq %rsi, 0x10(%rsp)
callq 0x4410
testq %rax, %rax
je 0x6d56
movq %rax, %r15
cmpq %r12, %rbx
movq %rbx, %rax
movq %rbp, %rbx
jne 0x69af
movq %rbx, %rdi
callq 0x3190
movq %rax, 0x18(%rsp)
cmpb $0x0, (%r15)
leaq 0x507c1(%rip), %r12     # 0x57180
je 0x6a25
leaq 0x38efc(%rip), %rsi     # 0x3f8c4
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x3090
testl %eax, %eax
je 0x6a6e
leaq 0x38ccb(%rip), %rsi     # 0x3f6ad
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x3090
testl %eax, %eax
je 0x6a99
movl %r14d, %edi
callq 0x160f7
movq %rbx, %rdi
movl %eax, %ebx
movl $0x2, (%rsp)
pushq $0x10
popq %r8
movq 0x18(%rsp), %rsi
movq %r13, %rdx
movq %r13, %rcx
xorl %r9d, %r9d
callq 0x6e93
movl %ebx, %edi
jmp 0x6a61
retq
testb $0x4, 0x2(%r12)
je 0x6b29
leaq 0x403e1(%rip), %rdi     # 0x46e19
xorl %eax, %eax
callq 0x3120
addl %r14d, %eax
movl %eax, %r14d
jmp 0x6acf
leaq 0x38e40(%rip), %rdi     # 0x3f891
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %r14d
jmp 0x6d56
testb $0x4, 0x2(%r12)
je 0x6b29
xorl %r12d, %r12d
cmpq $0x8, %r12
je 0x6ac8
movsbl (%r15,%r12), %edi
testl %edi, %edi
jle 0x6a94
callq 0x3060
incl %r14d
incq %r12
jmp 0x6a7d
testb $0x4, 0x2(%r12)
je 0x6bde
xorl %r12d, %r12d
cmpq $0x8, %r12
je 0x6bd7
movsbl (%r15,%r12), %edi
testl %edi, %edi
jle 0x6ac3
callq 0x3060
incl %r14d
incq %r12
jmp 0x6aa8
leaq 0x506b1(%rip), %r12     # 0x57180
pushq $0x29
popq %rdi
callq 0x3060
leaq 0x41a7a(%rip), %rdi     # 0x48558
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
incl %r14d
testb $0x4, 0x2(%r12)
je 0x6b29
cmpq $0x9, %r13
pushq $0x8
popq %rbp
movq %rbp, %r12
cmovaeq %r13, %r12
cmpq %r13, %rbp
jae 0x6b1a
movq %rbx, %rdi
callq 0x3150
testl %eax, %eax
jne 0x6b17
incq %rbp
jmp 0x6b01
movq %rbp, %r12
movl %r12d, %eax
movq %rax, 0x10(%rsp)
leaq 0x50657(%rip), %r12     # 0x57180
cmpq %r13, 0x10(%rsp)
jne 0x6b50
addq $-0x8, %r13
leaq 0x38d8f(%rip), %rdi     # 0x3f8ca
movq %r13, %rsi
xorl %eax, %eax
callq 0x3120
addl %r14d, %eax
movl %eax, %r14d
jmp 0x6cf0
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
je 0x6b9d
leaq 0x38d66(%rip), %rdi     # 0x3f8d7
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %r14d
movq 0x50438(%rip), %rax     # 0x56fc8
movq (%rax), %rdi
callq 0x16e8c
jmp 0x6cf0
movq %rbp, 0x20(%rsp)
cmpq $0x9, %r13
pushq $0x8
popq %rbp
movq %rbp, %rax
cmovaeq %r13, %rax
movq %rax, 0x10(%rsp)
movq %r13, %r12
subq %rbp, %r12
jbe 0x6c46
movq %rbx, %rdi
callq 0x3150
cmpl $0x20, %eax
jne 0x6c67
incq %rbp
jmp 0x6bb5
leaq 0x505a2(%rip), %r12     # 0x57180
addq $-0x8, %r13
movzwl 0x20(%rsp), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6d6c
movzwl 0x2(%r12), %eax
testw $0x104, %ax             # imm = 0x104
jne 0x6d56
leaq 0x38cfc(%rip), %rdi     # 0x3f90a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r14d, %ebp
cmpb $0x0, (%r15)
je 0x6d42
xorl %r14d, %r14d
cmpq $0x8, %r14
je 0x6d33
movsbl (%r15,%r14), %edi
testl %edi, %edi
jle 0x6c41
callq 0x3060
incl %ebp
incq %r14
jmp 0x6c27
movq 0x10(%rsp), %rsi
addl $-0x8, %esi
leaq 0x38ca9(%rip), %rdi     # 0x3f8fe
xorl %eax, %eax
callq 0x3120
addl %r14d, %eax
movl %eax, %r14d
jmp 0x6ce9
movq 0x18(%rsp), %r13
addq %rbp, %r13
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
je 0x6cac
leaq 0x38c50(%rip), %rdi     # 0x3f8d7
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r14d, %ebp
movq 0x50329(%rip), %rax     # 0x56fc8
movq (%rax), %rdi
callq 0x16e8c
movl %ebp, %r14d
jmp 0x6ce9
incl %r14d
cmpq $0x15, %rbp
jb 0x6cdb
leaq 0x504c4(%rip), %rax     # 0x57180
testb $0x4, 0x2(%rax)
je 0x6cdb
addl $-0x8, %ebp
leaq 0x38c32(%rip), %rdi     # 0x3f8fe
movl %ebp, %esi
xorl %eax, %eax
callq 0x3120
addl %r14d, %eax
movl %eax, %r14d
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x71a9
leaq 0x50490(%rip), %r12     # 0x57180
movzwl 0x2(%r12), %eax
testw $0x104, %ax             # imm = 0x104
jne 0x6d56
leaq 0x38c07(%rip), %rdi     # 0x3f90a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r14d, %ebp
cmpb $0x0, (%r15)
je 0x6d42
xorl %r14d, %r14d
cmpq $0x8, %r14
je 0x6d33
movsbl (%r15,%r14), %edi
testl %edi, %edi
jle 0x6d2e
callq 0x3060
incl %ebp
incq %r14
jmp 0x6d18
pushq $0x27
popq %rdi
callq 0x3060
incl %ebp
movl %ebp, %r14d
jmp 0x6d56
leaq 0x38bc9(%rip), %rdi     # 0x3f912
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
addl %ebp, %r14d
movl %r14d, %edi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16a4f