// File: /workspace/github_c_makefile_star2_O0/skoren[P]bacValidation/samToErrorRate.C
// Function: main
int
main (int argc, char **argv) {
    map<string, string> reference;
    // loadFasta
    FILE *in = fopen(argv[2], "r");
    gzFile f = gzdopen(fileno(in), "r");
    kseq_t *seq = kseq_init(f);
    int l = 0;
    while ((l=kseq_read(seq)) >= 0) {
       reference[seq->name.s] = seq->seq.s;
       string name = seq->name.s;
       name.append("rc");
       reference[name] = rc(seq->seq.s, strlen(seq->seq.s));
    }
    kseq_destroy(seq);
    gzclose(f);
    fclose(in);

    bam1_t *b = bam_init1();
    samfile_t * fp = open_alignment_file(argv[1]);
    if (fp == NULL) {
        exit(1);
    }
    bam_header_t* head = fp->header; // sam header
    while (samread(fp, b) >= 0) {
        //Get bam core.
        const bam1_core_t *core = &b->core;
        if (core == NULL) {
            printf("Input file is corrupt!");
            exit(1);
        }
        if (!is_mapped(core)) {
            continue;
        }

        string id = bam1_qname(b);
        string ref = head->target_name[core->tid];
        uint32_t* cigar = bam1_cigar(b);
        uint32_t refLen = head->target_len[core->tid];
        uint32_t refLo = core->pos + 1;
        uint32_t refHigh = bam_calend(core, cigar);
        uint32_t seqLow = 0;
        uint32_t seqHi = core->l_qseq; 
        uint32_t seqLen = core->l_qseq;
        bool isFwd = !(core->flag & BAM_FREVERSE);

        // now parse, we need both sequecnes for this
        if (strlen(reference[ref].c_str()) <= 0) { 
           fprintf(stderr, "Error: unknown reference sequence %s", ref.c_str());
           exit(1);
        }
        char *refSeq = (char*)reference[ref].c_str()+refLo-1;
        char *qrySeq = new char[core->l_qseq+1];
        char *orig = qrySeq;
        for (int i = 0; i < core->l_qseq; i++) {
          qrySeq[i] = bam_nt16_rev_table[bam1_seqi(bam1_seq(b), i)];
        }
        qrySeq[core->l_qseq]='\0';
        int errors = 0;
        int matches = 0;
        int indels = 0;
        uint32_t len = 0;
        for (int k = 0; k < core->n_cigar; ++k) {
            int cop = cigar[k] & BAM_CIGAR_MASK; // operation
            int cl = cigar[k] >> BAM_CIGAR_SHIFT; // length
            switch (cop) {
            // we don't care about clipping, not part of length
            case BAM_CSOFT_CLIP:
                 if (k == 0) seqLow+=cl;
                 else seqHi-=cl;
                 qrySeq+=cl;
                 break;
            case BAM_CHARD_CLIP:
                 if (k == 0) seqLow+=cl;
                 else seqHi-=cl;
                 seqLen+=cl;
                 seqHi+=cl;
                 break;
            // we don't care about matches either, not an error
            case BAM_CMATCH:
            case BAM_CEQUAL:
            case BAM_CDIFF: 
              for (int i = 0; i < cl; i++) {
                 if (toupper(*refSeq) == toupper(*qrySeq)) {
                    matches++;
                 } else {
                    errors++;
                 }
                 refSeq++;
                 qrySeq++;
             }
             len+=cl;
             break;
            case BAM_CINS:
               errors+=cl;
               indels+=cl;
               qrySeq+=cl;
               len+=cl;
               break;
            case BAM_CREF_SKIP:
               refSeq+=cl;
               len+=cl;
               break;
            case BAM_CDEL:
               errors+=cl;
               indels+=cl;
               refSeq+=cl;
               len+=cl;
               break;
            default:
                cerr << "Error: unknown base " << cop << " of len " << cl << endl;
                exit(1);
                break;
            }
        }

        double idy = (1-((double) errors / len /*(seqHi-seqLow)*/ /*(refHigh - refLo + 1)*/)) * 100;
        double idyMismatches =  (1-((double) (errors-indels) / len /*(seqHi-seqLow)*/ /*(refHigh - refLo + 1)*/)) * 100;
        cout << id << "\t" << ref << "\t" << int(ceil(-1*idy/100*len)) << "\t" << idy << "\t0\t" << (isFwd == true ? seqLow : seqLen-seqHi) << "\t" << (isFwd == true ? seqHi : seqLen-seqLow) << "\t" << seqLen << "\t" <<  (isFwd == true ? 0 : 1) << "\t" << (isFwd == true ? refLo : refLen-refHigh) << "\t" << (isFwd == true ? refHigh : refLen-refLo) << "\t" << refLen << "\t" << len << "\t" << (seqHi-seqLow) << "\t" << (refHigh-refLo) << "\t" << matches << "\t" << errors << "\t" << idyMismatches << "\t" << indels << endl;
        delete[] orig;
    }
    samclose(fp);
return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x410, %rsp            # imm = 0x410
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xfdd0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x4016(%rip), %rsi      # 0x122b7
callq 0x3480
movq %rax, -0x1d8(%rbp)
jmp 0xe2af
movq -0x1d8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x3400
movl %eax, %edi
leaq 0x3feb(%rip), %rsi      # 0x122b7
callq 0x36b0
movq %rax, -0x1e0(%rbp)
jmp 0xe2da
movq -0x1e0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0xf350
movq %rax, -0x1e8(%rbp)
jmp 0xe2f7
movq -0x1e8(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movq -0x68(%rbp), %rdi
callq 0xf390
movl %eax, -0x1ec(%rbp)
jmp 0xe31a
movl -0x1ec(%rbp), %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, %eax
jl 0xe506
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x200(%rbp)
movq 0x40(%rax), %rax
movq %rax, -0x208(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x3690
movq -0x200(%rbp), %rsi
movq -0x1f8(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0xfd20
jmp 0xe375
leaq -0x40(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xfdf0
movq %rax, -0x210(%rbp)
jmp 0xe38e
movq -0x208(%rbp), %rsi
movq -0x210(%rbp), %rdi
callq 0x3550
jmp 0xe3a3
leaq -0x90(%rbp), %rdi
callq 0x31f0
leaq -0x91(%rbp), %rdi
callq 0x3420
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x220(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x3690
movq -0x220(%rbp), %rsi
movq -0x218(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
callq 0xfd20
jmp 0xe3f9
leaq -0xb9(%rbp), %rdi
callq 0x3420
leaq 0x46ca(%rip), %rsi      # 0x12ad6
leaq -0xb8(%rbp), %rdi
callq 0x3710
jmp 0xe41a
movq -0x68(%rbp), %rax
movq 0x40(%rax), %rdi
movq %rdi, -0x230(%rbp)
callq 0x3150
movq -0x230(%rbp), %rdi
movl %eax, %esi
callq 0xe060
movq %rax, -0x228(%rbp)
jmp 0xe445
leaq -0x40(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xfed0
movq %rax, -0x238(%rbp)
jmp 0xe45e
movq -0x228(%rbp), %rsi
movq -0x238(%rbp), %rdi
callq 0x3550
jmp 0xe473
leaq -0xb8(%rbp), %rdi
callq 0x31f0
jmp 0xe309
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xf334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xe4bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x31f0
leaq -0x91(%rbp), %rdi
callq 0x3420
jmp 0xf334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xb9(%rbp), %rdi
callq 0x3420
jmp 0xf334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x31f0
jmp 0xf334
movq -0x68(%rbp), %rdi
callq 0xf750
jmp 0xe511
movq -0x60(%rbp), %rdi
callq 0x3660
jmp 0xe51c
movq -0x48(%rbp), %rdi
callq 0x3380
jmp 0xe527
movl $0x1, %edi
movl $0x38, %esi
callq 0x3210
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x248(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x3690
movq -0x248(%rbp), %rsi
movq -0x240(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0xfd20
jmp 0xe57b
leaq -0xf0(%rbp), %rdi
callq 0xe0f0
movq %rax, -0x250(%rbp)
jmp 0xe590
leaq -0xf0(%rbp), %rdi
callq 0x31f0
leaq -0xf1(%rbp), %rdi
callq 0x3420
movq -0x250(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0xd0(%rbp)
jne 0xe601
movl $0x1, %edi
callq 0x34b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xe5f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x31f0
leaq -0xf1(%rbp), %rdi
callq 0x3420
jmp 0xf334
movq -0xd0(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x100(%rbp)
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x4990
movl %eax, -0x254(%rbp)
jmp 0xe62e
movl -0x254(%rbp), %eax
cmpl $0x0, %eax
jl 0xf30a
movq -0xc8(%rbp), %rax
movq %rax, -0x108(%rbp)
cmpq $0x0, -0x108(%rbp)
jne 0xe66f
leaq 0x447d(%rip), %rdi      # 0x12ad9
xorl %eax, %eax
callq 0x3060
jmp 0xe665
movl $0x1, %edi
callq 0x34b0
movq -0x108(%rbp), %rdi
callq 0xf7c0
movb %al, -0x255(%rbp)
jmp 0xe683
movb -0x255(%rbp), %al
testb $0x1, %al
jne 0xe691
jmp 0xe68f
jmp 0xe613
movq -0xc8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x268(%rbp)
leaq -0x129(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x3690
movq -0x268(%rbp), %rsi
movq -0x260(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xfd20
jmp 0xe6d2
leaq -0x129(%rbp), %rdi
callq 0x3420
movq -0x100(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x108(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x278(%rbp)
leaq -0x151(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x3690
movq -0x278(%rbp), %rsi
movq -0x270(%rbp), %rdx
leaq -0x150(%rbp), %rdi
callq 0xfd20
jmp 0xe72d
leaq -0x151(%rbp), %rdi
callq 0x3420
movq -0xc8(%rbp), %rcx
movq 0x30(%rcx), %rax
movzbl 0xb(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x160(%rbp)
movq -0x100(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x108(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x164(%rbp)
movq -0x108(%rbp), %rax
movl 0x4(%rax), %eax
incl %eax
movl %eax, -0x168(%rbp)
movq -0x108(%rbp), %rdi
movq -0x160(%rbp), %rsi
callq 0x6420
movl %eax, -0x27c(%rbp)
jmp 0xe79d
movl -0x27c(%rbp), %eax
movl %eax, -0x16c(%rbp)
movl $0x0, -0x170(%rbp)
movq -0x108(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x174(%rbp)
movq -0x108(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x178(%rbp)
movq -0x108(%rbp), %rax
movl 0xc(%rax), %eax
testb $0x10, %al
sete -0x179(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xfed0
movq %rax, -0x288(%rbp)
jmp 0xe7ff
movq -0x288(%rbp), %rdi
callq 0x3130
movq %rax, %rdi
callq 0x3150
cmpq $0x0, %rax
ja 0xe8b3
movq 0x87ac(%rip), %rax      # 0x16fd0
movq (%rax), %rax
movq %rax, -0x290(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x3130
movq -0x290(%rbp), %rdi
movq %rax, %rdx
leaq 0x42a5(%rip), %rsi      # 0x12af0
movb $0x0, %al
callq 0x3590
movl $0x1, %edi
callq 0x34b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x129(%rbp), %rdi
callq 0x3420
jmp 0xf334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x151(%rbp), %rdi
callq 0x3420
jmp 0xf2fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x31f0
jmp 0xf2fc
leaq -0x40(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xfed0
movq %rax, -0x298(%rbp)
jmp 0xe8cc
movq -0x298(%rbp), %rdi
callq 0x3130
movl -0x168(%rbp), %ecx
leaq -0x1(%rax,%rcx), %rax
movq %rax, -0x188(%rbp)
movq -0x108(%rbp), %rax
movl 0x14(%rax), %eax
incl %eax
movslq %eax, %rdi
callq 0x3030
movq %rax, -0x2a0(%rbp)
jmp 0xe907
movq -0x2a0(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x198(%rbp)
movl $0x0, -0x19c(%rbp)
movl -0x19c(%rbp), %eax
movq -0x108(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jge 0xe9d6
leaq 0x8d86(%rip), %rax      # 0x176d0
movq (%rax), %rax
movq -0xc8(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq -0xc8(%rbp), %rdx
movl 0x10(%rdx), %edx
shll $0x2, %edx
movl %edx, %edx
addq %rdx, %rcx
movq -0xc8(%rbp), %rdx
movq 0x8(%rdx), %rdx
shrq $0x18, %rdx
andq $0xff, %rdx
movslq %edx, %rdx
addq %rdx, %rcx
movl -0x19c(%rbp), %edx
sarl %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %edx
movl -0x19c(%rbp), %ecx
xorl $-0x1, %ecx
andl $0x1, %ecx
shll $0x2, %ecx
sarl %cl, %edx
movl %edx, %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x190(%rbp), %rax
movslq -0x19c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x19c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x19c(%rbp)
jmp 0xe92d
movq -0x190(%rbp), %rax
movq -0x108(%rbp), %rcx
movslq 0x14(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x1a0(%rbp)
movl $0x0, -0x1a4(%rbp)
movl $0x0, -0x1a8(%rbp)
movl $0x0, -0x1ac(%rbp)
movl $0x0, -0x1b0(%rbp)
movl -0x1b0(%rbp), %eax
movq -0x108(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xed79
movq -0x160(%rbp), %rax
movslq -0x1b0(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0xf, %eax
movl %eax, -0x1b4(%rbp)
movq -0x160(%rbp), %rax
movslq -0x1b0(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shrl $0x4, %eax
movl %eax, -0x1b8(%rbp)
movl -0x1b4(%rbp), %eax
movq %rax, -0x2a8(%rbp)
subq $0x8, %rax
ja 0xecd6
movq -0x2a8(%rbp), %rax
leaq 0x3ef3(%rip), %rcx      # 0x12980
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x1b0(%rbp)
jne 0xeab3
movl -0x1b8(%rbp), %eax
addl -0x170(%rbp), %eax
movl %eax, -0x170(%rbp)
jmp 0xeac7
movl -0x1b8(%rbp), %ecx
movl -0x174(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x174(%rbp)
movl -0x1b8(%rbp), %ecx
movq -0x190(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x190(%rbp)
jmp 0xed63
cmpl $0x0, -0x1b0(%rbp)
jne 0xeb03
movl -0x1b8(%rbp), %eax
addl -0x170(%rbp), %eax
movl %eax, -0x170(%rbp)
jmp 0xeb17
movl -0x1b8(%rbp), %ecx
movl -0x174(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x174(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x178(%rbp), %eax
movl %eax, -0x178(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x174(%rbp), %eax
movl %eax, -0x174(%rbp)
jmp 0xed63
movl $0x0, -0x1bc(%rbp)
movl -0x1bc(%rbp), %eax
cmpl -0x1b8(%rbp), %eax
jge 0xebe4
movq -0x188(%rbp), %rax
movsbl (%rax), %edi
callq 0x36e0
movl %eax, -0x2ac(%rbp)
movq -0x190(%rbp), %rax
movsbl (%rax), %edi
callq 0x36e0
movl %eax, %ecx
movl -0x2ac(%rbp), %eax
cmpl %ecx, %eax
jne 0xeb9d
movl -0x1a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a4(%rbp)
jmp 0xebac
movl -0x1a0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a0(%rbp)
movq -0x188(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x188(%rbp)
movq -0x190(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x190(%rbp)
movl -0x1bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1bc(%rbp)
jmp 0xeb4a
movl -0x1b8(%rbp), %eax
addl -0x1ac(%rbp), %eax
movl %eax, -0x1ac(%rbp)
jmp 0xed63
movl -0x1b8(%rbp), %eax
addl -0x1a0(%rbp), %eax
movl %eax, -0x1a0(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x1a8(%rbp), %eax
movl %eax, -0x1a8(%rbp)
movl -0x1b8(%rbp), %ecx
movq -0x190(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x190(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x1ac(%rbp), %eax
movl %eax, -0x1ac(%rbp)
jmp 0xed63
movl -0x1b8(%rbp), %ecx
movq -0x188(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x188(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x1ac(%rbp), %eax
movl %eax, -0x1ac(%rbp)
jmp 0xed63
movl -0x1b8(%rbp), %eax
addl -0x1a0(%rbp), %eax
movl %eax, -0x1a0(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x1a8(%rbp), %eax
movl %eax, -0x1a8(%rbp)
movl -0x1b8(%rbp), %ecx
movq -0x188(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x188(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x1ac(%rbp), %eax
movl %eax, -0x1ac(%rbp)
jmp 0xed63
movq 0x8313(%rip), %rdi      # 0x16ff0
leaq 0x3e31(%rip), %rsi      # 0x12b15
callq 0x3370
movq %rax, -0x2b8(%rbp)
jmp 0xecf2
movq -0x2b8(%rbp), %rdi
movl -0x1b4(%rbp), %esi
callq 0x3670
movq %rax, -0x2c0(%rbp)
jmp 0xed0d
movq -0x2c0(%rbp), %rdi
leaq 0x3e0f(%rip), %rsi      # 0x12b2a
callq 0x3370
movq %rax, -0x2c8(%rbp)
jmp 0xed29
movq -0x2c8(%rbp), %rdi
movl -0x1b8(%rbp), %esi
callq 0x3670
movq %rax, -0x2d0(%rbp)
jmp 0xed44
movq -0x2d0(%rbp), %rdi
movq 0x825e(%rip), %rsi      # 0x16fb0
callq 0x33d0
jmp 0xed59
movl $0x1, %edi
callq 0x34b0
jmp 0xed65
movl -0x1b0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b0(%rbp)
jmp 0xea1e
cvtsi2sdl -0x1a0(%rbp), %xmm1
movl -0x1ac(%rbp), %eax
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm1
movsd 0x3bc8(%rip), %xmm0     # 0x12960
movaps %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd 0x3bc1(%rip), %xmm1     # 0x12968
mulsd %xmm1, %xmm2
movsd %xmm2, -0x1c8(%rbp)
movl -0x1a0(%rbp), %eax
movl -0x1a8(%rbp), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm2
movl -0x1ac(%rbp), %eax
cvtsi2sd %rax, %xmm3
divsd %xmm3, %xmm2
subsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1d0(%rbp)
movq 0x81dd(%rip), %rdi      # 0x16fc8
leaq -0x128(%rbp), %rsi
callq 0x3320
movq %rax, -0x2d8(%rbp)
jmp 0xee00
movq -0x2d8(%rbp), %rdi
leaq 0x3d27(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x2e0(%rbp)
jmp 0xee1c
movq -0x2e0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x3320
movq %rax, -0x2e8(%rbp)
jmp 0xee38
movq -0x2e8(%rbp), %rdi
leaq 0x3cef(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x2f0(%rbp)
jmp 0xee54
movsd -0x1c8(%rbp), %xmm0
movsd 0x3b0c(%rip), %xmm1     # 0x12970
divsd %xmm1, %xmm0
movl -0x1ac(%rbp), %eax
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
callq 0x30a0
movq -0x2f0(%rbp), %rdi
cvttsd2si %xmm0, %esi
callq 0x3670
movq %rax, -0x2f8(%rbp)
jmp 0xee95
movq -0x2f8(%rbp), %rdi
leaq 0x3c92(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x300(%rbp)
jmp 0xeeb1
movq -0x300(%rbp), %rdi
movsd -0x1c8(%rbp), %xmm0
callq 0x3700
movq %rax, -0x308(%rbp)
jmp 0xeece
movq -0x308(%rbp), %rdi
leaq 0x3c57(%rip), %rsi      # 0x12b33
callq 0x3370
movq %rax, -0x310(%rbp)
jmp 0xeeea
movb -0x179(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xef08
movl -0x170(%rbp), %eax
movl %eax, -0x314(%rbp)
jmp 0xef1a
movl -0x178(%rbp), %eax
subl -0x174(%rbp), %eax
movl %eax, -0x314(%rbp)
movq -0x310(%rbp), %rdi
movl -0x314(%rbp), %esi
callq 0x3540
movq %rax, -0x320(%rbp)
jmp 0xef35
movq -0x320(%rbp), %rdi
leaq 0x3bf2(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x328(%rbp)
jmp 0xef51
movb -0x179(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xef6f
movl -0x174(%rbp), %eax
movl %eax, -0x32c(%rbp)
jmp 0xef81
movl -0x178(%rbp), %eax
subl -0x170(%rbp), %eax
movl %eax, -0x32c(%rbp)
movq -0x328(%rbp), %rdi
movl -0x32c(%rbp), %esi
callq 0x3540
movq %rax, -0x338(%rbp)
jmp 0xef9c
movq -0x338(%rbp), %rdi
leaq 0x3b8b(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x340(%rbp)
jmp 0xefb8
movq -0x340(%rbp), %rdi
movl -0x178(%rbp), %esi
callq 0x3540
movq %rax, -0x348(%rbp)
jmp 0xefd3
movq -0x348(%rbp), %rdi
leaq 0x3b54(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x350(%rbp)
jmp 0xefef
movq -0x350(%rbp), %rdi
movb -0x179(%rbp), %al
notb %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x3670
movq %rax, -0x358(%rbp)
jmp 0xf012
movq -0x358(%rbp), %rdi
leaq 0x3b15(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x360(%rbp)
jmp 0xf02e
movb -0x179(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xf04c
movl -0x168(%rbp), %eax
movl %eax, -0x364(%rbp)
jmp 0xf05e
movl -0x164(%rbp), %eax
subl -0x16c(%rbp), %eax
movl %eax, -0x364(%rbp)
movq -0x360(%rbp), %rdi
movl -0x364(%rbp), %esi
callq 0x3540
movq %rax, -0x370(%rbp)
jmp 0xf079
movq -0x370(%rbp), %rdi
leaq 0x3aae(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x378(%rbp)
jmp 0xf095
movb -0x179(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xf0b3
movl -0x16c(%rbp), %eax
movl %eax, -0x37c(%rbp)
jmp 0xf0c5
movl -0x164(%rbp), %eax
subl -0x168(%rbp), %eax
movl %eax, -0x37c(%rbp)
movq -0x378(%rbp), %rdi
movl -0x37c(%rbp), %esi
callq 0x3540
movq %rax, -0x388(%rbp)
jmp 0xf0e0
movq -0x388(%rbp), %rdi
leaq 0x3a47(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x390(%rbp)
jmp 0xf0fc
movq -0x390(%rbp), %rdi
movl -0x164(%rbp), %esi
callq 0x3540
movq %rax, -0x398(%rbp)
jmp 0xf117
movq -0x398(%rbp), %rdi
leaq 0x3a10(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x3a0(%rbp)
jmp 0xf133
movq -0x3a0(%rbp), %rdi
movl -0x1ac(%rbp), %esi
callq 0x3540
movq %rax, -0x3a8(%rbp)
jmp 0xf14e
movq -0x3a8(%rbp), %rdi
leaq 0x39d9(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x3b0(%rbp)
jmp 0xf16a
movq -0x3b0(%rbp), %rdi
movl -0x174(%rbp), %esi
movl -0x170(%rbp), %eax
subl %eax, %esi
callq 0x3540
movq %rax, -0x3b8(%rbp)
jmp 0xf18d
movq -0x3b8(%rbp), %rdi
leaq 0x399a(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x3c0(%rbp)
jmp 0xf1a9
movq -0x3c0(%rbp), %rdi
movl -0x16c(%rbp), %esi
movl -0x168(%rbp), %eax
subl %eax, %esi
callq 0x3540
movq %rax, -0x3c8(%rbp)
jmp 0xf1cc
movq -0x3c8(%rbp), %rdi
leaq 0x395b(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x3d0(%rbp)
jmp 0xf1e8
movq -0x3d0(%rbp), %rdi
movl -0x1a4(%rbp), %esi
callq 0x3670
movq %rax, -0x3d8(%rbp)
jmp 0xf203
movq -0x3d8(%rbp), %rdi
leaq 0x3924(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x3e0(%rbp)
jmp 0xf21f
movq -0x3e0(%rbp), %rdi
movl -0x1a0(%rbp), %esi
callq 0x3670
movq %rax, -0x3e8(%rbp)
jmp 0xf23a
movq -0x3e8(%rbp), %rdi
leaq 0x38ed(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x3f0(%rbp)
jmp 0xf256
movq -0x3f0(%rbp), %rdi
movsd -0x1d0(%rbp), %xmm0
callq 0x3700
movq %rax, -0x3f8(%rbp)
jmp 0xf273
movq -0x3f8(%rbp), %rdi
leaq 0x38b4(%rip), %rsi      # 0x12b35
callq 0x3370
movq %rax, -0x400(%rbp)
jmp 0xf28f
movq -0x400(%rbp), %rdi
movl -0x1a8(%rbp), %esi
callq 0x3670
movq %rax, -0x408(%rbp)
jmp 0xf2aa
movq -0x408(%rbp), %rdi
movq 0x7cf8(%rip), %rsi      # 0x16fb0
callq 0x33d0
jmp 0xf2bf
movq -0x198(%rbp), %rax
movq %rax, -0x410(%rbp)
cmpq $0x0, %rax
je 0xf2df
movq -0x410(%rbp), %rdi
callq 0x3500
leaq -0x150(%rbp), %rdi
callq 0x31f0
leaq -0x128(%rbp), %rdi
callq 0x31f0
jmp 0xe613
leaq -0x128(%rbp), %rdi
callq 0x31f0
jmp 0xf334
movq -0xd0(%rbp), %rdi
callq 0x4730
jmp 0xf318
movl $0x0, -0x4(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xffb0
movl -0x4(%rbp), %eax
addq $0x410, %rsp            # imm = 0x410
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0xffb0
movq -0x50(%rbp), %rdi
callq 0x3680
nopw %cs:(%rax,%rax)