// File: /workspace/github_c_makefile_star2_O2/hfiguiere[P]exifprobe/process.c
// Function: process_exif_ifd
unsigned long
process_exif_ifd(FILE *inptr,unsigned short byteorder,
                    unsigned long exif_offset,unsigned long fileoffset_base,
                    unsigned long max_offset,struct image_summary *summary_entry,
                    char *parent_name,int ifdnum,int indent)
{
    struct ifd_entry *entry_ptr;
    unsigned long max_value_offset = 0L;
    unsigned long next_ifd_offset,current_offset,max_exif_offset;
    unsigned long start_entry_offset,entry_offset,value_offset;
    unsigned long value_start_offset = 0UL;
    unsigned long next_max_offset = 0UL;
    int entry_num,num_entries,value_is_offset,use_second_pass;
    int chpr = 0;
    char *prefix;
    char *fulldirname = CNULL;

    if(inptr == (FILE *)0)
    {
        fprintf(stderr,"%s: no open file pointer to read EXIF IFD\n",
                Progname);
        return(0L);
    }

    PUSHCOLOR(EXIF_COLOR);
    /* If the exif segment appears to be beyond the end of the parent */
    /* ifd, mark the start address to call attention.                 */
    if(max_offset && (exif_offset > max_offset))
        prefix = "+";
    else
        prefix = "@";
    if(summary_entry)
        summary_entry->filesubformat |= FILESUBFMT_EXIF;
    max_exif_offset = max_offset;
    print_tag_address(SECTION,exif_offset + fileoffset_base,indent,prefix);
    if(PRINT_SECTION)
        chpr += printf("<EXIF IFD> (in IFD %d)",ifdnum);

    num_entries = read_ushort(inptr,byteorder,exif_offset + fileoffset_base);
    if(ferror(inptr) || feof(inptr))
        goto blewit;
    current_offset = entry_offset = start_entry_offset = ftell(inptr);
    if(PRINT_SECTION)
    {
        chpr += printf(" %d entries ",num_entries);
        chpr += printf("starting at file offset %#lx=%lu",
                                            current_offset,current_offset);
            chpr = newline(chpr);
    }
    use_second_pass = value_is_offset = 0;
    fulldirname = splice(parent_name,".","Exif");

    indent += SMALLINDENT;
    /* The direct entries                                             */
    for(entry_num = 0; entry_num < num_entries; ++entry_num)
    {
        entry_ptr = read_ifd_entry(inptr,byteorder,entry_offset);
        if((entry_ptr->value_type == 0) || (entry_ptr->value_type > DOUBLE) ||
            ferror(inptr) || feof(inptr))
        {
            int invalid_entry = 0;
            unsigned long limit_offset = 0L;

            print_tag_address(ENTRY,entry_offset,indent,prefix);
            chpr += printf(" INVALID EXIF ENTRY (%lu)",entry_ptr->value);
            chpr = newline(chpr);
            clearerr(inptr);
            current_offset = ftell(inptr);
            if(max_offset > 0)
                limit_offset = max_offset;
            else
            {
                if(fseek(inptr,0L,SEEK_END) != -1)
                {
                    limit_offset = ftell(inptr);
                    fseek(inptr,current_offset,SEEK_SET);
                }
            }
            /* If there's an error on input, or we can't check    */
            /* for absurd num_entries, give up.                   */
            if(!ferror(inptr) && !feof(inptr) && (limit_offset > 0))
            {
                /* If the number of entries would read past the   */
                /* size of the IFD, or past EOF, give up          */
                if((entry_offset + (12 * num_entries)) < limit_offset)
                {
                    /* Limit the number of consecutive failures.  */
                    /* An apparently valid entry resets the count */
                    /* to 0.                                      */
                    if(invalid_entry++ < MAX_INVALID_ENTRIES)
                    {
                        entry_offset = current_offset;
                        continue;
                    }
                }
            }
            chpr = newline(chpr);
            goto blewit;
        }
        current_offset = ftell(inptr);
        switch(entry_ptr->tag)
        {
            case EXIFTAG_PixelXDimension:
                if(summary_entry)
                    summary_entry->primary_width = entry_ptr->value;
                break;
            case EXIFTAG_PixelYDimension:
                if(summary_entry)
                    summary_entry->primary_height = entry_ptr->value;
                break;
            case EXIFTAG_Interoperability: 
            case EXIFTAG_MakerNote: 
                use_second_pass++;
                break;
            default:
                break;
        }
     
        print_tag_address(ENTRY,entry_offset,indent,prefix);
        value_offset = print_entry(inptr,byteorder,entry_ptr,fileoffset_base,
                                        summary_entry,fulldirname,EXIF_IFD,
                                        ifdnum,-1,SMALLINDENT);
        if(value_offset == 0UL)
            value_offset = current_offset;
        if(value_offset > max_value_offset)
            max_value_offset = value_offset;
        if((PRINT_VALUE_AT_OFFSET) && (is_offset(entry_ptr)))
            ++use_second_pass;
        entry_offset = current_offset;
    }

    next_ifd_offset = read_ulong(inptr,byteorder,current_offset);

    /* There should be no next_ifd_offset for the Exif Ifd.           */
    /* I am not confident, however, that someone won't eventually     */
    /* chain Exif ifds, so just handle them, and let the error        */
    /* messages fly.                                                  */
    if(next_ifd_offset > 0L)
    {
        if((PRINT_VALUE) && (PRINT_SECTION) && (PRINT_VALUE_AT_OFFSET))
        {
            print_tag_address(SECTION,current_offset,indent + SMALLINDENT,prefix);
            chpr += printf("**** next IFD offset %lu  ",next_ifd_offset);
            next_ifd_offset += fileoffset_base;
            if(next_ifd_offset < ftell(inptr))
            {
                printred("BAD NEXT IFD OFFSET");
                next_ifd_offset = 0L;
            }
            else
                chpr += printf("(+ %lu = %#lx/%lu)",fileoffset_base,
                                        next_ifd_offset,next_ifd_offset);
            chpr = newline(chpr);
        }
        else
            next_ifd_offset += fileoffset_base;
        /* This should never happen                                   */
        max_exif_offset = next_ifd_offset;
    }
    else
    {
        if((PRINT_VALUE) && (PRINT_SECTION) && (PRINT_VALUE_AT_OFFSET))
        {
            print_tag_address(SECTION,current_offset,indent,prefix);
            chpr += printf("**** next IFD offset 0");
            chpr = newline(chpr);
        }
    }

    if(ferror(inptr) || feof(inptr))
    {
        chpr += printf(" READ NEXT IFD OFFSET FAILED ");
        chpr = newline(chpr);
        why(stdout);
        clearerr(inptr);    /* keep going...                          */
    }
    else
        current_offset = ftell(inptr);

    value_offset = current_offset;

    /* Second pass, to evaluate entries which are stored indirectly.  */
    /* This occurs when the value requires more than 4 bytes, AND for */
    /* certain LONG values which are intended to be used as offsets   */
    /* (and should have their own type defined in the spec),          */
    if(use_second_pass)
    {
        if((PRINT_VALUE) && (PRINT_SECTION) && (PRINT_VALUE_AT_OFFSET))
        {
            print_tag_address(SECTION,value_offset,indent,prefix);
            chpr += printf("============= VALUES, EXIF IFD ============");
            chpr = newline(chpr);
        }

        entry_offset = start_entry_offset;
        for(entry_num = 0; entry_num < num_entries; ++entry_num)
        {
            entry_ptr = read_ifd_entry(inptr,byteorder,entry_offset);
            if((entry_ptr->value_type == 0) || (entry_ptr->value_type > DOUBLE) ||
                ferror(inptr) || feof(inptr))
            {
                /* If the first pass made it through invalid entries, */
                /* this pass should just ignore them and quietly      */
                /* continue.                                          */
                entry_offset = current_offset = ftell(inptr);
                continue;
            }
            current_offset = entry_offset = ftell(inptr);
            switch(entry_ptr->tag)
            {
                case EXIFTAG_Interoperability: 
                    PUSHCOLOR(INTEROP_COLOR);
                    value_offset = process_tiff_ifd(inptr,byteorder,
                                            entry_ptr->value,fileoffset_base,
                                            max_exif_offset,summary_entry,
                                            fulldirname,INTEROP_IFD,ifdnum,0,
                                            indent);
                    POPCOLOR();
                    break;
                case EXIFTAG_MakerNote: 
        /* ###%%% temporary debug                                     */
                    if(Debug & END_OF_SECTION_DEBUG)
                        printf("mo=%lu, mvo=%lu, ",
                                max_offset,max_value_offset);
                    value_start_offset = entry_ptr->value + fileoffset_base;
                    if(max_offset && (value_start_offset > max_offset) &&
                            (entry_ptr->count > 4))
                    {
                        next_max_offset = value_start_offset;
                    }
                    if(Debug & END_OF_SECTION_DEBUG)
                        printf("vso=%lu, nmo=%lu\n",value_start_offset,next_max_offset);
                    value_offset = process_makernote(inptr,byteorder,
                                            entry_ptr,fileoffset_base,max_exif_offset,
                                                    summary_entry,fulldirname,indent);
                    if(Debug & END_OF_SECTION_DEBUG)
                        printf("mo=%lu, mvo=%lu, ",max_offset,max_value_offset);
                    if(Debug & END_OF_SECTION_DEBUG)
                        printf("MNvo=%lu, mo=%lu\n",value_offset,max_offset);
                    break;
                default:
                    if((PRINT_VALUE) && ((PRINT_VALUE_AT_OFFSET) && is_offset(entry_ptr)))
                    {
                        print_tag_address(ENTRY,fileoffset_base + entry_ptr->value,
                                            indent,prefix);
                        print_tagid(entry_ptr,SMALLINDENT,EXIF_IFD);
                        value_offset =
                                    print_offset_value(inptr,byteorder,entry_ptr,
                                                    fileoffset_base,fulldirname,
                                                    EXIF_IFD,indent,1);
                    }
                    break;
            }
            if(value_offset > max_value_offset)
                max_value_offset = value_offset;
            if(max_offset && (value_offset > max_offset))
            {
                next_max_offset = value_start_offset;
                if(Debug & END_OF_SECTION_DEBUG)
                    printf("nmo=%lu\n",next_max_offset);
            }
        }
    }
    else if(current_offset > max_value_offset)
        max_value_offset = current_offset;

    indent -= SMALLINDENT;
    if(max_offset && (max_value_offset > max_offset))
        print_tag_address(SECTION,max_offset - 1,indent,"<");
    else
        print_tag_address(SECTION,max_value_offset - 1,indent,"-");
    if(PRINT_SECTION)
    {
        chpr += printf("</EXIF IFD>");
        chpr = newline(chpr);
    }
    POPCOLOR();

    /* This shouldn't happen.                                         */
    if(next_ifd_offset)
    {
        printred("#========= WARNING! CHAINING NEXT IFD FROM EXIF IFD =========");
        chpr = newline(1);
        value_offset = process_tiff_ifd(inptr,byteorder,next_ifd_offset,
                                fileoffset_base,max_offset,summary_entry,fulldirname,
                                EXIF_IFD,++ifdnum,-1,indent);
        if(value_offset > max_value_offset)
            max_value_offset = value_offset;
    }
    if(fulldirname)
        free(fulldirname);
    if(next_max_offset)
        max_value_offset = next_max_offset;
    if(Debug & END_OF_SECTION_DEBUG)
        printf("exmvo=%lu\n",max_value_offset);
    return(max_value_offset);
blewit:
    clearerr(inptr);
    current_offset = ftell(inptr);
    print_tag_address(SECTION,current_offset - 1,indent,"-");
    if(PRINT_SECTION)
    {
        chpr += printf("</EXIF IFD>");
        chpr = newline(chpr);
    }
    if(fulldirname)
        free(fulldirname);
    POPCOLOR();
    return(0L);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
testq %rdi, %rdi
je 0xf8ea
movq %r9, %r12
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %rbx
movl 0xc0(%rsp), %r13d
cmpq %r8, %rdx
leaq 0x30665(%rip), %rdx     # 0x3fb82
leaq 0x2fbb8(%rip), %rax     # 0x3f0dc
cmovbeq %rax, %rdx
movq %r8, 0x10(%rsp)
testq %r8, %r8
cmoveq %rax, %rdx
movq %rdx, 0x30(%rsp)
testq %r9, %r9
je 0xf544
orb $0x10, 0x18(%r12)
movq %rcx, 0x18(%rsp)
addq %rcx, %r14
movl $0x40000, %edi          # imm = 0x40000
movq %r14, %rsi
movl %r13d, %edx
movq 0x30(%rsp), %rcx
callq 0x5100
leaq 0x47c18(%rip), %rcx     # 0x57180
xorl %ebp, %ebp
testb $0x4, 0x2(%rcx)
je 0xf587
leaq 0x335ce(%rip), %rdi     # 0x42b45
movl 0xb8(%rsp), %esi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
movzwl %r15w, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x416a
movl %eax, %r14d
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
jne 0xf5b9
movl %r15d, 0xc(%rsp)
movq %rbx, %rdi
callq 0x31a0
testl %eax, %eax
je 0xf624
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x31b0
movq %rbx, %rdi
callq 0x3190
leaq -0x1(%rax), %rsi
leaq 0x2fb22(%rip), %rcx     # 0x3f0f9
movl $0x40000, %edi          # imm = 0x40000
movl %r13d, %edx
callq 0x5100
leaq 0x47b95(%rip), %rax     # 0x57180
testb $0x4, 0x2(%rax)
je 0xf608
leaq 0x3052b(%rip), %rdi     # 0x3fb23
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
callq 0x160f7
movq %r14, %rdi
callq 0x3050
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzwl %r14w, %r14d
movq %rbx, %rdi
callq 0x3190
movq %rax, 0x20(%rsp)
leaq 0x47b44(%rip), %rax     # 0x57180
testb $0x4, 0x2(%rax)
movq %r12, 0x40(%rsp)
movl %ebp, %r15d
jne 0xf651
movl %r15d, 0x8(%rsp)
jmp 0xf68c
leaq 0x30547(%rip), %rdi     # 0x3fb9f
movl %r14d, %esi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
leaq 0x30541(%rip), %rdi     # 0x3fbac
movq 0x20(%rsp), %rdx
movq %rdx, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r15d
addl %ebp, %r15d
movl %r15d, %edi
callq 0x160f7
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %r12d
leaq 0x302ff(%rip), %rsi     # 0x3f997
leaq 0x32c78(%rip), %rdx     # 0x42317
movq 0xb0(%rsp), %rdi
callq 0x16f1d
movq %rax, 0x48(%rsp)
leal 0x2(%r13), %eax
movq %rax, 0x28(%rsp)
imull $0xc, %r14d, %eax
movq %rax, 0x50(%rsp)
movl %r14d, 0x6c(%rsp)
movl %r14d, %r13d
xorl %ebp, %ebp
movq 0x20(%rsp), %r15
movq %r15, %r14
movl $0x0, 0x60(%rsp)
subl $0x1, %r13d
jb 0xf913
movq %rbp, %r15
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x476a
movq %rax, %rbp
movzwl 0x2(%rax), %eax
addl $-0xd, %eax
cmpw $-0xc, %ax
jb 0xf724
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
jne 0xf724
movq %rbx, %rdi
callq 0x31a0
testl %eax, %eax
je 0xf7fa
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x5100
movq 0x10(%rbp), %rsi
leaq 0x33416(%rip), %rdi     # 0x42b5c
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %edi
addl %eax, %edi
callq 0x160f7
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
callq 0x31b0
movq %rbx, %rdi
callq 0x3190
movq %rax, %r12
movq 0x10(%rsp), %rax
movq %rax, %rbp
testq %rax, %rax
jne 0xf7ab
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x2
popq %rdx
callq 0x3210
movl $0x0, %ebp
cmpl $-0x1, %eax
je 0xf7ab
movq %rbx, %rdi
callq 0x3190
movq %rax, %rbp
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3210
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
jne 0xf8d0
movq %rbx, %rdi
callq 0x31a0
testq %rbp, %rbp
je 0xf8d0
testl %eax, %eax
jne 0xf8d0
addq 0x50(%rsp), %r14
cmpq %rbp, %r14
jae 0xf8d0
movq %r15, %r14
movq 0x20(%rsp), %r15
movq %r14, %rbp
movq %r12, %r14
movl 0xc(%rsp), %r12d
jmp 0xf6dd
movq %rbx, %rdi
callq 0x3190
movq %rax, %r12
movzwl (%rbp), %eax
cmpl $0x927c, %eax           # imm = 0x927C
je 0xf839
cmpl $0xa005, %eax           # imm = 0xA005
je 0xf839
cmpl $0xa003, %eax           # imm = 0xA003
je 0xf83f
cmpl $0xa002, %eax           # imm = 0xA002
jne 0xf851
movq 0x40(%rsp), %rcx
testq %rcx, %rcx
je 0xf851
movq 0x10(%rbp), %rax
movq %rax, 0x60(%rcx)
jmp 0xf851
incl 0x60(%rsp)
jmp 0xf851
movq 0x40(%rsp), %rcx
testq %rcx, %rcx
je 0xf851
movq 0x10(%rbp), %rax
movq %rax, 0x68(%rcx)
movl $0x4003333, %edi        # imm = 0x4003333
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x5100
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movq %rbp, %rdx
movq 0x18(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x48(%rsp), %r9
pushq $0x2
popq %rax
movq %rax, %r10
pushq %rax
pushq $-0x1
movl 0xc8(%rsp), %eax
pushq %rax
pushq %r10
callq 0x524a
addq $0x20, %rsp
movq %rax, %r14
testq %rax, %rax
cmoveq %r12, %r14
cmpq %r15, %r14
cmovbeq %r15, %r14
leaq 0x478cb(%rip), %rax     # 0x57180
testb $0x1, 0x3(%rax)
je 0xf7e5
movq %rbp, %rdi
callq 0xf1c7
addl %eax, 0x60(%rsp)
jmp 0xf7e5
movl 0x8(%rsp), %edi
callq 0x160f7
movl %eax, %ebp
movq 0x48(%rsp), %r14
movq 0x28(%rsp), %r13
jmp 0xf5bc
movq 0x47707(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x48b6d(%rip), %rax     # 0x58468
movq (%rax), %rdx
leaq 0x33215(%rip), %rsi     # 0x42b1a
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x3180
jmp 0xf612
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x42ba
movq %rax, %r13
leaq 0x47855(%rip), %rax     # 0x57180
movq (%rax), %rax
testb $0x30, %al
sete %cl
notl %eax
testl $0x1040000, %eax        # imm = 0x1040000
setne %al
orb %cl, %al
testq %r13, %r13
movq %rbp, 0x38(%rsp)
je 0xf95c
testb %al, %al
je 0xf968
addq 0x18(%rsp), %r13
movq %r13, 0x58(%rsp)
jmp 0xfa37
testb %al, %al
je 0xf9c1
xorl %r13d, %r13d
jmp 0xf9f8
movl 0xc0(%rsp), %eax
leal 0x4(%rax), %edx
movl $0x40000, %edi          # imm = 0x40000
movq %r14, %rsi
movq 0x30(%rsp), %rcx
callq 0x5100
leaq 0x30268(%rip), %rdi     # 0x3fbf3
movq %r13, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl 0x8(%rsp), %ebp
movq 0x18(%rsp), %r15
addq %r15, %r13
movq %rbx, %rdi
callq 0x3190
cmpq %rax, %r13
jae 0xfa04
leaq 0x35c99(%rip), %rdi     # 0x45650
callq 0x56e2
xorl %r13d, %r13d
jmp 0xfa1d
movl $0x40000, %edi          # imm = 0x40000
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x5100
leaq 0x3022f(%rip), %rdi     # 0x3fc0e
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %edi
addl %eax, %edi
callq 0x160f7
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0xfa37
leaq 0x33879(%rip), %rdi     # 0x43284
movq %r15, %rsi
movq %r13, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
callq 0x160f7
movl %eax, 0x8(%rsp)
movq %r13, 0x58(%rsp)
movq 0x38(%rsp), %rbp
movq 0x20(%rsp), %r15
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
jne 0xfa53
movq %rbx, %rdi
callq 0x31a0
testl %eax, %eax
je 0xfec2
leaq 0x301cb(%rip), %rdi     # 0x3fc25
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %edi
addl %eax, %edi
callq 0x160f7
movl %eax, 0x8(%rsp)
movq 0x47551(%rip), %rax     # 0x56fc8
movq (%rax), %rdi
callq 0x16e8c
movq %rbx, %rdi
callq 0x31b0
cmpl $0x0, 0x60(%rsp)
movq 0x10(%rsp), %rdx
je 0xfdbb
movq %r13, 0x60(%rsp)
leaq 0x476dd(%rip), %rax     # 0x57180
movq (%rax), %rax
testb $0x30, %al
sete %cl
notl %eax
testl $0x1040000, %eax        # imm = 0x1040000
setne %al
orb %cl, %al
jne 0xfaed
movl $0x40000, %edi          # imm = 0x40000
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x5100
leaq 0x3309f(%rip), %rdi     # 0x42b76
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %edi
addl %eax, %edi
callq 0x160f7
movl %eax, 0x8(%rsp)
leaq 0x4cb7c(%rip), %rax     # 0x5c670
movq $0x0, 0x50(%rsp)
xorl %r13d, %r13d
subl $0x1, 0x6c(%rsp)
jb 0xfda7
movq %rax, %rbp
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x476a
movq %rax, %r12
movzwl 0x2(%rax), %eax
addl $-0xd, %eax
cmpw $-0xc, %ax
jb 0xfb44
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
jne 0xfb44
movq %rbx, %rdi
callq 0x31a0
testl %eax, %eax
je 0xfb59
movq %rbx, %rdi
callq 0x3190
movq %rax, %r15
movl 0xc(%rsp), %r12d
movq %rbp, %rax
jmp 0xfb00
movq %rbx, %rdi
callq 0x3190
movq %rax, %r15
movzwl (%r12), %eax
cmpl $0x927c, %eax           # imm = 0x927C
je 0xfbbc
cmpl $0xa005, %eax           # imm = 0xA005
jne 0xfc18
movq 0x10(%r12), %rdx
subq $0x8, %rsp
movq %rbx, %rdi
movl 0x14(%rsp), %esi
movq 0x20(%rsp), %rcx
movq 0x60(%rsp), %r8
movq 0x48(%rsp), %r9
pushq 0x30(%rsp)
pushq $0x0
movl 0xd0(%rsp), %eax
pushq %rax
pushq $0x3
pushq 0x70(%rsp)
callq 0xc004
addq $0x30, %rsp
jmp 0xfcab
movq %rbp, %rcx
testb $0x10, (%rbp)
je 0xfbe0
leaq 0x32fd6(%rip), %rdi     # 0x42ba2
movq 0x10(%rsp), %rsi
movq 0x38(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
movq %rbp, %rcx
movq 0x10(%r12), %rdx
addq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rax
testq %rax, %rax
movq 0x48(%rsp), %r14
je 0xfd0a
cmpq %rax, %rdx
movq %rdx, %rax
jbe 0xfd0d
cmpq $0x5, 0x8(%r12)
cmovaeq %rax, %r13
jmp 0xfd0d
leaq 0x47561(%rip), %rax     # 0x57180
movq (%rax), %rax
testb $0x30, %al
sete %cl
btl $0x18, %eax
setae %al
orb %cl, %al
jne 0xfcae
movq %r12, %rdi
callq 0xf1c7
testl %eax, %eax
je 0xfcae
movq 0x10(%r12), %rsi
movq 0x18(%rsp), %r14
addq %r14, %rsi
movl $0x4003333, %edi        # imm = 0x4003333
movq %r13, 0x70(%rsp)
movq %r15, 0x20(%rsp)
movq 0x28(%rsp), %r15
movl %r15d, %edx
movq 0x30(%rsp), %rcx
callq 0x5100
movq %r12, %rdi
pushq $0x2
popq %r13
movl %r13d, %esi
movl %r13d, %edx
callq 0x62b2
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movq %r12, %rdx
movq %r14, %rcx
movq 0x48(%rsp), %r8
movl %r13d, %r9d
pushq $0x1
pushq %r15
movq 0x30(%rsp), %r15
movq 0x80(%rsp), %r13
callq 0x56fc
popq %rcx
popq %rdx
movq %rax, %r14
movq 0x10(%rsp), %r12
movq %rbp, %rax
movq 0x38(%rsp), %rcx
cmpq %rcx, %r14
cmovaq %r14, %rcx
movq %rcx, 0x38(%rsp)
testq %r12, %r12
je 0xfce5
cmpq %r12, %r14
jbe 0xfce5
testb $0x10, (%rax)
movl 0xc(%rsp), %r12d
jne 0xfcef
movq 0x50(%rsp), %r13
jmp 0xfb00
movl 0xc(%rsp), %r12d
jmp 0xfb00
leaq 0x32ec7(%rip), %rdi     # 0x42bbd
movq 0x50(%rsp), %r13
movq %r13, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0xfb54
movq %rdx, %rax
movq %rax, 0x50(%rsp)
testb $0x10, (%rcx)
je 0xfd2d
leaq 0x32e96(%rip), %rdi     # 0x42bb4
movq 0x50(%rsp), %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x3120
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movq %r12, %rdx
movq 0x18(%rsp), %rcx
movq 0x58(%rsp), %r8
movq 0x40(%rsp), %r9
pushq 0x28(%rsp)
pushq %r14
callq 0x18f38
popq %rcx
popq %rdx
movq %rax, %r14
testb $0x10, (%rbp)
jne 0xfd69
movq %rbp, %rax
movq 0x10(%rsp), %r12
jmp 0xfcb6
leaq 0x32e32(%rip), %rdi     # 0x42ba2
movq 0x10(%rsp), %r12
movq %r12, %rsi
movq 0x38(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
testb $0x10, (%rbp)
je 0xfcb3
leaq 0x32e31(%rip), %rdi     # 0x42bc6
movq %r14, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3120
jmp 0xfcb3
movq %r13, %r15
movq 0x10(%rsp), %rdx
movq 0x38(%rsp), %rbp
movq 0x60(%rsp), %r13
jmp 0xfdc5
cmpq %rbp, %r14
cmovaq %r14, %rbp
xorl %r15d, %r15d
testq %rdx, %rdx
setne %al
cmpq %rdx, %rbp
seta %cl
testb %cl, %al
movq %rbp, %rsi
cmovneq %rdx, %rsi
leaq 0x32df7(%rip), %rax     # 0x42bd8
leaq 0x2f311(%rip), %rcx     # 0x3f0f9
cmovneq %rax, %rcx
decq %rsi
movl $0x40000, %edi          # imm = 0x40000
movl 0xc0(%rsp), %edx
callq 0x5100
leaq 0x47379(%rip), %rax     # 0x57180
testb $0x4, 0x2(%rax)
movq 0x48(%rsp), %r14
je 0xfe2b
leaq 0x2fd0a(%rip), %rdi     # 0x3fb23
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %edi
addl %eax, %edi
callq 0x160f7
testq %r13, %r13
je 0xfe8d
leaq 0x32da3(%rip), %rdi     # 0x42bda
callq 0x56e2
pushq $0x1
popq %rdi
callq 0x160f7
movl 0xb8(%rsp), %eax
movq %rax, %r10
incl %r10d
subq $0x8, %rsp
movq %rbx, %rdi
movl %r12d, %esi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x48(%rsp), %r9
movl 0xc8(%rsp), %eax
pushq %rax
pushq $-0x1
pushq %r10
pushq $0x2
pushq %r14
callq 0xc004
addq $0x30, %rsp
cmpq %rbp, %rax
cmovaq %rax, %rbp
movq %r14, %rdi
callq 0x3050
testq %r15, %r15
cmovneq %r15, %rbp
leaq 0x4c7cd(%rip), %rax     # 0x5c670
testb $0x10, (%rax)
je 0xf612
leaq 0x32d65(%rip), %rdi     # 0x42c18
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0xf612
movq %rbx, %rdi
callq 0x3190
movq %rax, %r14
jmp 0xfa87