// File: YerevaNN[P]pmi/train.cpp
// Function: std::vector<unsigned long, std::allocator<unsigned long>> getNgrams<std::_Deque_iterator<unsigned long, unsigned long&, unsigned long*>>(std::_Deque_iterator<unsigned long, unsigned long&, unsigned long*> const&, std::_Deque_iterator<unsigned long, unsigned long&, unsigned long*> const&)
std::vector<ngram> getNgrams(const T& begin, const T& end) {
    std::vector<ngram> ngrams;
    
    if(std::distance(begin, end) >= 1) {
        auto unigrams = getUnigrams(begin, end);
        ngrams.insert(ngrams.end(), unigrams.begin(), unigrams.end());
    }
    if(std::distance(begin, end) >= 2) {
        auto bigrams = getBigrams(begin, end);
        ngrams.insert(ngrams.end(), bigrams.begin(), bigrams.end());
    }
    if(std::distance(begin, end) >= 3) {
        auto trigrams = getTrigrams(begin, end);
        ngrams.insert(ngrams.end(), trigrams.begin(), trigrams.end());
    }
    
    return ngrams;
}

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x60(%rsp)
movq %rdi, %rax
movq %rax, 0x68(%rsp)
movq %rdi, 0x230(%rsp)
movq %rsi, 0x228(%rsp)
movq %rdx, 0x220(%rsp)
movb $0x0, 0x21f(%rsp)
callq 0xc700
movq 0x228(%rsp), %rsi
leaq 0x1f8(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0xc140
movq 0x220(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xc140
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0xc710
movq %rax, 0x80(%rsp)
jmp 0xc216
movq 0x80(%rsp), %rax
cmpq $0x1, %rax
jl 0xc31e
movq 0x228(%rsp), %rsi
movq 0x220(%rsp), %rdx
leaq 0x1b0(%rsp), %rdi
callq 0xc770
jmp 0xc247
movq 0x60(%rsp), %rdi
callq 0xc600
movq %rax, 0x1a0(%rsp)
leaq 0x1a8(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0xc9b0
leaq 0x1b0(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0xc5d0
movq 0x50(%rsp), %rdi
movq %rax, 0x198(%rsp)
callq 0xc600
movq 0x60(%rsp), %rdi
movq %rax, 0x190(%rsp)
movq 0x1a8(%rsp), %rsi
movq 0x198(%rsp), %rdx
movq 0x190(%rsp), %rcx
callq 0xc8f0
movq %rax, 0x58(%rsp)
jmp 0xc2c3
movq 0x58(%rsp), %rax
movq %rax, 0x188(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0xc6a0
jmp 0xc31e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
jmp 0xc5ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0xc6a0
jmp 0xc5ae
movq 0x228(%rsp), %rsi
leaq 0x168(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0xc140
movq 0x220(%rsp), %rsi
leaq 0x148(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0xc140
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0xc710
movq %rax, 0x48(%rsp)
jmp 0xc368
movq 0x48(%rsp), %rax
cmpq $0x2, %rax
jl 0xc454
movq 0x228(%rsp), %rsi
movq 0x220(%rsp), %rdx
leaq 0x130(%rsp), %rdi
callq 0xc9f0
jmp 0xc396
movq 0x60(%rsp), %rdi
callq 0xc600
movq %rax, 0x120(%rsp)
leaq 0x128(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0xc9b0
leaq 0x130(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xc5d0
movq 0x28(%rsp), %rdi
movq %rax, 0x118(%rsp)
callq 0xc600
movq 0x60(%rsp), %rdi
movq %rax, 0x110(%rsp)
movq 0x128(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq 0x110(%rsp), %rcx
callq 0xc8f0
movq %rax, 0x30(%rsp)
jmp 0xc412
movq 0x30(%rsp), %rax
movq %rax, 0x108(%rsp)
leaq 0x130(%rsp), %rdi
callq 0xc6a0
jmp 0xc454
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0x130(%rsp), %rdi
callq 0xc6a0
jmp 0xc5ae
movq 0x228(%rsp), %rsi
leaq 0xe8(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xc140
movq 0x220(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xc140
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xc710
movq %rax, 0x20(%rsp)
jmp 0xc49e
movq 0x20(%rsp), %rax
cmpq $0x3, %rax
jl 0xc585
movq 0x228(%rsp), %rsi
movq 0x220(%rsp), %rdx
leaq 0xb0(%rsp), %rdi
callq 0xcc00
jmp 0xc4cc
movq 0x60(%rsp), %rdi
callq 0xc600
movq %rax, 0xa0(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xc9b0
leaq 0xb0(%rsp), %rdi
movq %rdi, (%rsp)
callq 0xc5d0
movq (%rsp), %rdi
movq %rax, 0x98(%rsp)
callq 0xc600
movq 0x60(%rsp), %rdi
movq %rax, 0x90(%rsp)
movq 0xa8(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq 0x90(%rsp), %rcx
callq 0xc8f0
movq %rax, 0x8(%rsp)
jmp 0xc546
movq 0x8(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xc6a0
jmp 0xc585
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xc6a0
jmp 0xc5ae
movb $0x1, 0x21f(%rsp)
testb $0x1, 0x21f(%rsp)
jne 0xc5a1
movq 0x60(%rsp), %rdi
callq 0xc6a0
movq 0x68(%rsp), %rax
addq $0x238, %rsp            # imm = 0x238
retq
movq 0x60(%rsp), %rdi
callq 0xc6a0
movq 0x1d0(%rsp), %rdi
callq 0x2280
nopw %cs:(%rax,%rax)
nop