// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/jp2000.c
// Function: process_jp2_jp2h
unsigned long
process_jp2_jp2h(FILE *inptr,struct jp2box *box,struct image_summary *summary_entry,
                                                        int indent)
{
    unsigned long lastbox = 0L;
    unsigned long boxoffset,max_offset,dataoffset,tbox;
    unsigned long boxlength;
    int chpr = 0;

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

    dataoffset = boxoffset + box->dataoffset;
    max_offset = boxoffset + boxlength;


    while(!feof(inptr) && !lastbox && (dataoffset < max_offset))
    {
        box = read_jp2box(inptr,dataoffset);
        if(box)
        {
            switch(box->tbox)
            {
                case JP2_ihdr:
                    dataoffset = process_jp2_ihdr(inptr,box,summary_entry,indent + SUBINDENT);
                    break;
                case JP2_colr:
                    dataoffset = process_jp2_colr(inptr,box,indent + SUBINDENT);
                    break;
                case JP2_res:
                    dataoffset = process_jp2_res(inptr,box,indent + SUBINDENT);
                    break;
                case JP2_bpcc:
                case JP2_pclr:
                case JP2_cdef:
                case JP2_resc:  /* handled in process_jp2_res().  */
                case JP2_resd:  /* handled in process_jp2_res().  */
                    /* These fields are reported but not expanded */
                    print_jp2box(inptr,box,indent + SUBINDENT);
                    if(boxlength)
                        dataoffset += boxlength;
                    else
                        ++lastbox;
                    chpr = newline(chpr);
                    break;
                default:
                    /* report the unknown box and try to continue. If */
                    /* the box is properly constructed, that may be   */
                    /* possible; most likely this is garbled data.    */
                    print_jp2box(inptr,box,indent + SUBINDENT);
                    if(ferror(inptr) || feof(inptr))
                    {
                        clearerr(inptr);
                        ++lastbox;
                    }
                    if(boxlength)
                        dataoffset += boxlength;
                    else
                        ++lastbox;
                    chpr = newline(chpr);
                    break;
            }
        }
    }
    if((PRINT_SECTION))
    {
        chpr = newline(chpr);
        print_tag_address(SECTION,dataoffset - 1,indent,"@");
        print_jp2type(tbox,1);
    }
    chpr = newline(chpr);
    return(max_offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x54(%rbp)
leaq 0x47a03(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
jne 0x2f7ae
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %ecx
leaq 0x3bcbd(%rip), %rdx     # 0x6b45b
movl $0x1, %r8d
callq 0x2eab0
movl %eax, -0x54(%rbp)
jmp 0x2f7be
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x2e980
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
addq 0x10(%rcx), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3190
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x55(%rbp)
jne 0x2f82d
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x55(%rbp)
jne 0x2f82d
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
setb %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x2f839
jmp 0x2f9de
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x2e610
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2f9d9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
subq $0x62706363, %rax       # imm = 0x62706363
je 0x2f926
jmp 0x2f86f
movq -0x60(%rbp), %rax
subq $0x63646566, %rax       # imm = 0x63646566
je 0x2f926
jmp 0x2f881
movq -0x60(%rbp), %rax
subq $0x636f6c72, %rax       # imm = 0x636F6C72
je 0x2f8ee
jmp 0x2f88f
movq -0x60(%rbp), %rax
subq $0x69686472, %rax       # imm = 0x69686472
je 0x2f8ce
jmp 0x2f89d
movq -0x60(%rbp), %rax
subq $0x70636c72, %rax       # imm = 0x70636C72
je 0x2f926
jmp 0x2f8ab
movq -0x60(%rbp), %rax
subq $0x72657320, %rax       # imm = 0x72657320
je 0x2f90a
jmp 0x2f8b9
movq -0x60(%rbp), %rax
addq $-0x72657363, %rax      # imm = 0x8D9A8C9D
subq $0x2, %rax
jb 0x2f926
jmp 0x2f967
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
addl $0x2, %ecx
callq 0x301a0
movq %rax, -0x40(%rbp)
jmp 0x2f9d7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x2, %edx
callq 0x308c0
movq %rax, -0x40(%rbp)
jmp 0x2f9d7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x2, %edx
callq 0x30e10
movq %rax, -0x40(%rbp)
jmp 0x2f9d7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x2, %edx
callq 0x2e980
cmpq $0x0, -0x50(%rbp)
je 0x2f94e
movq -0x50(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x2f95a
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x54(%rbp), %edi
callq 0x1ef50
movl %eax, -0x54(%rbp)
jmp 0x2f9d7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x2, %edx
callq 0x2e980
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x2f996
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x2f9ab
movq -0x8(%rbp), %rdi
callq 0x31a0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x2f9c0
movq -0x50(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x2f9cc
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x54(%rbp), %edi
callq 0x1ef50
movl %eax, -0x54(%rbp)
jmp 0x2f9d9
jmp 0x2f7fe
leaq 0x4779b(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x2fa29
movl -0x54(%rbp), %edi
callq 0x1ef50
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rsi
subq $0x1, %rsi
movl -0x1c(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x346c6(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x2e830
movl -0x54(%rbp), %edi
callq 0x1ef50
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop