// File: /workspace/github_c_makefile_star2_O3/Leeheng86[P]word2vec/word2vec.c
// Function: LearnVocabFromTrainFile()
void LearnVocabFromTrainFile() {
  char word[MAX_STRING];
  FILE *fin;
  long long a, i;
  for (a = 0; a < vocab_hash_size; a++) vocab_hash[a] = -1;
  fin = fopen(train_file, "rb");
  if (fin == NULL) {
    printf("ERROR: training data file not found!\n");
    exit(1);
  }
  vocab_size = 0;
  AddWordToVocab((char *)"
");
  while (1) {
    ReadWord(word, fin);
    if (feof(fin)) break;
    train_words++;
    if ((debug_mode > 1) && (train_words % 100000 == 0)) {
      printf("%lldK%c", train_words / 1000, 13);
      fflush(stdout);
    }
    i = SearchVocab(word);
    if (i == -1) {
      a = AddWordToVocab(word);
      vocab[a].cn = 1;
    } else vocab[i].cn++;
    if (vocab_size > vocab_hash_size * 0.7) ReduceVocab();
  }
  SortVocab();
  if (debug_mode > 0) {
    printf("Vocab size: %lld\n", vocab_size);
    printf("Words in train file: %lld\n", train_words);
  }
  file_size = ftell(fin);
  fclose(fin);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq 0x83b1(%rip), %rdi      # 0xb488
movl $0x7270e00, %edx        # imm = 0x7270E00
movl $0xff, %esi
callq 0x2150
leaq 0x81d3(%rip), %rdi      # 0xb2c0
leaq 0x3fdd(%rip), %rsi      # 0x70d1
callq 0x22a0
testq %rax, %rax
je 0x3293
movq %rax, %rbx
movq $0x0, 0x8380(%rip) # 0xb490
leaq 0x3fb5(%rip), %rdi      # 0x70cc
callq 0x29a9
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x27d4
movq %rbx, %rdi
callq 0x2370
testl %eax, %eax
jne 0x3236
movabsq $0x29f16b11c6d1e109, %r12 # imm = 0x29F16B11C6D1E109
movabsq $0x20c49ba5e353f7cf, %r13 # imm = 0x20C49BA5E353F7CF
leaq 0x3f82(%rip), %r14      # 0x70d4
movq 0x7e6f(%rip), %rbp      # 0xafc8
movq %rsp, %r15
movq 0x8335(%rip), %rsi      # 0xb498
leaq 0x1(%rsi), %rcx
movq %rcx, %rax
imulq %r12
movq %rcx, 0x8324(%rip)      # 0xb498
cmpl $0x2, 0x80e1(%rip)      # 0xb25c
jl 0x31cc
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0xe, %rdx
addq %rax, %rdx
imulq $0x186a0, %rdx, %rax    # imm = 0x186A0
negq %rax
addq %rsi, %rax
incq %rax
testq %rax, %rax
jne 0x31cc
movq %rcx, %rax
imulq %r13
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x7, %rdx
addq %rdx, %rsi
movq %r14, %rdi
movl $0xd, %edx
xorl %eax, %eax
callq 0x2050
movq (%rbp), %rdi
callq 0x2290
movq %r15, %rdi
callq 0x28bb
cmpl $-0x1, %eax
je 0x31ec
cltq
movq 0x8296(%rip), %rcx      # 0xb478
leaq (%rax,%rax,4), %rax
incq (%rcx,%rax,8)
jmp 0x3209
movq %r15, %rdi
callq 0x29a9
cltq
movq 0x827b(%rip), %rcx      # 0xb478
leaq (%rax,%rax,4), %rax
movq $0x1, (%rcx,%rax,8)
cmpq $0x1406f41, 0x827c(%rip) # imm = 0x1406F41
jl 0x321b
callq 0x2c98
movq %r15, %rdi
movq %rbx, %rsi
callq 0x27d4
movq %rbx, %rdi
callq 0x2370
testl %eax, %eax
je 0x315c
callq 0x2adb
cmpl $0x0, 0x801a(%rip)      # 0xb25c
jle 0x326e
movq 0x8245(%rip), %rsi      # 0xb490
leaq 0x3e8a(%rip), %rdi      # 0x70dc
xorl %eax, %eax
callq 0x2050
movq 0x8238(%rip), %rsi      # 0xb498
leaq 0x3e87(%rip), %rdi      # 0x70ee
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x2030
movq %rax, 0x822b(%rip)      # 0xb4a8
movq %rbx, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
leaq 0x4136(%rip), %rdi      # 0x73d0
callq 0x2360
movl $0x1, %edi
callq 0x22c0