// File: /workspace/github_c_makefile_star2_O3/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 0x360e0(%rip), %rax     # 0x58180
movzwl 0x2(%rax), %eax
testl $0x104, %eax            # imm = 0x104
je 0x220be
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x209e0
xorl %r14d, %r14d
jmp 0x220dc
leaq 0x26c50(%rip), %rdx     # 0x48d15
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
movl $0x1, %r8d
callq 0x20aa9
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 0x4d48
movw %ax, 0xe(%rsp)
movq %r15, 0x20(%rsp)
leal 0x8(%r15), %ebp
leaq 0x228a5(%rip), %rcx     # 0x449c5
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x55eb
leaq 0x3604a(%rip), %rbx     # 0x58180
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x22169
testb $0x40, %al
je 0x22155
leaq 0x26cc0(%rip), %rdi     # 0x48e0b
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x27363(%rip), %rdi     # 0x494bf
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x22183
movzwl 0xe(%rsp), %esi
leaq 0x22e25(%rip), %rdi     # 0x44f9e
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, %r14d
leaq 0x1(%r13), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4d48
movl %eax, %r15d
leaq 0x2281e(%rip), %rcx     # 0x449c5
movl $0x4003333, %edi        # imm = 0x4003333
movq %rbx, %rsi
movl %ebp, %edx
callq 0x55eb
leaq 0x35fc3(%rip), %rbx     # 0x58180
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x221f0
testb $0x40, %al
je 0x221dc
leaq 0x26c39(%rip), %rdi     # 0x48e0b
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x26c37(%rip), %rdi     # 0x48e1a
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x22209
movzwl %r15w, %esi
leaq 0x22d9f(%rip), %rdi     # 0x44f9e
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, %r14d
leaq 0x2(%r13), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4d48
movl %eax, %r15d
leaq 0x22798(%rip), %rcx     # 0x449c5
movl $0x4003333, %edi        # imm = 0x4003333
movq %rbx, %rsi
movl %ebp, %edx
callq 0x55eb
leaq 0x35f3d(%rip), %rbx     # 0x58180
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x22276
testb $0x40, %al
je 0x22262
leaq 0x26bb3(%rip), %rdi     # 0x48e0b
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x26bbc(%rip), %rdi     # 0x48e25
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x2228f
movzwl %r15w, %esi
leaq 0x22d19(%rip), %rdi     # 0x44f9e
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq 0x10(%rsp), %r15
movl %r14d, %edi
callq 0x1707a
movl %eax, %r14d
addq $0x3, %r13
cmpw $0x1, 0xe(%rsp)
jne 0x22367
movq %r12, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq %r13, %rdx
callq 0x4707
movq %rax, %r12
leaq 0x226fc(%rip), %rcx     # 0x449c5
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x55eb
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x2230b
testb $0x40, %al
je 0x222f7
leaq 0x26b1e(%rip), %rdi     # 0x48e0b
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x26b3e(%rip), %rdi     # 0x48e3c
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x223d1
movzwl %r12w, %esi
leaq 0x22c80(%rip), %rdi     # 0x44f9e
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r14d, %ebx
cmpw $0x11, %r12w
leaq 0x26b23(%rip), %rax     # 0x48e59
leaq 0x26b29(%rip), %rcx     # 0x48e66
cmoveq %rax, %rcx
cmpw $0x10, %r12w
leaq 0x26b04(%rip), %rdi     # 0x48e51
cmovneq %rcx, %rdi
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
addl %ebx, %r14d
leaq 0x35e1b(%rip), %rbx     # 0x58180
jmp 0x223d1
leaq 0x22657(%rip), %rcx     # 0x449c5
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x55eb
movq (%rbx), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x223b0
testb $0x40, %al
je 0x2239c
leaq 0x26a79(%rip), %rdi     # 0x48e0b
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x26ad0(%rip), %rdi     # 0x48e73
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x223d1
movq %r15, %rsi
subq 0x18(%rsp), %rsi
addq $-0x3, %rsi
leaq 0x1ed04(%rip), %rdi     # 0x410cb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, %ebp
addq 0x30(%rsp), %r15
testb $0x4, 0x2(%rbx)
je 0x2241c
movl %ebp, %edi
callq 0x1707a
movl %eax, %ebp
leaq -0x1(%r15), %rsi
leaq 0x1ece2(%rip), %rcx     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq 0x20(%rsp), %rdx
callq 0x55eb
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x208ff
movl %ebp, %edi
callq 0x1707a
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq