// File: zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::Create()
bool BamStandardIndex::Create(void) {

    // skip if BamReader is invalid or not open
    if ( m_reader == 0 || !m_reader->IsOpen() ) {
        SetErrorString("BamStandardIndex::Create", "could not create index: reader is not open");
        return false;
    }

    // rewind BamReader
    if ( !m_reader->Rewind() ) {
        const string readerError = m_reader->GetErrorString();
        const string message = "could not create index: \n\t" + readerError;
        SetErrorString("BamStandardIndex::Create", message);
        return false;
    }

    try {

        // open new index file (read & write)
        string indexFilename = m_reader->Filename() + Extension();
        OpenFile(indexFilename, IBamIODevice::ReadWrite);

        // initialize BaiFileSummary with number of references
        const int& numReferences = m_reader->GetReferenceCount();
        ReserveForSummary(numReferences);

        // initialize output file
        WriteHeader();

        // set up bin, ID, offset, & coordinate markers
        const uint32_t defaultValue = 0xffffffffu;
        uint32_t currentBin    = defaultValue;
        uint32_t lastBin       = defaultValue;
        int32_t  currentRefID  = defaultValue;
        int32_t  lastRefID     = defaultValue;
        uint64_t currentOffset = (uint64_t)m_reader->Tell();
        uint64_t lastOffset    = currentOffset;
        int32_t  lastPosition  = defaultValue;

        // iterate through alignments in BAM file
        BamAlignment al;
        BaiReferenceEntry refEntry;
        while ( m_reader->LoadNextAlignment(al) ) {

            // changed to new reference
            if ( lastRefID != al.RefID ) {

                // if not first reference, save previous reference data
                if ( lastRefID != (int32_t)defaultValue ) {

                    SaveAlignmentChunkToBin(refEntry.Bins, currentBin, currentOffset, lastOffset);
                    WriteReferenceEntry(refEntry);
                    ClearReferenceEntry(refEntry);

                    // write any empty references between (but *NOT* including) lastRefID & al.RefID
                    for ( int i = lastRefID+1; i < al.RefID; ++i ) {
                        BaiReferenceEntry emptyEntry(i);
                        WriteReferenceEntry(emptyEntry);
                    }

                    // update bin markers
                    currentOffset = lastOffset;
                    currentBin    = al.Bin;
                    lastBin       = al.Bin;
                    currentRefID  = al.RefID;
                }

                // otherwise, this is first pass
                // be sure to write any empty references up to (but *NOT* including) current RefID
                else {
                    for ( int i = 0; i < al.RefID; ++i ) {
                        BaiReferenceEntry emptyEntry(i);
                        WriteReferenceEntry(emptyEntry);
                    }
                }

                // update reference markers
                refEntry.ID = al.RefID;
                lastRefID   = al.RefID;
                lastBin     = defaultValue;
            }

            // if lastPosition greater than current alignment position - file not sorted properly
            else if ( lastPosition > al.Position ) {
                stringstream s("");
                s << "BAM file is not properly sorted by coordinate" << endl
                  << "Current alignment position: " << al.Position
                  << " < previous alignment position: " << lastPosition
                  << " on reference ID: " << al.RefID << endl;
                SetErrorString("BamStandardIndex::Create", s.str());
                return false;
            }

            // if alignment's ref ID is valid & its bin is not a 'leaf'
            if ( (al.RefID >= 0) && (al.Bin < 4681) )
                SaveLinearOffsetEntry(refEntry.LinearOffsets, al.Position, al.GetEndPosition(), lastOffset);

            // changed to new BAI bin
            if ( al.Bin != lastBin ) {

                // if not first bin on reference, save previous bin data
                if ( currentBin != defaultValue )
                    SaveAlignmentChunkToBin(refEntry.Bins, currentBin, currentOffset, lastOffset);

                // update markers
                currentOffset = lastOffset;
                currentBin    = al.Bin;
                lastBin       = al.Bin;
                currentRefID  = al.RefID;

                // if invalid RefID, break out
                if ( currentRefID < 0 )
                    break;
            }

            // make sure that current file pointer is beyond lastOffset
            if ( m_reader->Tell() <= (int64_t)lastOffset ) {
                SetErrorString("BamStandardIndex::Create", "calculating offsets failed");
                return false;
            }

            // update lastOffset & lastPosition
            lastOffset   = m_reader->Tell();
            lastPosition = al.Position;
        }

        // after finishing alignments, if any data was read, check:
        if ( lastOffset != currentOffset ) {

            // store last alignment chunk to its bin, then write last reference entry with data
            SaveAlignmentChunkToBin(refEntry.Bins, currentBin, currentOffset, lastOffset);
            WriteReferenceEntry(refEntry);
        }

        // then write any empty references remaining at end of file
        for ( int i = currentRefID+1; i < numReferences; ++i ) {
            BaiReferenceEntry emptyEntry(i);
            WriteReferenceEntry(emptyEntry);
        }

    } catch ( BamException& e) {
        m_errorString = e.what();
        return false;
    }

    // rewind BamReader
    if ( !m_reader->Rewind() ) {
        const string readerError = m_reader->GetErrorString();
        const string message = "could not create index: \n\t" + readerError;
        SetErrorString("BamStandardIndex::Create", message);
        return false;
    }

    // return success
    return true;
}

// Assembly:
subq $0x7b8, %rsp            # imm = 0x7B8
movq %rdi, 0x7a8(%rsp)
movq 0x7a8(%rsp), %rax
movq %rax, 0xd8(%rsp)
cmpq $0x0, 0x8(%rax)
je 0xb1edf
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x77980
testb $0x1, %al
jne 0xb202a
leaq 0x787(%rsp), %rdi
movq %rdi, 0xd0(%rsp)
callq 0x7b5f0
movq 0xd0(%rsp), %rdx
leaq 0x39296(%rip), %rsi     # 0xeb199
leaq 0x788(%rsp), %rdi
callq 0x78e70
jmp 0xb1f12
leaq 0x74f(%rsp), %rdi
movq %rdi, 0xc8(%rsp)
callq 0x7b5f0
movq 0xc8(%rsp), %rdx
leaq 0x3927c(%rip), %rsi     # 0xeb1b2
leaq 0x750(%rsp), %rdi
callq 0x78e70
jmp 0xb1f45
movq 0xd8(%rsp), %rdi
leaq 0x788(%rsp), %rsi
leaq 0x750(%rsp), %rdx
callq 0x71d90
jmp 0xb1f64
leaq 0x750(%rsp), %rdi
callq 0x7cce8
jmp 0xb1f73
leaq 0x74f(%rsp), %rdi
callq 0x76f80
leaq 0x788(%rsp), %rdi
callq 0x7cce8
jmp 0xb1f8f
leaq 0x787(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x7b7(%rsp)
jmp 0xb2f90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2018
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb1ffa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x750(%rsp), %rdi
callq 0x7cce8
jmp 0xb1ff8
jmp 0xb1ffa
leaq 0x74f(%rsp), %rdi
callq 0x76f80
leaq 0x788(%rsp), %rdi
callq 0x7cce8
jmp 0xb2016
jmp 0xb2018
leaq 0x787(%rsp), %rdi
callq 0x76f80
jmp 0xb2fa1
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x7b0d0
testb $0x1, %al
jne 0xb219c
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x728(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
callq 0x7bbf0
movq 0xc0(%rsp), %rdx
leaq 0x38a96(%rip), %rsi     # 0xeab09
leaq 0x708(%rsp), %rdi
callq 0x75e70
jmp 0xb2082
leaq 0x6e7(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0x7b5f0
movq 0xb8(%rsp), %rdx
leaq 0x390f3(%rip), %rsi     # 0xeb199
leaq 0x6e8(%rsp), %rdi
callq 0x78e70
jmp 0xb20b5
movq 0xd8(%rsp), %rdi
leaq 0x6e8(%rsp), %rsi
leaq 0x708(%rsp), %rdx
callq 0x71d90
jmp 0xb20d4
leaq 0x6e8(%rsp), %rdi
callq 0x7cce8
jmp 0xb20e3
leaq 0x6e7(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x7b7(%rsp)
leaq 0x708(%rsp), %rdi
callq 0x7cce8
jmp 0xb2174
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2188
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2158
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x6e8(%rsp), %rdi
callq 0x7cce8
jmp 0xb2156
jmp 0xb2158
leaq 0x6e7(%rsp), %rdi
callq 0x76f80
leaq 0x708(%rsp), %rdi
callq 0x7cce8
jmp 0xb2186
leaq 0x728(%rsp), %rdi
callq 0x7cce8
jmp 0xb2f90
jmp 0xb2188
leaq 0x728(%rsp), %rdi
callq 0x7cce8
jmp 0xb2197
jmp 0xb2fa1
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x6a0(%rsp), %rdi
callq 0x78400
jmp 0xb21b7
leaq 0x680(%rsp), %rdi
callq 0x78cd0
jmp 0xb21c6
leaq 0x6c0(%rsp), %rdi
leaq 0x6a0(%rsp), %rsi
leaq 0x680(%rsp), %rdx
callq 0x7c720
jmp 0xb21e5
leaq 0x680(%rsp), %rdi
callq 0x7cce8
jmp 0xb21f4
leaq 0x6a0(%rsp), %rdi
callq 0x7cce8
jmp 0xb2203
movq 0xd8(%rsp), %rdi
leaq 0x6c0(%rsp), %rsi
movl $0x3, %edx
callq 0x7a8f0
jmp 0xb221f
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x77160
movl %eax, 0xb4(%rsp)
jmp 0xb2239
movq 0xd8(%rsp), %rdi
movl 0xb4(%rsp), %eax
movl %eax, 0x674(%rsp)
leaq 0x674(%rsp), %rax
movq %rax, 0x678(%rsp)
movq 0x678(%rsp), %rsi
callq 0x7a670
jmp 0xb226e
movq 0xd8(%rsp), %rdi
callq 0x742d0
jmp 0xb227d
movq 0xd8(%rsp), %rax
movl $0xffffffff, 0x670(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x66c(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x668(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x664(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x660(%rsp) # imm = 0xFFFFFFFF
movq 0x8(%rax), %rdi
callq 0x739a0
movq %rax, 0xa8(%rsp)
jmp 0xb22cf
movq 0xa8(%rsp), %rax
movq %rax, 0x658(%rsp)
movq 0x658(%rsp), %rax
movq %rax, 0x650(%rsp)
movl $0xffffffff, 0x64c(%rsp) # imm = 0xFFFFFFFF
leaq 0x4f0(%rsp), %rdi
callq 0x72830
jmp 0xb2309
movl $0xffffffff, 0x49c(%rsp) # imm = 0xFFFFFFFF
leaq 0x4a0(%rsp), %rdi
leaq 0x49c(%rsp), %rsi
callq 0x796c0
jmp 0xb232b
jmp 0xb232d
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x4f0(%rsp), %rsi
callq 0x74860
movb %al, 0xa7(%rsp)
jmp 0xb234f
movb 0xa7(%rsp), %al
testb $0x1, %al
jne 0xb235f
jmp 0xb2c1b
movl 0x660(%rsp), %eax
cmpl 0x598(%rsp), %eax
je 0xb2634
cmpl $-0x1, 0x660(%rsp)
je 0xb2571
movq 0xd8(%rsp), %rdi
leaq 0x4a8(%rsp), %rsi
leaq 0x66c(%rsp), %rdx
leaq 0x658(%rsp), %rcx
leaq 0x650(%rsp), %r8
callq 0x7b9c0
jmp 0xb23b0
movq 0xd8(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
callq 0x726b0
jmp 0xb23c7
movq 0xd8(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
callq 0x740a0
jmp 0xb23de
movl 0x660(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x498(%rsp)
movl 0x498(%rsp), %eax
cmpl 0x598(%rsp), %eax
jge 0xb2530
leaq 0x448(%rsp), %rdi
leaq 0x498(%rsp), %rsi
callq 0x796c0
jmp 0xb241a
movq 0xd8(%rsp), %rdi
leaq 0x448(%rsp), %rsi
callq 0x726b0
jmp 0xb2431
leaq 0x448(%rsp), %rdi
callq 0x74200
jmp 0xb2440
jmp 0xb2442
movl 0x498(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x498(%rsp)
jmp 0xb23ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2d92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb24a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x680(%rsp), %rdi
callq 0x7cce8
jmp 0xb24a7
jmp 0xb24a9
leaq 0x6a0(%rsp), %rdi
callq 0x7cce8
jmp 0xb24b8
jmp 0xb2d92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2d81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2d70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2d5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x448(%rsp), %rdi
callq 0x74200
jmp 0xb252b
jmp 0xb2d5f
movq 0x650(%rsp), %rax
movq %rax, 0x658(%rsp)
movzwl 0x5a0(%rsp), %eax
movl %eax, 0x66c(%rsp)
movzwl 0x5a0(%rsp), %eax
movl %eax, 0x668(%rsp)
movl 0x598(%rsp), %eax
movl %eax, 0x664(%rsp)
jmp 0xb2608
movl $0x0, 0x444(%rsp)
movl 0x444(%rsp), %eax
cmpl 0x598(%rsp), %eax
jge 0xb2606
leaq 0x3f0(%rsp), %rdi
leaq 0x444(%rsp), %rsi
callq 0x796c0
jmp 0xb25a3
movq 0xd8(%rsp), %rdi
leaq 0x3f0(%rsp), %rsi
callq 0x726b0
jmp 0xb25ba
leaq 0x3f0(%rsp), %rdi
callq 0x74200
jmp 0xb25c9
jmp 0xb25cb
movl 0x444(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x444(%rsp)
jmp 0xb257c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x3f0(%rsp), %rdi
callq 0x74200
jmp 0xb2601
jmp 0xb2d5f
jmp 0xb2608
movl 0x598(%rsp), %eax
movl %eax, 0x4a0(%rsp)
movl 0x598(%rsp), %eax
movl %eax, 0x660(%rsp)
movl $0xffffffff, 0x668(%rsp) # imm = 0xFFFFFFFF
jmp 0xb2951
movl 0x64c(%rsp), %eax
cmpl 0x59c(%rsp), %eax
jle 0xb294f
leaq 0x247(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x7b5f0
movq 0x98(%rsp), %rdx
leaq 0x38a70(%rip), %rsi     # 0xeb0dc
leaq 0x248(%rsp), %rdi
callq 0x78e70
jmp 0xb267b
movl $0x10, %edi
movl $0x8, %esi
callq 0x7b8d0
movl %eax, 0x94(%rsp)
jmp 0xb2693
movl 0x94(%rsp), %edx
leaq 0x268(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x7a4b0
jmp 0xb26b1
leaq 0x248(%rsp), %rdi
callq 0x7cce8
jmp 0xb26c0
leaq 0x247(%rsp), %rdi
callq 0x76f80
leaq 0x278(%rsp), %rdi
leaq 0x38b01(%rip), %rsi     # 0xeb1dd
callq 0x768e0
movq %rax, 0x88(%rsp)
jmp 0xb26eb
movq 0x88(%rsp), %rdi
movq 0x5f81e(%rip), %rsi     # 0x111f18
callq 0x76cc0
movq %rax, 0x80(%rsp)
jmp 0xb2709
movq 0x80(%rsp), %rdi
leaq 0x38af3(%rip), %rsi     # 0xeb20b
callq 0x768e0
movq %rax, 0x78(%rsp)
jmp 0xb2724
movq 0x78(%rsp), %rdi
movl 0x59c(%rsp), %esi
callq 0x7b150
movq %rax, 0x70(%rsp)
jmp 0xb273c
movq 0x70(%rsp), %rdi
leaq 0x38ae0(%rip), %rsi     # 0xeb228
callq 0x768e0
movq %rax, 0x68(%rsp)
jmp 0xb2754
movq 0x68(%rsp), %rdi
movl 0x64c(%rsp), %esi
callq 0x7b150
movq %rax, 0x60(%rsp)
jmp 0xb276c
movq 0x60(%rsp), %rdi
leaq 0x38ad1(%rip), %rsi     # 0xeb249
callq 0x768e0
movq %rax, 0x58(%rsp)
jmp 0xb2784
movq 0x58(%rsp), %rdi
movl 0x598(%rsp), %esi
callq 0x7b150
movq %rax, 0x50(%rsp)
jmp 0xb279c
movq 0x50(%rsp), %rdi
movq 0x5f770(%rip), %rsi     # 0x111f18
callq 0x76cc0
jmp 0xb27af
leaq 0x21f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x7b5f0
movq 0x48(%rsp), %rdx
leaq 0x389cc(%rip), %rsi     # 0xeb199
leaq 0x220(%rsp), %rdi
callq 0x78e70
jmp 0xb27dc
leaq 0x1f8(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0x76880
jmp 0xb27f3
movq 0xd8(%rsp), %rdi
leaq 0x220(%rsp), %rsi
leaq 0x1f8(%rsp), %rdx
callq 0x71d90
jmp 0xb2812
leaq 0x1f8(%rsp), %rdi
callq 0x7cce8
jmp 0xb2821
leaq 0x220(%rsp), %rdi
callq 0x7cce8
jmp 0xb2830
leaq 0x21f(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x7b7(%rsp)
movl $0x1, 0x1f4(%rsp)
leaq 0x268(%rsp), %rdi
callq 0x74f60
jmp 0xb2936
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb289d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x7cce8
jmp 0xb289b
jmp 0xb289d
leaq 0x247(%rsp), %rdi
callq 0x76f80
jmp 0xb2d5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb293b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2927
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2916
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x7cce8
jmp 0xb2914
jmp 0xb2916
leaq 0x220(%rsp), %rdi
callq 0x7cce8
jmp 0xb2925
jmp 0xb2927
leaq 0x21f(%rsp), %rdi
callq 0x76f80
jmp 0xb293b
jmp 0xb2d1b
leaq 0x268(%rsp), %rdi
callq 0x74f60
jmp 0xb294a
jmp 0xb2d5f
jmp 0xb2951
cmpl $0x0, 0x598(%rsp)
jl 0xb29d1
movzwl 0x5a0(%rsp), %eax
cmpl $0x1249, %eax           # imm = 0x1249
jge 0xb29d1
leaq 0x4d8(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x59c(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x4f0(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x76240
movl %eax, 0x44(%rsp)
jmp 0xb299b
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rsi
movq 0xd8(%rsp), %rdi
movl 0x44(%rsp), %eax
movl %eax, 0x1f0(%rsp)
leaq 0x1f0(%rsp), %rcx
leaq 0x650(%rsp), %r8
callq 0x7b2a0
jmp 0xb29cf
jmp 0xb29d1
movzwl 0x5a0(%rsp), %eax
cmpl 0x668(%rsp), %eax
je 0xb2a6e
cmpl $-0x1, 0x66c(%rsp)
je 0xb2a21
movq 0xd8(%rsp), %rdi
leaq 0x4a8(%rsp), %rsi
leaq 0x66c(%rsp), %rdx
leaq 0x658(%rsp), %rcx
leaq 0x650(%rsp), %r8
callq 0x7b9c0
jmp 0xb2a1f
jmp 0xb2a21
movq 0x650(%rsp), %rax
movq %rax, 0x658(%rsp)
movzwl 0x5a0(%rsp), %eax
movl %eax, 0x66c(%rsp)
movzwl 0x5a0(%rsp), %eax
movl %eax, 0x668(%rsp)
movl 0x598(%rsp), %eax
movl %eax, 0x664(%rsp)
cmpl $0x0, 0x664(%rsp)
jge 0xb2a6c
jmp 0xb2c1b
jmp 0xb2a6e
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x739a0
movq %rax, 0x28(%rsp)
jmp 0xb2a86
movq 0x28(%rsp), %rax
cmpq 0x650(%rsp), %rax
jg 0xb2be3
leaq 0x1cf(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x7b5f0
movq 0x20(%rsp), %rdx
leaq 0x386e2(%rip), %rsi     # 0xeb199
leaq 0x1d0(%rsp), %rdi
callq 0x78e70
jmp 0xb2ac6
leaq 0x1a7(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x18(%rsp), %rdx
leaq 0x38778(%rip), %rsi     # 0xeb25c
leaq 0x1a8(%rsp), %rdi
callq 0x78e70
jmp 0xb2af3
movq 0xd8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
callq 0x71d90
jmp 0xb2b12
leaq 0x1a8(%rsp), %rdi
callq 0x7cce8
jmp 0xb2b21
leaq 0x1a7(%rsp), %rdi
callq 0x76f80
leaq 0x1d0(%rsp), %rdi
callq 0x7cce8
jmp 0xb2b3d
leaq 0x1cf(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x7b7(%rsp)
movl $0x1, 0x1f4(%rsp)
jmp 0xb2d1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2bd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2bb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x7cce8
jmp 0xb2bb1
jmp 0xb2bb3
leaq 0x1a7(%rsp), %rdi
callq 0x76f80
leaq 0x1d0(%rsp), %rdi
callq 0x7cce8
jmp 0xb2bcf
jmp 0xb2bd1
leaq 0x1cf(%rsp), %rdi
callq 0x76f80
jmp 0xb2d5f
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x739a0
movq %rax, 0x10(%rsp)
jmp 0xb2bfb
movq 0x10(%rsp), %rax
movq %rax, 0x650(%rsp)
movl 0x59c(%rsp), %eax
movl %eax, 0x64c(%rsp)
jmp 0xb232d
movq 0x650(%rsp), %rax
cmpq 0x658(%rsp), %rax
je 0xb2c75
movq 0xd8(%rsp), %rdi
leaq 0x4a8(%rsp), %rsi
leaq 0x66c(%rsp), %rdx
leaq 0x658(%rsp), %rcx
leaq 0x650(%rsp), %r8
callq 0x7b9c0
jmp 0xb2c5c
movq 0xd8(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
callq 0x726b0
jmp 0xb2c73
jmp 0xb2c75
movl 0x664(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a0(%rsp)
movl 0x1a0(%rsp), %eax
movq 0x678(%rsp), %rcx
cmpl (%rcx), %eax
jge 0xb2d10
leaq 0x150(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x796c0
jmp 0xb2cb0
movq 0xd8(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x726b0
jmp 0xb2cc7
leaq 0x150(%rsp), %rdi
callq 0x74200
jmp 0xb2cd6
jmp 0xb2cd8
movl 0x1a0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a0(%rsp)
jmp 0xb2c86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x74200
jmp 0xb2d0e
jmp 0xb2d5f
movl $0x0, 0x1f4(%rsp)
leaq 0x4a0(%rsp), %rdi
callq 0x74200
jmp 0xb2d2a
leaq 0x4f0(%rsp), %rdi
callq 0x7a0d0
jmp 0xb2d39
leaq 0x6c0(%rsp), %rdi
callq 0x7cce8
jmp 0xb2d48
movl 0x1f4(%rsp), %eax
testl %eax, %eax
je 0xb2d5a
jmp 0xb2d55
jmp 0xb2f90
jmp 0xb2e1f
leaq 0x4a0(%rsp), %rdi
callq 0x74200
jmp 0xb2d6e
jmp 0xb2d70
leaq 0x4f0(%rsp), %rdi
callq 0x7a0d0
jmp 0xb2d7f
jmp 0xb2d81
leaq 0x6c0(%rsp), %rdi
callq 0x7cce8
jmp 0xb2d90
jmp 0xb2d92
movl 0x774(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xb2fa1
movq 0x778(%rsp), %rdi
callq 0x72fc0
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq 0xd8(%rsp), %rdi
movq %rax, %rsi
addq $0x10, %rdi
callq 0x78d10
jmp 0xb2de2
movb $0x0, 0x7b7(%rsp)
movl $0x1, 0x1f4(%rsp)
callq 0x7a790
jmp 0xb2f90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
callq 0x7a790
jmp 0xb2e1a
jmp 0xb2fa1
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x7b0d0
testb $0x1, %al
jne 0xb2f88
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x128(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7bbf0
movq 0x8(%rsp), %rdx
leaq 0x37ca7(%rip), %rsi     # 0xeab09
leaq 0x108(%rsp), %rdi
callq 0x75e70
jmp 0xb2e71
leaq 0xe7(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x7b5f0
movq (%rsp), %rdx
leaq 0x3830c(%rip), %rsi     # 0xeb199
leaq 0xe8(%rsp), %rdi
callq 0x78e70
jmp 0xb2e9c
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0x108(%rsp), %rdx
callq 0x71d90
jmp 0xb2ebb
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xb2eca
leaq 0xe7(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x7b7(%rsp)
movl $0x1, 0x1f4(%rsp)
leaq 0x108(%rsp), %rdi
callq 0x7cce8
jmp 0xb2f66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2f77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
jmp 0xb2f4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x778(%rsp)
movl %eax, 0x774(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xb2f48
jmp 0xb2f4a
leaq 0xe7(%rsp), %rdi
callq 0x76f80
leaq 0x108(%rsp), %rdi
callq 0x7cce8
jmp 0xb2f75
leaq 0x128(%rsp), %rdi
callq 0x7cce8
jmp 0xb2f90
jmp 0xb2f77
leaq 0x128(%rsp), %rdi
callq 0x7cce8
jmp 0xb2f86
jmp 0xb2fa1
movb $0x1, 0x7b7(%rsp)
movb 0x7b7(%rsp), %al
andb $0x1, %al
addq $0x7b8, %rsp            # imm = 0x7B8
retq
movq 0x778(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw %cs:(%rax,%rax)