// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/jp2000.c
// Function: process_jpc_qcd
unsigned long
process_jpc_qcd(FILE *inptr,unsigned long marker_offset,unsigned short tag,
                                    struct image_summary *summary_entry,
                                    int indent)
{
    unsigned long max_offset;
    unsigned short seg_length;
    unsigned short qstyle;
    unsigned short guardbits;
    unsigned short stepsize,rawstepsize;
    char *name;
    int chpr = 0;
    int i;

    name = jp2000tagname(tag);
    seg_length = read_ushort(inptr,TIFF_MOTOROLA,marker_offset +2 );
    print_tag_address(SECTION|ENTRY,marker_offset,indent,"@");

    if((LIST_MODE))
    {
        if((PRINT_TAGINFO))
        {
            if((PRINT_LONGNAMES))
                chpr += printf("JP2.jp2c.");
            chpr += printf("%s",name);
        }
        if((PRINT_VALUE))
            chpr += printf(" = @%lu:%u",marker_offset,seg_length + 2);
    }
    else
        chpr += printf("<%#x=%s> length %u",tag,name,seg_length);
    max_offset = marker_offset + seg_length + 2;
    marker_offset += 4;

    qstyle = read_ubyte(inptr,marker_offset);
    ++marker_offset;
    chpr = newline(chpr);
    print_tag_address(ENTRY,marker_offset,indent + 8,"=");
    if((PRINT_TAGINFO))
    {
        if((PRINT_LONGNAMES))
            chpr += printf("JP2.jp2c.qcd.");
        chpr += printf("QuantizationStyle");
    }
    if((PRINT_VALUE))
    {
        chpr += printf(" = %#x",qstyle & 0xff);
        chpr += printf(" = ");
        if((qstyle & 0x1f) == 0)
            chpr += printf("no quantization");
        else if((qstyle & 0x1f) == 1)
            chpr += printf("implicit quantization");
        else if((qstyle & 0x1f) == 2)
            chpr += printf("explicit quantization");
        guardbits = (qstyle >> 5) & 0x7;

        chpr += printf(", %u guard bit%s",guardbits,guardbits > 1 ? "s" : "");
    }
    /* Record quantization in the second byte of the summary      */
    /* compression                                                */
    if(summary_entry)
        summary_entry->compression |= (((qstyle & 3) << 8) & 0xff00);
    for(i = 0;marker_offset < (max_offset - 1); ++i)
    {
        chpr = newline(chpr);
        print_tag_address(ENTRY,marker_offset,indent + 8,"=");
        if((qstyle & 0x1f) == 0)
        {
            rawstepsize = read_ubyte(inptr,marker_offset);
            stepsize = rawstepsize >> 3;
            if(stepsize & ~0x1f)
            {
                PUSHCOLOR(RED);
                print_tag_address(ENTRY,marker_offset,indent + SUBINDENT,"@");
                chpr += printf("# WARNING: stepsize exponent %d out of range (%#x => %#x)",
                                                                    i,rawstepsize,stepsize);
                POPCOLOR();
                marker_offset++;
                continue;
                break;
            }
            stepsize <<= 11;
            if((PRINT_TAGINFO))
            {
                if((PRINT_LONGNAMES))
                    chpr += printf("JP2.jp2c.");
                chpr += printf("qcd.Stepsize[%d]",i);
            }
            if((PRINT_VALUE))
                chpr += printf(" = %#x -> %u",rawstepsize,stepsize);
            marker_offset++;
        }
        else
        {
            stepsize = read_ushort(inptr,TIFF_MOTOROLA,marker_offset);
            marker_offset += 2;
            if((PRINT_TAGINFO))
            {
                if((PRINT_LONGNAMES))
                    chpr += printf("JP2.jp2c.qcd.");
                chpr += printf("Stepsize[%d]",i);
            }
            if((PRINT_VALUE))
                chpr += printf(" = %u",stepsize);
        }
    }
    if(!(LIST_MODE))
    {
        chpr = newline(chpr);
        print_tag_address(SECTION|ENTRY,marker_offset - 1,indent,"@");
        chpr += printf("</%#x=%s> ",tag,name);
    }
    if(marker_offset > max_offset)
        printred(" READ PAST END OF BOX");
    chpr = newline(chpr);

    return(max_offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movw %dx, %ax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl $0x0, -0x4c(%rbp)
movzwl -0x12(%rbp), %edi
callq 0x110f0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x2, %rdx
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4480
movw %ax, -0x32(%rbp)
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
movl $0x4043333, %edi        # imm = 0x4043333
leaq 0x2f11c(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x421b4(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
jne 0x3506a
leaq 0x4219a(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x35035
leaq 0x42184(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x3501d
leaq 0x366da(%rip), %rdi     # 0x6b6ea
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rsi
leaq 0x2f06f(%rip), %rdi     # 0x64097
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq 0x42144(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x35068
movq -0x10(%rbp), %rsi
movzwl -0x32(%rbp), %edx
addl $0x2, %edx
leaq 0x366b6(%rip), %rdi     # 0x6b711
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x3508a
movzwl -0x12(%rbp), %esi
movq -0x48(%rbp), %rdx
movzwl -0x32(%rbp), %ecx
leaq 0x3669f(%rip), %rdi     # 0x6b71c
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movzwl -0x32(%rbp), %ecx
addq %rcx, %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4f20
movw %ax, -0x34(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movl -0x4c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
addl $0x8, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x31f6c(%rip), %rcx     # 0x67053
callq 0x5ed0
leaq 0x4208d(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x3513e
leaq 0x42077(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x3512a
leaq 0x36958(%rip), %rdi     # 0x6ba75
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq 0x36952(%rip), %rdi     # 0x6ba83
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq 0x4203b(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3522f
movzwl -0x34(%rbp), %esi
andl $0xff, %esi
leaq 0x3673f(%rip), %rdi     # 0x6b8a6
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq 0x37b9d(%rip), %rdi     # 0x6cd18
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movzwl -0x34(%rbp), %eax
andl $0x1f, %eax
cmpl $0x0, %eax
jne 0x351aa
leaq 0x33266(%rip), %rdi     # 0x68401
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x351f0
movzwl -0x34(%rbp), %eax
andl $0x1f, %eax
cmpl $0x1, %eax
jne 0x351cc
leaq 0x33254(%rip), %rdi     # 0x68411
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x351ee
movzwl -0x34(%rbp), %eax
andl $0x1f, %eax
cmpl $0x2, %eax
jne 0x351ec
leaq 0x33248(%rip), %rdi     # 0x68427
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x351ee
jmp 0x351f0
movzwl -0x34(%rbp), %eax
sarl $0x5, %eax
andl $0x7, %eax
movw %ax, -0x36(%rbp)
movzwl -0x36(%rbp), %esi
movzwl -0x36(%rbp), %ecx
leaq 0x3510d(%rip), %rdx     # 0x6a31a
leaq 0x2ee84(%rip), %rax     # 0x64098
cmpl $0x1, %ecx
cmovgq %rax, %rdx
leaq 0x36873(%rip), %rdi     # 0x6ba95
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x35256
movzwl -0x34(%rbp), %ecx
andl $0x3, %ecx
shll $0x8, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
movq -0x20(%rbp), %rax
orl 0xc8(%rax), %ecx
movl %ecx, 0xc8(%rax)
movl $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x35471
movl -0x4c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
addl $0x8, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x31dc0(%rip), %rcx     # 0x67053
callq 0x5ed0
movzwl -0x34(%rbp), %eax
andl $0x1f, %eax
cmpl $0x0, %eax
jne 0x353bc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4f20
movw %ax, -0x3a(%rbp)
movzwl -0x3a(%rbp), %eax
sarl $0x3, %eax
movw %ax, -0x38(%rbp)
movzwl -0x38(%rbp), %eax
andl $-0x20, %eax
cmpl $0x0, %eax
je 0x3531b
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
addl $0x2, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x2edf6(%rip), %rcx     # 0x640dc
callq 0x5ed0
movl -0x50(%rbp), %esi
movzwl -0x3a(%rbp), %edx
movzwl -0x38(%rbp), %ecx
leaq 0x367a9(%rip), %rdi     # 0x6baa6
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x35463
movzwl -0x38(%rbp), %eax
shll $0xb, %eax
movw %ax, -0x38(%rbp)
leaq 0x41e53(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x3537b
leaq 0x41e3d(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x35364
leaq 0x36393(%rip), %rdi     # 0x6b6ea
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %esi
leaq 0x36772(%rip), %rdi     # 0x6bae0
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq 0x41dfe(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x353ab
movzwl -0x3a(%rbp), %esi
movzwl -0x38(%rbp), %edx
leaq 0x36753(%rip), %rdi     # 0x6baf1
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x35461
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4480
movw %ax, -0x38(%rbp)
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
leaq 0x41d9b(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x35433
leaq 0x41d85(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x3541c
leaq 0x36666(%rip), %rdi     # 0x6ba75
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %esi
leaq 0x366be(%rip), %rdi     # 0x6bae4
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq 0x41d46(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3545f
movzwl -0x38(%rbp), %esi
leaq 0x321da(%rip), %rdi     # 0x6762c
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x35461
jmp 0x35463
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x3525d
leaq 0x41d08(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
je 0x354ca
movl -0x4c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rsi
subq $0x1, %rsi
movl -0x24(%rbp), %edx
movl $0x4043333, %edi        # imm = 0x4043333
leaq 0x2ec33(%rip), %rcx     # 0x640dc
callq 0x5ed0
movzwl -0x12(%rbp), %esi
movq -0x48(%rbp), %rdx
leaq 0x363ae(%rip), %rdi     # 0x6b86b
movb $0x0, %al
callq 0x3110
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x354e0
leaq 0x3639b(%rip), %rdi     # 0x6b876
callq 0x6860
movl -0x4c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x4c(%rbp)
movq -0x30(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop