// File: /workspace/github_c_makefile_star2_O1/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 0x8489(%rip), %rdi      # 0xb488
movl $0x7270e00, %edx        # imm = 0x7270E00
movl $0xff, %esi
callq 0x2150
leaq 0x82ab(%rip), %rdi      # 0xb2c0
leaq 0x4069(%rip), %rsi      # 0x7085
callq 0x22a0
testq %rax, %rax
je 0x31bb
movq %rax, %rbx
movq $0x0, 0x8458(%rip) # 0xb490
leaq 0x4041(%rip), %rdi      # 0x7080
callq 0x29a9
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x27d4
movq %rbx, %rdi
callq 0x2370
testl %eax, %eax
jne 0x315e
movabsq $0x29f16b11c6d1e109, %r12 # imm = 0x29F16B11C6D1E109
movabsq $0x20c49ba5e353f7cf, %r13 # imm = 0x20C49BA5E353F7CF
leaq 0x400e(%rip), %r14      # 0x7088
movq 0x7f47(%rip), %rbp      # 0xafc8
movq %rsp, %r15
movq 0x840d(%rip), %rsi      # 0xb498
leaq 0x1(%rsi), %rcx
movq %rcx, %rax
imulq %r12
movq %rcx, 0x83fc(%rip)      # 0xb498
cmpl $0x2, 0x81b9(%rip)      # 0xb25c
jl 0x30f4
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 0x30f4
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 0x3114
cltq
movq 0x836e(%rip), %rcx      # 0xb478
leaq (%rax,%rax,4), %rax
incq (%rcx,%rax,8)
jmp 0x3131
movq %r15, %rdi
callq 0x29a9
cltq
movq 0x8353(%rip), %rcx      # 0xb478
leaq (%rax,%rax,4), %rax
movq $0x1, (%rcx,%rax,8)
cmpq $0x1406f41, 0x8354(%rip) # imm = 0x1406F41
jl 0x3143
callq 0x2c94
movq %r15, %rdi
movq %rbx, %rsi
callq 0x27d4
movq %rbx, %rdi
callq 0x2370
testl %eax, %eax
je 0x3084
callq 0x2adb
cmpl $0x0, 0x80f2(%rip)      # 0xb25c
jle 0x3196
movq 0x831d(%rip), %rsi      # 0xb490
leaq 0x3f16(%rip), %rdi      # 0x7090
xorl %eax, %eax
callq 0x2050
movq 0x8310(%rip), %rsi      # 0xb498
leaq 0x3f13(%rip), %rdi      # 0x70a2
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x2030
movq %rax, 0x8303(%rip)      # 0xb4a8
movq %rbx, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
leaq 0x41c2(%rip), %rdi      # 0x7384
callq 0x2360
movl $0x1, %edi
callq 0x22c0