// File: /workspace/github_c_makefile_star2_O1/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 0x38913(%rip), %r13     # 0x58180
xorl %ebx, %ebx
testb $0x4, 0x2(%r13)
je 0x1f890
leaq 0x28e9c(%rip), %rdi     # 0x48719
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x16b56
movl %eax, %ebx
cmpq $0x2, %r12
movq %r12, 0x18(%rsp)
jb 0x1f9a1
shrq %r12
movzwl %r14w, %eax
movl %eax, (%rsp)
movq 0x8(%rsp), %r14
movq 0x20(%rsp), %rdi
movl (%rsp), %esi
movq %r14, %rdx
callq 0x4574
movl %eax, %r15d
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movl 0x4(%rsp), %edx
leaq 0x21808(%rip), %rcx     # 0x410dc
callq 0x5605
movq (%r13), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x1f92a
cmpq $0x0, 0x10(%rsp)
sete %cl
testb $0x40, %al
sete %al
orb %cl, %al
jne 0x1f909
leaq 0x25baa(%rip), %rdi     # 0x454a7
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
leaq 0x291e1(%rip), %rdi     # 0x48af1
movl $0x17, %esi
movl $0x17, %edx
leaq 0x2884d(%rip), %rcx     # 0x4816e
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
testb $0x30, (%r13)
je 0x1f98b
movzwl %r15w, %ebp
leaq 0x28f4a(%rip), %rdi     # 0x48886
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %r15d
leaq 0x28f3e(%rip), %rdi     # 0x4888e
cmpq $0x1, %rbp
je 0x1f97c
cmpl $0xfff, %ebp            # imm = 0xFFF
je 0x1f96c
cmpl $0x2, %ebp
jne 0x1f975
leaq 0x28f34(%rip), %rdi     # 0x4889e
jmp 0x1f97c
leaq 0x28f39(%rip), %rdi     # 0x488ac
jmp 0x1f97c
leaq 0x28f42(%rip), %rdi     # 0x488be
addl %ebx, %r15d
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r15d, %ebx
movl %ebx, %edi
callq 0x16b56
movl %eax, %ebx
addq $0x2, %r14
decq %r12
jne 0x1f8ae
movq 0x18(%rsp), %r14
addq 0x8(%rsp), %r14
movl %ebx, %edi
callq 0x17530
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq