// File: /workspace/github_cpp_makefile_star2_O2/aalto-speech[P]ftk/src/2g-prune-simple.cc
// Function: main
int main(int argc, char* argv[]) {

    conf::Config config;
    config("usage: 2g-prune-simple [OPTION...] WORDLIST TRANSITIONS_INIT MSFG_IN TRANSITIONS_OUT\n")
      ('h', "help", "", "", "display help")
      ('r', "removals=INT", "arg", "500", "Number of removals per iteration")
      ('m', "min-length=INT", "arg", "2", "Minimum length of subwords to remove, DEFAULT: 2")
      ('v', "vocab-size=INT", "arg must", "30000", "Target vocabulary size (stopping criterion)")
      ('f', "forward-backward", "", "", "Use Forward-backward segmentation instead of Viterbi")
      ('8', "utf-8", "", "", "Utf-8 character encoding in use");
    config.default_parse(argc, argv);
    if (config.arguments.size() != 4) config.print_help(stderr, 1);

    unsigned int removals_per_iter = config["removals"].get_int();
    unsigned int min_removal_length = config["min-length"].get_int();
    unsigned int target_vocab_size = config["vocab-size"].get_int();
    string wordlist_fname = config.arguments[0];
    string initial_transitions_fname = config.arguments[1];
    string msfg_fname = config.arguments[2];
    string transition_fname = config.arguments[3];
    bool enable_fb = config["forward-backward"].specified;
    bool utf8_encoding = config["utf-8"].specified;

    cerr << "parameters, initial transitions: " << initial_transitions_fname << endl;
    cerr << "parameters, wordlist: " << wordlist_fname << endl;
    cerr << "parameters, msfg: " << msfg_fname << endl;
    cerr << "parameters, transitions: " << transition_fname << endl;
    cerr << "parameters, removals per iteration: " << removals_per_iter << endl;
    cerr << "parameters, minimum length for subwords to remove: " << min_removal_length << endl;
    cerr << "parameters, target vocab size: " << target_vocab_size << endl;
    cerr << "parameters, floor lp: " << FLOOR_LP << endl;
    cerr << "parameters, use forward-backward: " << enable_fb << endl;
    cerr << "parameters, utf-8 encoding: " << utf8_encoding << endl;

    int word_maxlen;
    map<string, flt_type> all_chars;
    map<string, flt_type> freqs;
    map<string, flt_type> words;
    MultiStringFactorGraph msfg(start_end_symbol);
    transitions_t transitions;
    transitions_t trans_stats;
    map<string, flt_type> unigram_stats;
    set<string> short_subwords;

    cerr << "Reading initial transitions " << initial_transitions_fname << endl;
    int retval = Bigrams::read_transitions(transitions, initial_transitions_fname);
    if (retval < 0) {
        cerr << "something went wrong reading transitions" << endl;
        exit(EXIT_FAILURE);
    }
    cerr << "\tnumber of transitions: " << Bigrams::transition_count(transitions) << endl;
    cerr << "\tvocabulary size: " << transitions.size() << endl;

    map<string, flt_type> vocab;
    Bigrams::trans_to_vocab(transitions, vocab);
    find_short_factors(vocab, short_subwords, min_removal_length, utf8_encoding);

    cerr << "Reading word list " << wordlist_fname << endl;
    retval = Unigrams::read_vocab(wordlist_fname, words, word_maxlen, utf8_encoding);
    if (retval < 0) {
        cerr << "something went wrong reading word list" << endl;
        exit(EXIT_FAILURE);
    }
    cerr << "\t" << "wordlist size: " << words.size() << endl;
    cerr << "\t" << "maximum word length: " << word_maxlen << endl;

    cerr << "Reading msfg " << msfg_fname << endl;
    msfg.read(msfg_fname);

    if (transitions.size() < msfg.factor_node_map.size()) {
        vector<string> to_remove;
        cerr << "Pruning " << msfg.factor_node_map.size()-transitions.size() << " unused transitions from msfg." << endl;
        for (auto it = msfg.factor_node_map.begin(); it != msfg.factor_node_map.end(); ++it)
            if (transitions.find(it->first) == transitions.end())
                to_remove.push_back(it->first);
        for (auto it = to_remove.begin(); it != to_remove.end(); ++it)
            msfg.remove_arcs(*it);
    }

    assign_scores(transitions, msfg);

    std::cerr << std::setprecision(15);
    int iteration = 1;
    while (true) {

        cerr << "Iteration " << iteration << endl;

        flt_type lp = Bigrams::collect_trans_stats(words, msfg, trans_stats, unigram_stats, enable_fb);
        transitions.swap(trans_stats);
        Bigrams::freqs_to_logprobs(transitions);
        assign_scores(transitions, msfg);
        trans_stats.clear();

        cerr << "\tbigram likelihood: " << lp << endl;
        cerr << "\tnumber of transitions: " << Bigrams::transition_count(transitions) << endl;
        cerr << "\tvocabulary size: " << transitions.size() << endl;

        // Write temp transitions
        ostringstream transitions_temp;
        transitions_temp << "transitions.iter" << iteration << ".gz";
        cerr << "\twriting to: " << transitions_temp.str() << endl;
        Bigrams::write_transitions(transitions, transitions_temp.str());

        cerr << "\tinitializing removals .." << endl;
        map<string, flt_type> removals;
        if (iteration == 1 && transitions.size() % 1000 != 0) {
            int first_iter_removals = transitions.size() % 1000;
            Bigrams::init_candidates_freq(first_iter_removals, unigram_stats, removals, short_subwords);
        }
        else
            Bigrams::init_candidates_freq(removals_per_iter, unigram_stats, removals, short_subwords);

        vector<string> to_remove;
        for (auto it = removals.begin(); it != removals.end(); ++it)
            to_remove.push_back(it->first);
        Bigrams::remove_transitions(to_remove, transitions);
        for (auto it = to_remove.begin(); it != to_remove.end(); ++it)
            msfg.remove_arcs(*it);

        if  (transitions.size() <= target_vocab_size) break;
        iteration++;
    }

    // Write transitions
    Bigrams::write_transitions(transitions, transition_fname);

    exit(EXIT_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x998, %rsp            # imm = 0x998
movq %rsi, %rbx
movl %edi, %r14d
leaq -0x6e0(%rbp), %rdi
callq 0x7efc
leaq 0x1f4c9(%rip), %rsi     # 0x24022
leaq -0x628(%rbp), %rdi
leaq -0x860(%rbp), %rdx
callq 0x4150
leaq -0x6e0(%rbp), %rdi
leaq -0x628(%rbp), %rsi
callq 0x7f68
movq %rax, %r15
leaq 0x1f4f7(%rip), %rsi     # 0x24080
leaq -0x608(%rbp), %rdi
leaq -0x9b8(%rbp), %rdx
callq 0x4150
leaq 0x1fbf4(%rip), %rsi     # 0x24797
leaq -0x5e8(%rbp), %rdi
leaq -0x8c0(%rbp), %rdx
callq 0x4150
leaq 0x1fbda(%rip), %rsi     # 0x24797
leaq -0x5c8(%rbp), %rdi
leaq -0x890(%rbp), %rdx
callq 0x4150
leaq 0x1f4a1(%rip), %rsi     # 0x24078
leaq -0x5a8(%rbp), %rdi
leaq -0x268(%rbp), %rdx
callq 0x4150
pushq $0x68
popq %rsi
leaq -0x608(%rbp), %rdx
leaq -0x5e8(%rbp), %rcx
leaq -0x5c8(%rbp), %r8
leaq -0x5a8(%rbp), %r9
movq %r15, %rdi
callq 0x7f80
movq %rax, %r15
leaq 0x1f46a(%rip), %rsi     # 0x24085
leaq -0x588(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x4150
leaq 0x1f45d(%rip), %rsi     # 0x24092
leaq -0x568(%rbp), %rdi
leaq -0x238(%rbp), %rdx
callq 0x4150
leaq 0x1f447(%rip), %rsi     # 0x24096
leaq -0x548(%rbp), %rdi
leaq -0x208(%rbp), %rdx
callq 0x4150
leaq 0x1f431(%rip), %rsi     # 0x2409a
leaq -0x528(%rbp), %rdi
leaq -0x1d8(%rbp), %rdx
callq 0x4150
pushq $0x72
popq %rsi
leaq -0x588(%rbp), %rdx
leaq -0x568(%rbp), %rcx
leaq -0x548(%rbp), %r8
leaq -0x528(%rbp), %r9
movq %r15, %rdi
callq 0x7f80
movq %rax, %r15
leaq 0x1f40e(%rip), %rsi     # 0x240bb
leaq -0x508(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
callq 0x4150
leaq 0x1f3cb(%rip), %rsi     # 0x24092
leaq -0x4e8(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x4150
leaq 0x1f41b(%rip), %rsi     # 0x240f9
leaq -0x4c8(%rbp), %rdi
leaq -0x138(%rbp), %rdx
callq 0x4150
leaq 0x1f3d2(%rip), %rsi     # 0x240ca
leaq -0x4a8(%rbp), %rdi
leaq -0x118(%rbp), %rdx
callq 0x4150
pushq $0x6d
popq %rsi
leaq -0x508(%rbp), %rdx
leaq -0x4e8(%rbp), %rcx
leaq -0x4c8(%rbp), %r8
leaq -0x4a8(%rbp), %r9
movq %r15, %rdi
callq 0x7f80
movq %rax, %r15
leaq 0x1f3bf(%rip), %rsi     # 0x240fb
leaq -0x488(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0x4150
leaq 0x1f3b4(%rip), %rsi     # 0x2410a
leaq -0x468(%rbp), %rdi
leaq -0x158(%rbp), %rdx
callq 0x4150
leaq 0x1f3a3(%rip), %rsi     # 0x24113
leaq -0x448(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x4150
leaq 0x1f38f(%rip), %rsi     # 0x24119
leaq -0x428(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x4150
pushq $0x76
popq %rsi
leaq -0x488(%rbp), %rdx
leaq -0x468(%rbp), %rcx
leaq -0x448(%rbp), %r8
leaq -0x428(%rbp), %r9
movq %r15, %rdi
callq 0x7f80
movq %rax, %r15
leaq 0x1f37a(%rip), %rsi     # 0x24145
leaq -0x408(%rbp), %rdi
leaq -0x34(%rbp), %rdx
callq 0x4150
leaq 0x1f9b5(%rip), %rsi     # 0x24797
leaq -0x3e8(%rbp), %rdi
leaq -0x33(%rbp), %rdx
callq 0x4150
leaq 0x1f99e(%rip), %rsi     # 0x24797
leaq -0x3c8(%rbp), %rdi
leaq -0x32(%rbp), %rdx
callq 0x4150
leaq 0x1f346(%rip), %rsi     # 0x24156
leaq -0x3a8(%rbp), %rdi
leaq -0x31(%rbp), %rdx
callq 0x4150
pushq $0x66
popq %rsi
leaq -0x408(%rbp), %rdx
leaq -0x3e8(%rbp), %rcx
leaq -0x3c8(%rbp), %r8
leaq -0x3a8(%rbp), %r9
movq %r15, %rdi
callq 0x7f80
movq %rax, %r15
leaq 0x1f33a(%rip), %rsi     # 0x2418b
leaq -0x388(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x4150
leaq 0x1f92f(%rip), %rsi     # 0x24797
leaq -0x368(%rbp), %rdi
leaq -0x2f(%rbp), %rdx
callq 0x4150
leaq 0x1f918(%rip), %rsi     # 0x24797
leaq -0x348(%rbp), %rdi
leaq -0x2e(%rbp), %rdx
callq 0x4150
leaq 0x1f2fb(%rip), %rsi     # 0x24191
leaq -0x328(%rbp), %rdi
leaq -0x2d(%rbp), %rdx
callq 0x4150
pushq $0x38
popq %rsi
leaq -0x388(%rbp), %rdx
leaq -0x368(%rbp), %rcx
leaq -0x348(%rbp), %r8
leaq -0x328(%rbp), %r9
movq %r15, %rdi
callq 0x7f80
leaq -0x328(%rbp), %rdi
callq 0x46e8
leaq -0x348(%rbp), %rdi
callq 0x46e8
leaq -0x368(%rbp), %rdi
callq 0x46e8
leaq -0x388(%rbp), %rdi
callq 0x46e8
leaq -0x3a8(%rbp), %rdi
callq 0x46e8
leaq -0x3c8(%rbp), %rdi
callq 0x46e8
leaq -0x3e8(%rbp), %rdi
callq 0x46e8
leaq -0x408(%rbp), %rdi
callq 0x46e8
leaq -0x428(%rbp), %rdi
callq 0x46e8
leaq -0x448(%rbp), %rdi
callq 0x46e8
leaq -0x468(%rbp), %rdi
callq 0x46e8
leaq -0x488(%rbp), %rdi
callq 0x46e8
leaq -0x4a8(%rbp), %rdi
callq 0x46e8
leaq -0x4c8(%rbp), %rdi
callq 0x46e8
leaq -0x4e8(%rbp), %rdi
callq 0x46e8
leaq -0x508(%rbp), %rdi
callq 0x46e8
leaq -0x528(%rbp), %rdi
callq 0x46e8
leaq -0x548(%rbp), %rdi
callq 0x46e8
leaq -0x568(%rbp), %rdi
callq 0x46e8
leaq -0x588(%rbp), %rdi
callq 0x46e8
leaq -0x5a8(%rbp), %rdi
callq 0x46e8
leaq -0x5c8(%rbp), %rdi
callq 0x46e8
leaq -0x5e8(%rbp), %rdi
callq 0x46e8
leaq -0x608(%rbp), %rdi
callq 0x46e8
leaq -0x628(%rbp), %rdi
callq 0x46e8
leaq -0x6e0(%rbp), %rdi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x87e6
movq -0x640(%rbp), %rax
subq -0x648(%rbp), %rax
cmpq $0x80, %rax
je 0x503a
movq 0x30f98(%rip), %rax     # 0x35fc0
movq (%rax), %rsi
leaq -0x6e0(%rbp), %rdi
pushq $0x1
popq %rdx
callq 0x8cce
leaq 0x1f170(%rip), %rsi     # 0x241b1
leaq -0x308(%rbp), %rdi
leaq -0x860(%rbp), %rdx
callq 0x4150
leaq -0x6e0(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x8886
movq %rax, %rdi
callq 0x7dcc
movl %eax, %ebx
leaq -0x308(%rbp), %rdi
callq 0x46e8
leaq 0x1f136(%rip), %rsi     # 0x241ba
leaq -0x2e8(%rbp), %rdi
leaq -0x860(%rbp), %rdx
callq 0x4150
leaq -0x6e0(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x8886
movq %rax, %rdi
callq 0x7dcc
movl %eax, %r14d
leaq -0x2e8(%rbp), %rdi
callq 0x46e8
leaq 0x1f0fd(%rip), %rsi     # 0x241c5
leaq -0x2c8(%rbp), %rdi
leaq -0x860(%rbp), %rdx
callq 0x4150
leaq -0x6e0(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x8886
movq %rax, %rdi
callq 0x7dcc
movl %eax, %r15d
leaq -0x2c8(%rbp), %rdi
callq 0x46e8
movq -0x648(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x4480
movq -0x648(%rbp), %rsi
addq $0x20, %rsi
leaq -0x118(%rbp), %rdi
callq 0x4480
movq -0x648(%rbp), %rsi
addq $0x40, %rsi
leaq -0xf8(%rbp), %rdi
callq 0x4480
movq -0x648(%rbp), %rsi
addq $0x60, %rsi
leaq -0x158(%rbp), %rdi
callq 0x4480
leaq 0x1efe1(%rip), %rsi     # 0x24145
leaq -0x2a8(%rbp), %rdi
leaq -0x860(%rbp), %rdx
callq 0x4150
leaq -0x6e0(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x8886
movb 0x4a(%rax), %r12b
leaq -0x2a8(%rbp), %rdi
callq 0x46e8
leaq 0x1efea(%rip), %rsi     # 0x2418b
leaq -0x288(%rbp), %rdi
leaq -0x860(%rbp), %rdx
callq 0x4150
leaq -0x6e0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x8886
movb 0x4a(%rax), %al
movb %al, -0x2c(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x46e8
movq 0x30e08(%rip), %rdi     # 0x35fe8
leaq 0x1efe9(%rip), %rsi     # 0x241d0
callq 0x4350
leaq -0x118(%rbp), %rsi
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4190
movq 0x30dde(%rip), %rdi     # 0x35fe8
leaq 0x1efe1(%rip), %rsi     # 0x241f2
callq 0x4350
leaq -0x138(%rbp), %rsi
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4190
movq 0x30db4(%rip), %rdi     # 0x35fe8
leaq 0x1efce(%rip), %rsi     # 0x24209
callq 0x4350
leaq -0xf8(%rbp), %rsi
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4190
movq 0x30d8a(%rip), %rdi     # 0x35fe8
leaq 0x1efb7(%rip), %rsi     # 0x2421c
callq 0x4350
leaq -0x158(%rbp), %rsi
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4190
movq 0x30d60(%rip), %rdi     # 0x35fe8
leaq 0x1efa7(%rip), %rsi     # 0x24236
callq 0x4350
movl %ebx, %esi
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4190
movq 0x30d3b(%rip), %rdi     # 0x35fe8
leaq 0x1efa7(%rip), %rsi     # 0x2425b
callq 0x4350
movl %r14d, %esi
movq %rax, %rdi
movq %rsi, -0x78(%rbp)
callq 0x4260
movq %rax, %rdi
callq 0x4190
movq 0x30d11(%rip), %rdi     # 0x35fe8
leaq 0x1efb1(%rip), %rsi     # 0x2428f
callq 0x4350
movl %r15d, %esi
movq %rax, %rdi
movq %rsi, -0xd8(%rbp)
callq 0x4260
movq %rax, %rdi
callq 0x4190
movq 0x30ce4(%rip), %rdi     # 0x35fe8
leaq 0x1efa4(%rip), %rsi     # 0x242af
callq 0x4350
movsd 0x1ecf0(%rip), %xmm0    # 0x24008
movq %rax, %rdi
callq 0x4560
movq %rax, %rdi
callq 0x4190
movq 0x30cb9(%rip), %rdi     # 0x35fe8
leaq 0x1ef90(%rip), %rsi     # 0x242c6
callq 0x4350
movzbl %r12b, %esi
movq %rax, %rdi
movl %esi, -0x80(%rbp)
callq 0x45a0
movq %rax, %rdi
callq 0x4190
movq 0x30c8f(%rip), %rdi     # 0x35fe8
leaq 0x1ef89(%rip), %rsi     # 0x242e9
callq 0x4350
movzbl -0x2c(%rbp), %esi
movq %rax, %rdi
movl %esi, -0x7c(%rbp)
callq 0x45a0
movq %rax, %rdi
callq 0x4190
leaq -0x8b8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x888(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x260(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x30fc1(%rip), %rsi     # 0x36398
leaq -0x9b8(%rbp), %rdi
callq 0x5f52
leaq -0xa8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x230(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x200(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x1d0(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq 0x30b8e(%rip), %rdi     # 0x35fe8
leaq 0x1eea5(%rip), %rsi     # 0x24306
callq 0x4350
leaq -0x118(%rbp), %rsi
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4190
leaq -0xb0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x20d8c
testl %eax, %eax
jns 0x54b4
movq 0x30b4d(%rip), %rdi     # 0x35fe8
leaq 0x1ee81(%rip), %rsi     # 0x24323
callq 0x4350
movq %rax, %rdi
callq 0x4190
jmp 0x56ef
movq 0x30b2d(%rip), %rdi     # 0x35fe8
leaq 0x1ee8a(%rip), %rsi     # 0x2434c
callq 0x4350
movq %rax, %r14
leaq -0xb0(%rbp), %rdi
callq 0x2141a
movq %r14, %rdi
movl %eax, %esi
callq 0x4600
movq %rax, %rdi
callq 0x4190
movq 0x30af9(%rip), %rdi     # 0x35fe8
leaq 0x1ee6f(%rip), %rsi     # 0x24365
callq 0x4350
movq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4190
leaq -0x1a0(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0xb0(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x2146c
movq -0x190(%rbp), %r13
leaq -0x70(%rbp), %r15
leaq -0x860(%rbp), %r14
leaq -0x1a0(%rbp), %rax
cmpq %rax, %r13
je 0x5669
andq $0x0, -0x60(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
leaq 0x20(%r13), %r12
cmpb $0x0, -0x2c(%rbp)
je 0x55da
andl $0x0, -0x860(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x6a9e
andl $0x0, -0x860(%rbp)
xorl %eax, %eax
movl %eax, %eax
cmpq %rax, 0x28(%r13)
jbe 0x562d
movq (%r12), %rcx
movb (%rcx,%rax), %dl
pushq $0x1
popq %rcx
testb %dl, %dl
jns 0x55bf
pushq $0x4
popq %rcx
cmpb $-0x11, %dl
ja 0x55bf
cmpb $-0x20, %dl
pushq $0x2
popq %rcx
sbbl $-0x1, %ecx
addl %ecx, %eax
movl %eax, -0x860(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x6a78
movl -0x860(%rbp), %eax
jmp 0x5594
movq %r14, %rdi
movq %r12, %rsi
callq 0x4480
movq -0x70(%rbp), %rax
cmpq %rax, -0x68(%rbp)
je 0x55f3
movq %rax, -0x68(%rbp)
xorl %eax, %eax
movl %eax, -0xd0(%rbp)
movl %eax, %eax
movq -0x858(%rbp), %rcx
incq %rcx
cmpq %rax, %rcx
jbe 0x5625
movq %r15, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x6a78
movl -0xd0(%rbp), %eax
incl %eax
jmp 0x55f5
movq %r14, %rdi
callq 0x46e8
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
sarq $0x2, %rax
decq %rax
cmpq -0x78(%rbp), %rax
jae 0x5651
leaq -0x1d8(%rbp), %rdi
movq %r12, %rsi
callq 0x6cd8
movq %r15, %rdi
callq 0x6960
movq %r13, %rdi
callq 0x43c0
movq %rax, %r13
jmp 0x5553
movq 0x30978(%rip), %rdi     # 0x35fe8
leaq 0x1ed01(%rip), %rsi     # 0x24378
callq 0x4350
leaq -0x138(%rbp), %rsi
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4190
leaq -0x178(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x4480
leaq -0x178(%rbp), %rdi
leaq -0x268(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movl -0x7c(%rbp), %ecx
callq 0x1c846
movl %eax, %r14d
leaq -0x178(%rbp), %rdi
callq 0x46e8
testl %r14d, %r14d
jns 0x56f7
movq 0x3090d(%rip), %rdi     # 0x35fe8
leaq 0x1eca9(%rip), %rsi     # 0x2438b
callq 0x4350
movq %rax, %rdi
callq 0x4190
pushq $0x1
popq %rdi
callq 0x43d0
movq 0x308ea(%rip), %rdi     # 0x35fe8
leaq 0x1f091(%rip), %rsi     # 0x24796
callq 0x4350
leaq 0x1eca1(%rip), %rsi     # 0x243b2
movq %rax, %rdi
callq 0x4350
movq -0x240(%rbp), %rsi
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4190
movq 0x308b1(%rip), %rdi     # 0x35fe8
leaq 0x1f058(%rip), %rsi     # 0x24796
callq 0x4350
leaq 0x1ec78(%rip), %rsi     # 0x243c2
movq %rax, %rdi
callq 0x4350
movl -0x38(%rbp), %esi
movq %rax, %rdi
callq 0x4600
movq %rax, %rdi
callq 0x4190
movq 0x3087c(%rip), %rdi     # 0x35fe8
leaq 0x1ec65(%rip), %rsi     # 0x243d8
callq 0x4350
leaq -0xf8(%rbp), %rsi
movq %rax, %rdi
callq 0x4310
movq %rax, %rdi
callq 0x4190
leaq -0x9b8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x12c36
movq -0x88(%rbp), %rax
cmpq -0x8f8(%rbp), %rax
jae 0x588b
xorps %xmm0, %xmm0
movaps %xmm0, -0x860(%rbp)
andq $0x0, -0x850(%rbp)
movq 0x30819(%rip), %rdi     # 0x35fe8
leaq 0x1ec10(%rip), %rsi     # 0x243e6
callq 0x4350
movq -0x8f8(%rbp), %rsi
subq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x4260
leaq 0x1ebf7(%rip), %rsi     # 0x243ef
movq %rax, %rdi
callq 0x4350
movq %rax, %rdi
callq 0x4190
leaq -0x918(%rbp), %r15
movq 0x10(%r15), %r12
leaq -0xb0(%rbp), %r14
cmpq %r15, %r12
je 0x5857
leaq 0x20(%r12), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x7236
leaq -0xa8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x584a
leaq -0x860(%rbp), %rdi
movq %r13, %rsi
callq 0x60da
movq %r12, %rdi
callq 0x4280
movq %rax, %r12
jmp 0x581a
movq -0x860(%rbp), %r14
leaq -0x9b8(%rbp), %r15
cmpq -0x858(%rbp), %r14
je 0x587f
movq %r15, %rdi
movq %r14, %rsi
callq 0x127b2
addq $0x20, %r14
jmp 0x5865
leaq -0x860(%rbp), %rdi
callq 0x6116
leaq -0xb0(%rbp), %rdi
leaq -0x9b8(%rbp), %rsi
callq 0x1823a
movq 0x30743(%rip), %rcx     # 0x35fe8
movq (%rcx), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x8(%rcx,%rax)
pushq $0x1
popq %rax
movl %eax, -0x2c(%rbp)
leaq -0x68(%rbp), %r14
leaq -0x9b8(%rbp), %r15
leaq -0xd0(%rbp), %r13
movq 0x30714(%rip), %rdi     # 0x35fe8
leaq 0x1eb33(%rip), %rsi     # 0x2440e
callq 0x4350
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x4600
movq %rax, %rdi
callq 0x4190
leaq -0x268(%rbp), %rdi
movq %r15, %rsi
leaq -0x238(%rbp), %rdx
leaq -0x208(%rbp), %rcx
movl -0x80(%rbp), %r8d
callq 0x1fe1a
movsd %xmm0, -0x78(%rbp)
leaq -0xb0(%rbp), %r12
movq %r12, %rdi
leaq -0x238(%rbp), %rsi
callq 0x74a8
movq %r12, %rdi
movsd 0x1e6ce(%rip), %xmm0    # 0x24008
callq 0x1ffd0
leaq -0xb0(%rbp), %rdi
movq %r15, %rsi
callq 0x1823a
leaq -0x238(%rbp), %rdi
callq 0x757c
movq 0x30687(%rip), %rdi     # 0x35fe8
leaq 0x1eab1(%rip), %rsi     # 0x24419
callq 0x4350
movq %rax, %rdi
movsd -0x78(%rbp), %xmm0
callq 0x4560
movq %rax, %rdi
callq 0x4190
movq 0x3065f(%rip), %rdi     # 0x35fe8
leaq 0x1e9bc(%rip), %rsi     # 0x2434c
callq 0x4350
movq %rax, %r12
leaq -0xb0(%rbp), %rdi
callq 0x2141a
movq %r12, %rdi
movl %eax, %esi
callq 0x4600
movq %rax, %rdi
callq 0x4190
movq 0x3062b(%rip), %rdi     # 0x35fe8
leaq 0x1e9a1(%rip), %rsi     # 0x24365
callq 0x4350
movq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4190
leaq -0x860(%rbp), %rdi
callq 0x4470
leaq -0x860(%rbp), %rdi
leaq 0x1ea34(%rip), %rsi     # 0x2442e
callq 0x4350
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x4600
movq %rax, %rdi
leaq 0x1ea2b(%rip), %rsi     # 0x2443f
callq 0x4350
movq 0x305c8(%rip), %rdi     # 0x35fe8
leaq 0x1ea1c(%rip), %rsi     # 0x24443
callq 0x4350
movq %rax, %r12
leaq -0x70(%rbp), %rdi
leaq -0x858(%rbp), %rsi
callq 0x4540
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4310
movq %rax, %rdi
callq 0x4190
leaq -0x70(%rbp), %r12
movq %r12, %rdi
callq 0x46e8
movq %r12, %rdi
leaq -0x858(%rbp), %rsi
callq 0x4540
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
xorl %edx, %edx
pushq $0x6
popq %rcx
callq 0x20b18
leaq -0x70(%rbp), %rdi
callq 0x46e8
movq 0x30555(%rip), %rdi     # 0x35fe8
leaq 0x1e9b7(%rip), %rsi     # 0x24451
callq 0x4350
movq %rax, %rdi
callq 0x4190
andl $0x0, -0x68(%rbp)
andq $0x0, -0x60(%rbp)
movq %r14, -0x58(%rbp)
movq %r14, -0x50(%rbp)
andq $0x0, -0x48(%rbp)
cmpl $0x1, -0x2c(%rbp)
jne 0x5af4
movq -0x88(%rbp), %rax
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
divq %rcx
testq %rdx, %rdx
je 0x5af4
movl %edx, %edi
leaq -0x208(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x1d8(%rbp), %rcx
callq 0x21b62
jmp 0x5b0d
movl %ebx, %edi
leaq -0x208(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x1d8(%rbp), %rcx
callq 0x21b62
xorps %xmm0, %xmm0
movaps %xmm0, -0xd0(%rbp)
andq $0x0, -0xc0(%rbp)
movq -0x58(%rbp), %r12
cmpq %r14, %r12
je 0x5b42
leaq 0x20(%r12), %rsi
movq %r13, %rdi
callq 0x60da
movq %r12, %rdi
callq 0x4280
movq %rax, %r12
jmp 0x5b23
movq %r13, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x20f30
movq -0xd0(%rbp), %r12
cmpq -0xc8(%rbp), %r12
je 0x5b72
movq %r15, %rdi
movq %r12, %rsi
callq 0x127b2
addq $0x20, %r12
jmp 0x5b58
movq -0x88(%rbp), %r12
incl -0x2c(%rbp)
movq %r13, %rdi
callq 0x6116
leaq -0x70(%rbp), %rdi
callq 0x6f08
leaq -0x860(%rbp), %rdi
callq 0x40d0
cmpq -0xd8(%rbp), %r12
ja 0x58cd
leaq -0xb0(%rbp), %rdi
leaq -0x158(%rbp), %rsi
pushq $0x6
popq %rcx
xorl %edx, %edx
callq 0x20b18
xorl %edi, %edi
callq 0x43d0
jmp 0x5c17
jmp 0x5bcb
jmp 0x5bcb
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x6116
jmp 0x5be1
jmp 0x5bde
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x6f08
jmp 0x5c03
jmp 0x5c00
jmp 0x5bf2
jmp 0x5c00
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x46e8
jmp 0x5c03
movq %rax, %rbx
leaq -0x860(%rbp), %rdi
callq 0x40d0
jmp 0x5c63
jmp 0x5c17
jmp 0x5c17
jmp 0x5c17
movq %rax, %rbx
jmp 0x5c63
jmp 0x5c22
jmp 0x5c22
jmp 0x5c22
movq %rax, %rbx
leaq -0x860(%rbp), %rdi
callq 0x6116
jmp 0x5c63
movq %rax, %rbx
leaq -0x178(%rbp), %rdi
callq 0x46e8
jmp 0x5c63
jmp 0x5c57
movq %rax, %rbx
leaq -0x860(%rbp), %rdi
callq 0x46e8
jmp 0x5c5a
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x6960
leaq -0x1a8(%rbp), %rdi
callq 0x6f08
jmp 0x5c76
jmp 0x5c73
movq %rax, %rbx
leaq -0x1d8(%rbp), %rdi
callq 0x6f80
leaq -0x208(%rbp), %rdi
callq 0x6f08
leaq -0x238(%rbp), %rdi
callq 0x6ff8
leaq -0xb0(%rbp), %rdi
callq 0x6ff8
leaq -0x9b8(%rbp), %rdi
callq 0x11dcc
jmp 0x5cb7
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x6f08
leaq -0x890(%rbp), %rdi
callq 0x6f08
leaq -0x8c0(%rbp), %rdi
callq 0x6f08
jmp 0x5d01
jmp 0x5cfe
movq %rax, %rbx
leaq -0x288(%rbp), %rdi
jmp 0x5cf7
jmp 0x5cfe
movq %rax, %rbx
leaq -0x2a8(%rbp), %rdi
callq 0x46e8
jmp 0x5d01
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x46e8
jmp 0x5d12
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x46e8
jmp 0x5d23
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x46e8
jmp 0x5d34
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
jmp 0x5f34
jmp 0x5f3b
movq %rax, %rbx
leaq -0x2c8(%rbp), %rdi
jmp 0x5f34
jmp 0x5f3b
movq %rax, %rbx
leaq -0x2e8(%rbp), %rdi
jmp 0x5f34
jmp 0x5f3b
movq %rax, %rbx
leaq -0x308(%rbp), %rdi
jmp 0x5f34
jmp 0x5f3b
jmp 0x5f3b
movq %rax, %rbx
leaq -0x328(%rbp), %rdi
callq 0x46e8
jmp 0x5d9a
movq %rax, %rbx
leaq -0x348(%rbp), %rdi
callq 0x46e8
jmp 0x5dab
movq %rax, %rbx
leaq -0x368(%rbp), %rdi
callq 0x46e8
jmp 0x5dbc
movq %rax, %rbx
leaq -0x388(%rbp), %rdi
callq 0x46e8
jmp 0x5dcf
jmp 0x5dcc
movq %rax, %rbx
leaq -0x3a8(%rbp), %rdi
callq 0x46e8
jmp 0x5de0
movq %rax, %rbx
leaq -0x3c8(%rbp), %rdi
callq 0x46e8
jmp 0x5df1
movq %rax, %rbx
leaq -0x3e8(%rbp), %rdi
callq 0x46e8
jmp 0x5e02
movq %rax, %rbx
leaq -0x408(%rbp), %rdi
callq 0x46e8
jmp 0x5e15
jmp 0x5e12
movq %rax, %rbx
leaq -0x428(%rbp), %rdi
callq 0x46e8
jmp 0x5e26
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x46e8
jmp 0x5e37
movq %rax, %rbx
leaq -0x468(%rbp), %rdi
callq 0x46e8
jmp 0x5e48
movq %rax, %rbx
leaq -0x488(%rbp), %rdi
callq 0x46e8
jmp 0x5e5b
jmp 0x5e58
movq %rax, %rbx
leaq -0x4a8(%rbp), %rdi
callq 0x46e8
jmp 0x5e6c
movq %rax, %rbx
leaq -0x4c8(%rbp), %rdi
callq 0x46e8
jmp 0x5e7d
movq %rax, %rbx
leaq -0x4e8(%rbp), %rdi
callq 0x46e8
jmp 0x5e8e
movq %rax, %rbx
leaq -0x508(%rbp), %rdi
callq 0x46e8
jmp 0x5ea1
jmp 0x5e9e
movq %rax, %rbx
leaq -0x528(%rbp), %rdi
callq 0x46e8
jmp 0x5eb2
movq %rax, %rbx
leaq -0x548(%rbp), %rdi
callq 0x46e8
jmp 0x5ec3
movq %rax, %rbx
leaq -0x568(%rbp), %rdi
callq 0x46e8
jmp 0x5ed4
movq %rax, %rbx
leaq -0x588(%rbp), %rdi
callq 0x46e8
jmp 0x5ee7
jmp 0x5ee4
movq %rax, %rbx
leaq -0x5a8(%rbp), %rdi
callq 0x46e8
jmp 0x5ef8
movq %rax, %rbx
leaq -0x5c8(%rbp), %rdi
callq 0x46e8
jmp 0x5f09
movq %rax, %rbx
leaq -0x5e8(%rbp), %rdi
callq 0x46e8
jmp 0x5f1a
movq %rax, %rbx
leaq -0x608(%rbp), %rdi
callq 0x46e8
jmp 0x5f2d
jmp 0x5f2a
movq %rax, %rbx
leaq -0x628(%rbp), %rdi
callq 0x46e8
jmp 0x5f3e
movq %rax, %rbx
leaq -0x6e0(%rbp), %rdi
callq 0x6142
movq %rbx, %rdi
callq 0x4620