// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]oatk/run_syncasm.c
// Function: syncasm
int syncasm(char **file_in, int n_file, size_t m_data, int k, int s, int bubble_size, int tip_size, int min_k_cov, double min_a_cov_f,
        double weak_cross, int do_ec, int do_unzip, int n_threads, char *out, scg_meta_t *meta, int VERBOSE)
{
    FILE *fo;
    sstream_t *sr_rdr;
    scg_t *scg;
    sr_db_t *sr_db;
    syncmer_db_t *scm_db;
    scg_ra_v *ra_db;
    int ret = 0;

    scg = 0;
    sr_db = 0;
    scm_db = 0;
    ra_db = 0;

    sr_rdr = sstream_open(file_in, n_file);
    if (sr_rdr == 0) {
        fprintf(stderr, "[E::%s] failed to open files: %s\n", __func__, strerror(errno));
        ret = 1;
        goto do_clean;
    }

    MYMALLOC(sr_db, 1);
    sr_db_init(sr_db, k, s);
    sr_read(sr_rdr, sr_db, m_data, n_threads);
    fprintf(stderr, "[M::%s] collected syncmers from %lu target sequence(s)\n", __func__, sr_rdr->n_seq);
    sstream_close(sr_rdr);
    if (sr_db_validate(sr_db)) {
        ret = 1;
        goto do_clean;
    }
    sr_db_stat(sr_db, stderr, VERBOSE);

    if (min_k_cov == 0) {
        min_k_cov = sr_db->stats->kmer_peak_het > 0? (sr_db->stats->kmer_peak_het * 10) : (sr_db->stats->kmer_peak_hom * 10);
        fprintf(stderr, "[M::%s] set minimum kmer coverage as %d\n", __func__, min_k_cov);
    }

#ifdef DEBUG_SYNCMER_SEQ
    uint32_t i;
    fo = open_outstream(out, "_syncmer_debug.fa");
    for (i = 0; i < sr_db->n; ++i) print_all_syncmers_on_seq(&sr_db->a[i], s, k, fo);
    fclose(fo);
#endif

    // make syncmer database
    scm_db = collect_syncmer_from_reads(sr_db);
    
    // syncmer_link_coverage_analysis(sr_db, scm_db, min_k_cov, 30, 30, .7, 0, 0, 0, VERBOSE);
    
    if (do_ec) {
        // make syncmer graph with all syncmers for error correction
        scg = make_syncmer_graph(sr_db, scm_db, 0, 0.);
#ifdef DEBUG_GRAPH_ERROR_CORRECTION
        // save sequence in graph
        fo = open_outstream(out, "_syncmer_hoco.gfa");
        scg_consensus(sr_db, scg, 1, 1, fo);
        fclose(fo);
#endif
        // do consensus in hoco space
        scg_consensus(sr_db, scg, 1, 1, 0);
        // naive error finding without checking arc coverage
#ifdef DEBUG_GRAPH_ERROR_CORRECTION
        fo = open_outstream(out, ".ec.fa");
#else
        fo = 0;
#endif
        read_error_correction(sr_db, scg, 0.02, min_k_cov, min_k_cov * 10, min_k_cov, min_a_cov_f, n_threads, fo, VERBOSE);
#ifdef DEBUG_GRAPH_ERROR_CORRECTION
        fclose(fo);
        fo = open_outstream(out, "_syncmer_hoco.noerr.gfa");
        scg_print(scg, fo, 0);
        fclose(fo);
#endif
        sr_db_stat(sr_db, stderr, VERBOSE);
        scg_destroy(scg); scg = 0;
        // goto do_clean;
    }

    // make syncmer graph
    fprintf(stderr, "[M::%s] make syncmer graph\n", __func__);
    scg = make_syncmer_graph(sr_db, scm_db, min_k_cov, min_a_cov_f);
    if (!scg || scg_is_empty(scg)) {
        fprintf(stderr, "[E::%s] empty syncmer graph\n", __func__);
        ret = 1;
        goto do_clean;
    }
    fprintf(stderr, "[M::%s] syncmer graph stats\n", __func__);
    scg_stat(scg, stderr, 0);
    if (VERBOSE > 1) scg_subgraph_stat(scg, stderr);

#ifdef DEBUG_SYNCMER_GRAPH
    fo = open_outstream(out, "_syncmer.gfa");
    scg_consensus(sr_db, scg, 0, 0, fo);
    fclose(fo);
    MYCALLOC(ra_db, 1);
    scg_read_alignment(sr_db, ra_db, scg, n_threads, 0);
    fprintf(stderr, "[DEBUG_SYNCMER_GRAPH::%s] read alignment\n", __func__);
    scg_rv_print(ra_db, stderr);
    scg_ra_v_destroy(ra_db);
#endif

    // make unitigs
    fprintf(stderr, "[M::%s] syncmer graph unitigging\n", __func__);
    process_mergeable_unitigs(scg);
    fprintf(stderr, "[M::%s] syncmer graph stats after unitigging\n", __func__);
    scg_stat(scg, stderr, 0);
    fo = open_outstream(out, ".utg.gfa");
    scg_consensus(sr_db, scg, 0, 0, fo);
    fclose(fo);

    if (VERBOSE > 1) scg_subgraph_stat(scg, stderr);

#ifdef DEBUG_GRAPH_UNITIG
    scg_print_unitig_syncmer_list(scg, stderr);
    MYCALLOC(ra_db, 1);
    scg_read_alignment(sr_db, ra_db, scg, n_threads, 0);
    fprintf(stderr, "[DEBUG_GRAPH_UNITIG::%s] read alignment\n", __func__);
    scg_rv_print(ra_db, stderr);
    scg_ra_v_destroy(ra_db);
#endif

    // do basic cleanup
    // already have consensus information
    fprintf(stderr, "[M::%s] syncmer graph cleanup\n", __func__);
    uint64_t cleaned = 1;
    while (cleaned) {
        // do not do bubble popping before unzipping to avoid removing haplotypes
        cleaned = 0;
        if (do_unzip <= 0) {
            cleaned += asmg_pop_bubble(scg->utg_asmg, bubble_size, 0, 0, 1, 0, VERBOSE);
            cleaned += asmg_remove_weak_crosslink(scg->utg_asmg, weak_cross, 10, 0, VERBOSE);
        }
        cleaned += asmg_drop_tip(scg->utg_asmg, INT32_MAX, tip_size, 1, 0, VERBOSE);
    }
    process_mergeable_unitigs(scg);
    
#ifdef DEBUG_GRAPH_MULTIPLEX
    fprintf(stderr, "[M::%s] syncmer graph stats after cleanup\n", __func__);
    scg_stat(scg, stderr, 0);
    fo = open_outstream(out, ".utg.clean.gfa");
    scg_consensus(sr_db, scg, 0, 0, fo);
    fclose(fo);
#endif

#ifdef DEBUG_GRAPH_MULTIPLEX
    scg_print_unitig_syncmer_list(scg, stderr);
#endif

    MYCALLOC(ra_db, 1);
    // do read threading
    if (do_unzip > 0) {
        fprintf(stderr, "[M::%s] assembly graph unzipping\n", __func__);
        int round, updated;
        uint32_t max_n_scm;

        // set max_n_scm for maximum repeats of ~15Kb which reach the HiFi read length limit
        max_n_scm = ceil(30000.0 / k);

        // do multiplexing
        round = 0;
        updated = 1;
        while (updated != 0 && round < do_unzip) {
            ++round;
            scg_read_alignment(sr_db, ra_db, scg, n_threads, 1);
            // scg_rv_print(ra_db, stderr);
            scg_update_utg_cov(scg);
            updated = scg_multiplex(scg, ra_db, max_n_scm, 10, .3);
            if (VERBOSE > 0) {
                fprintf(stderr, "[M::%s] syncmer graph stats after multiplexing round %d\n", __func__, round);
                scg_stat(scg, stderr, 0);
            }
#ifdef DEBUG_GRAPH_MULTIPLEX
            char *out1;
            MYMALLOC(out1, strlen(out) + 36);
            sprintf(out1, "%s.utg.unzip.r%02d.gfa", out, round);
            fo = open_outstream(out1, "");
            scg_consensus(sr_db, scg, 0, 0, fo);
            fclose(fo);
            free(out1);
            scg_print_unitig_syncmer_list(scg, stderr);
#endif
        }
        
        // arc coverage estimation from aligned reads
        // to remove weak cross arcs
        // only arc coverage is required
        scg_read_alignment(sr_db, ra_db, scg, n_threads, 1);
        scg_ra_arc_coverage(scg, sr_db, ra_db, 0, VERBOSE);
        asmg_remove_weak_crosslink(scg->utg_asmg, weak_cross, 10, 0, VERBOSE);

#ifdef DEBUG_GRAPH_MULTIPLEX
        fprintf(stderr, "[M::%s] syncmer graph stats after multiplexing\n", __func__);
        scg_stat(scg, stderr, 0);
        fo = open_outstream(out, ".utg.multiplex.gfa");
        scg_consensus(sr_db, scg, 0, 0, fo);
        fclose(fo);
#endif

        // do demultiplexing
        scg_demultiplex(scg);
        // the arc coverage is lost
        scg_read_alignment(sr_db, ra_db, scg, n_threads, 0);
        scg_ra_utg_coverage(scg, sr_db, ra_db, VERBOSE);
        scg_ra_arc_coverage(scg, sr_db, ra_db, 1, VERBOSE);
        
#ifdef DEBUG_GRAPH_MULTIPLEX
        fprintf(stderr, "[M::%s] syncmer graph stats after unzipping\n", __func__);
        scg_stat(scg, stderr, 0);
        fo = open_outstream(out, ".utg.unzip.gfa");
        scg_consensus(sr_db, scg, 0, 0, fo);
        fclose(fo);
#else
        // consensus infomration is required for basic cleanup
        scg_consensus(sr_db, scg, 0, 0, 0);
#endif

        // do basic cleanup
        cleaned = 1;
        while (cleaned) {
            cleaned = 0;
            cleaned += asmg_pop_bubble(scg->utg_asmg, bubble_size, 0, 0, 1, 0, VERBOSE);
            cleaned += asmg_remove_weak_crosslink(scg->utg_asmg, weak_cross, 10, 0, VERBOSE);
            cleaned += asmg_drop_tip(scg->utg_asmg, INT32_MAX, tip_size, 1, 0, VERBOSE);
        }
        process_mergeable_unitigs(scg);

#ifdef DEBUG_GRAPH_UNITIG
        scg_print_unitig_syncmer_list(scg, stderr);
#endif

#ifdef DEBUG_GRAPH_ALIGNMENT
        fprintf(stderr, "[DEBUG_GRAPH_ALIGNMENT::%s] read alignment\n", __func__);
        scg_rv_print(ra_db, stderr);
#endif
    }

    // unitig and arc coverage estimation
    scg_read_alignment(sr_db, ra_db, scg, n_threads, 0);
    scg_ra_utg_coverage(scg, sr_db, ra_db, VERBOSE);
    scg_ra_arc_coverage(scg, sr_db, ra_db, 1, VERBOSE);

    fprintf(stderr, "[M::%s] syncmer graph stats after final processing\n", __func__);
    scg_stat(scg, stderr, 0);
    fo = open_outstream(out, ".utg.final.gfa");
    scg_consensus(sr_db, scg, 0, 0, fo);
    fclose(fo);

do_clean:
    if (meta) {
        scg_meta_clean(meta);
        meta->k = k;
        meta->s = s;
        meta->scg = scg;
        meta->scm_db = scm_db;
        meta->sr_db = sr_db;
        meta->ra_db = ra_db;
    } else {
        scg_destroy(scg);
        syncmer_db_destroy(scm_db);
        sr_db_destroy(sr_db);
        scg_ra_v_destroy(ra_db);
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movsd %xmm1, 0x40(%rsp)
movsd %xmm0, 0x28(%rsp)
movl %r9d, %ebp
movl %r8d, %r12d
movl %ecx, %r15d
movq %rdx, %r14
callq 0x165e3
testq %rax, %rax
movl %r15d, 0x34(%rsp)
jne 0x26c0
movq 0x1e978(%rip), %rax     # 0x20ff0
movq (%rax), %rbx
callq 0x2080
movl (%rax), %edi
callq 0x24c0
leaq 0x169fa(%rip), %rsi     # 0x19088
leaq 0x16a15(%rip), %rdx     # 0x190aa
xorl %r13d, %r13d
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2280
xorl %r14d, %r14d
movq $0x0, 0x38(%rsp)
xorl %ebp, %ebp
movq 0xb0(%rsp), %rbx
jmp 0x2750
movq %rax, %rbx
movl %ebp, 0x20(%rsp)
movl 0xa0(%rsp), %ebp
pushq $0x28
popq %rdi
callq 0x2310
movq %rax, %r13
movq %rax, %rdi
movl %r15d, %esi
movl %r12d, 0x14(%rsp)
movl %r12d, %edx
callq 0xa756
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r13, %r14
movl %ebp, %ecx
callq 0xa308
movq 0x1e8ea(%rip), %r15     # 0x20ff0
movq (%r15), %rdi
movq (%rbx), %rcx
leaq 0x1699f(%rip), %rsi     # 0x190b2
leaq 0x16990(%rip), %rdx     # 0x190aa
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x2280
movq %rbx, %rdi
callq 0x16558
movq %r14, %rdi
callq 0xb964
testl %eax, %eax
je 0x27b6
movq $0x0, 0x38(%rsp)
xorl %ebp, %ebp
movq 0xb0(%rsp), %rbx
movl 0x14(%rsp), %r12d
pushq $0x1
popq %r15
testq %rbx, %rbx
je 0x2782
movq %rbx, %rdi
callq 0x38b7
movl 0x34(%rsp), %eax
movl %eax, (%rbx)
movl %r12d, 0x4(%rbx)
movq %r13, 0x8(%rbx)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rbx)
movq %r14, 0x18(%rbx)
movq %rbp, 0x20(%rbx)
jmp 0x27a4
movq %r13, %rdi
callq 0x3884
movq 0x38(%rsp), %rdi
callq 0xbab5
movq %r14, %rdi
callq 0xba3c
movq %rbp, %rdi
callq 0x151dc
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xb8(%rsp), %edx
movl 0x90(%rsp), %ebp
movl 0x88(%rsp), %ebx
movq (%r15), %rsi
movq %r14, %rdi
callq 0xa8b6
testl %ebx, %ebx
movq %r14, 0x18(%rsp)
movl 0x14(%rsp), %r12d
jne 0x281b
movq 0x20(%r14), %rcx
movl 0x44(%rcx), %eax
testl %eax, %eax
jg 0x27f2
movl 0x40(%rcx), %eax
imull $0xa, %eax, %ebx
movq 0x1e7f4(%rip), %rax     # 0x20ff0
movq (%rax), %rdi
leaq 0x168e4(%rip), %rsi     # 0x190ea
leaq 0x1689d(%rip), %rdx     # 0x190aa
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2280
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0xc0fe
movq %rax, %r13
testl %ebp, %ebp
je 0x28b2
xorpd %xmm0, %xmm0
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x38fe
movq %rax, %r15
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %rax, %rsi
movl %ecx, %edx
xorl %r8d, %r8d
callq 0x473b
imull $0xa, %ebx, %ecx
movl 0xb8(%rsp), %r12d
movl %r12d, 0x8(%rsp)
andq $0x0, (%rsp)
movsd 0x16796(%rip), %xmm0    # 0x19008
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
movl %ebx, %r8d
movsd 0x28(%rsp), %xmm1
movl 0xa0(%rsp), %r9d
callq 0xf72c
movq 0x1e759(%rip), %rax     # 0x20ff0
movq (%rax), %rsi
movq %r14, %rdi
movl %r12d, %edx
movl 0x14(%rsp), %r12d
callq 0xa8b6
movq %r15, %rdi
callq 0x3884
movq 0x1e737(%rip), %rax     # 0x20ff0
movq (%rax), %rdi
leaq 0x16850(%rip), %rsi     # 0x19113
leaq 0x167e0(%rip), %rdx     # 0x190aa
xorl %eax, %eax
callq 0x2280
movq %r14, %rdi
movq %r13, 0x38(%rsp)
movq %r13, %rsi
movl %ebx, %edx
movsd 0x28(%rsp), %xmm0
callq 0x38fe
movq %rax, %r13
testq %rax, %rax
pushq $0x1
popq %r15
je 0x29e2
movq %r13, %rdi
callq 0x4295
testl %eax, %eax
jne 0x29e2
movq 0xa8(%rsp), %r15
movl 0x80(%rsp), %ebp
movq 0x1e6d1(%rip), %r14     # 0x20ff0
movq (%r14), %rdi
leaq 0x16823(%rip), %rsi     # 0x1914c
leaq 0x1677a(%rip), %rdx     # 0x190aa
xorl %eax, %eax
callq 0x2280
movq (%r14), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x42c6
movq (%r14), %rax
cmpl $0x2, 0xb8(%rsp)
jl 0x2a15
movq %r13, %rdi
movq %rax, %rsi
callq 0x43d4
movq (%r14), %rdi
leaq 0x167ff(%rip), %rsi     # 0x19169
leaq 0x16739(%rip), %rbx     # 0x190aa
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2280
movq %r13, %rdi
callq 0x571b
movq (%r14), %rdi
leaq 0x167fe(%rip), %rsi     # 0x1918b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2280
movq (%r14), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x42c6
leaq 0x1680e(%rip), %rsi     # 0x191b9
movq %r15, %rdi
callq 0x16e82
movq %rax, %rbx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rax, %r8
callq 0x473b
movq %rbx, %rdi
callq 0x2140
movq (%r14), %rsi
movq %r13, %rdi
callq 0x43d4
jmp 0x2a87
movq 0x1e607(%rip), %rax     # 0x20ff0
movq (%rax), %rdi
leaq 0x1673c(%rip), %rsi     # 0x1912f
leaq 0x166b0(%rip), %rdx     # 0x190aa
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2280
movq 0xb0(%rsp), %rbx
movq 0x18(%rsp), %r14
jmp 0x2754
leaq 0x1674d(%rip), %rsi     # 0x19169
leaq 0x16687(%rip), %rbx     # 0x190aa
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2280
movq %r13, %rdi
callq 0x571b
movq (%r14), %rdi
leaq 0x16749(%rip), %rsi     # 0x1918b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2280
movq (%r14), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x42c6
leaq 0x16759(%rip), %rsi     # 0x191b9
movq %r15, %rdi
callq 0x16e82
movq %rax, %rbx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rax, %r8
callq 0x473b
movq %rbx, %rdi
callq 0x2140
movq (%r14), %rdi
leaq 0x16731(%rip), %rsi     # 0x191c2
leaq 0x16612(%rip), %rdx     # 0x190aa
xorl %eax, %eax
callq 0x2280
movslq 0x20(%rsp), %rax
movq %rax, 0x28(%rsp)
movslq %ebp, %r14
pushq $0x1
popq %rax
pushq $0x1
popq %r15
movl 0xb8(%rsp), %ebp
testq %rax, %rax
je 0x2b2f
cmpl $0x0, 0x98(%rsp)
jle 0x2acd
xorl %ebx, %ebx
jmp 0x2b10
movq 0x8(%r13), %rdi
movl %ebp, (%rsp)
movq 0x28(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x1315c
movq %rax, %r15
movq 0x8(%r13), %rdi
movsd 0x40(%rsp), %xmm0
movsd 0x16513(%rip), %xmm1    # 0x19010
xorl %esi, %esi
movl %ebp, %edx
callq 0x12f0d
movq %rax, %rbx
addq %r15, %rbx
pushq $0x1
popq %r15
movq 0x8(%r13), %rdi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %r14, %rdx
movl %r15d, %ecx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0x12af3
addq %rbx, %rax
jmp 0x2aba
movq %r13, %rdi
callq 0x571b
pushq $0x1
popq %r15
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x2250
movq %rax, %rbp
cmpl $0x0, 0x98(%rsp)
jle 0x2d7f
movq %rbp, 0x20(%rsp)
movq 0x1e48d(%rip), %rax     # 0x20ff0
movq (%rax), %rdi
leaq 0x16674(%rip), %rsi     # 0x191e1
leaq 0x16536(%rip), %rdx     # 0x190aa
xorl %eax, %eax
callq 0x2280
cvtsi2sdl 0x34(%rsp), %xmm1
movsd 0x1648f(%rip), %xmm0    # 0x19018
divsd %xmm1, %xmm0
callq 0x24e0
cvttsd2si %xmm0, %rbx
pushq $0x1
popq %rbp
movl %ebp, %r12d
testl %ebp, %ebp
movl 0xa0(%rsp), %ecx
je 0x2c45
leal -0x1(%r12), %eax
cmpl 0x98(%rsp), %eax
jge 0x2c45
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rbp
movq %rbp, %rsi
movq %r13, %rdx
pushq $0x1
popq %r8
callq 0x1522e
movq %r13, %rdi
callq 0x4594
movq %r13, %rdi
movq %rbp, %rsi
movl %ebx, %edx
movsd 0x16421(%rip), %xmm0    # 0x19010
movsd 0x16429(%rip), %xmm1    # 0x19020
callq 0x574a
movl %eax, %ebp
cmpl $0x0, 0xb8(%rsp)
jg 0x2c0d
incl %r12d
jmp 0x2b9d
movq 0x1e3dc(%rip), %rax     # 0x20ff0
movq (%rax), %rdi
leaq 0x165e5(%rip), %rsi     # 0x19203
leaq 0x16485(%rip), %rdx     # 0x190aa
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2280
movq 0x1e3ba(%rip), %rax     # 0x20ff0
movq (%rax), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x42c6
jmp 0x2c08
pushq $0x1
popq %rbp
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r12
movq %r12, %rsi
movq %r13, %rdx
movl %ebp, %r8d
callq 0x1522e
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
movl 0xb8(%rsp), %r12d
movl %r12d, %r8d
callq 0x90ef
movq 0x8(%r13), %rdi
movsd 0x16386(%rip), %xmm1    # 0x19010
movsd 0x40(%rsp), %xmm0
xorl %esi, %esi
movl %r12d, %edx
callq 0x12f0d
movq %r13, %rdi
callq 0x7190
movq %rbx, %rdi
movq 0x20(%rsp), %r12
movq %r12, %rsi
movq %r13, %rdx
movl 0xa0(%rsp), %ecx
xorl %r8d, %r8d
callq 0x1522e
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movl 0xb8(%rsp), %ecx
callq 0x7dd9
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movl %ebp, %ecx
movl 0xb8(%rsp), %r8d
callq 0x90ef
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x473b
testq %r15, %r15
je 0x2d6d
movq 0x8(%r13), %rdi
movl 0xb8(%rsp), %r15d
movl %r15d, (%rsp)
movq 0x28(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x1315c
movq %rax, %rbx
movq 0x8(%r13), %rdi
movsd 0x40(%rsp), %xmm0
movsd 0x162d4(%rip), %xmm1    # 0x19010
xorl %esi, %esi
movl %r15d, %edx
callq 0x12f0d
movq %rax, %r12
movq 0x8(%r13), %rdi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %r14, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
movl %r15d, %r9d
callq 0x12af3
movq %rax, %r15
addq %rbx, %r15
addq %r12, %r15
jmp 0x2cfe
movq %r13, %rdi
callq 0x571b
movl 0x14(%rsp), %r12d
movq 0x20(%rsp), %rbp
xorl %r15d, %r15d
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movl 0xa0(%rsp), %ecx
xorl %r8d, %r8d
callq 0x1522e
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movl 0xb8(%rsp), %ebx
movl %ebx, %ecx
callq 0x7dd9
pushq $0x1
popq %rcx
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movl %ebx, %r8d
callq 0x90ef
movq 0x1e21f(%rip), %rbx     # 0x20ff0
movq (%rbx), %rdi
leaq 0x16461(%rip), %rsi     # 0x1923c
leaq 0x162c8(%rip), %rdx     # 0x190aa
xorl %eax, %eax
callq 0x2280
movq (%rbx), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x42c6
leaq 0x16473(%rip), %rsi     # 0x19270
movq 0xa8(%rsp), %rdi
callq 0x16e82
movq %rax, %rbx
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rax, %r8
callq 0x473b
movq %rbx, %rdi
callq 0x2140
movq 0xb0(%rsp), %rbx
jmp 0x2754