// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/jp2000.c
// Function: process_jp2
unsigned long
process_jp2(FILE *inptr,unsigned long offset,struct image_summary *summary_entry,
                                    char *parent_name,int indent)
{
    struct jp2box *box;
    unsigned long max_offset = 0L;
    unsigned long lastbox = 0L;
    unsigned long dumplength;

    while(!feof(inptr) && !lastbox)
    {
        box = read_jp2box(inptr,offset);
        if(box)
        {
            /* This routine is currently called only from main(),     */
            /* where the summary_entry will already have been created */

            /* nonetheless...                                         */
            if((summary_entry == NULL) || summary_entry->entry_lock)
                summary_entry = new_summary_entry(summary_entry,0,IMGFMT_JPEG2000);
            switch(box->tbox)
            {
                case JP2_FTYP:
                    max_offset = process_jp2_ftyp(inptr,box,summary_entry,indent);
                    break;
                case JP2_XML:
                    max_offset = process_jp2_xml(inptr,box,indent);
                    break;
                case JP2_JP2I:
                    max_offset = process_jp2_jp2i(inptr,box,indent);
                    break;
                case JP2_JP2H:
                    max_offset = process_jp2_jp2h(inptr,box,summary_entry,indent);
                    break;
                case JP2_UUID:
                    max_offset = process_jp2_uuid(inptr,box,summary_entry,indent);
                    break;
                case JP2_JP2C:
                    if(box->boxlength == 0)
                        ++lastbox;
                    max_offset = process_jp2_jp2c(inptr,box,summary_entry,indent);
                    break;
                case JP2_UINF:
                    max_offset = process_jp2_uinf(inptr,box,summary_entry,indent);
                    break;
                case JP2_PRFL:  /* apparently not in the final spec   */
                default:
                    if((box->boxlength == 0) || ateof(inptr))
                        ++lastbox;
                    if((LIST_MODE))
                        setcharsprinted(list_jp2box(inptr,box,"JP2.",indent,1));
                    else
                        print_jp2box(inptr,box,indent);
                    max_offset = box->boxoffset + box->boxlength;
                    if((PRINT_SECTION))
                    {
                        /* Dump unrecognized boxes.                   */
                        if(Max_undefined > 0)
                        {
                            if(Max_undefined == DUMPALL)
                                dumplength = box->boxlength;
                            else if(Max_undefined > box->boxlength)
                                    dumplength = box->boxlength;
                            else
                                dumplength = Max_undefined;
                        }
                        else
                        {
                            /* Always dump a little of undefined  */
                            /* boxes                              */
                            if(box->boxlength < 48)
                                dumplength = box->boxlength;
                            else
                                dumplength = 48;
                        }

                        (void)newline(0);
                        hexdump(inptr,box->boxoffset,dumplength,dumplength,
                                                            16,indent,SUBINDENT);
                        (void)newline(1);
                    }
                    if((PRINT_SECTION))
                    {
                        (void)newline(0);
                        print_tag_address(SECTION,max_offset - 1,indent,"@");
                        print_jp2type(box->tbox,1);
                    }
                    break;
            }
            (void)newline(0);
            offset = max_offset;
            if(ateof(inptr))
                ++lastbox;
        }
        else
            break;
    }
    return(max_offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3190
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x49(%rbp)
jne 0x2ec5e
cmpq $0x0, -0x40(%rbp)
setne %al
xorb $-0x1, %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x2ec6a
jmp 0x2efee
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2e610
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2efe7
cmpq $0x0, -0x18(%rbp)
je 0x2ec97
movq -0x18(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x2ecab
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0xd0a870a, %edx        # imm = 0xD0A870A
callq 0x15420
movq %rax, -0x18(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
subq $0x66747970, %rax       # imm = 0x66747970
je 0x2ed36
jmp 0x2ecc1
movq -0x58(%rbp), %rax
subq $0x6a703263, %rax       # imm = 0x6A703263
je 0x2edbf
jmp 0x2ecd3
movq -0x58(%rbp), %rax
subq $0x6a703268, %rax       # imm = 0x6A703268
je 0x2ed85
jmp 0x2ece5
movq -0x58(%rbp), %rax
subq $0x6a703269, %rax       # imm = 0x6A703269
je 0x2ed6c
jmp 0x2ecf3
movq -0x58(%rbp), %rax
subq $0x7072666c, %rax       # imm = 0x7072666C
je 0x2ee10
jmp 0x2ed05
movq -0x58(%rbp), %rax
subq $0x75696e66, %rax       # imm = 0x75696E66
je 0x2edf3
jmp 0x2ed17
movq -0x58(%rbp), %rax
subq $0x75756964, %rax       # imm = 0x75756964
je 0x2eda2
jmp 0x2ed25
movq -0x58(%rbp), %rax
subq $0x786d6c20, %rax       # imm = 0x786D6C20
je 0x2ed53
jmp 0x2ee12
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x2f000
movq %rax, -0x38(%rbp)
jmp 0x2efbc
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x24(%rbp), %edx
callq 0x2f3f0
movq %rax, -0x38(%rbp)
jmp 0x2efbc
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x24(%rbp), %edx
callq 0x2f5b0
movq %rax, -0x38(%rbp)
jmp 0x2efbc
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x2f750
movq %rax, -0x38(%rbp)
jmp 0x2efbc
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x2fa40
movq %rax, -0x38(%rbp)
jmp 0x2efbc
movq -0x30(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x2edd6
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x2fe90
movq %rax, -0x38(%rbp)
jmp 0x2efbc
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x2ffb0
movq %rax, -0x38(%rbp)
jmp 0x2efbc
jmp 0x2ee12
movq -0x30(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x2ee2b
movq -0x8(%rbp), %rdi
callq 0x54e0
cmpl $0x0, %eax
je 0x2ee37
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
leaq 0x48342(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
jne 0x2ee73
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x24(%rbp), %ecx
leaq 0x3c5fc(%rip), %rdx     # 0x6b45b
movl $0x1, %r8d
callq 0x2eab0
movl %eax, %edi
callq 0x1ff00
jmp 0x2ee83
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x24(%rbp), %edx
callq 0x2e980
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rcx
addq 0x20(%rcx), %rax
movq %rax, -0x38(%rbp)
leaq 0x482e2(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x2ef6f
leaq 0x49550(%rip), %rax     # 0x78408
cmpq $0x0, (%rax)
jbe 0x2ef11
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
leaq 0x4953e(%rip), %rax     # 0x78408
cmpq %rcx, (%rax)
jne 0x2eedd
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2ef0f
leaq 0x49524(%rip), %rax     # 0x78408
movq (%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jbe 0x2eeff
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2ef0d
leaq 0x49502(%rip), %rax     # 0x78408
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2ef0f
jmp 0x2ef34
movq -0x30(%rbp), %rax
cmpq $0x30, 0x20(%rax)
jae 0x2ef2a
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2ef32
movq $0x30, -0x48(%rbp)
jmp 0x2ef34
xorl %edi, %edi
callq 0x1ef50
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x48(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl -0x24(%rbp), %r9d
movl $0x10, %r8d
movl $0x2, (%rsp)
callq 0x8aa0
movl $0x1, %edi
callq 0x1ef50
leaq 0x4820a(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x2efba
xorl %edi, %edi
callq 0x1ef50
movq -0x38(%rbp), %rsi
subq $0x1, %rsi
movl -0x24(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x35139(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x2e830
jmp 0x2efbc
xorl %edi, %edi
callq 0x1ef50
movq -0x38(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x54e0
cmpl $0x0, %eax
je 0x2efe5
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2efe9
jmp 0x2efee
jmp 0x2ec3c
movq -0x38(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)