// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movw %si, %ax
movl 0x20(%rbp), %esi
movl 0x18(%rbp), %esi
movq 0x10(%rbp), %rsi
movq %rdi, -0x18(%rbp)
movw %ax, -0x1a(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movl $0x0, -0xa4(%rbp)
movq $0x0, -0xb8(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x15d8a
movq 0x61296(%rip), %rax     # 0x76ff8
movq (%rax), %rdi
leaq 0x626fc(%rip), %rax     # 0x78468
movq (%rax), %rdx
leaq 0x51476(%rip), %rsi     # 0x671ec
movb $0x0, %al
callq 0x3170
movq $0x0, -0x10(%rbp)
jmp 0x16a6e
cmpq $0x0, -0x38(%rbp)
je 0x15dab
movq -0x28(%rbp), %rax
cmpq -0x38(%rbp), %rax
jbe 0x15dab
leaq 0x4edab(%rip), %rax     # 0x64b4d
movq %rax, -0xb0(%rbp)
jmp 0x15db9
leaq 0x4e32a(%rip), %rax     # 0x640dc
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x15dcd
movq -0x40(%rbp), %rax
movl 0x18(%rax), %ecx
orl $0x10, %ecx
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movl 0x20(%rbp), %edx
movq -0xb0(%rbp), %rcx
movl $0x40000, %edi          # imm = 0x40000
callq 0x5ed0
leaq 0x61388(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x15e24
movl 0x18(%rbp), %esi
leaq 0x51406(%rip), %rdi     # 0x67217
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %ax
movq -0x28(%rbp), %rdx
addq -0x30(%rbp), %rdx
movzwl %ax, %esi
callq 0x4480
movzwl %ax, %eax
movl %eax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x15e61
movq -0x18(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x15e66
jmp 0x169dd
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0x70(%rbp)
movq %rax, -0x78(%rbp)
movq %rax, -0x60(%rbp)
leaq 0x612fe(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x15ee4
movl -0x98(%rbp), %esi
leaq 0x4eccc(%rip), %rdi     # 0x64b6a
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x60(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq 0x4ecb7(%rip), %rdi     # 0x64b77
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
movq 0x10(%rbp), %rdi
leaq 0x4ea5f(%rip), %rsi     # 0x64962
leaq 0x50ac1(%rip), %rdx     # 0x669cb
callq 0x20960
movq %rax, -0xb8(%rbp)
movl 0x20(%rbp), %eax
addl $0x2, %eax
movl %eax, 0x20(%rbp)
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0x1622e
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %ax
movq -0x78(%rbp), %rdx
movzwl %ax, %esi
callq 0x4c60
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x15f8d
movq -0x48(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0xc, %eax
jg 0x15f8d
movq -0x18(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x15f8d
movq -0x18(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x160cc
movl $0x0, -0xbc(%rbp)
movq $0x0, -0xc8(%rbp)
movq -0x78(%rbp), %rsi
movl 0x20(%rbp), %edx
movq -0xb0(%rbp), %rcx
movl $0x4003333, %edi        # imm = 0x4003333
callq 0x5ed0
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x51265(%rip), %rdi     # 0x6722e
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
movq -0x18(%rbp), %rdi
callq 0x31a0
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x38(%rbp)
jbe 0x16017
movq -0x38(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x1604f
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x3200
cmpl $-0x1, %eax
je 0x1604d
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rdi
movq -0x60(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
jmp 0x1604f
movq -0x18(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x160b6
movq -0x18(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x160b6
cmpq $0x0, -0xc8(%rbp)
jbe 0x160b6
movq -0x78(%rbp), %rax
imull $0xc, -0x98(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
cmpq -0xc8(%rbp), %rax
jae 0x160b4
movl -0xbc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xbc(%rbp)
cmpl $0x6, %eax
jge 0x160b2
movq -0x60(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x1621a
jmp 0x160b4
jmp 0x160b6
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
jmp 0x169dd
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0xcc(%rbp)
subl $0x927c, %eax           # imm = 0x927C
je 0x1614e
jmp 0x160ef
movl -0xcc(%rbp), %eax
subl $0xa002, %eax           # imm = 0xA002
je 0x1611c
jmp 0x160fe
movl -0xcc(%rbp), %eax
subl $0xa003, %eax           # imm = 0xA003
je 0x16135
jmp 0x1610d
movl -0xcc(%rbp), %eax
subl $0xa005, %eax           # imm = 0xA005
je 0x1614e
jmp 0x1615f
cmpq $0x0, -0x40(%rbp)
je 0x16133
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x60(%rax)
jmp 0x16161
cmpq $0x0, -0x40(%rbp)
je 0x1614c
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x68(%rax)
jmp 0x16161
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x16161
jmp 0x16161
movq -0x78(%rbp), %rsi
movl 0x20(%rbp), %edx
movq -0xb0(%rbp), %rcx
movl $0x4003333, %edi        # imm = 0x4003333
callq 0x5ed0
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %si
movq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %r8
movq -0xb8(%rbp), %r9
movl 0x18(%rbp), %eax
movzwl %si, %esi
movl $0x2, (%rsp)
movl %eax, 0x8(%rsp)
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
movl $0x2, 0x18(%rsp)
callq 0x6130
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x161cd
movq -0x60(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x50(%rbp), %rax
jbe 0x161df
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x60f9a(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x16212
movq -0x48(%rbp), %rdi
callq 0x158d0
cmpl $0x0, %eax
je 0x16212
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x15f29
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %ax
movq -0x60(%rbp), %rdx
movzwl %ax, %esi
callq 0x4610
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jbe 0x1636d
leaq 0x60f28(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x16354
leaq 0x60f10(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x16354
leaq 0x60ef6(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x16354
movq -0x60(%rbp), %rsi
movl 0x20(%rbp), %edx
addl $0x2, %edx
movq -0xb0(%rbp), %rcx
movl $0x40000, %edi          # imm = 0x40000
callq 0x5ed0
movq -0x58(%rbp), %rsi
leaq 0x4e8fb(%rip), %rdi     # 0x64bbe
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x30(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
jae 0x1631b
leaq 0x538cc(%rip), %rdi     # 0x69bd8
callq 0x6860
movq $0x0, -0x58(%rbp)
jmp 0x16341
movq -0x30(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x58(%rbp), %rcx
leaq 0x51628(%rip), %rdi     # 0x67956
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
jmp 0x16360
movq -0x30(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x163f2
leaq 0x60e0c(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x163f0
leaq 0x60df8(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x163f0
leaq 0x60de2(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x163f0
movq -0x60(%rbp), %rsi
movl 0x20(%rbp), %edx
movq -0xb0(%rbp), %rcx
movl $0x40000, %edi          # imm = 0x40000
callq 0x5ed0
leaq 0x4e80d(%rip), %rdi     # 0x64bd9
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
jmp 0x163f2
movq -0x18(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x1640e
movq -0x18(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x16453
leaq 0x4e7db(%rip), %rdi     # 0x64bf0
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
movq 0x60b88(%rip), %rax     # 0x76fc8
movq (%rax), %rdi
callq 0x20840
movq -0x18(%rbp), %rdi
callq 0x31a0
jmp 0x16460
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpl $0x0, -0xa0(%rbp)
je 0x16847
leaq 0x60d04(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x164f8
leaq 0x60cf0(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x164f8
leaq 0x60cda(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x164f8
movq -0x80(%rbp), %rsi
movl 0x20(%rbp), %edx
movq -0xb0(%rbp), %rcx
movl $0x40000, %edi          # imm = 0x40000
callq 0x5ed0
leaq 0x50d74(%rip), %rdi     # 0x67248
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0x16845
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %ax
movq -0x78(%rbp), %rdx
movzwl %ax, %esi
callq 0x4c60
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x1656a
movq -0x48(%rbp), %rax
movzwl 0x2(%rax), %eax
cmpl $0xc, %eax
jg 0x1656a
movq -0x18(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
jne 0x1656a
movq -0x18(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
je 0x16580
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0x60(%rbp)
movq %rax, -0x78(%rbp)
jmp 0x16831
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0x78(%rbp)
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0xdc(%rbp)
subl $0x927c, %eax           # imm = 0x927C
je 0x16614
jmp 0x165a7
movl -0xdc(%rbp), %eax
subl $0xa005, %eax           # imm = 0xA005
jne 0x16731
jmp 0x165ba
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %si
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x30(%rbp), %rcx
movq -0x68(%rbp), %r8
movq -0x40(%rbp), %r9
movq -0xb8(%rbp), %r11
movl 0x18(%rbp), %r10d
movl 0x20(%rbp), %eax
xorl %ebx, %ebx
movzwl %si, %esi
movq %r11, (%rsp)
movl $0x3, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x112e0
movq %rax, -0x80(%rbp)
jmp 0x167d6
leaq 0x66095(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1663b
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq 0x50c40(%rip), %rdi     # 0x67274
movb $0x0, %al
callq 0x3110
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x1667b
movq -0x88(%rbp), %rax
cmpq -0x38(%rbp), %rax
jbe 0x1667b
movq -0x48(%rbp), %rax
cmpq $0x4, 0x8(%rax)
jbe 0x1667b
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x6602e(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x166a8
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq 0x50be5(%rip), %rdi     # 0x67286
movb $0x0, %al
callq 0x3110
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %si
movq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x68(%rbp), %r8
movq -0x40(%rbp), %r9
movq -0xb8(%rbp), %r10
movl 0x20(%rbp), %eax
movzwl %si, %esi
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x24da0
movq %rax, -0x80(%rbp)
leaq 0x65fcb(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x16705
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq 0x50b76(%rip), %rdi     # 0x67274
movb $0x0, %al
callq 0x3110
leaq 0x65fa4(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1672c
movq -0x80(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq 0x50b73(%rip), %rdi     # 0x67298
movb $0x0, %al
callq 0x3110
jmp 0x167d6
leaq 0x60a48(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x167d4
leaq 0x60a30(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x167d4
movq -0x48(%rbp), %rdi
callq 0x158d0
cmpl $0x0, %eax
je 0x167d4
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rax
addq 0x10(%rax), %rsi
movl 0x20(%rbp), %edx
movq -0xb0(%rbp), %rcx
movl $0x4003333, %edi        # imm = 0x4003333
callq 0x5ed0
movq -0x48(%rbp), %rdi
movl $0x2, %edx
movl %edx, %esi
callq 0x7ae0
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %si
movq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0xb8(%rbp), %r8
movl 0x20(%rbp), %eax
movl $0x2, %r9d
movzwl %si, %esi
movl %eax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x68a0
movq %rax, -0x80(%rbp)
jmp 0x167d6
movq -0x80(%rbp), %rax
cmpq -0x50(%rbp), %rax
jbe 0x167e8
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x1682f
movq -0x80(%rbp), %rax
cmpq -0x38(%rbp), %rax
jbe 0x1682f
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x65ea2(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1682d
movq -0x90(%rbp), %rsi
leaq 0x50a69(%rip), %rdi     # 0x6728f
movb $0x0, %al
callq 0x3110
jmp 0x1682f
jmp 0x16831
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x1650a
jmp 0x1685b
movq -0x60(%rbp), %rax
cmpq -0x50(%rbp), %rax
jbe 0x16859
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x1685b
movl 0x20(%rbp), %eax
subl $0x2, %eax
movl %eax, 0x20(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x16893
movq -0x50(%rbp), %rax
cmpq -0x38(%rbp), %rax
jbe 0x16893
movq -0x38(%rbp), %rsi
subq $0x1, %rsi
movl 0x20(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x50a1e(%rip), %rcx     # 0x672aa
callq 0x5ed0
jmp 0x168af
movq -0x50(%rbp), %rsi
subq $0x1, %rsi
movl 0x20(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x4d84f(%rip), %rcx     # 0x640f9
callq 0x5ed0
leaq 0x608ca(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x168f0
leaq 0x4e222(%rip), %rdi     # 0x64aee
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x16982
leaq 0x509aa(%rip), %rdi     # 0x672ac
callq 0x6860
movl $0x1, %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %si
movq -0x58(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %r9
movq -0xb8(%rbp), %r11
movl 0x18(%rbp), %r10d
addl $0x1, %r10d
movl %r10d, 0x18(%rbp)
movl 0x20(%rbp), %eax
movzwl %si, %esi
movq %r11, (%rsp)
movl $0x2, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
movl %eax, 0x20(%rsp)
callq 0x112e0
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x50(%rbp), %rax
jbe 0x16980
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x16982
cmpq $0x0, -0xb8(%rbp)
je 0x16998
movq -0xb8(%rbp), %rdi
callq 0x3040
cmpq $0x0, -0x90(%rbp)
je 0x169ad
movq -0x90(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x65cfc(%rip), %rax     # 0x7c6b0
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x169d0
movq -0x50(%rbp), %rsi
leaq 0x50921(%rip), %rdi     # 0x672ea
movb $0x0, %al
callq 0x3110
movq -0x50(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x16a6e
movq -0x18(%rbp), %rdi
callq 0x31a0
movq -0x18(%rbp), %rdi
callq 0x3180
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rsi
subq $0x1, %rsi
movl 0x20(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x4d6ef(%rip), %rcx     # 0x640f9
callq 0x5ed0
leaq 0x6076a(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x16a50
leaq 0x4e0c2(%rip), %rdi     # 0x64aee
movb $0x0, %al
callq 0x3110
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edi
callq 0x1ef50
movl %eax, -0xa4(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x16a66
movq -0xb8(%rbp), %rdi
callq 0x3040
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
nopl (%rax)