// File: /workspace/github_c_makefile_star2_O1/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, %rbx
leaq 0x4759c(%rip), %r14     # 0x5d670
testb $0x4, (%r14)
je 0x160ee
movl $0xa, %edi
callq 0x3060
movl $0x0, 0x4745a(%rip)     # 0x5d548
testq %rbx, %rbx
je 0x1642c
movl $0x0, 0x4(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq $0x0, 0x30(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x10(%rsp)
xorl %r15d, %r15d
movq %r15, %rax
movq %rbx, %r15
cmpl $0x0, 0x10(%r15)
movq 0x8(%r15), %rbx
jg 0x16155
movq %rbx, %r15
testq %rbx, %rbx
jne 0x1613d
jmp 0x16427
movq %rbp, 0x38(%rsp)
movq %r12, 0x28(%rsp)
testb $0x4, (%r14)
je 0x161a7
leaq 0x2e699(%rip), %rdi     # 0x44805
callq 0x5c33
movl 0x10(%r15), %esi
movl 0x14(%r15), %edx
movl 0x18(%r15), %ecx
leaq 0x2f5af(%rip), %rdi     # 0x45733
xorl %eax, %eax
callq 0x3120
movl 0xcc(%r15), %esi
movl 0xd0(%r15), %edx
leaq 0x2f5a9(%rip), %rdi     # 0x45749
xorl %eax, %eax
callq 0x3120
movq 0x78(%r15), %rbp
imulq 0x70(%r15), %rbp
cmpl $0x0, 0xd0(%r15)
je 0x162fd
movl 0xcc(%r15), %r12d
testl %r12d, %r12d
je 0x162fd
cmpl $0x11, %r12d
jl 0x161ec
movl $0x10, %r12d
testb $0x4, (%r14)
je 0x161ec
leaq 0x2fd25(%rip), %rdi     # 0x45f0c
callq 0x30a0
testl %r12d, %r12d
jle 0x1621c
movl %r12d, %eax
xorps %xmm2, %xmm2
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsi2ssl 0xd0(%r15,%rcx,4), %xmm0
addss %xmm0, %xmm2
incq %rcx
cmpq %rcx, %rax
jne 0x161f9
mulss 0x2f2d6(%rip), %xmm2    # 0x454f0
jmp 0x1621f
xorps %xmm2, %xmm2
testb $0x4, (%r14)
je 0x16244
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
leaq 0x2f52a(%rip), %rdi     # 0x4575d
movb $0x1, %al
movaps %xmm2, 0x40(%rsp)
callq 0x3120
movaps 0x40(%rsp), %xmm2
testq %rbp, %rbp
js 0x16253
xorps %xmm0, %xmm0
cvtsi2ss %rbp, %xmm0
jmp 0x1626d
movq %rbp, %rax
shrq %rax
movl %ebp, %ecx
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
mulss %xmm0, %xmm2
movaps %xmm2, %xmm1
subss 0x2f278(%rip), %xmm1    # 0x454f4
movq 0x98(%r15), %rax
testq %rax, %rax
js 0x16292
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x162aa
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
cvttss2si %xmm2, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
cvttss2si %xmm1, %r13
andq %rcx, %r13
orq %rax, %r13
js 0x162cd
xorps %xmm1, %xmm1
cvtsi2ss %r13, %xmm1
jmp 0x162e8
movq %r13, %rax
shrq %rax
movl %r13d, %ecx
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm1, %xmm1
cvtsi2ss %rcx, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
mulss 0x2f204(%rip), %xmm0    # 0x454f8
movss %xmm0, 0x114(%r15)
testb $0x4, (%r14)
je 0x16327
movq 0x98(%r15), %rsi
xorps %xmm0, %xmm0
cvtss2sd 0x114(%r15), %xmm0
leaq 0x2f455(%rip), %rdi     # 0x45772
movq %r13, %rdx
movb $0x1, %al
callq 0x3120
movl 0xc4(%r15), %eax
cmpl $0x1, %eax
jne 0x16366
cmpq $0x0, 0x68(%r15)
jne 0x16342
movq 0x78(%r15), %rcx
movq %rcx, 0x68(%r15)
incl 0x4(%rsp)
movq 0x98(%r15), %rcx
movq %rcx, 0x38(%rsp)
cmpq $0x0, 0x60(%r15)
jne 0x16361
movq 0x70(%r15), %rcx
movq %rcx, 0x60(%r15)
movq %rbp, 0x20(%rsp)
cmpq 0x10(%rsp), %rbp
jbe 0x16384
movq 0x70(%r15), %rcx
movq %rcx, 0x18(%rsp)
movq 0x78(%r15), %rcx
movq %rcx, 0x30(%rsp)
movq %rbp, 0x10(%rsp)
movq 0x68(%r15), %rcx
movq 0x98(%r15), %rdx
movq 0x28(%rsp), %r12
cmpq %r12, %rdx
cmovaq %rdx, %r12
testq %rcx, %rcx
movq 0x38(%rsp), %rbp
jne 0x163ac
cmpq $0x0, 0x60(%r15)
je 0x163f8
movq 0x60(%r15), %rsi
movq %rsi, %rdx
imulq %rcx, %rdx
testq %rbx, %rbx
je 0x163f3
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
jne 0x163cc
cmpq $0x0, 0x60(%rbx)
je 0x163eb
movq 0x60(%rbx), %r8
movq %r8, %r9
imulq %rdi, %r9
movq %r9, 0x8(%rsp)
cmpq %rdx, %r9
jbe 0x163eb
movq %r8, 0x60(%r15)
movq %rdi, 0x68(%r15)
jmp 0x163f8
movq %rsi, 0x60(%rbx)
movq %rcx, 0x68(%rbx)
movq %rdx, 0x8(%rsp)
cmpl $-0x1, %eax
jne 0x1641c
cmpl $0xffd8, 0x14(%r15)     # imm = 0xFFD8
jne 0x1641c
cmpq $0x0, 0x90(%r15)
jne 0x1641c
movl $0x0, 0xc4(%r15)
testq %rbx, %rbx
jne 0x16137
jmp 0x16469
movq %rax, %r15
jmp 0x16469
xorl %r15d, %r15d
movq $0x0, 0x10(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x30(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x4(%rsp)
testb $0x4, (%r14)
je 0x164f6
testq %r15, %r15
je 0x164f6
leaq 0x2e386(%rip), %rbx     # 0x44805
movq %rbx, %rdi
callq 0x5c33
movq 0x60(%r15), %rsi
movq 0x68(%r15), %rdx
leaq 0x2f2ef(%rip), %rdi     # 0x45785
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x3120
movq %rbx, %rdi
callq 0x5c33
leaq 0x2f2f4(%rip), %rdi     # 0x457a5
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x3120
movq %rbx, %rdi
callq 0x5c33
leaq 0x2f2ef(%rip), %rdi     # 0x457c5
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
leaq 0x2f2f8(%rip), %rdi     # 0x457e1
movq %rbp, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3120
xorl %ebx, %ebx
testq %r15, %r15
movq %r12, 0x28(%rsp)
je 0x16507
movq (%r15), %rax
jmp 0x16509
xorl %eax, %eax
testq %r15, %r15
je 0x16877
leaq 0x2e2ec(%rip), %r13     # 0x44805
leaq 0x2f2ef(%rip), %rbp     # 0x4580f
xorl %ebx, %ebx
movq %rbx, 0x8(%rsp)
movq %r15, %rbx
movq %rax, %r15
testb $0x4, (%r14)
je 0x1654d
movq %r13, %rdi
callq 0x5c33
movl 0x10(%rbx), %esi
movq %rbp, %rdi
movl %ebx, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3120
cmpl $0x0, 0x10(%rbx)
jg 0x1656f
testq %r15, %r15
je 0x1655d
movq (%r15), %rax
jmp 0x1655f
xorl %eax, %eax
movq %r15, %rbx
testq %r15, %r15
movq %rax, %r15
jne 0x1652d
jmp 0x16872
movq 0x98(%rbx), %rax
movq %rax, 0x18(%rsp)
movq 0x78(%rbx), %r12
imulq 0x70(%rbx), %r12
testb $0x4, (%r14)
je 0x165ec
movl 0x14(%rbx), %esi
movl 0x18(%rbx), %edx
leaq 0x2f290(%rip), %rdi     # 0x45827
xorl %eax, %eax
callq 0x3120
movq 0x80(%rbx), %rsi
movq 0x88(%rbx), %rdx
leaq 0x2f288(%rip), %rdi     # 0x4583b
xorl %eax, %eax
callq 0x3120
movq 0x90(%rbx), %rsi
movq 0x98(%rbx), %rdx
leaq 0x2f281(%rip), %rdi     # 0x45850
xorl %eax, %eax
callq 0x3120
movq 0x70(%rbx), %rsi
movq 0x78(%rbx), %rdx
leaq 0x2f27f(%rip), %rdi     # 0x45864
xorl %eax, %eax
callq 0x3120
testq %r15, %r15
je 0x1660b
cmpl $0x1, 0xc4(%r15)
je 0x1660b
movq 0x60(%rbx), %rax
movq %rax, 0x60(%r15)
movq 0x68(%rbx), %rax
movq %rax, 0x68(%r15)
testb $0x4, (%r14)
je 0x16625
movl 0xc4(%rbx), %esi
leaq 0x2f257(%rip), %rdi     # 0x45875
xorl %eax, %eax
callq 0x3120
cmpl $0x0, 0x4(%rsp)
jle 0x16648
cmpl $0x0, 0xc4(%rbx)
jne 0x1673a
movl $0x5, 0xc4(%rbx)
jmp 0x1673a
jne 0x1673a
movl $0x0, 0x4(%rsp)
cmpl $0x0, 0xc4(%rbx)
jne 0x1673a
movl 0x14(%rbx), %eax
cmpl $0x5351, %eax           # imm = 0x5351
jle 0x1668b
cmpl $0xd0a870a, %eax        # imm = 0xD0A870A
je 0x16728
cmpl $0xffd8, %eax           # imm = 0xFFD8
je 0x166cb
cmpl $0x5352, %eax           # imm = 0x5352
je 0x16697
jmp 0x1670c
cmpl $0x2a, %eax
je 0x16697
cmpl $0x4f52, %eax           # imm = 0x4F52
jne 0x1670c
movl 0xc8(%rbx), %eax
leal -0xffc3(%rax), %ecx
cmpl $0xc, %ecx
ja 0x166b2
movl $0x1111, %edx           # imm = 0x1111
btl %ecx, %edx
jb 0x166c2
leal -0x8798(%rax), %ecx
cmpl $0x2, %ecx
jb 0x166c2
cmpl $0x1, %eax
jne 0x166f0
cmpq 0x10(%rsp), %r12
jae 0x16728
jmp 0x1673a
cmpq $0x0, 0x90(%rbx)
je 0x16728
testb $0x5, 0x18(%rbx)
je 0x1673a
movl 0xc8(%rbx), %eax
movl $0xffff003d, %ecx       # imm = 0xFFFF003D
addl %ecx, %eax
roll $0x1e, %eax
cmpl $0x3, %eax
jbe 0x166c2
cmpq 0x10(%rsp), %r12
jb 0x16639
movq 0x18(%rsp), %rax
cmpq 0x28(%rsp), %rax
jae 0x1673a
jmp 0x16639
cmpq $0x18023, 0x88(%rbx) # imm = 0x18023
jne 0x16639
cmpq 0x10(%rsp), %r12
jb 0x16639
movl $0x1, 0xc4(%rbx)
movl $0x1, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x1674c
cmpl $0x0, 0xc4(%rbx)
jg 0x1678f
jmp 0x16765
movl 0xc4(%rbx), %eax
cmpq 0x10(%rsp), %r12
jae 0x16771
movl $0x0, 0x4(%rsp)
testl %eax, %eax
jg 0x1678f
movl $0x5, 0xc4(%rbx)
jmp 0x1678f
movl $0x0, 0x4(%rsp)
testl %eax, %eax
jne 0x1678f
movl $0x1, 0xc4(%rbx)
movl $0x1, 0x4(%rsp)
cmpq $0x0, 0x80(%rbx)
je 0x167bc
movl 0x88(%rbx), %eax
movl $0xfffffff, %ecx        # imm = 0xFFFFFFF
andl %ecx, %eax
xorl %ecx, %ecx
cmpl $0x15b, %eax            # imm = 0x15B
setne %cl
movq 0x8(%rsp), %rax
addl %ecx, %eax
movq %rax, 0x8(%rsp)
testb $0x4, (%r14)
je 0x16856
movq %r13, %rdi
callq 0x5c33
movl 0x10(%rbx), %esi
movq %rbp, %rdi
movl %ebx, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3120
movl 0x14(%rbx), %esi
movl 0x18(%rbx), %edx
leaq 0x2f03a(%rip), %rdi     # 0x45827
xorl %eax, %eax
callq 0x3120
movq 0x80(%rbx), %rsi
movq 0x88(%rbx), %rdx
leaq 0x2f032(%rip), %rdi     # 0x4583b
xorl %eax, %eax
callq 0x3120
movq 0x90(%rbx), %rsi
movq 0x98(%rbx), %rdx
leaq 0x2f02b(%rip), %rdi     # 0x45850
xorl %eax, %eax
callq 0x3120
movq 0x70(%rbx), %rsi
movq 0x78(%rbx), %rdx
leaq 0x2f029(%rip), %rdi     # 0x45864
xorl %eax, %eax
callq 0x3120
movl 0xc4(%rbx), %esi
leaq 0x2f026(%rip), %rdi     # 0x45875
xorl %eax, %eax
callq 0x3120
testq %r15, %r15
je 0x16860
movq (%r15), %rax
jmp 0x16862
xorl %eax, %eax
movq 0x8(%rsp), %rbx
testq %r15, %r15
jne 0x16522
jmp 0x16877
movq 0x8(%rsp), %rbx
testb $0x4, (%r14)
je 0x16891
movl $0xa, %edi
callq 0x3060
movl $0x0, 0x46cb7(%rip)     # 0x5d548
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq