// File: /workspace/github_cpp_makefile_star2_O1/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 0x3076
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 0x4aaa
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x70(%rsp), %r13
movq 0x48(%rsp), %rax
movq %rax, %rcx
subq 0x28(%rsp), %rcx
shrq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
shlq $0x6, %rcx
movq 0x30(%rsp), %rax
subq 0x38(%rsp), %rax
movq 0x20(%rsp), %rdx
sarq $0x3, %rax
subq 0x10(%rsp), %rdx
sarq $0x3, %rdx
addq %rax, %rdx
addq %rcx, %rdx
cmpq %r15, %rdx
je 0x47f0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4682
movq %rax, 0x70(%rsp)
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rdx
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x47e0
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x30(%rsp)
jmp 0x476b
movq %r12, %rdi
movq %r13, %rsi
callq 0x4d82
jmp 0x476b
leaq 0x70(%rsp), %r15
leaq 0x90(%rsp), %r12
xorl %ebp, %ebp
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps 0x30(%rsp), %xmm2
movaps 0x40(%rsp), %xmm3
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x49d2
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4682
movq %rax, %r13
movq %rax, 0x70(%rsp)
cmpq $0x1fffff, %rax         # imm = 0x1FFFFF
je 0x490b
movq 0x30(%rsp), %rax
movq 0x40(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x487e
movq %r13, (%rax)
addq $0x8, %rax
movq %rax, 0x30(%rsp)
jmp 0x4889
movq %rsp, %rdi
movq %r15, %rsi
callq 0x5b30
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x48a2
addq $0x8, %rax
jmp 0x48d4
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)
movq %rax, 0x10(%rsp)
incq %rbp
movq %rbp, %rax
movabsq $0x52ffa658f3be2953, %rcx # imm = 0x52FFA658F3BE2953
imulq %rcx, %rax
movabsq $0x59a70c41d6ad00, %rcx # imm = 0x59A70C41D6AD00
cmpq %rcx, %rax
jbe 0x491a
movq 0x46c5(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
callq 0x2160
cmpq $0x1fffff, %r13         # imm = 0x1FFFFF
jne 0x47ff
jmp 0x4937
movq 0x46a7(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
leaq 0x17bd(%rip), %rsi      # 0x60e8
movq %rbp, %rdx
xorl %eax, %eax
callq 0x21b0
jmp 0x48fc
movq 0x46b2(%rip), %rdi      # 0x8ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x4697(%rip), %rdi      # 0x8ff0
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x4982
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2130
movq %rsp, %rdi
callq 0x4d32
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x49a2
jmp 0x49a2
jmp 0x49a2
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x49c1
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2130
movq %rsp, %rdi
callq 0x4d32
movq %rbx, %rdi
callq 0x2220
nop