// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/process_vcf_fill_aa.cpp
// Function: fillAaMain(int, char**)
int fillAaMain(int argc, char** argv) {
    parseFillAaOptions(argc, argv);
    string line; // for reading the input files
    
    std::istream* vcfFile = createReader(opt::vcfFile.c_str());
    std::ifstream* ancSeqFile = new std::ifstream(opt::ancSeqFile.c_str());
    
    string refFastaFileRoot;
    if (opt::out.empty()) {
        refFastaFileRoot = stripExtension(opt::vcfFile);
    } else {
        refFastaFileRoot = opt::out;
    }
    // the output file
    std::ostream* outFile;
    if (opt::out == "") {
        outFile = &std::cout;
    } else {
        string outFN = refFastaFileRoot + "_AAfilled.vcf.gz";
        outFile = createWriter(outFN.c_str());
    }
    
    // Read in the whole ancestral sequence
    std::map<string, string> ancSeqs;
    getline(*ancSeqFile, line);
    string currentScaffold = line.substr(1,string::npos);
    ancSeqs[currentScaffold] = ""; ancSeqs[currentScaffold].reserve(50000000);
    while (getline(*ancSeqFile, line)) {
        if (line[0] != '>') {
            ancSeqs[currentScaffold].append(line);
        } else {
            // std::cerr << currentScaffold << " length: " << ancSeqs[currentScaffold].length() << std::endl;
            currentScaffold = line.substr(1,string::npos);
            ancSeqs[currentScaffold] = ""; ancSeqs[currentScaffold].reserve(50000000);
        }
    }
    
    // Now go through the vcf and add the AA fields
    int totalVariantNumber = 0;
    int aaDashCount = 0; int aaRefCount = 0; int aaAltCount = 0; int aaDiffCount = 0; int aaNcount = 0; int aaHetCount = 0;
    while (getline(*vcfFile, line)) {
        if (line[0] == '#' && line[1] == '#')
            *outFile << line << std::endl;
        else if (line[0] == '#' && line[1] == 'C') {
            if (opt::IndividualName == "") {
                *outFile << "##INFO=<ID=AA,Number=1,Type=String,Description=\"Ancestral allele\">" << std::endl;
                *outFile << line << std::endl;
            } else {
                *outFile << line << "\t" << opt::IndividualName << std::endl;
            }
        } else {
            totalVariantNumber++; string genotypeToAdd;
            std::vector<std::string> fields = split(line, '\t');
            std::vector<std::string> info = split(fields[7], ';');
            if (info[0] != "INDEL") {
                assert(ancSeqs.find(fields[0]) != ancSeqs.end());
                char AA;
                if (ancSeqs[fields[0]].length() == 0) {
                    AA = 'N';
                } else {
                    AA = std::toupper(ancSeqs[fields[0]][atoi(fields[1].c_str())-1]);
                    if (AA == '-') { aaDashCount++; genotypeToAdd = "./."; }
                    else if (AA == 'N') { aaNcount++; genotypeToAdd = "./."; }
                    else if (isDNAonly(AA)) {
                         if (AA == fields[3][0]) { aaRefCount++; genotypeToAdd = "0/0"; }
                        else if (AA == fields[4][0]) { aaAltCount++; genotypeToAdd = "1/1"; }
                        else if (!((AA == fields[3][0]) || (AA == fields[4][0]))) {
                            aaDiffCount++; genotypeToAdd = "./.";
                        }
                    } else {
                        aaHetCount++; string AAhetBases = returnHetIUPAC(AA);
                        if ((AAhetBases[0] == fields[3][0]) && (AAhetBases[1] == fields[4][0])) {
                            genotypeToAdd = "1/0";
                        } else if ((AAhetBases[1] == fields[3][0]) && (AAhetBases[0] == fields[4][0])) {
                            genotypeToAdd = "1/0";
                        } else {
                            genotypeToAdd = "./.";
                        }
                    }
                    // std::cerr << fields[0] << "\t" << fields[1] << "\t" << fields[3] << "\t" << fields[4] << "\t" << AA << std::endl;
                    // assert((AA == fields[3][0]) || (AA == fields[4][0]));
                }
                if (opt::IndividualName == "") {
                    fields[7] += ";AA="; fields[7] += AA;
                    print_vector(fields, *outFile, '\t');
                } else {
                    fields.push_back(genotypeToAdd);
                    print_vector(fields, *outFile, '\t');
                }
            } else {
                if (opt::IndividualName == "") {
                    *outFile << line << std::endl;
                } else {
                    fields.push_back("./.");
                    print_vector(fields, *outFile, '\t');
                }
            }
            if (totalVariantNumber % 100000 == 0) {
                double totalAAfilled = aaRefCount + aaAltCount + aaDashCount + aaDiffCount + aaNcount;
                std::cerr << totalVariantNumber << " variants processed. AA=Ref:" << aaRefCount << "("<< 100*(aaRefCount/totalAAfilled) <<"%); AA=Alt:" << aaAltCount << "("<< 100*(aaAltCount/totalAAfilled) <<"%); AA='-':" << aaDashCount << "("<< 100*(aaDashCount/totalAAfilled) << "%); AA=?(Neither Ref nor Alt):" << aaDiffCount << "("<< 100*(aaDiffCount/totalAAfilled) <<"%); AA=N:" << aaNcount << "("<< 100*(aaNcount/totalAAfilled) << "%)" << std::endl;
            }
        }
    }
    // Final summary
    double totalAAfilled = aaRefCount + aaAltCount + aaDashCount + aaDiffCount;
    std::cerr << std::endl;
    std::cerr << "All " << totalVariantNumber << " variants processed. AA=Ref:" << aaRefCount << "("<< 100*(aaRefCount/totalAAfilled) <<"%); AA=Alt:" << aaAltCount << "("<< 100*(aaAltCount/totalAAfilled) <<"%); AA='-':" << aaDashCount << "("<< 100*(aaDashCount/totalAAfilled) << "%); AA=?(Neither Ref nor Alt):" << aaDiffCount << "("<< 100*(aaDiffCount/totalAAfilled) <<"%)" << std::endl;
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
callq 0x4f3ad
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0xbde1f(%rip), %rsi     # 0x10c128
leaq 0x98(%rsp), %rdi
leaq 0x108(%rsp), %rdx
callq 0x286de
leaq 0x98(%rsp), %rdi
movl $0x8, %esi
callq 0x53224
movq %rax, %rbx
leaq 0xa8(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x4e355
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r15
movq 0xbdddf(%rip), %rsi     # 0x10c148
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpq $0x0, 0xbdddb(%rip)     # 0x10c170
je 0x4e3ad
leaq 0xbddca(%rip), %rsi     # 0x10c168
leaq 0x108(%rsp), %rdi
callq 0x8270
jmp 0x4e3f1
leaq 0xbdd74(%rip), %rsi     # 0x10c128
leaq 0x98(%rsp), %rdi
callq 0x50803
leaq 0x108(%rsp), %rdi
leaq 0x98(%rsp), %r14
movq %r14, %rsi
callq 0x8540
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x4e3f1
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xbdd70(%rip), %rdi     # 0x10c168
leaq 0x83880(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
je 0x4e4b2
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rdx
addq %rsi, %rdx
callq 0x2e45c
leaq 0x884ea(%rip), %rsi     # 0xd6920
leaq 0x98(%rsp), %rdi
callq 0x88c0
movq 0x98(%rsp), %rsi
leaq 0xe8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x286de
leaq 0xe8(%rsp), %rdi
movl $0x10, %esi
callq 0x532b3
movq %rax, %r14
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4e493
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x4e4b9
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x4e4b9
movq 0xbcaff(%rip), %r14     # 0x10afb8
leaq 0xa0(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
leaq 0x58(%rsp), %rsi
movq %r15, %rdi
callq 0x8870
leaq 0xe8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x84a0
movq %r14, 0x20(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x3e394
movq 0x8(%rax), %rdx
leaq 0x8373f(%rip), %rcx     # 0xd1c7f
movq %rax, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x86c0
leaq 0x98(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x3e394
movl $0x2faf080, %esi        # imm = 0x2FAF080
movq %rax, %rdi
callq 0x86f0
leaq 0x58(%rsp), %r12
leaq 0x30(%rsp), %r13
leaq 0xe8(%rsp), %rbp
leaq 0x98(%rsp), %r14
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4e667
movq 0x58(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x4e645
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
movq $-0x1, %rcx
callq 0x84a0
movq %rbp, %rdi
movq %r13, %rsi
callq 0x8540
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4e605
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3e394
movq 0x8(%rax), %rdx
movq %rax, %rdi
xorl %esi, %esi
leaq 0x8365f(%rip), %rcx     # 0xd1c7f
xorl %r8d, %r8d
callq 0x86c0
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3e394
movl $0x2faf080, %esi        # imm = 0x2FAF080
movq %rax, %rdi
callq 0x86f0
jmp 0x4e589
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3e394
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %rax, %rdi
callq 0x8180
jmp 0x4e589
movq $0x0, 0x50(%rsp)
leaq 0x58(%rsp), %r13
leaq 0x83603(%rip), %rbp     # 0xd1c7f
xorl %r15d, %r15d
movq $0x0, 0x8(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movq 0x20(%rsp), %r12
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4ef19
movq 0x58(%rsp), %rsi
movb (%rsi), %al
cmpb $0x23, %al
jne 0x4e813
cmpb $0x23, 0x1(%rsi)
jne 0x4e719
movq 0x60(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x4e7fb
cmpb $0x23, %al
jne 0x4e813
cmpb $0x43, 0x1(%rsi)
jne 0x4e813
leaq 0xbda56(%rip), %rdi     # 0x10c188
movq %rbp, %rsi
callq 0x8160
testl %eax, %eax
je 0x4e796
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8351c(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq 0xbda1a(%rip), %rsi     # 0x10c188
movq 0xbda1b(%rip), %rdx     # 0x10c190
movq %r14, %rdi
callq 0x84e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x4e7fb
movl $0x42, %edx
movq %r12, %rdi
leaq 0x8818c(%rip), %rsi     # 0xd6931
callq 0x84e0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r12, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
jmp 0x4e6a7
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
movl $0x9, %edx
callq 0x50624
movq 0x78(%rsp), %rsi
movl $0xe0, %eax
addq %rax, %rsi
leaq 0x128(%rsp), %rdi
movl $0x3b, %edx
callq 0x50624
movq 0x128(%rsp), %rdi
leaq 0x80cb7(%rip), %rsi     # 0xcf522
callq 0x8160
testl %eax, %eax
je 0x4e93b
movq 0x78(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x4f716
leaq 0xa0(%rsp), %rcx
cmpq %rcx, %rax
je 0x4f1af
movq 0x78(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x3e394
cmpq $0x0, 0x8(%rax)
je 0x4e9e6
movq 0x78(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x3e394
movq %rax, %r14
movq 0x78(%rsp), %r12
movq 0x20(%r12), %rdi
callq 0x86e0
movq (%r14), %rcx
cltq
movsbl -0x1(%rcx,%rax), %edi
callq 0x8880
movl %eax, %r14d
shll $0x18, %eax
cmpl $0x4e000000, %eax       # imm = 0x4E000000
je 0x4ea2f
cmpl $0x2d000000, %eax       # imm = 0x2D000000
jne 0x4ea63
movq 0x38(%rsp), %rdx
movl $0x3, %r8d
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
leaq 0x880b2(%rip), %rcx     # 0xd69d2
callq 0x86c0
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
jmp 0x4ebcd
leaq 0xbd846(%rip), %rdi     # 0x10c188
movq %rbp, %rsi
callq 0x8160
testl %eax, %eax
je 0x4e9ee
leaq 0xd8(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
leaq 0x8805e(%rip), %rsi     # 0xd69d2
leaq 0x8805a(%rip), %rdx     # 0xd69d5
callq 0x28952
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0x416a6
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x4e9b2
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x140(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3273a
leaq 0x140(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x39979
jmp 0x4ec7e
movb $0x4e, %r14b
jmp 0x4ebcd
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
jmp 0x4ec86
movq 0x38(%rsp), %rdx
movl $0x3, %r8d
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
leaq 0x87f8a(%rip), %rcx     # 0xd69d2
callq 0x86c0
movq 0x20(%rsp), %r12
movq 0x50(%rsp), %rax
incl %eax
movq %rax, 0x50(%rsp)
jmp 0x4ebcd
movsbl %r14b, %esi
movzbl %sil, %eax
addl $-0x41, %eax
cmpl $0x13, %eax
ja 0x4eb2e
movl $0x80045, %ecx          # imm = 0x80045
btl %eax, %ecx
jae 0x4eb2e
movq 0x60(%r12), %rax
movsbl (%rax), %eax
cmpl %eax, %esi
jne 0x4eac5
movq 0x38(%rsp), %rdx
movl $0x3, %r8d
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
leaq 0x87f2c(%rip), %rcx     # 0xd69d6
callq 0x86c0
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %rax
incl %eax
movq %rax, 0x28(%rsp)
jmp 0x4ebcd
movq 0x80(%r12), %rax
movsbl (%rax), %eax
movq 0x38(%rsp), %rdx
cmpl %eax, %esi
jne 0x4eb08
movl $0x3, %r8d
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
leaq 0x87eed(%rip), %rcx     # 0xd69da
callq 0x86c0
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %rax
incl %eax
movq %rax, 0x8(%rsp)
jmp 0x4ebcd
movl $0x3, %r8d
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
leaq 0x87eb6(%rip), %rcx     # 0xd69d2
callq 0x86c0
movq 0x20(%rsp), %r12
incl %r15d
jmp 0x4ebcd
leaq 0xc8(%rsp), %rdi
callq 0x4f660
movq 0xc8(%rsp), %rsi
movb (%rsi), %al
movq 0x78(%rsp), %rdx
movq 0x60(%rdx), %rcx
movb (%rcx), %dil
cmpb %dil, %al
movq 0x20(%rsp), %r12
jne 0x4eb72
movb 0x1(%rsi), %r8b
movq 0x80(%rdx), %r9
leaq 0x87e71(%rip), %rcx     # 0xd69de
cmpb (%r9), %r8b
je 0x4eb91
cmpb %dil, 0x1(%rsi)
jne 0x4eb8a
movq 0x80(%rdx), %rdx
leaq 0x87e58(%rip), %rcx     # 0xd69de
cmpb (%rdx), %al
je 0x4eb91
leaq 0x87e41(%rip), %rcx     # 0xd69d2
movq 0x38(%rsp), %rdx
movl $0x3, %r8d
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x86c0
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x4ebcd
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xbd5b4(%rip), %rdi     # 0x10c188
movq %rbp, %rsi
callq 0x8160
testl %eax, %eax
je 0x4ec20
leaq 0x78(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x33db0
leaq 0x158(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3273a
leaq 0x158(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x39979
jmp 0x4ec7e
movq 0x78(%rsp), %rdi
movl $0xe0, %eax
addq %rax, %rdi
leaq 0x87dae(%rip), %rsi     # 0xd69e2
callq 0x88c0
movq 0x78(%rsp), %rdi
movl $0xe0, %eax
addq %rax, %rdi
movsbl %r14b, %esi
callq 0x83d0
leaq 0x170(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3273a
leaq 0x170(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x39979
movq %r14, %rdi
callq 0x3123c
movl 0x10(%rsp), %eax
incl %eax
movl %eax, 0x10(%rsp)
imull $0xbcbe61d, %eax, %eax  # imm = 0xBCBE61D
rorl $0x5, %eax
cmpl $0xa7c5, %eax           # imm = 0xA7C5
ja 0x4eedd
movq 0xbc33d(%rip), %rdi     # 0x10afe8
movl 0x10(%rsp), %esi
callq 0x8810
movq %rax, %r14
movl $0x1c, %edx
movq %rax, %rdi
leaq 0x87d21(%rip), %rsi     # 0xd69e7
callq 0x84e0
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x8810
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8a8da(%rip), %rsi     # 0xd95c4
callq 0x84e0
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rdx
addl %edx, %eax
movq 0x8(%rsp), %rcx
addl %r15d, %ecx
addl %eax, %ecx
addl 0x50(%rsp), %ecx
cvtsi2sd %ecx, %xmm1
cvtsi2sd %edx, %xmm0
movsd %xmm1, 0x90(%rsp)
divsd %xmm1, %xmm0
mulsd 0x87bf2(%rip), %xmm0    # 0xd6918
movq %r14, %rdi
callq 0x8730
movq %rax, %r14
movl $0xb, %edx
movq %rax, %rdi
leaq 0x87cc4(%rip), %rsi     # 0xd6a04
callq 0x84e0
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x8810
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8a860(%rip), %rsi     # 0xd95c4
callq 0x84e0
xorps %xmm0, %xmm0
cvtsi2sdl 0x8(%rsp), %xmm0
divsd 0x90(%rsp), %xmm0
mulsd 0x87b95(%rip), %xmm0    # 0xd6918
movq %r14, %rdi
callq 0x8730
movq %rax, %r14
movl $0xb, %edx
movq %rax, %rdi
leaq 0x87c73(%rip), %rsi     # 0xd6a10
callq 0x84e0
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0x8810
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8a803(%rip), %rsi     # 0xd95c4
callq 0x84e0
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rsp), %xmm0
divsd 0x90(%rsp), %xmm0
mulsd 0x87b38(%rip), %xmm0    # 0xd6918
movq %r14, %rdi
callq 0x8730
movq %rax, %r14
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x87c22(%rip), %rsi     # 0xd6a1c
callq 0x84e0
movq %r14, %rdi
movl %r15d, %esi
callq 0x8810
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8a7a8(%rip), %rsi     # 0xd95c4
callq 0x84e0
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
divsd 0x90(%rsp), %xmm0
mulsd 0x87ade(%rip), %xmm0    # 0xd6918
movq %r14, %rdi
callq 0x8730
movq %rax, %r14
movl $0x9, %edx
movq %rax, %rdi
leaq 0x87be7(%rip), %rsi     # 0xd6a3b
callq 0x84e0
movq %r14, %rdi
movq 0x50(%rsp), %rsi
callq 0x8810
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8a74c(%rip), %rsi     # 0xd95c4
callq 0x84e0
xorps %xmm0, %xmm0
cvtsi2sdl 0x50(%rsp), %xmm0
divsd 0x90(%rsp), %xmm0
mulsd 0x87a81(%rip), %xmm0    # 0xd6918
movq %r14, %rdi
callq 0x8730
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x90b86(%rip), %rsi     # 0xdfa37
callq 0x84e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x128(%rsp), %rdi
callq 0x3123c
leaq 0x78(%rsp), %rdi
callq 0x3123c
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4e6a7
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x4e6a7
movq 0xbc0c8(%rip), %rdi     # 0x10afe8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0xbc0ad(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0xbc099(%rip), %rdi     # 0x10afe8
leaq 0x87aef(%rip), %rsi     # 0xd6a45
movl $0x4, %edx
callq 0x84e0
movq 0xbc081(%rip), %rdi     # 0x10afe8
movl 0x10(%rsp), %esi
callq 0x8810
movq %rax, %rbx
leaq 0x87a6d(%rip), %rsi     # 0xd69e7
movl $0x1c, %edx
movq %rax, %rdi
callq 0x84e0
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0x8810
movq %rax, %rbx
leaq 0x8a626(%rip), %rsi     # 0xd95c4
movl $0x1, %edx
movq %rax, %rdi
callq 0x84e0
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rdx
addl %edx, %eax
movq 0x8(%rsp), %rcx
addl %r15d, %ecx
addl %eax, %ecx
cvtsi2sd %ecx, %xmm1
cvtsi2sd %edx, %xmm0
movsd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
mulsd 0x8793d(%rip), %xmm0    # 0xd6918
movq %rbx, %rdi
callq 0x8730
movq %rax, %rbx
leaq 0x87a17(%rip), %rsi     # 0xd6a04
movl $0xb, %edx
movq %rax, %rdi
callq 0x84e0
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x8810
movq %rax, %rbx
leaq 0x8a5b3(%rip), %rsi     # 0xd95c4
movl $0x1, %edx
movq %rax, %rdi
callq 0x84e0
xorps %xmm0, %xmm0
cvtsi2sdl 0x8(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x878e3(%rip), %xmm0    # 0xd6918
movq %rbx, %rdi
callq 0x8730
movq %rax, %rbx
leaq 0x879c9(%rip), %rsi     # 0xd6a10
movl $0xb, %edx
movq %rax, %rdi
callq 0x84e0
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x8810
movq %rax, %rbx
leaq 0x8a559(%rip), %rsi     # 0xd95c4
movl $0x1, %edx
movq %rax, %rdi
callq 0x84e0
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x87889(%rip), %xmm0    # 0xd6918
movq %rbx, %rdi
callq 0x8730
movq %rax, %rbx
leaq 0x8797b(%rip), %rsi     # 0xd6a1c
movl $0x1e, %edx
movq %rax, %rdi
callq 0x84e0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x8810
movq %rax, %rbx
leaq 0x8a501(%rip), %rsi     # 0xd95c4
movl $0x1, %edx
movq %rax, %rdi
callq 0x84e0
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x87832(%rip), %xmm0    # 0xd6918
movq %rbx, %rdi
callq 0x8730
movq %rax, %rbx
leaq 0x9093f(%rip), %rsi     # 0xdfa37
movl $0x2, %edx
movq %rax, %rdi
callq 0x84e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f14d
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x98(%rsp), %rdi
callq 0x3f5f4
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x4f17f
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x4f19b
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x8480
xorl %eax, %eax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x877be(%rip), %rdi     # 0xd6974
leaq 0x877e0(%rip), %rsi     # 0xd699d
leaq 0x877f1(%rip), %rcx     # 0xd69b5
movl $0x67, %edx
callq 0x82c0
jmp 0x4f2f7
jmp 0x4f1ff
jmp 0x4f283
movq %rax, %rbx
leaq 0x170(%rsp), %rdi
jmp 0x4f296
jmp 0x4f2f7
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
jmp 0x4f296
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x4f2fa
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x4f2fa
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f25b
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x4f25b
jmp 0x4f258
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x4f364
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x4f364
jmp 0x4f283
movq %rax, %rbx
jmp 0x4f364
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x3123c
jmp 0x4f2fa
jmp 0x4f2ec
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r15, %rdi
jmp 0x4f384
jmp 0x4f2d6
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f389
movq 0xa8(%rsp), %rsi
jmp 0x4f381
movq %rax, %rbx
jmp 0x4f389
jmp 0x4f2f7
jmp 0x4f2f7
movq %rax, %rbx
jmp 0x4f307
movq %rax, %rbx
jmp 0x4f311
movq %rax, %rbx
jmp 0x4f357
jmp 0x4f333
jmp 0x4f2f7
jmp 0x4f333
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x3123c
leaq 0x78(%rsp), %rdi
callq 0x3123c
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4f336
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x4f336
jmp 0x4f333
jmp 0x4f333
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f357
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x98(%rsp), %rdi
callq 0x3f5f4
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x4f389
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x4f3a5
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840