// File: /workspace/github_c_makefile_star2_O2/hfiguiere[P]exifprobe/ciff.c
// Function: canon_colorspace
unsigned long
canon_colorspace(FILE *inptr,unsigned short byteorder,char *tagprefix,
                            unsigned long offset,unsigned long dirlength,int indent)
{
    unsigned long count,value;
    unsigned long end_offset;
    int i;
    int chpr = 0;

    if(PRINT_SECTION)
    {
        chpr += printf(", length %lu",dirlength);
        chpr = newline(chpr);
    }

    end_offset = offset + dirlength;
    count = (dirlength / sizeof(unsigned short));

    /* There should be just one (no idea why they didn't do it        */
    /* INRECORD), and there is no 2-byte count                        */
    for(i = 0; i < count; ++i)
    {
        value = read_ushort(inptr,byteorder,offset);
        print_tag_address(ENTRY,offset,indent,"@");
        if((PRINT_TAGINFO))
        {
            if(tagprefix && (PRINT_LONGNAMES))
                chpr = printf("%s.",tagprefix);
            chpr = printf("%-*.*s",CIFFTAGWIDTH,CIFFTAGWIDTH,"type");
        }
        if((PRINT_VALUE))
        {
            chpr += printf(" = %lu ",value);
            if(value == 1)
                chpr += printf(" = \"real-world\"");
            else if(value == 2)
                chpr += printf(" = \"document\"");
            else if(value == 0xfff)
                chpr += printf(" = \"uncalibrated\"");
            else
                chpr += printf(" = \"undefined\"");
        }
        chpr = newline(chpr);
        offset += 2;
    }
    setcharsprinted(chpr);
    return(end_offset);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, 0x4(%rsp)
movq %r8, %r12
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movl %esi, %r14d
movq %rdi, 0x20(%rsp)
leaq 0x38604(%rip), %r13     # 0x57180
xorl %ebx, %ebx
testb $0x4, 0x2(%r13)
je 0x1eb9f
leaq 0x27b7d(%rip), %rdi     # 0x46709
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x160f7
movl %eax, %ebx
movq %r12, 0x18(%rsp)
shrq %r12
movzwl %r14w, %eax
movl %eax, (%rsp)
movq 0x8(%rsp), %r14
subq $0x1, %r12
jb 0x1eca7
movq 0x20(%rsp), %rdi
movl (%rsp), %esi
movq %r14, %rdx
callq 0x416a
movl %eax, %r15d
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movl 0x4(%rsp), %edx
leaq 0x204f9(%rip), %rcx     # 0x3f0dc
callq 0x5100
movq (%r13), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x1ec37
cmpq $0x0, 0x10(%rsp)
sete %cl
testb $0x40, %al
sete %al
orb %cl, %al
jne 0x1ec17
leaq 0x2489c(%rip), %rdi     # 0x434a7
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
leaq 0x27ec3(%rip), %rdi     # 0x46ae1
pushq $0x17
popq %rdx
movl %edx, %esi
leaq 0x27534(%rip), %rcx     # 0x4615e
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
movq (%r13), %rax
testb $0x30, %al
je 0x1ec95
movzwl %r15w, %ebp
leaq 0x27c30(%rip), %rdi     # 0x46876
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %r15d
leaq 0x27c24(%rip), %rdi     # 0x4687e
cmpq $0x1, %rbp
je 0x1ec86
cmpl $0xfff, %ebp            # imm = 0xFFF
je 0x1ec76
cmpl $0x2, %ebp
jne 0x1ec7f
leaq 0x27c1a(%rip), %rdi     # 0x4688e
jmp 0x1ec86
leaq 0x27c1f(%rip), %rdi     # 0x4689c
jmp 0x1ec86
leaq 0x27c28(%rip), %rdi     # 0x468ae
addl %ebx, %r15d
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r15d, %ebx
movl %ebx, %edi
callq 0x160f7
movl %eax, %ebx
addq $0x2, %r14
jmp 0x1ebb3
movq 0x18(%rsp), %r14
addq 0x8(%rsp), %r14
movl %ebx, %edi
callq 0x16a4f
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq