// File: /workspace/github_c_makefile_star2_O1/hfiguiere[P]exifprobe/jp2000.c
// Function: process_jp2_colr
unsigned long
process_jp2_colr(FILE *inptr,struct jp2box *box,int indent)
{
    unsigned long boxoffset,dataoffset;
    unsigned long boxlength,proflength;
    unsigned short meth = 0;
    unsigned short prec = 0;
    unsigned short approx = 0;
    unsigned short csenum = 0;
    int chpr = 0;

    if((LIST_MODE))
        chpr = list_jp2box(inptr,box,"JP2.jp2h.",indent,1);
    else
        print_jp2box(inptr,box,indent);
    boxoffset = box->boxoffset;
    dataoffset = boxoffset + box->dataoffset;
    boxlength = box->boxlength;

    meth = read_ubyte(inptr,dataoffset);
    print_tag_address(ENTRY,dataoffset,indent + 8,"=");
    if((PRINT_TAGINFO))
    {
        if((PRINT_LONGNAMES))
            chpr += printf("JP2.jp2h.colr.");
        chpr += printf("Method");
    }
    if((PRINT_VALUE))
        chpr += printf(" = %u",meth);
    chpr = newline(chpr);
    dataoffset ++;

    prec = read_ubyte(inptr,dataoffset);
    print_tag_address(ENTRY,dataoffset,indent + 8,"=");
    if((PRINT_TAGINFO))
    {
        if((PRINT_LONGNAMES))
            chpr += printf("JP2.jp2h.colr.");
        chpr += printf("Precedence");
    }
    if((PRINT_VALUE))
        chpr += printf(" = %u",prec);
    chpr = newline(chpr);
    dataoffset ++;

    approx = read_ubyte(inptr,dataoffset);
    print_tag_address(ENTRY,dataoffset,indent + 8,"=");
    if((PRINT_TAGINFO))
    {
        if((PRINT_LONGNAMES))
            chpr += printf("JP2.jp2h.colr.");
        chpr += printf("ColorSpaceAproximation");
    }
    if((PRINT_VALUE))
        chpr += printf(" = %u",approx);
    chpr = newline(chpr);
    dataoffset ++;

    if(meth == 1)
    {
        csenum = read_ulong(inptr,TIFF_MOTOROLA,dataoffset);
        print_tag_address(ENTRY,dataoffset,indent + 8,"=");
        if((PRINT_TAGINFO))
        {
            if((PRINT_LONGNAMES))
                chpr += printf("JP2.jp2h.colr.");
            chpr += printf("EnumeratedColorSpace");
        }
        if((PRINT_VALUE))
        {
            chpr += printf(" = %u",csenum);
            switch(csenum)
            {
                case 16: chpr += printf(" = sRGB"); break;
                case 17: chpr += printf(" = greyscale"); break;
                default: chpr += printf(" = undefined"); break;
            }
        }
        chpr = newline(chpr);
        dataoffset += 4;
    }
    else
    {
        print_tag_address(ENTRY,dataoffset,indent + 8,"=");
        proflength = boxoffset + boxlength - dataoffset;
        if((PRINT_TAGINFO))
        {
            if((PRINT_LONGNAMES))
                chpr += printf("JP2.jp2h.colr.");
            chpr += printf("ICCProfileLength");
        }
        if((PRINT_VALUE))
            chpr += printf(" = %lu",proflength);
        chpr = newline(chpr);
        /* ###%%% display this as soon as we have some ICC routines   */
        dataoffset = boxoffset + boxlength;
    }
    dataoffset = boxoffset + boxlength;
    if((PRINT_SECTION))
    {
        chpr = newline(chpr);
        print_tag_address(SECTION,dataoffset - 1,indent,"@");
        print_jp2type(box->tbox,1);
    }
    chpr = newline(chpr);
    return(dataoffset);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x366ad(%rip), %rax     # 0x58180
movzwl 0x2(%rax), %eax
testl $0x104, %eax            # imm = 0x104
je 0x21af1
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x2041a
xorl %r14d, %r14d
jmp 0x21b0f
leaq 0x271dd(%rip), %rdx     # 0x48cd5
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
movl $0x1, %r8d
callq 0x204e6
movl %eax, %r14d
movq 0x10(%rbx), %rcx
movq 0x18(%rbx), %rax
movq %rax, 0x30(%rsp)
movq %rcx, 0x18(%rsp)
leaq (%rcx,%rax), %r13
movq %rbx, 0x28(%rsp)
movq 0x20(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x4d44
movw %ax, 0xe(%rsp)
movq %r15, 0x20(%rsp)
leal 0x8(%r15), %ebp
leaq 0x22e2e(%rip), %rcx     # 0x44981
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x5605
leaq 0x36617(%rip), %rbx     # 0x58180
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x21b99
testb $0x40, %al
je 0x21b88
leaq 0x2724d(%rip), %rdi     # 0x48dcb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x278f0(%rip), %rdi     # 0x4947f
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
testb $0x30, (%rbx)
je 0x21bb4
movzwl 0xe(%rsp), %esi
leaq 0x233b0(%rip), %rdi     # 0x44f5a
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movl %eax, %r14d
leaq 0x1(%r13), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4d44
movl %eax, %r15d
leaq 0x22da9(%rip), %rcx     # 0x44981
movl $0x4003333, %edi        # imm = 0x4003333
movq %rbx, %rsi
movl %ebp, %edx
callq 0x5605
leaq 0x36592(%rip), %rbx     # 0x58180
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x21c1e
testb $0x40, %al
je 0x21c0d
leaq 0x271c8(%rip), %rdi     # 0x48dcb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x271c6(%rip), %rdi     # 0x48dda
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
testb $0x30, (%rbx)
je 0x21c38
movzwl %r15w, %esi
leaq 0x2332c(%rip), %rdi     # 0x44f5a
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movl %eax, %r14d
leaq 0x2(%r13), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4d44
movl %eax, %r15d
leaq 0x22d25(%rip), %rcx     # 0x44981
movl $0x4003333, %edi        # imm = 0x4003333
movq %rbx, %rsi
movl %ebp, %edx
callq 0x5605
leaq 0x3650e(%rip), %rbx     # 0x58180
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x21ca2
testb $0x40, %al
je 0x21c91
leaq 0x27144(%rip), %rdi     # 0x48dcb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x2714d(%rip), %rdi     # 0x48de5
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
testb $0x30, (%rbx)
je 0x21cbc
movzwl %r15w, %esi
leaq 0x232a8(%rip), %rdi     # 0x44f5a
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq 0x10(%rsp), %r15
movl %r14d, %edi
callq 0x16b56
movl %eax, %r14d
addq $0x3, %r13
cmpw $0x1, 0xe(%rsp)
jne 0x21d92
movq %r12, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq %r13, %rdx
callq 0x46cc
movq %rax, %r12
leaq 0x22c8b(%rip), %rcx     # 0x44981
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x5605
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x21d35
testb $0x40, %al
je 0x21d24
leaq 0x270b1(%rip), %rdi     # 0x48dcb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x270d1(%rip), %rdi     # 0x48dfc
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
testb $0x30, (%rbx)
je 0x21dfa
movzwl %r12w, %esi
leaq 0x23211(%rip), %rdi     # 0x44f5a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r14d, %ebx
cmpw $0x11, %r12w
leaq 0x270b8(%rip), %rax     # 0x48e19
leaq 0x270be(%rip), %rcx     # 0x48e26
cmoveq %rax, %rcx
cmpw $0x10, %r12w
leaq 0x27099(%rip), %rdi     # 0x48e11
cmovneq %rcx, %rdi
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
addl %ebx, %r14d
leaq 0x363f0(%rip), %rbx     # 0x58180
jmp 0x21dfa
leaq 0x22be8(%rip), %rcx     # 0x44981
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x5605
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x21dd8
testb $0x40, %al
je 0x21dc7
leaq 0x2700e(%rip), %rdi     # 0x48dcb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x27065(%rip), %rdi     # 0x48e33
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
testb $0x30, (%rbx)
je 0x21dfa
movq %r15, %rsi
subq 0x18(%rsp), %rsi
addq $-0x3, %rsi
leaq 0x1f2db(%rip), %rdi     # 0x410cb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movl %eax, %ebp
addq 0x30(%rsp), %r15
testb $0x4, 0x2(%rbx)
je 0x21e45
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
leaq -0x1(%r15), %rsi
leaq 0x1f2b9(%rip), %rcx     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq 0x20(%rsp), %rdx
callq 0x5605
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x2033b
movl %ebp, %edi
callq 0x16b56
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq