// File: /workspace/github_cpp_makefile_star2_O3/YerevaNN[P]pmi/train.cpp
// Function: model::train(std::istream&, unsigned long)
void model::train(std::istream& in, size_t windowSize) {
    clear();
    
    std::deque<word> window;
    
    std::string s;
    
    while(window.size() != windowSize) {
        window.push_back(readWord(in));
    }
    
    size counter = 0;
    
    while(true) {
        processWindow(window.begin(), window.end());
        
        word add = readWord(in);
        if(add == emptyWord) {
            break;
        }
        window.push_back(add);
        window.pop_front();
        
        ++counter;
        if(counter % 731 == 0)
            report("\r%lld\t\t", counter);
    }
    std::cerr << std::endl;

    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
callq 0x307e
xorps %xmm0, %xmm0
movq %rsp, %r12
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %r12, %rdi
xorl %esi, %esi
callq 0x4ae6
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x58(%rsp), %r13
movq 0x48(%rsp), %rcx
movq 0x28(%rsp), %rsi
movq %rcx, %rax
subq %rsi, %rax
shrq $0x3, %rax
cmpq $0x1, %rcx
adcq $-0x1, %rax
shlq $0x6, %rax
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %r8
movq %rdi, %rdx
subq %r8, %rdx
sarq $0x3, %rdx
movq 0x10(%rsp), %r10
movq 0x20(%rsp), %r9
movq %r9, %r11
subq %r10, %r11
sarq $0x3, %r11
addq %rdx, %r11
addq %rax, %r11
cmpq %r15, %r11
je 0x47f5
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4672
movq %rax, 0x58(%rsp)
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rdx
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x47e5
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x30(%rsp)
jmp 0x475e
movq %r12, %rdi
movq %r13, %rsi
callq 0x4db8
jmp 0x475e
movl $0x1, %r15d
leaq 0x58(%rsp), %r12
movq 0x47c1(%rip), %r13      # 0x8fc8
movq %r15, %rax
movabsq $0x2cd38620eb56802d, %rdx # imm = 0x2CD38620EB56802D
mulq %rdx
movq %rdx, %rbp
movq %r10, 0x58(%rsp)
movq 0x18(%rsp), %rax
movq 0x40(%rsp), %rdx
movq %rax, 0x60(%rsp)
movq %r9, 0x68(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdi, 0x98(%rsp)
movq %r8, 0xa0(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rcx, 0xb0(%rsp)
movq %r14, %rdi
movq %r12, %rsi
leaq 0x98(%rsp), %rdx
callq 0x4a0c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4672
movq %rax, 0x58(%rsp)
cmpq $0x1fffff, %rax         # imm = 0x1FFFFF
je 0x4965
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rdx
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x48a8
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x30(%rsp)
jmp 0x48b3
movq %rsp, %rdi
movq %r12, %rsi
callq 0x5b32
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x48cc
addq $0x8, %rax
jmp 0x48fe
movq 0x18(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x2130
movq 0x28(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x28(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x20(%rsp)
shrq $0x7, %rbp
imulq $0x2db, %rbp, %rcx      # imm = 0x2DB
movl $0x1, %edx
subq %rcx, %rdx
movq %rax, 0x10(%rsp)
addq %r15, %rdx
cmpq $0x1, %rdx
je 0x494e
movq (%r13), %rdi
callq 0x2160
movq 0x10(%rsp), %r10
movq 0x20(%rsp), %r9
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %r8
movq 0x48(%rsp), %rcx
incq %r15
jmp 0x4807
movq (%r13), %rdi
leaq 0x178f(%rip), %rsi      # 0x60e8
movq %r15, %rdx
xorl %eax, %eax
callq 0x21b0
jmp 0x491f
movq 0x4684(%rip), %rdi      # 0x8ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x4669(%rip), %rdi      # 0x8ff0
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x49b6
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2130
movq %rsp, %rdi
callq 0x4d60
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x49d6
jmp 0x49d6
jmp 0x49d6
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x49fb
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2130
movq %rsp, %rdi
callq 0x4d60
movq %rbx, %rdi
callq 0x2220
nop