// File: /workspace/github_c_makefile_star2_O2/hfiguiere[P]exifprobe/misc.c
// Function: scan_summary
int
scan_summary(struct image_summary *summary_entry)
{
    struct image_summary *next_entry = NULL;
    struct image_summary *prev_entry = NULL;
    unsigned long long image_size = 0ULL;
    unsigned long long max_image_size = 0ULL;
    unsigned long marked_primary_image_length = 0ULL;
    unsigned long long marked_primary_image_size = 0ULL;
    unsigned long long primary_image_size = 0ULL;
    unsigned long long next_primary_size = 0ULL;
    unsigned long max_image_width = 0UL;
    unsigned long max_image_height = 0UL;
    unsigned long max_image_length = 0UL;
    unsigned long image_length = 0UL;
    int primary_found = 0;
    int number_of_images = 0;

    if(Debug & 0x4)
        (void)newline(1);

    /* The passed entry should be the head; scan forward merging data */
    while(summary_entry/*  && next_entry */)
    {
        if(summary_entry->entry_lock <= 0)
        {
            summary_entry = summary_entry->next_entry;
            continue;
        }
        if(summary_entry)
            next_entry = summary_entry->next_entry;
        if(Debug & 0x4)
        {
            printred("DEBUG:");
            printf(" %d: ffm=%#x, fsf=%#x",summary_entry->entry_lock,
                    summary_entry->fileformat,summary_entry->filesubformat);
            printf(", spp=%d, bps[0]=%d",summary_entry->spp,summary_entry->bps[0]);
        }

        /* 'image_size' in pixels                                     */
        image_size = summary_entry->pixel_width * summary_entry->pixel_height;

        /* image_length vs summary length: compressed? how much?      */
        /* ###%%% this is "experimental" and shows up only in Debug   */
        if(summary_entry->bps[0] && summary_entry->spp)
        {
            int i;
            int spp = summary_entry->spp;
            float total_bits,bytes_per_pixel;

            total_bits = 0;
            if (spp > MAXSAMPLE)
            {
                spp = MAXSAMPLE;
                if(Debug & 0x4)
                {
                    printf("CLAMPING spp\n");
                }
            }
            for(i = 0; i < spp; ++i)
                total_bits += summary_entry->bps[i];
            bytes_per_pixel = total_bits / 8.0;
            if(Debug & 0x4)
                printf(", bytesperpixel=%.1f",bytes_per_pixel);
            image_length = image_size * bytes_per_pixel;
            summary_entry->compress_percent = (float)summary_entry->length / (float)image_length;
            summary_entry->compress_percent *= 100.0;
        }
        if(Debug & 0x4)
            printf(" c=%lu/%lu=%.0f%%\n",summary_entry->length,image_length,
                                            summary_entry->compress_percent);

        if(summary_entry->subfiletype == PRIMARY_TYPE)
        {
            ++primary_found;    /* marked in a TIFF/EP IFD            */
            marked_primary_image_size = image_size;
            marked_primary_image_length = summary_entry->length;
            if(summary_entry->primary_height == 0UL)
                summary_entry->primary_height = summary_entry->pixel_height;
            if(summary_entry->primary_width == 0UL)
                summary_entry->primary_width = summary_entry->pixel_width;
            
        }
        /* maintain max values independently of primary               */
        if(image_size > max_image_size)
        {
            max_image_height = summary_entry->pixel_height;
            max_image_width = summary_entry->pixel_width;
            max_image_size = image_size;
        }

        /* The largest chunk of image data; could be very important   */
        if(summary_entry->length > max_image_length)
            max_image_length = summary_entry->length;

        /* If a primary size was found, e.g. in an exif ifd, carry    */
        /* it forward. If more than one was found, keep the largest.  */
        /* Then carry it back down to the head in the backward loop.  */
        /* Should wind up with all entries the same (and possibly     */
        /* zero).                                                     */
        if(summary_entry->primary_height || summary_entry->primary_width)
        {
            primary_image_size = summary_entry->primary_width * summary_entry->primary_height;
            if(next_entry && (next_entry->primary_height || next_entry->primary_width))
            {
                next_primary_size = next_entry->primary_width * next_entry->primary_height;
                if(next_primary_size > primary_image_size)
                {
                    summary_entry->primary_width = next_entry->primary_width;
                    summary_entry->primary_height = next_entry->primary_height;
                    primary_image_size = next_primary_size;
                }
                else
                {
                    next_entry->primary_width = summary_entry->primary_width;
                    next_entry->primary_height = summary_entry->primary_height;
                }
            }
            else if(next_entry)
            {
                next_entry->primary_width = summary_entry->primary_width;
                next_entry->primary_height = summary_entry->primary_height;
            }
        }
        /* In JPEG format files, it's almost certain that the primary */
        /* begins at the beginning of the file; "almost" only because */
        /* I've seen some strange things...                           */
        if((summary_entry->fileformat == FILEFMT_JPEG) &&
                            (summary_entry->subfiletype == UNKNOWN_TYPE))
        {
            if(summary_entry->offset == 0)
                summary_entry->subfiletype = POSSIBLE_PRIMARY_TYPE;
        }
        
        prev_entry = summary_entry;
        summary_entry = next_entry;
    }
    summary_entry = prev_entry;
    if((Debug & 0x4) && summary_entry)
    {
        printred("DEBUG:");
        printf(" Exif   Primary=%lux%lu = %llu\n",summary_entry->primary_width,summary_entry->primary_height,primary_image_size);
        printred("DEBUG:");
        printf("        Maxsize=%lux%lu = %llu\n",max_image_width,max_image_height,max_image_size);
        printred("DEBUG:");
        printf(" Marked Primary size = %llu",marked_primary_image_size);
        printf(" Marked Primary length=%lu, max length = %lu\n",marked_primary_image_length,max_image_length);
    }

    /* now walk back to the head                                      */
    /* If a marked primary has been found, the primary job is to mark */
    /* reduced resolution images which haven't been defined as        */
    /* thumbnails in the main code. If no marked primary, it is also  */
    /* necessary to deduce the identity of the primary image, using   */
    /* size, length and/or image and compression type.                */

    /* ###%%% at this point, after all the futzing around with        */
    /* primary_width, etc., it never gets used. max_* are used        */
    /* (and primary_image_size may not have been set if the last      */
    /* entry contained the values)                                    */

    if(summary_entry)
        prev_entry = summary_entry->prev_entry;
    while(summary_entry)
    {
        if(Debug & 0x4)
        {
            printred("DEBUG:");
            printf(" #%d se=%#-9x, pe=%#-9x",summary_entry->entry_lock,
                    (unsigned int)summary_entry,(unsigned int)prev_entry);
        }
        image_size = summary_entry->pixel_width * summary_entry->pixel_height;
        image_length = summary_entry->length;
        if(summary_entry->entry_lock <= 0)
        {
            summary_entry = prev_entry;
            if(summary_entry)
                prev_entry = summary_entry->prev_entry;
            continue;
        }
        if(Debug & 0x4)
        {
            printf(" ffm=%#x, fsf=%#-3x",summary_entry->fileformat,summary_entry->filesubformat);
            printf(", ifm=%#lx, isf=%#lx",summary_entry->imageformat,summary_entry->imagesubformat);
            printf(", offs=%lu, len=%lu",summary_entry->offset,summary_entry->length);
            printf(", pw=%lu, ph=%lu",summary_entry->pixel_width,summary_entry->pixel_height);
        }
        if(prev_entry && (prev_entry->subfiletype != PRIMARY_TYPE))
        {
            /* The primary size was carried up to the last entry in   */
            /* the forward scan; now copy it back down.               */
            /* ###%%% is this used?   ...no, never                    */
            prev_entry->primary_width = summary_entry->primary_width;
            prev_entry->primary_height = summary_entry->primary_height;
        }
        if(Debug & 0x4)
            printf(" sft=%d\n",summary_entry->subfiletype);
        if(primary_found >= 1)  /* should never be greater than 1     */
        {
            if(summary_entry->subfiletype == POSSIBLE_PRIMARY_TYPE)
                summary_entry->subfiletype = REDUCED_RES_TYPE;
        }
        else if(primary_found == 0)
        {
            if(summary_entry->subfiletype == POSSIBLE_PRIMARY_TYPE)
            {
                if((summary_entry->fileformat == FILEFMT_TIFF) ||
                    (summary_entry->fileformat == FILEFMT_ORF1) ||
                        (summary_entry->fileformat == FILEFMT_ORF2))
                {
                    switch(summary_entry->compression)
                    {
                        case 1:
                        case 34712:     /* JPEG 2000 */
                        case 34713:     /* NEF compressed */
                        case JPEG_SOF_3:
                        case JPEG_SOF_7:
                        case JPEG_SOF_11:
                        case JPEG_SOF_15:
                            if(image_size >= max_image_size)
                            {
                                summary_entry->subfiletype = PRIMARY_TYPE;
                                ++primary_found;
                            }
                            break;
                        default:
                            if((image_size < max_image_size) || (image_length < max_image_length))
                                summary_entry->subfiletype = REDUCED_RES_TYPE;
                            break;
                    }
                }
                else if(summary_entry->fileformat == FILEFMT_JP2)
                {
                        summary_entry->subfiletype = PRIMARY_TYPE;
                        ++primary_found;
                }
                else if(summary_entry->fileformat == FILEFMT_JPEG)
                {
                    if(summary_entry->offset == 0)
                    {
                        summary_entry->subfiletype = PRIMARY_TYPE;
                        ++primary_found;
                    }
                    else if(summary_entry->filesubformat & (FILESUBFMT_TIFF|FILESUBFMT_TIFFEP))
                    {
                        switch(summary_entry->compression)
                        {
                            case JPEG_SOF_3:
                            case JPEG_SOF_7:
                            case JPEG_SOF_11:
                            case JPEG_SOF_15:
                                /* lossless compression               */
                                if(image_size >= max_image_size)
                                {
                                    summary_entry->subfiletype = PRIMARY_TYPE;
                                    ++primary_found;
                                }
                                break;
                            default:
                                if((image_size < max_image_size) ||
                                                            (image_length < max_image_length))
                                    summary_entry->subfiletype = REDUCED_RES_TYPE;
                                break;
                        }
                    }
                }
                else if(summary_entry->imagesubformat == IMGSUBFMT_CFA)
                {
                    /* fileformat may be MRW; other fileformats?      */
                    if(image_size >= max_image_size)
                    {
                        summary_entry->subfiletype = PRIMARY_TYPE;
                        ++primary_found;
                    }
                    else
                        summary_entry->subfiletype = REDUCED_RES_TYPE;
                }
                else
                    summary_entry->subfiletype = REDUCED_RES_TYPE;
            }
        }

        if(primary_found)
        {
            if(summary_entry->subfiletype <= POSSIBLE_PRIMARY_TYPE)
                summary_entry->subfiletype = REDUCED_RES_TYPE;
        }
        else if(image_size >= max_image_size)
        {
            if(summary_entry->subfiletype == POSSIBLE_PRIMARY_TYPE)
            {
                summary_entry->subfiletype = PRIMARY_TYPE;
                ++primary_found;
            }
        }
        else if(summary_entry->subfiletype <= POSSIBLE_PRIMARY_TYPE)
            summary_entry->subfiletype = REDUCED_RES_TYPE;

        if(((summary_entry->imageformat) != IMGFMT_NOIMAGE) &&
                ((summary_entry->imagesubformat & ~IMGSUBFMT_ERRORMASK) != IMGSUBFMT_JPEGTABLES))
            ++number_of_images;
        if(Debug & 0x4)
        {
            printred("DEBUG:");
            printf(" #%d se=%#-9x, pe=%#-9x",summary_entry->entry_lock,
                    (unsigned int)summary_entry,(unsigned int)prev_entry);
            printf(" ffm=%#x, fsf=%#-3x",summary_entry->fileformat,summary_entry->filesubformat);
            printf(", ifm=%#lx, isf=%#lx",summary_entry->imageformat,summary_entry->imagesubformat);
            printf(", offs=%lu, len=%lu",summary_entry->offset,summary_entry->length);
            printf(", pw=%lu, ph=%lu",summary_entry->pixel_width,summary_entry->pixel_height);
            printf(" sft=%d\n",summary_entry->subfiletype);
        }
        summary_entry = prev_entry;
        if(summary_entry)
            prev_entry = summary_entry->prev_entry;
        else
            prev_entry = NULL;
    }
    if(Debug & 0x4)
        (void)newline(1);
    return(number_of_images);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r13
leaq 0x46f54(%rip), %r14     # 0x5c670
testb $0x4, (%r14)
je 0x1572a
pushq $0x1
popq %rdi
callq 0x160f7
xorl %r12d, %r12d
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x30(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x20(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
xorl %r15d, %r15d
movl $0x0, 0xc(%rsp)
movq %r12, %rbx
testq %r13, %r13
je 0x15a47
movq %r13, %r12
cmpl $0x0, 0x10(%r13)
movq 0x8(%r13), %r13
jle 0x15773
testb $0x4, (%r14)
je 0x157d7
leaq 0x2d06e(%rip), %rdi     # 0x42805
callq 0x56e2
movl 0x10(%r12), %esi
movl 0x14(%r12), %edx
movl 0x18(%r12), %ecx
leaq 0x2df81(%rip), %rdi     # 0x43733
xorl %eax, %eax
callq 0x3120
movl 0xcc(%r12), %esi
movl 0xd0(%r12), %edx
leaq 0x2df79(%rip), %rdi     # 0x43749
xorl %eax, %eax
callq 0x3120
movq 0x78(%r12), %rbx
imulq 0x70(%r12), %rbx
cmpl $0x0, 0xd0(%r12)
je 0x15918
movl 0xcc(%r12), %eax
testl %eax, %eax
je 0x15918
cmpl $0x11, %eax
jl 0x1581e
testb $0x4, (%r14)
pushq $0x10
popq %rax
je 0x1581e
leaq 0x2e6f6(%rip), %rdi     # 0x43f0c
callq 0x30a0
pushq $0x10
popq %rax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
xorps %xmm2, %xmm2
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x15845
cvtsi2ssl 0xd0(%r12,%rcx,4), %xmm0
addss %xmm0, %xmm2
incq %rcx
jmp 0x1582d
mulss 0x2dca3(%rip), %xmm2    # 0x434f0
testb $0x4, (%r14)
je 0x1586f
cvtss2sd %xmm2, %xmm0
leaq 0x2deff(%rip), %rdi     # 0x4375d
movb $0x1, %al
movaps %xmm2, 0x40(%rsp)
callq 0x3120
movaps 0x40(%rsp), %xmm2
testq %rbx, %rbx
js 0x1587b
cvtsi2ss %rbx, %xmm0
jmp 0x15892
movq %rbx, %rax
shrq %rax
movl %ebx, %ecx
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
mulss %xmm0, %xmm2
movaps %xmm2, %xmm1
subss 0x2dc53(%rip), %xmm1    # 0x434f4
movq 0x98(%r12), %rax
testq %rax, %rax
js 0x158b5
cvtsi2ss %rax, %xmm0
jmp 0x158ca
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
cvttss2si %xmm2, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
cvttss2si %xmm1, %r15
andq %rcx, %r15
orq %rax, %r15
js 0x158ea
cvtsi2ss %r15, %xmm1
jmp 0x15902
movq %r15, %rax
shrq %rax
movl %r15d, %ecx
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
mulss 0x2dbea(%rip), %xmm0    # 0x434f8
movss %xmm0, 0x114(%r12)
testb $0x4, (%r14)
je 0x15941
movq 0x98(%r12), %rsi
cvtss2sd 0x114(%r12), %xmm0
leaq 0x2de3b(%rip), %rdi     # 0x43772
movq %r15, %rdx
movb $0x1, %al
callq 0x3120
movl 0xc4(%r12), %eax
cmpl $0x1, %eax
jne 0x15988
cmpq $0x0, 0x68(%r12)
jne 0x15960
movq 0x78(%r12), %rcx
movq %rcx, 0x68(%r12)
incl 0xc(%rsp)
movq 0x98(%r12), %rcx
movq %rcx, 0x10(%rsp)
cmpq $0x0, 0x60(%r12)
jne 0x15983
movq 0x70(%r12), %rcx
movq %rcx, 0x60(%r12)
movq %rbx, 0x30(%rsp)
cmpq 0x18(%rsp), %rbx
jbe 0x159a8
movq 0x70(%r12), %rcx
movq %rcx, 0x20(%rsp)
movq 0x78(%r12), %rcx
movq %rcx, 0x38(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x98(%r12), %rcx
movq 0x28(%rsp), %rdx
cmpq %rdx, %rcx
cmovaq %rcx, %rdx
movq %rdx, 0x28(%rsp)
movq 0x60(%r12), %rdx
movq 0x68(%r12), %rcx
movq %rcx, %rsi
orq %rdx, %rsi
je 0x15a12
movq %rdx, %rsi
imulq %rcx, %rsi
testq %r13, %r13
je 0x15a0f
movq 0x60(%r13), %r8
movq 0x68(%r13), %rdi
movq %rdi, %r9
orq %r8, %r9
je 0x15a07
movq %r8, %rbp
imulq %rdi, %rbp
cmpq %rsi, %rbp
jbe 0x15a07
movq %r8, 0x60(%r12)
movq %rdi, 0x68(%r12)
jmp 0x15a12
movq %rdx, 0x60(%r13)
movq %rcx, 0x68(%r13)
movq %rsi, %rbp
cmpl $-0x1, %eax
jne 0x15770
cmpl $0xffd8, 0x14(%r12)     # imm = 0xFFD8
jne 0x15770
cmpq $0x0, 0x90(%r12)
jne 0x15770
andl $0x0, 0xc4(%r12)
jmp 0x15770
testb $0x4, (%r14)
je 0x15adf
testq %rbx, %rbx
je 0x15adf
leaq 0x2cda4(%rip), %r15     # 0x42805
movq %r15, %rdi
callq 0x56e2
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
leaq 0x2dd0d(%rip), %rdi     # 0x43785
xorl %r12d, %r12d
movq %rbp, %rcx
xorl %eax, %eax
callq 0x3120
movq %r15, %rdi
callq 0x56e2
leaq 0x2dd11(%rip), %rdi     # 0x437a5
movq 0x20(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x3120
movq %r15, %rdi
callq 0x56e2
leaq 0x2dd0c(%rip), %rdi     # 0x437c5
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
leaq 0x2dd15(%rip), %rdi     # 0x437e1
movq 0x10(%rsp), %rsi
movq 0x28(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
jmp 0x15ae7
xorl %r12d, %r12d
testq %rbx, %rbx
je 0x15aec
movq (%rbx), %rax
jmp 0x15aee
xorl %eax, %eax
leaq 0x2cd10(%rip), %r13     # 0x42805
leaq 0x2dd13(%rip), %rbp     # 0x4380f
movq %rbx, %r15
movq %rax, %rbx
movl (%r14), %eax
testq %r15, %r15
je 0x15e62
testb $0x4, %al
je 0x15b2d
movq %r13, %rdi
callq 0x56e2
movl 0x10(%r15), %esi
movq %rbp, %rdi
movl %r15d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3120
cmpl $0x0, 0x10(%r15)
jg 0x15b46
movl $0x0, %eax
movq %rbx, %r15
testq %rbx, %rbx
je 0x15aff
movq (%rbx), %rax
jmp 0x15afc
movq %r12, 0x10(%rsp)
movq 0x98(%r15), %rax
movq %rax, 0x20(%rsp)
movq 0x78(%r15), %r12
imulq 0x70(%r15), %r12
testb $0x4, (%r14)
je 0x15bca
movl 0x14(%r15), %esi
movl 0x18(%r15), %edx
leaq 0x2dcb2(%rip), %rdi     # 0x43827
xorl %eax, %eax
callq 0x3120
movq 0x80(%r15), %rsi
movq 0x88(%r15), %rdx
leaq 0x2dcaa(%rip), %rdi     # 0x4383b
xorl %eax, %eax
callq 0x3120
movq 0x90(%r15), %rsi
movq 0x98(%r15), %rdx
leaq 0x2dca3(%rip), %rdi     # 0x43850
xorl %eax, %eax
callq 0x3120
movq 0x70(%r15), %rsi
movq 0x78(%r15), %rdx
leaq 0x2dca1(%rip), %rdi     # 0x43864
xorl %eax, %eax
callq 0x3120
testq %rbx, %rbx
je 0x15be1
cmpl $0x1, 0xc4(%rbx)
je 0x15be1
movups 0x60(%r15), %xmm0
movups %xmm0, 0x60(%rbx)
testb $0x4, (%r14)
je 0x15bfc
movl 0xc4(%r15), %esi
leaq 0x2dc80(%rip), %rdi     # 0x43875
xorl %eax, %eax
callq 0x3120
cmpl $0x0, 0xc(%rsp)
jle 0x15c20
movl 0xc4(%r15), %eax
testl %eax, %eax
jne 0x15c2d
movl $0x5, 0xc4(%r15)
movq 0x10(%rsp), %r12
jmp 0x15c41
movl 0xc4(%r15), %eax
je 0x15d17
testl %eax, %eax
movq 0x10(%rsp), %r12
jg 0x15c41
movl $0x5, 0xc4(%r15)
cmpq $0x0, 0x80(%r15)
je 0x15c66
movl 0x88(%r15), %eax
movl $0xfffffff, %ecx        # imm = 0xFFFFFFF
andl %ecx, %eax
xorl %ecx, %ecx
cmpl $0x15b, %eax            # imm = 0x15B
setne %cl
addl %ecx, %r12d
testb $0x4, (%r14)
je 0x15d04
movq %r13, %rdi
callq 0x56e2
movl 0x10(%r15), %esi
movq %rbp, %rdi
movl %r15d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3120
movl 0x14(%r15), %esi
movl 0x18(%r15), %edx
leaq 0x2db8d(%rip), %rdi     # 0x43827
xorl %eax, %eax
callq 0x3120
movq 0x80(%r15), %rsi
movq 0x88(%r15), %rdx
leaq 0x2db85(%rip), %rdi     # 0x4383b
xorl %eax, %eax
callq 0x3120
movq 0x90(%r15), %rsi
movq 0x98(%r15), %rdx
leaq 0x2db7e(%rip), %rdi     # 0x43850
xorl %eax, %eax
callq 0x3120
movq 0x70(%r15), %rsi
movq 0x78(%r15), %rdx
leaq 0x2db7c(%rip), %rdi     # 0x43864
xorl %eax, %eax
callq 0x3120
movl 0xc4(%r15), %esi
leaq 0x2db78(%rip), %rdi     # 0x43875
xorl %eax, %eax
callq 0x3120
movl $0x0, %eax
testq %rbx, %rbx
je 0x15afc
jmp 0x15ae7
testl %eax, %eax
je 0x15d5b
cmpq 0x18(%rsp), %r12
jae 0x15d2f
movl $0x0, 0xc(%rsp)
jmp 0x15c2d
movl $0x0, 0xc(%rsp)
testl %eax, %eax
movq 0x10(%rsp), %r12
jne 0x15c41
movl $0x1, 0xc4(%r15)
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
jmp 0x15c41
movl 0x14(%r15), %eax
cmpl $0x2a, %eax
je 0x15d84
cmpl $0x4f52, %eax           # imm = 0x4F52
je 0x15d84
cmpl $0xd0a870a, %eax        # imm = 0xD0A870A
je 0x15e0c
cmpl $0xffd8, %eax           # imm = 0xFFD8
je 0x15dbe
cmpl $0x5352, %eax           # imm = 0x5352
jne 0x15df8
movl 0xc8(%r15), %eax
leal -0xffc3(%rax), %ecx
cmpl $0xc, %ecx
ja 0x15da0
movl $0x1111, %edx           # imm = 0x1111
btl %ecx, %edx
jb 0x15db0
leal -0x8798(%rax), %ecx
cmpl $0x2, %ecx
jb 0x15db0
cmpl $0x1, %eax
jne 0x15e23
cmpq 0x18(%rsp), %r12
jae 0x15e0c
xorl %eax, %eax
jmp 0x15d1b
cmpq $0x0, 0x90(%r15)
je 0x15e0c
xorl %eax, %eax
testb $0x5, 0x18(%r15)
je 0x15d1b
movl 0xc8(%r15), %ecx
movl $0xffff003d, %edx       # imm = 0xFFFF003D
addl %edx, %ecx
roll $0x1e, %ecx
cmpl $0x3, %ecx
ja 0x15e38
cmpq 0x18(%rsp), %r12
jb 0x15d1b
jmp 0x15e0c
cmpq $0x18023, 0x88(%r15) # imm = 0x18023
jne 0x15e4f
cmpq 0x18(%rsp), %r12
jb 0x15e4f
movl $0x1, 0xc4(%r15)
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
jmp 0x15c19
cmpq 0x18(%rsp), %r12
jb 0x15e4f
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
jae 0x15db7
jmp 0x15e4f
cmpq 0x18(%rsp), %r12
jb 0x15e4f
movq 0x20(%rsp), %rcx
cmpq 0x28(%rsp), %rcx
jae 0x15d1b
movl $0x5, 0xc4(%r15)
pushq $0x5
popq %rax
jmp 0x15d1b
testb $0x4, %al
je 0x15e6e
pushq $0x1
popq %rdi
callq 0x160f7
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq