// File: /workspace/github_c_makefile_star2_O3/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 0x3833b(%rip), %r13     # 0x58180
xorl %ebx, %ebx
testb $0x4, 0x2(%r13)
je 0x1fe68
leaq 0x28904(%rip), %rdi     # 0x48759
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x1707a
movl %eax, %ebx
cmpq $0x2, %r12
movq %r12, 0x18(%rsp)
jb 0x1ff7a
shrq %r12
movzwl %r14w, %eax
movl %eax, (%rsp)
movq 0x8(%rsp), %r14
movq 0x20(%rsp), %rdi
movl (%rsp), %esi
movq %r14, %rdx
callq 0x45af
movl %eax, %r15d
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movl 0x4(%rsp), %edx
leaq 0x21230(%rip), %rcx     # 0x410dc
callq 0x55eb
movq (%r13), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x1ff06
cmpq $0x0, 0x10(%rsp)
sete %cl
testb $0x40, %al
sete %al
orb %cl, %al
jne 0x1fee1
leaq 0x25616(%rip), %rdi     # 0x454eb
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
leaq 0x28c49(%rip), %rdi     # 0x48b31
movl $0x17, %esi
movl $0x17, %edx
leaq 0x282b5(%rip), %rcx     # 0x481ae
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
movq (%r13), %rax
testb $0x30, %al
je 0x1ff64
movzwl %r15w, %ebp
leaq 0x289b1(%rip), %rdi     # 0x488c6
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %r15d
leaq 0x289a5(%rip), %rdi     # 0x488ce
cmpq $0x1, %rbp
je 0x1ff55
cmpl $0xfff, %ebp            # imm = 0xFFF
je 0x1ff45
cmpl $0x2, %ebp
jne 0x1ff4e
leaq 0x2899b(%rip), %rdi     # 0x488de
jmp 0x1ff55
leaq 0x289a0(%rip), %rdi     # 0x488ec
jmp 0x1ff55
leaq 0x289a9(%rip), %rdi     # 0x488fe
addl %ebx, %r15d
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r15d, %ebx
movl %ebx, %edi
callq 0x1707a
movl %eax, %ebx
addq $0x2, %r14
decq %r12
jne 0x1fe86
movq 0x18(%rsp), %r14
addq 0x8(%rsp), %r14
movl %ebx, %edi
callq 0x17a82
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq