// File: /workspace/github_c_makefile_star2_O2/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 0x36448(%rip), %rax     # 0x57180
movzwl 0x2(%rax), %eax
testw $0x104, %ax             # imm = 0x104
je 0x20d55
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x1f71d
xorl %r14d, %r14d
jmp 0x20d71
leaq 0x25f69(%rip), %rdx     # 0x46cc5
pushq $0x1
popq %r8
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
callq 0x1f7e6
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 0x48de
movw %ax, 0xe(%rsp)
movq %r15, 0x20(%rsp)
leal 0x8(%r15), %ebp
leaq 0x21bcc(%rip), %rcx     # 0x42981
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x5100
leaq 0x363b5(%rip), %rbx     # 0x57180
movq (%rbx), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x20dfd
testb $0x40, %al
je 0x20de9
leaq 0x25fdc(%rip), %rdi     # 0x46dbb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x2667f(%rip), %rdi     # 0x4746f
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x20e17
movzwl 0xe(%rsp), %esi
leaq 0x2214d(%rip), %rdi     # 0x42f5a
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %r14d
leaq 0x1(%r13), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x48de
movl %eax, %r15d
leaq 0x21b46(%rip), %rcx     # 0x42981
movl $0x4003333, %edi        # imm = 0x4003333
movq %rbx, %rsi
movl %ebp, %edx
callq 0x5100
leaq 0x3632f(%rip), %rbx     # 0x57180
movq (%rbx), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x20e83
testb $0x40, %al
je 0x20e6f
leaq 0x25f56(%rip), %rdi     # 0x46dbb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x25f54(%rip), %rdi     # 0x46dca
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x20e9c
movzwl %r15w, %esi
leaq 0x220c8(%rip), %rdi     # 0x42f5a
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %r14d
leaq 0x2(%r13), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x48de
movl %eax, %r15d
leaq 0x21ac1(%rip), %rcx     # 0x42981
movl $0x4003333, %edi        # imm = 0x4003333
movq %rbx, %rsi
movl %ebp, %edx
callq 0x5100
leaq 0x362aa(%rip), %rbx     # 0x57180
movq (%rbx), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x20f08
testb $0x40, %al
je 0x20ef4
leaq 0x25ed1(%rip), %rdi     # 0x46dbb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x25eda(%rip), %rdi     # 0x46dd5
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x20f21
movzwl %r15w, %esi
leaq 0x22043(%rip), %rdi     # 0x42f5a
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq 0x10(%rsp), %r15
movl %r14d, %edi
callq 0x160f7
movl %eax, %r14d
addq $0x3, %r13
cmpw $0x1, 0xe(%rsp)
jne 0x20ff8
movq %r12, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq %r13, %rdx
callq 0x42ba
movq %rax, %r12
leaq 0x21a26(%rip), %rcx     # 0x42981
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x5100
movq (%rbx), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x20f9c
testb $0x40, %al
je 0x20f88
leaq 0x25e3d(%rip), %rdi     # 0x46dbb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x25e5d(%rip), %rdi     # 0x46dec
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x21061
movzwl %r12w, %esi
leaq 0x21fab(%rip), %rdi     # 0x42f5a
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r14d, %ebx
cmpw $0x11, %r12w
leaq 0x25e42(%rip), %rax     # 0x46e09
leaq 0x25e48(%rip), %rcx     # 0x46e16
cmoveq %rax, %rcx
cmpw $0x10, %r12w
leaq 0x25e23(%rip), %rdi     # 0x46e01
cmovneq %rcx, %rdi
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
addl %ebx, %r14d
leaq 0x3618a(%rip), %rbx     # 0x57180
jmp 0x21061
leaq 0x21982(%rip), %rcx     # 0x42981
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, %rsi
movl %ebp, %edx
callq 0x5100
movq (%rbx), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x21040
testb $0x40, %al
je 0x2102c
leaq 0x25d99(%rip), %rdi     # 0x46dbb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x25df0(%rip), %rdi     # 0x46e23
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%rbx), %rax
testb $0x30, %al
je 0x21061
movq %r15, %rsi
subq 0x18(%rsp), %rsi
addq $-0x3, %rsi
leaq 0x1e074(%rip), %rdi     # 0x3f0cb
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %ebp
addq 0x30(%rsp), %r15
testb $0x4, 0x2(%rbx)
je 0x210aa
movl %ebp, %edi
callq 0x160f7
movl %eax, %ebp
leaq -0x1(%r15), %rsi
leaq 0x1e052(%rip), %rcx     # 0x3f0dc
movl $0x40000, %edi          # imm = 0x40000
movq 0x20(%rsp), %rdx
callq 0x5100
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
pushq $0x1
popq %rsi
callq 0x1f649
movl %ebp, %edi
callq 0x160f7
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq