// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/jp2000.c
// Function: process_jp2_uuid
unsigned long
process_jp2_uuid(FILE *inptr,struct jp2box *box,struct image_summary *summary_entry,
                                                        int indent)
{
    unsigned long boxoffset,max_offset,dataoffset;
    unsigned long boxlength,dumplength;
    unsigned long ifd_offset = 0UL;
    unsigned short idbyte,byte;
    struct fileheader *header = NULL;
    int chpr = 0;
    int i;

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

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

    idbyte = byte = read_ubyte(inptr,dataoffset);
    print_tag_address(SECTION,dataoffset,indent + 4,"*");
    if((LIST_MODE))
    {
        if((PRINT_VALUE))
            chpr += printf(" # ID: ");
    }
    else
        chpr += printf("ID: ");
    if(!(LIST_MODE) || (PRINT_VALUE))
    {
        if(!feof(inptr) && !ferror(inptr))
        {
            chpr += printf("%02x",(unsigned int)byte & 0xff);
            for(i = 1; i < 16; ++i)
            {
                byte = read_ubyte(inptr,HERE);
                if(feof(inptr) || ferror(inptr))
                    break;
                chpr += printf(",%02x",(unsigned int)byte & 0xff);
            }
            chpr = newline(chpr);
        }
    }
    dataoffset += 16;

    /* No idea what the 16 "ID" bytes mean, or how to track           */
    /* registered types through the OID register. For now, a leading  */
    /* byte of 0x5 seems to signal a TIFF IFD. Dump a little bit of   */
    /* anything else. Probably need to check more of the ID...        */

    /* ...ok, now I've seen *two* ids that introduce TIFF sections... */
    if((idbyte != 5) && (idbyte != 0xb1))
    {
        if((PRINT_SECTION))
        {
            dumplength = max_offset - dataoffset;
            if(dumplength > 48)
                dumplength = 48;
            chpr = newline(chpr);
            hexdump(inptr,dataoffset,dumplength,dumplength,16,indent,SUBINDENT);
            chpr = newline(1);
        }
    }

    /* So far I've seen these with recognizable "magic"               */
    /* 96,a9,f1,f1,... MSIG - ??? what is this?                       */
    /* 2c,4c,01,00,... 8BIM Adobe PhotoShop - should handle this...   */
    /* 05,37,cd,ab,... TIFF - this we can do...                       */
    /* b1,4b,f8,bd.... also TIFF                                      */
    header = read_imageheader(inptr,dataoffset);
    if(header && (header->probe_magic == PROBE_TIFFMAGIC))
    {
        if((PRINT_SECTION))
        {
            chpr = newline(chpr);
            print_tag_address(SECTION,dataoffset,indent + 4,"@");
            print_header(header,SECTION);
            ifd_offset = read_ulong(inptr,header->file_marker,HERE); 
            chpr += printf(" ifd offset = %#lx/%lu",ifd_offset,ifd_offset);
            chpr += printf(" (+ %lu = %#lx/%lu)",dataoffset,
                                                    dataoffset + ifd_offset,
                                                    dataoffset + ifd_offset);
            chpr = newline(0);
        }
        dataoffset = process_tiff_ifd(inptr,header->file_marker,
                            8,dataoffset,max_offset,summary_entry,"JP2.uuid",
                            TIFF_IFD,0,-1,indent + 4);
    }
    dataoffset = boxoffset + boxlength;

    if((PRINT_SECTION))
    {
        chpr = newline(0);
        print_tag_address(SECTION,dataoffset - 1,indent,"@");
        print_jp2type(box->tbox,1);
        chpr = newline(chpr);
    }
    return(max_offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
leaq 0x47708(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
jne 0x2faa6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %ecx
leaq 0x3b9c2(%rip), %rdx     # 0x6b45b
xorl %r8d, %r8d
callq 0x2eab0
movl %eax, -0x64(%rbp)
jmp 0x2fab6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x2e980
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
addq 0x10(%rcx), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x4f20
movw %ax, -0x54(%rbp)
movw %ax, -0x52(%rbp)
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x4, %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x34e0f(%rip), %rcx     # 0x64924
callq 0x5ed0
leaq 0x4765f(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
jne 0x2fb5a
leaq 0x47649(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x2fb58
leaq 0x3b9d9(%rip), %rdi     # 0x6b524
movb $0x0, %al
callq 0x3110
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x2fb6e
leaq 0x3b9c6(%rip), %rdi     # 0x6b527
movb $0x0, %al
callq 0x3110
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
leaq 0x4760b(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
jne 0x2fb9c
leaq 0x475f5(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x2fc51
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x2fc4f
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x2fc4f
movzwl -0x54(%rbp), %esi
andl $0xff, %esi
leaq 0x34b35(%rip), %rdi     # 0x64706
movb $0x0, %al
callq 0x3110
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl $0x1, -0x68(%rbp)
cmpl $0x10, -0x68(%rbp)
jge 0x2fc44
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x4f20
movw %ax, -0x54(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x2fc19
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x2fc1b
jmp 0x2fc44
movzwl -0x54(%rbp), %esi
andl $0xff, %esi
leaq 0x34ad9(%rip), %rdi     # 0x64705
movb $0x0, %al
callq 0x3110
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x2fbe5
movl -0x64(%rbp), %edi
callq 0x1ef50
movl %eax, -0x64(%rbp)
jmp 0x2fc51
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movzwl -0x52(%rbp), %eax
cmpl $0x5, %eax
je 0x2fce2
movzwl -0x52(%rbp), %eax
cmpl $0xb1, %eax
je 0x2fce2
leaq 0x47508(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x2fce0
movq -0x30(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x30, -0x48(%rbp)
jbe 0x2fca2
movq $0x30, -0x48(%rbp)
movl -0x64(%rbp), %edi
callq 0x1ef50
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl -0x1c(%rbp), %r9d
movl $0x10, %r8d
movl $0x2, (%rsp)
callq 0x8aa0
movl $0x1, %edi
callq 0x1ef50
movl %eax, -0x64(%rbp)
jmp 0x2fce2
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3f70
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x2fe1a
movq -0x60(%rbp), %rax
cmpq $0x2a, 0x8(%rax)
jne 0x2fe1a
leaq 0x4746c(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x2fdc2
movl -0x64(%rbp), %edi
callq 0x1ef50
movl %eax, -0x64(%rbp)
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x4, %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x34394(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq -0x60(%rbp), %rdi
movl $0x40000, %esi          # imm = 0x40000
callq 0x55c0
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl (%rax), %esi
callq 0x4610
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq 0x3435b(%rip), %rdi     # 0x640de
movb $0x0, %al
callq 0x3110
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x38(%rbp), %rsi
movq -0x38(%rbp), %rdx
addq -0x50(%rbp), %rdx
movq -0x38(%rbp), %rcx
addq -0x50(%rbp), %rcx
leaq 0x37baa(%rip), %rdi     # 0x67955
movb $0x0, %al
callq 0x3110
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
xorl %edi, %edi
callq 0x1ef50
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rax
movw (%rax), %si
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x18(%rbp), %r9
movl -0x1c(%rbp), %eax
addl $0x4, %eax
movl $0x8, %edx
leaq 0x3b741(%rip), %r10     # 0x6b52c
xorl %r11d, %r11d
movzwl %si, %esi
movq %r10, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
movl %eax, 0x20(%rsp)
callq 0x112e0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq 0x47353(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x2fe7f
xorl %edi, %edi
callq 0x1ef50
movl %eax, -0x64(%rbp)
movq -0x38(%rbp), %rsi
subq $0x1, %rsi
movl -0x1c(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x3427f(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x2e830
movl -0x64(%rbp), %edi
callq 0x1ef50
movl %eax, -0x64(%rbp)
movq -0x30(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)