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

    conf::Config config;
    config("usage: llh [OPTION...] WORDLIST VOCABULARY\n")
      ('h', "help", "", "", "display help")
      ('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() != 2) config.print_help(stderr, 1);

    bool enable_forward_backward = config["forward-backward"].specified;
    bool utf8_encoding = config["utf-8"].specified;
    string wordlist_fname = config.arguments[0];
    string vocab_in_fname = config.arguments[1];

    cerr << "parameters, wordlist: " << wordlist_fname << endl;
    cerr << "parameters, vocabulary: " << vocab_in_fname << endl;
    cerr << "parameters, use forward-backward: " << enable_forward_backward << endl;
    cerr << "parameters, utf-8 encoding: " << utf8_encoding << endl;

    int maxlen, word_maxlen;
    map<string, flt_type> vocab;
    map<string, flt_type> freqs;
    map<string, flt_type> words;

    cerr << "Reading vocabulary " << vocab_in_fname << endl;
    int retval = Unigrams::read_vocab(vocab_in_fname, vocab, maxlen, utf8_encoding);
    if (retval < 0) {
        cerr << "something went wrong reading vocabulary" << endl;
        exit(EXIT_FAILURE);
    }
    cerr << "\t" << "size: " << vocab.size() << endl;
    cerr << "\t" << "maximum string length: " << maxlen << endl;

    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;

    Unigrams ug;
    if (enable_forward_backward)
        ug.set_segmentation_method(forward_backward);
    else
        ug.set_segmentation_method(viterbi);
    ug.set_utf8(utf8_encoding);

    flt_type ll = ug.resegment_words(words, vocab, freqs);
    cerr << "cost: " << ll << endl;

    exit(EXIT_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x410, %rsp            # imm = 0x410
movq %rsi, %rbx
movl %edi, %r14d
leaq -0x428(%rbp), %rdi
callq 0x5fd0
leaq 0x1e4df(%rip), %rsi     # 0x23006
leaq -0x308(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x4140
leaq -0x428(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x603c
movq %rax, %r15
leaq 0x1e4e3(%rip), %rsi     # 0x2303a
leaq -0x2e8(%rbp), %rdi
leaq -0x370(%rbp), %rdx
callq 0x4140
leaq 0x1e9b6(%rip), %rsi     # 0x23527
leaq -0x2c8(%rbp), %rdi
leaq -0x128(%rbp), %rdx
callq 0x4140
leaq 0x1e99c(%rip), %rsi     # 0x23527
leaq -0x2a8(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x4140
leaq 0x1e490(%rip), %rsi     # 0x23032
leaq -0x288(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x4140
pushq $0x68
popq %rsi
leaq -0x2e8(%rbp), %rdx
leaq -0x2c8(%rbp), %rcx
leaq -0x2a8(%rbp), %r8
leaq -0x288(%rbp), %r9
movq %r15, %rdi
callq 0x6054
movq %rax, %r15
leaq 0x1e45c(%rip), %rsi     # 0x2303f
leaq -0x268(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0x4140
leaq 0x1e92a(%rip), %rsi     # 0x23527
leaq -0x248(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x4140
leaq 0x1e913(%rip), %rsi     # 0x23527
leaq -0x228(%rbp), %rdi
leaq -0x2c(%rbp), %rdx
callq 0x4140
leaq 0x1e425(%rip), %rsi     # 0x23050
leaq -0x208(%rbp), %rdi
leaq -0x25(%rbp), %rdx
callq 0x4140
pushq $0x66
popq %rsi
leaq -0x268(%rbp), %rdx
leaq -0x248(%rbp), %rcx
leaq -0x228(%rbp), %r8
leaq -0x208(%rbp), %r9
movq %r15, %rdi
callq 0x6054
movq %rax, %r15
leaq 0x1e419(%rip), %rsi     # 0x23085
leaq -0x1e8(%rbp), %rdi
leaq -0x24(%rbp), %rdx
callq 0x4140
leaq 0x1e8a4(%rip), %rsi     # 0x23527
leaq -0x1c8(%rbp), %rdi
leaq -0x23(%rbp), %rdx
callq 0x4140
leaq 0x1e88d(%rip), %rsi     # 0x23527
leaq -0x1a8(%rbp), %rdi
leaq -0x22(%rbp), %rdx
callq 0x4140
leaq 0x1e3da(%rip), %rsi     # 0x2308b
leaq -0x188(%rbp), %rdi
leaq -0x21(%rbp), %rdx
callq 0x4140
pushq $0x38
popq %rsi
leaq -0x1e8(%rbp), %rdx
leaq -0x1c8(%rbp), %rcx
leaq -0x1a8(%rbp), %r8
leaq -0x188(%rbp), %r9
movq %r15, %rdi
callq 0x6054
leaq -0x188(%rbp), %rdi
callq 0x46b8
leaq -0x1a8(%rbp), %rdi
callq 0x46b8
leaq -0x1c8(%rbp), %rdi
callq 0x46b8
leaq -0x1e8(%rbp), %rdi
callq 0x46b8
leaq -0x208(%rbp), %rdi
callq 0x46b8
leaq -0x228(%rbp), %rdi
callq 0x46b8
leaq -0x248(%rbp), %rdi
callq 0x46b8
leaq -0x268(%rbp), %rdi
callq 0x46b8
leaq -0x288(%rbp), %rdi
callq 0x46b8
leaq -0x2a8(%rbp), %rdi
callq 0x46b8
leaq -0x2c8(%rbp), %rdi
callq 0x46b8
leaq -0x2e8(%rbp), %rdi
callq 0x46b8
leaq -0x308(%rbp), %rdi
callq 0x46b8
leaq -0x428(%rbp), %rdi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x68ba
movq -0x388(%rbp), %rax
subq -0x390(%rbp), %rax
cmpq $0x40, %rax
je 0x4dc3
movq 0x3020f(%rip), %rax     # 0x34fc0
movq (%rax), %rsi
leaq -0x428(%rbp), %rdi
pushq $0x1
popq %rdx
callq 0x6da2
leaq 0x1e275(%rip), %rsi     # 0x2303f
leaq -0x168(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x4140
leaq -0x428(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x695a
movb 0x4a(%rax), %r15b
leaq -0x168(%rbp), %rdi
callq 0x46b8
leaq 0x1e27e(%rip), %rsi     # 0x23085
leaq -0x148(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x4140
leaq -0x428(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x695a
movb 0x4a(%rax), %r12b
leaq -0x148(%rbp), %rdi
callq 0x46b8
movq -0x390(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x4460
movq -0x390(%rbp), %rsi
addq $0x20, %rsi
leaq -0x58(%rbp), %rdi
callq 0x4460
movq 0x30180(%rip), %rdi     # 0x34fe8
leaq 0x1e23c(%rip), %rsi     # 0x230ab
callq 0x4340
leaq -0x78(%rbp), %rsi
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
callq 0x4180
movq 0x30159(%rip), %rdi     # 0x34fe8
leaq 0x1e22c(%rip), %rsi     # 0x230c2
callq 0x4340
leaq -0x58(%rbp), %rsi
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
callq 0x4180
movq 0x30132(%rip), %rdi     # 0x34fe8
leaq 0x1e21e(%rip), %rsi     # 0x230db
callq 0x4340
movzbl %r15b, %esi
movq %rax, %rdi
callq 0x4570
movq %rax, %rdi
callq 0x4180
movq 0x3010b(%rip), %rdi     # 0x34fe8
leaq 0x1e21a(%rip), %rsi     # 0x230fe
callq 0x4340
movzbl %r12b, %ebx
movq %rax, %rdi
movl %ebx, %esi
callq 0x4570
movq %rax, %rdi
callq 0x4180
leaq -0xa0(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x368(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x120(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq 0x3008e(%rip), %rdi     # 0x34fe8
leaq 0x1e1ba(%rip), %rsi     # 0x2311b
callq 0x4340
leaq -0x58(%rbp), %rsi
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
callq 0x4180
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4460
leaq -0xf8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movl %ebx, %ecx
callq 0x1ba12
movl %eax, %r14d
leaq -0xf8(%rbp), %rdi
callq 0x46b8
testl %r14d, %r14d
jns 0x4fda
movq 0x3002a(%rip), %rdi     # 0x34fe8
leaq 0x1e16a(%rip), %rsi     # 0x2312f
callq 0x4340
movq %rax, %rdi
callq 0x4180
pushq $0x1
popq %rdi
callq 0x43c0
movq 0x30007(%rip), %rdi     # 0x34fe8
leaq 0x1e53e(%rip), %rsi     # 0x23526
callq 0x4340
leaq 0x1e1be(%rip), %rsi     # 0x231b2
movq %rax, %rdi
callq 0x4340
movq -0x80(%rbp), %rsi
movq %rax, %rdi
callq 0x4250
movq %rax, %rdi
callq 0x4180
movq 0x2ffd1(%rip), %rdi     # 0x34fe8
leaq 0x1e508(%rip), %rsi     # 0x23526
callq 0x4340
leaq 0x1e12d(%rip), %rsi     # 0x23157
movq %rax, %rdi
callq 0x4340
movl -0x30(%rbp), %esi
movq %rax, %rdi
callq 0x45d0
movq %rax, %rdi
callq 0x4180
movq 0x2ff9c(%rip), %rdi     # 0x34fe8
leaq 0x1e11c(%rip), %rsi     # 0x2316f
callq 0x4340
leaq -0x78(%rbp), %rsi
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
callq 0x4180
leaq -0xd8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4460
leaq -0xd8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movl %ebx, %ecx
callq 0x1ba12
movl %eax, %ebx
leaq -0xd8(%rbp), %rdi
callq 0x46b8
testl %ebx, %ebx
jns 0x50c7
movq 0x2ff3a(%rip), %rdi     # 0x34fe8
leaq 0x1e0cd(%rip), %rsi     # 0x23182
callq 0x4340
movq %rax, %rdi
callq 0x4180
jmp 0x4fd2
movq 0x2ff1a(%rip), %rdi     # 0x34fe8
leaq 0x1e451(%rip), %rsi     # 0x23526
callq 0x4340
leaq 0x1e0c8(%rip), %rsi     # 0x231a9
movq %rax, %rdi
callq 0x4340
movq -0x100(%rbp), %rsi
movq %rax, %rdi
callq 0x4250
movq %rax, %rdi
callq 0x4180
movq 0x2fee1(%rip), %rdi     # 0x34fe8
leaq 0x1e418(%rip), %rsi     # 0x23526
callq 0x4340
leaq 0x1e09f(%rip), %rsi     # 0x231b9
movq %rax, %rdi
callq 0x4340
movl -0x2c(%rbp), %esi
movq %rax, %rdi
callq 0x45d0
movq %rax, %rdi
callq 0x4180
testb %r15b, %r15b
je 0x5143
leaq 0x10afd(%rip), %rax     # 0x15c3e
jmp 0x514a
leaq 0x10650(%rip), %rax     # 0x1579a
leaq -0xb8(%rbp), %rdi
movq %rax, (%rdi)
movb %r12b, 0x8(%rdi)
leaq -0x338(%rbp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x128(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
leaq -0x370(%rbp), %rcx
leaq -0x340(%rbp), %r8
callq 0x1c264
movsd %xmm0, -0x38(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x53c6
movq 0x2fe37(%rip), %rdi     # 0x34fe8
leaq 0x1e017(%rip), %rsi     # 0x231cf
callq 0x4340
movq %rax, %rdi
movsd -0x38(%rbp), %xmm0
callq 0x4530
movq %rax, %rdi
callq 0x4180
xorl %edi, %edi
callq 0x43c0
jmp 0x520b
movq %rax, %rbx
leaq -0x340(%rbp), %rdi
callq 0x53c6
jmp 0x520e
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
jmp 0x5202
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x46b8
jmp 0x520e
jmp 0x520b
movq %rax, %rbx
leaq -0x128(%rbp), %rdi
callq 0x543e
leaq -0x370(%rbp), %rdi
callq 0x543e
leaq -0xa8(%rbp), %rdi
callq 0x543e
jmp 0x5237
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x46b8
jmp 0x5245
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
jmp 0x535c
jmp 0x5363
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
jmp 0x535c
jmp 0x5363
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
jmp 0x535c
jmp 0x5363
jmp 0x5363
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
callq 0x46b8
jmp 0x5294
movq %rax, %rbx
leaq -0x1a8(%rbp), %rdi
callq 0x46b8
jmp 0x52a5
movq %rax, %rbx
leaq -0x1c8(%rbp), %rdi
callq 0x46b8
jmp 0x52b6
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x46b8
jmp 0x52c9
jmp 0x52c6
movq %rax, %rbx
leaq -0x208(%rbp), %rdi
callq 0x46b8
jmp 0x52da
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x46b8
jmp 0x52eb
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
callq 0x46b8
jmp 0x52fc
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x46b8
jmp 0x530f
jmp 0x530c
movq %rax, %rbx
leaq -0x288(%rbp), %rdi
callq 0x46b8
jmp 0x5320
movq %rax, %rbx
leaq -0x2a8(%rbp), %rdi
callq 0x46b8
jmp 0x5331
movq %rax, %rbx
leaq -0x2c8(%rbp), %rdi
callq 0x46b8
jmp 0x5342
movq %rax, %rbx
leaq -0x2e8(%rbp), %rdi
callq 0x46b8
jmp 0x5355
jmp 0x5352
movq %rax, %rbx
leaq -0x308(%rbp), %rdi
callq 0x46b8
jmp 0x5366
movq %rax, %rbx
leaq -0x428(%rbp), %rdi
callq 0x537a
movq %rbx, %rdi
callq 0x45f0