// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/jp2000.c
// Function: process_jp2_ftyp
unsigned long
process_jp2_ftyp(FILE *inptr,struct jp2box *box,struct image_summary *summary_entry,
                                                        int indent)
{
    unsigned long boxoffset,max_offset,dataoffset;
    unsigned long boxlength;
    unsigned long mjv,mnv,cl,ncl;
    int compat = 0;
    int chpr = 0;
    int i;

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

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

        
    mjv = read_ulong(inptr,TIFF_MOTOROLA,dataoffset);
    dataoffset += 4;
    print_tag_address(ENTRY,dataoffset,indent + 8,"=");
    if((PRINT_TAGINFO))
    {
        if((PRINT_LONGNAMES))
            chpr += printf("JP2.ftyp.");
        chpr += printf("MajorVersion");
    }
    if((PRINT_VALUE))
    {
        chpr += printf(" = %#-10lx = ",mjv);
        print_jp2type(mjv,0);
        if(mjv != JP2_BR)
            printred( " (INVALID MAJOR VERSION");
    }
    chpr = newline(chpr);
    print_tag_address(ENTRY,dataoffset,indent + 8,"=");
    mnv = read_ulong(inptr,TIFF_MOTOROLA,dataoffset); 
    dataoffset += 4;
    if((PRINT_TAGINFO))
    {
        if((PRINT_LONGNAMES))
            chpr += printf("JP2.ftyp.");
        chpr += printf("MinorVersion");
    }
    if((PRINT_VALUE))
    {
        chpr += printf(" = %#-10lx = ",mnv);
        print_jp2type(mnv,0);
    }
    chpr = newline(chpr);
    ncl = box->boxlength - box->dataoffset - 8;
    ncl /= 4;
    for(i = 0; i < ncl; ++i)
    {
        print_tag_address(ENTRY,dataoffset,indent + 8,"=");
        cl = read_ulong(inptr,TIFF_MOTOROLA,dataoffset); 
        dataoffset += 4;
        if((PRINT_TAGINFO))
        {
            if((PRINT_LONGNAMES))
                chpr += printf("JP2.ftyp.");
            chpr += printf("Compat");
        }
        if((PRINT_VALUE))
        {
            chpr += printf(" = %#-10lx = ",cl);
            print_jp2type(cl,0);
        }
        chpr =  newline(chpr);
        if(cl == JP2_BR)
            compat++;
    }
    if((PRINT_SECTION))
    {
        chpr = newline(chpr);
        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 $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
leaq 0x48154(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1040000, %rax        # imm = 0x1040000
cmpq $0x0, %rax
jne 0x2f05d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %ecx
leaq 0x3c40e(%rip), %rdx     # 0x6b45b
movl $0x1, %r8d
callq 0x2eab0
movl %eax, -0x68(%rbp)
jmp 0x2f06d
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), %rdx
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4610
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x8, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x37f7a(%rip), %rcx     # 0x67053
callq 0x5ed0
leaq 0x4809b(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x2f130
leaq 0x48085(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x2f11c
leaq 0x3c351(%rip), %rdi     # 0x6b460
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq 0x3c347(%rip), %rdi     # 0x6b46a
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq 0x48049(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x2f17f
movq -0x48(%rbp), %rsi
leaq 0x3c328(%rip), %rdi     # 0x6b477
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x2e830
cmpq $0x6a703220, -0x48(%rbp) # imm = 0x6A703220
je 0x2f17d
leaq 0x3c30d(%rip), %rdi     # 0x6b485
callq 0x6860
jmp 0x2f17f
movl -0x68(%rbp), %edi
callq 0x1ef50
movl %eax, -0x68(%rbp)
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x8, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x37eb3(%rip), %rcx     # 0x67053
callq 0x5ed0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4610
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
leaq 0x47fb2(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x2f219
leaq 0x47f9c(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x2f205
leaq 0x3c268(%rip), %rdi     # 0x6b460
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq 0x3c291(%rip), %rdi     # 0x6b49d
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq 0x47f60(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x2f250
movq -0x50(%rbp), %rsi
leaq 0x3c23f(%rip), %rdi     # 0x6b477
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x2e830
movl -0x68(%rbp), %edi
callq 0x1ef50
movl %eax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
subq 0x10(%rcx), %rax
subq $0x8, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shrq $0x2, %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x6c(%rbp)
movslq -0x6c(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x2f388
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x8, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x37da9(%rip), %rcx     # 0x67053
callq 0x5ed0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4610
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
leaq 0x47ea8(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x2f323
leaq 0x47e92(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x2f30f
leaq 0x3c15e(%rip), %rdi     # 0x6b460
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq 0x3c194(%rip), %rdi     # 0x6b4aa
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq 0x47e56(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x2f35a
movq -0x58(%rbp), %rsi
leaq 0x3c135(%rip), %rdi     # 0x6b477
movb $0x0, %al
callq 0x3110
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x2e830
movl -0x68(%rbp), %edi
callq 0x1ef50
movl %eax, -0x68(%rbp)
cmpq $0x6a703220, -0x58(%rbp) # imm = 0x6A703220
jne 0x2f378
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2f37a
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x2f286
leaq 0x47df1(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x2f3d7
movl -0x68(%rbp), %edi
callq 0x1ef50
movl %eax, -0x68(%rbp)
movq -0x38(%rbp), %rsi
subq $0x1, %rsi
movl -0x1c(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x34d1c(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x2e830
movl -0x68(%rbp), %edi
callq 0x1ef50
movl %eax, -0x68(%rbp)
movq -0x30(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)