// File: zeeev[P]DASVC/src/annotate.cpp
// Function: processBlock(std::__cxx11::list<BamTools::BamAlignment, std::allocator<BamTools::BamAlignment>>&, std::vector<BamTools::BamAlignment, std::allocator<BamTools::BamAlignment>>&, int, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, long, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, long>>>&)
int processBlock(std::list< BamAlignment > & readBuffer ,
                 std::vector< BamAlignment > & processed,
                 int blockId,
                 std::map<std::string, long int> & queryLens )
{

    int totalAlignedBases = 0;

    std::vector<BamAlignment> reads;

    std::map<int, int> matchesPerContig;

    for(std::list<BamAlignment>::iterator it = readBuffer.begin();
        it != readBuffer.end(); it++){

        long int queryStart = 0;

        for(std::vector<CigarOp>::iterator iz = it->CigarData.begin() ;
            iz != it->CigarData.end() ; iz++){
            /* first matching query position */
            if( (iz->Type != 'H') && (iz->Type != 'S') ){
                break;
            }
            advanceQuery(iz->Type, iz->Length, &queryStart, true);
        }

        long int queryEnd   = 0;
        int seen            = 0;

        /* if alignment starts without clip bump the stop condition */
        if(it->CigarData.front().Type != 'H'
           && it->CigarData.front().Type != 'S'){
            seen += 1;
        }


        for(std::vector<CigarOp>::iterator iz = it->CigarData.begin() ;
            iz != it->CigarData.end() ; iz++){
            /* first matching query position */

            if( (iz->Type == 'H') || (iz->Type == 'S') ){
                seen += 1;
            }
            if(seen > 1){
                break;
            }

            advanceQuery(iz->Type, iz->Length, &queryEnd, true);
        }

        int matchingBases = 0;

        double pctID = percentID(it->CigarData, it->Length, &matchingBases);

        if(matchesPerContig.find(it->RefID) != matchesPerContig.end() ){
            matchesPerContig[it->RefID] += matchingBases;
        }
        else{
            matchesPerContig[it->RefID] = matchingBases;
        }

        /* reverse strand needs to flip */

        if(it->AlignmentFlag & 16){
            if(queryLens.find(it->Name) == queryLens.end()){
                std::cerr << "FATAL: query name not found in query .fai" << std::endl;
                exit(1);
            }

            queryStart = queryLens[it->Name] - queryStart;
            queryEnd   = queryLens[it->Name] - queryEnd  ;

            int tmp = queryStart;
            queryStart = queryEnd;
            queryEnd   = tmp;
        }

        /* position where the alignment starts matching */

        it->AddTag<int>( "QS", "i", queryStart      );

        /* position in the aligment where it stops matching */

        it->AddTag<int>( "QE", "i", queryEnd        );

        /* lenght of the alignment block */

        it->AddTag<int>( "QL", "i", (queryEnd - queryStart));


        it->AddTag<int>( "TS", "i", it->Position);
        it->AddTag<int>( "TE", "i", it->GetEndPosition());

        /* number of matching bases M= */

        it->AddTag<int>( "MB", "i", matchingBases);

        /* percent ID */

        it->AddTag<float>( "PI", "f", pctID);

        /* alignment group ; just another way of saying query name */

        it->AddTag<int>( "BI", "i", blockId);

        if(matchingBases > 200 && pctID > 0.85 ){
            totalAlignedBases += matchingBases;
            reads.push_back(*it);
        }
    }

    sort(reads.begin(), reads.end(),  qStartSort);

    /* best contig match */

    int maxRefId = 0;
    int maxValue = 0;

    for(std::map<int, int>::iterator mp = matchesPerContig.begin();
        mp != matchesPerContig.end(); mp++){
        if(mp->second > maxValue){
            maxRefId = mp->first;
            maxValue = mp->second;
        }
    }

    for(int i = 0; i < reads.size(); i++){

        if(reads[i].RefID != maxRefId){
            continue;
        }
        processed.push_back(reads[i]);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x540, %rsp            # imm = 0x540
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x11c40
leaq -0x70(%rbp), %rdi
callq 0x11c60
movq -0x8(%rbp), %rdi
callq 0x11c80
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
callq 0x11ce0
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x11cb0
testb $0x1, %al
jne 0xf6f3
jmp 0x10668
movq $0x0, -0x88(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rdi
addq $0xb8, %rdi
callq 0x11d30
movq %rax, -0x90(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rdi
addq $0xb8, %rdi
callq 0x11da0
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x11d60
testb $0x1, %al
jne 0xf758
jmp 0xf7f9
leaq -0x90(%rbp), %rdi
callq 0x11dd0
movsbl (%rax), %eax
cmpl $0x48, %eax
je 0xf782
leaq -0x90(%rbp), %rdi
callq 0x11dd0
movsbl (%rax), %eax
cmpl $0x53, %eax
je 0xf782
jmp 0xf7f9
leaq -0x90(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x11dd0
movq -0x3d8(%rbp), %rdi
movsbl (%rax), %eax
movl %eax, -0x3d0(%rbp)
callq 0x11dd0
movl -0x3d0(%rbp), %edi
movl 0x4(%rax), %esi
leaq -0x88(%rbp), %rdx
movl $0x1, %ecx
callq 0x1e030
jmp 0xf7c6
jmp 0xf7c8
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
callq 0x11df0
movq %rax, -0xb0(%rbp)
jmp 0xf71d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x10806
movq $0x0, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rdi
addq $0xb8, %rdi
callq 0x11e30
movsbl (%rax), %eax
cmpl $0x48, %eax
je 0xf85d
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rdi
addq $0xb8, %rdi
callq 0x11e30
movsbl (%rax), %eax
cmpl $0x53, %eax
je 0xf85d
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rdi
addq $0xb8, %rdi
callq 0x11d30
movq %rax, -0xc8(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rdi
addq $0xb8, %rdi
callq 0x11da0
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x11d60
testb $0x1, %al
jne 0xf8b7
jmp 0xf959
leaq -0xc8(%rbp), %rdi
callq 0x11dd0
movsbl (%rax), %eax
cmpl $0x48, %eax
je 0xf8df
leaq -0xc8(%rbp), %rdi
callq 0x11dd0
movsbl (%rax), %eax
cmpl $0x53, %eax
jne 0xf8ee
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
cmpl $0x1, -0xbc(%rbp)
jle 0xf8f9
jmp 0xf959
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x11dd0
movq -0x3e8(%rbp), %rdi
movsbl (%rax), %eax
movl %eax, -0x3dc(%rbp)
callq 0x11dd0
movl -0x3dc(%rbp), %edi
movl 0x4(%rax), %esi
leaq -0xb8(%rbp), %rdx
movl $0x1, %ecx
callq 0x1e030
jmp 0xf93d
jmp 0xf93f
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
callq 0x11df0
movq %rax, -0xd8(%rbp)
jmp 0xf87c
movl $0x0, -0xdc(%rbp)
leaq -0x78(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x11d10
movq -0x400(%rbp), %rdi
addq $0xb8, %rax
movq %rax, -0x3f8(%rbp)
callq 0x11d10
movq -0x3f8(%rbp), %rdi
movl 0x20(%rax), %esi
leaq -0xdc(%rbp), %rdx
callq 0x1ded0
movsd %xmm0, -0x3f0(%rbp)
jmp 0xf9ac
movsd -0x3f0(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rsi
addq $0xa8, %rsi
leaq -0x70(%rbp), %rdi
callq 0x11e90
movq %rax, -0x408(%rbp)
jmp 0xf9e1
movq -0x408(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x11ec0
movq %rax, -0xf8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x11e60
testb $0x1, %al
jne 0xfa18
jmp 0xfa5c
movl -0xdc(%rbp), %eax
movl %eax, -0x414(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rsi
addq $0xa8, %rsi
leaq -0x70(%rbp), %rdi
callq 0x11ef0
movq %rax, -0x410(%rbp)
jmp 0xfa49
movq -0x410(%rbp), %rax
movl -0x414(%rbp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
jmp 0xfa9c
movl -0xdc(%rbp), %eax
movl %eax, -0x424(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rsi
addq $0xa8, %rsi
leaq -0x70(%rbp), %rdi
callq 0x11ef0
movq %rax, -0x420(%rbp)
jmp 0xfa8d
movq -0x420(%rbp), %rax
movl -0x424(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movl 0xb4(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xfc09
movq -0x20(%rbp), %rax
movq %rax, -0x438(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq -0x438(%rbp), %rdi
movq %rax, %rsi
callq 0x12000
movq %rax, -0x430(%rbp)
jmp 0xfae3
movq -0x430(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x20(%rbp), %rdi
callq 0x12030
movq %rax, -0x108(%rbp)
leaq -0x100(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x11fd0
testb $0x1, %al
jne 0xfb1a
jmp 0xfb55
movq 0x9e4cf(%rip), %rdi     # 0xadff0
leaq 0x70616(%rip), %rsi     # 0x8013e
callq 0x6560
movq %rax, -0x440(%rbp)
jmp 0xfb36
movq -0x440(%rbp), %rdi
movq 0x9e464(%rip), %rsi     # 0xadfa8
callq 0x65c0
jmp 0xfb4b
movl $0x1, %edi
callq 0x66f0
movq -0x20(%rbp), %rax
movq %rax, -0x450(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq -0x450(%rbp), %rdi
movq %rax, %rsi
callq 0x12060
movq %rax, -0x448(%rbp)
jmp 0xfb81
movq -0x448(%rbp), %rax
movq (%rax), %rax
movq -0x88(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x460(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq -0x460(%rbp), %rdi
movq %rax, %rsi
callq 0x12060
movq %rax, -0x458(%rbp)
jmp 0xfbc8
movq -0x458(%rbp), %rax
movq (%rax), %rax
subq -0xb8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x88(%rbp), %rax
movl %eax, -0x10c(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x88(%rbp)
movslq -0x10c(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x470(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x468(%rbp)
callq 0x6a20
movq -0x468(%rbp), %rdx
leaq 0x7049e(%rip), %rsi     # 0x800d8
leaq -0x130(%rbp), %rdi
callq 0x11570
jmp 0xfc48
leaq -0x159(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x6a20
movq -0x478(%rbp), %rdx
leaq 0x71d0d(%rip), %rsi     # 0x81976
leaq -0x158(%rbp), %rdi
callq 0x11570
jmp 0xfc77
movq -0x470(%rbp), %rdi
movl -0x88(%rbp), %eax
movl %eax, -0x160(%rbp)
leaq -0x130(%rbp), %rsi
leaq -0x158(%rbp), %rdx
leaq -0x160(%rbp), %rcx
callq 0x11920
jmp 0xfca6
leaq -0x158(%rbp), %rdi
callq 0x6ba8
leaq -0x159(%rbp), %rdi
callq 0x6600
leaq -0x130(%rbp), %rdi
callq 0x6ba8
leaq -0x131(%rbp), %rdi
callq 0x6600
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x488(%rbp)
leaq -0x181(%rbp), %rdi
movq %rdi, -0x480(%rbp)
callq 0x6a20
movq -0x480(%rbp), %rdx
leaq 0x703da(%rip), %rsi     # 0x800e1
leaq -0x180(%rbp), %rdi
callq 0x11570
jmp 0xfd15
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x6a20
movq -0x490(%rbp), %rdx
leaq 0x71c40(%rip), %rsi     # 0x81976
leaq -0x1a8(%rbp), %rdi
callq 0x11570
jmp 0xfd44
movq -0x488(%rbp), %rdi
movl -0xb8(%rbp), %eax
movl %eax, -0x1b0(%rbp)
leaq -0x180(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
leaq -0x1b0(%rbp), %rcx
callq 0x11920
jmp 0xfd73
leaq -0x1a8(%rbp), %rdi
callq 0x6ba8
leaq -0x1a9(%rbp), %rdi
callq 0x6600
leaq -0x180(%rbp), %rdi
callq 0x6ba8
leaq -0x181(%rbp), %rdi
callq 0x6600
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x4a0(%rbp)
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x498(%rbp)
callq 0x6a20
movq -0x498(%rbp), %rdx
leaq 0x70307(%rip), %rsi     # 0x800db
leaq -0x1d0(%rbp), %rdi
callq 0x11570
jmp 0xfde2
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x4a8(%rbp)
callq 0x6a20
movq -0x4a8(%rbp), %rdx
leaq 0x71b73(%rip), %rsi     # 0x81976
leaq -0x1f8(%rbp), %rdi
callq 0x11570
jmp 0xfe11
movq -0x4a0(%rbp), %rdi
movl -0xb8(%rbp), %eax
movl -0x88(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x200(%rbp)
leaq -0x1d0(%rbp), %rsi
leaq -0x1f8(%rbp), %rdx
leaq -0x200(%rbp), %rcx
callq 0x11920
jmp 0xfe48
leaq -0x1f8(%rbp), %rdi
callq 0x6ba8
leaq -0x1f9(%rbp), %rdi
callq 0x6600
leaq -0x1d0(%rbp), %rdi
callq 0x6ba8
leaq -0x1d1(%rbp), %rdi
callq 0x6600
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x4b8(%rbp)
leaq -0x221(%rbp), %rdi
movq %rdi, -0x4b0(%rbp)
callq 0x6a20
movq -0x4b0(%rbp), %rdx
leaq 0x702bf(%rip), %rsi     # 0x80168
leaq -0x220(%rbp), %rdi
callq 0x11570
jmp 0xfeb7
leaq -0x249(%rbp), %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x6a20
movq -0x4c0(%rbp), %rdx
leaq 0x71a9e(%rip), %rsi     # 0x81976
leaq -0x248(%rbp), %rdi
callq 0x11570
jmp 0xfee6
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq -0x4b8(%rbp), %rdi
movq %rax, %rcx
addq $0xac, %rcx
leaq -0x220(%rbp), %rsi
leaq -0x248(%rbp), %rdx
callq 0x11920
jmp 0xff15
leaq -0x248(%rbp), %rdi
callq 0x6ba8
leaq -0x249(%rbp), %rdi
callq 0x6600
leaq -0x220(%rbp), %rdi
callq 0x6ba8
leaq -0x221(%rbp), %rdi
callq 0x6600
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x4d0(%rbp)
leaq -0x271(%rbp), %rdi
movq %rdi, -0x4c8(%rbp)
callq 0x6a20
movq -0x4c8(%rbp), %rdx
leaq 0x701f5(%rip), %rsi     # 0x8016b
leaq -0x270(%rbp), %rdi
callq 0x11570
jmp 0xff84
leaq -0x299(%rbp), %rdi
movq %rdi, -0x4d8(%rbp)
callq 0x6a20
movq -0x4d8(%rbp), %rdx
leaq 0x719d1(%rip), %rsi     # 0x81976
leaq -0x298(%rbp), %rdi
callq 0x11570
jmp 0xffb3
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x2cdf0
movl %eax, -0x4dc(%rbp)
jmp 0xffd0
movq -0x4d0(%rbp), %rdi
movl -0x4dc(%rbp), %eax
movl %eax, -0x2a0(%rbp)
leaq -0x270(%rbp), %rsi
leaq -0x298(%rbp), %rdx
leaq -0x2a0(%rbp), %rcx
callq 0x11920
jmp 0xffff
leaq -0x298(%rbp), %rdi
callq 0x6ba8
leaq -0x299(%rbp), %rdi
callq 0x6600
leaq -0x270(%rbp), %rdi
callq 0x6ba8
leaq -0x271(%rbp), %rdi
callq 0x6600
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x4f0(%rbp)
leaq -0x2c1(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x6a20
movq -0x4e8(%rbp), %rdx
leaq 0x7007e(%rip), %rsi     # 0x800de
leaq -0x2c0(%rbp), %rdi
callq 0x11570
jmp 0x1006e
leaq -0x2e9(%rbp), %rdi
movq %rdi, -0x4f8(%rbp)
callq 0x6a20
movq -0x4f8(%rbp), %rdx
leaq 0x718e7(%rip), %rsi     # 0x81976
leaq -0x2e8(%rbp), %rdi
callq 0x11570
jmp 0x1009d
movq -0x4f0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
leaq -0x2e8(%rbp), %rdx
leaq -0xdc(%rbp), %rcx
callq 0x11920
jmp 0x100c0
leaq -0x2e8(%rbp), %rdi
callq 0x6ba8
leaq -0x2e9(%rbp), %rdi
callq 0x6600
leaq -0x2c0(%rbp), %rdi
callq 0x6ba8
leaq -0x2c1(%rbp), %rdi
callq 0x6600
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x508(%rbp)
leaq -0x311(%rbp), %rdi
movq %rdi, -0x500(%rbp)
callq 0x6a20
movq -0x500(%rbp), %rdx
leaq 0x7004d(%rip), %rsi     # 0x8016e
leaq -0x310(%rbp), %rdi
callq 0x11570
jmp 0x1012f
leaq -0x339(%rbp), %rdi
movq %rdi, -0x510(%rbp)
callq 0x6a20
movq -0x510(%rbp), %rdx
leaq 0x70021(%rip), %rsi     # 0x80171
leaq -0x338(%rbp), %rdi
callq 0x11570
jmp 0x1015e
movq -0x508(%rbp), %rdi
movsd -0xe8(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x340(%rbp)
leaq -0x310(%rbp), %rsi
leaq -0x338(%rbp), %rdx
leaq -0x340(%rbp), %rcx
callq 0x12140
jmp 0x10195
leaq -0x338(%rbp), %rdi
callq 0x6ba8
leaq -0x339(%rbp), %rdi
callq 0x6600
leaq -0x310(%rbp), %rdi
callq 0x6ba8
leaq -0x311(%rbp), %rdi
callq 0x6600
leaq -0x78(%rbp), %rdi
callq 0x11d10
movq %rax, -0x520(%rbp)
leaq -0x361(%rbp), %rdi
movq %rdi, -0x518(%rbp)
callq 0x6a20
movq -0x518(%rbp), %rdx
leaq 0x6ff7d(%rip), %rsi     # 0x80173
leaq -0x360(%rbp), %rdi
callq 0x11570
jmp 0x10204
leaq -0x389(%rbp), %rdi
movq %rdi, -0x528(%rbp)
callq 0x6a20
movq -0x528(%rbp), %rdx
leaq 0x71751(%rip), %rsi     # 0x81976
leaq -0x388(%rbp), %rdi
callq 0x11570
jmp 0x10233
movq -0x520(%rbp), %rdi
leaq -0x360(%rbp), %rsi
leaq -0x388(%rbp), %rdx
leaq -0x14(%rbp), %rcx
callq 0x11920
jmp 0x10253
leaq -0x388(%rbp), %rdi
callq 0x6ba8
leaq -0x389(%rbp), %rdi
callq 0x6600
leaq -0x360(%rbp), %rdi
callq 0x6ba8
leaq -0x361(%rbp), %rdi
callq 0x6600
cmpl $0xc8, -0xdc(%rbp)
jle 0x1064f
movsd -0xe8(%rbp), %xmm0
movsd 0x6fe2d(%rip), %xmm1    # 0x800d0
ucomisd %xmm1, %xmm0
jbe 0x1064f
movl -0xdc(%rbp), %ecx
movl -0x24(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x24(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x12410
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x123a0
jmp 0x102d2
jmp 0x1064f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x10335
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1031d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x6ba8
leaq -0x159(%rbp), %rdi
callq 0x6600
leaq -0x130(%rbp), %rdi
callq 0x6ba8
leaq -0x131(%rbp), %rdi
callq 0x6600
jmp 0x10806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x103a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1038c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x6ba8
leaq -0x1a9(%rbp), %rdi
callq 0x6600
leaq -0x180(%rbp), %rdi
callq 0x6ba8
leaq -0x181(%rbp), %rdi
callq 0x6600
jmp 0x10806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x10413
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x103fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x6ba8
leaq -0x1f9(%rbp), %rdi
callq 0x6600
leaq -0x1d0(%rbp), %rdi
callq 0x6ba8
leaq -0x1d1(%rbp), %rdi
callq 0x6600
jmp 0x10806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x10482
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1046a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x6ba8
leaq -0x249(%rbp), %rdi
callq 0x6600
leaq -0x220(%rbp), %rdi
callq 0x6ba8
leaq -0x221(%rbp), %rdi
callq 0x6600
jmp 0x10806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x104f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x104d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x6ba8
leaq -0x299(%rbp), %rdi
callq 0x6600
leaq -0x270(%rbp), %rdi
callq 0x6ba8
leaq -0x271(%rbp), %rdi
callq 0x6600
jmp 0x10806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x10560
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x10548
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x6ba8
leaq -0x2e9(%rbp), %rdi
callq 0x6600
leaq -0x2c0(%rbp), %rdi
callq 0x6ba8
leaq -0x2c1(%rbp), %rdi
callq 0x6600
jmp 0x10806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x105cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x105b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x6ba8
leaq -0x339(%rbp), %rdi
callq 0x6600
leaq -0x310(%rbp), %rdi
callq 0x6ba8
leaq -0x311(%rbp), %rdi
callq 0x6600
jmp 0x10806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1063e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x10626
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x6ba8
leaq -0x389(%rbp), %rdi
callq 0x6600
leaq -0x360(%rbp), %rdi
callq 0x6ba8
leaq -0x361(%rbp), %rdi
callq 0x6600
jmp 0x10806
jmp 0x10651
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
callq 0x12430
movq %rax, -0x398(%rbp)
jmp 0xf6d0
leaq -0x40(%rbp), %rdi
movq %rdi, -0x530(%rbp)
callq 0x11650
movq -0x530(%rbp), %rdi
movq %rax, -0x3a0(%rbp)
callq 0x116c0
movq %rax, -0x3a8(%rbp)
movq -0x3a0(%rbp), %rdi
movq -0x3a8(%rbp), %rsi
leaq -0x1e97(%rip), %rdx     # 0xe810
callq 0x12460
jmp 0x106ae
movl $0x0, -0x3ac(%rbp)
movl $0x0, -0x3b0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x124b0
movq %rax, -0x3b8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x11ec0
movq %rax, -0x3c0(%rbp)
leaq -0x3b8(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
callq 0x11e60
testb $0x1, %al
jne 0x106fb
jmp 0x10757
leaq -0x3b8(%rbp), %rdi
callq 0x124e0
movl 0x4(%rax), %eax
cmpl -0x3b0(%rbp), %eax
jle 0x1073b
leaq -0x3b8(%rbp), %rdi
callq 0x124e0
movl (%rax), %eax
movl %eax, -0x3ac(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0x124e0
movl 0x4(%rax), %eax
movl %eax, -0x3b0(%rbp)
jmp 0x1073d
leaq -0x3b8(%rbp), %rdi
xorl %esi, %esi
callq 0x12500
movq %rax, -0x3c8(%rbp)
jmp 0x106d2
movl $0x0, -0x3cc(%rbp)
movslq -0x3cc(%rbp), %rax
movq %rax, -0x538(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x11620
movq %rax, %rcx
movq -0x538(%rbp), %rax
cmpq %rcx, %rax
jae 0x107e9
movslq -0x3cc(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x11860
movl 0xa8(%rax), %eax
cmpl -0x3ac(%rbp), %eax
je 0x107a7
jmp 0x107d5
movq -0x10(%rbp), %rax
movq %rax, -0x540(%rbp)
movslq -0x3cc(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x11860
movq -0x540(%rbp), %rdi
movq %rax, %rsi
callq 0x123a0
jmp 0x107d3
jmp 0x107d5
movl -0x3cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3cc(%rbp)
jmp 0x10761
leaq -0x70(%rbp), %rdi
callq 0x12540
leaq -0x40(%rbp), %rdi
callq 0x12560
xorl %eax, %eax
addq $0x540, %rsp            # imm = 0x540
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x12540
leaq -0x40(%rbp), %rdi
callq 0x12560
movq -0xa0(%rbp), %rdi
callq 0x6a10
nopw %cs:(%rax,%rax)