// File: /workspace/github_c_makefile_star2_O2/Leeheng86[P]word2vec/word2vec.c
// Function: main
int main(int argc, char **argv) {
  int i;
  if (argc == 1) {
    printf("WORD VECTOR estimation toolkit v 0.1c\n\n");
    printf("Options:\n");
    printf("Parameters for training:\n");
    printf("\t-train <file>\n");
    printf("\t\tUse text data from <file> to train the model\n");
    printf("\t-output <file>\n");
    printf("\t\tUse <file> to save the resulting word vectors / word clusters\n");
    printf("\t-size <int>\n");
    printf("\t\tSet size of word vectors; default is 100\n");
    printf("\t-window <int>\n");
    printf("\t\tSet max skip length between words; default is 5\n");
    printf("\t-sample <float>\n");
    printf("\t\tSet threshold for occurrence of words. Those that appear with higher frequency in the training data\n");
    printf("\t\twill be randomly down-sampled; default is 1e-3, useful range is (0, 1e-5)\n");
    printf("\t-hs <int>\n");
    printf("\t\tUse Hierarchical Softmax; default is 0 (not used)\n");
    printf("\t-negative <int>\n");
    printf("\t\tNumber of negative examples; default is 5, common values are 3 - 10 (0 = not used)\n");
    printf("\t-threads <int>\n");
    printf("\t\tUse <int> threads (default 12)\n");
    printf("\t-iter <int>\n");
    printf("\t\tRun more training iterations (default 5)\n");
    printf("\t-min-count <int>\n");
    printf("\t\tThis will discard words that appear less than <int> times; default is 5\n");
    printf("\t-alpha <float>\n");
    printf("\t\tSet the starting learning rate; default is 0.025 for skip-gram and 0.05 for CBOW\n");
    printf("\t-classes <int>\n");
    printf("\t\tOutput word classes rather than word vectors; default number of classes is 0 (vectors are written)\n");
    printf("\t-debug <int>\n");
    printf("\t\tSet the debug mode (default = 2 = more info during training)\n");
    printf("\t-binary <int>\n");
    printf("\t\tSave the resulting vectors in binary moded; default is 0 (off)\n");
    printf("\t-save-vocab <file>\n");
    printf("\t\tThe vocabulary will be saved to <file>\n");
    printf("\t-read-vocab <file>\n");
    printf("\t\tThe vocabulary will be read from <file>, not constructed from the training data\n");
    printf("\t-cbow <int>\n");
    printf("\t\tUse the continuous bag of words model; default is 1 (use 0 for skip-gram model)\n");
    printf("\t-deepwalk <int>\n");
    printf("\t\tRun random walk before word2vec; default is 0 (off)\n");
    printf("\t-walk-length <int>\n");
    printf("\t\tSet the length of walk path; default is 40\n");
    printf("\t-number-walks <int>\n");
    printf("\t\tSet the number of restart for each node; default is 10\n");
    printf("\t-undirected <int>\n");
    printf("\t\tUse undirected edge or directed; default is 1 (undirected)\n");
    printf("\nExamples:\n");
    printf("./word2vec -train data.txt -output vec.txt -size 200 -window 5 -sample 1e-4 -negative 5 -hs 0 -binary 0 -cbow 1 -iter 3\n\n");
    return 0;
  }
  output_file[0] = 0;
  save_vocab_file[0] = 0;
  read_vocab_file[0] = 0;
  if ((i = ArgPos((char *)"-size", argc, argv)) > 0) layer1_size = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-train", argc, argv)) > 0) strcpy(train_file, argv[i + 1]);
  if ((i = ArgPos((char *)"-save-vocab", argc, argv)) > 0) strcpy(save_vocab_file, argv[i + 1]);
  if ((i = ArgPos((char *)"-read-vocab", argc, argv)) > 0) strcpy(read_vocab_file, argv[i + 1]);
  if ((i = ArgPos((char *)"-debug", argc, argv)) > 0) debug_mode = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-binary", argc, argv)) > 0) binary = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-cbow", argc, argv)) > 0) cbow = atoi(argv[i + 1]);
  if (cbow) alpha = 0.05;
  if ((i = ArgPos((char *)"-alpha", argc, argv)) > 0) alpha = atof(argv[i + 1]);
  if ((i = ArgPos((char *)"-output", argc, argv)) > 0) strcpy(output_file, argv[i + 1]);
  if ((i = ArgPos((char *)"-window", argc, argv)) > 0) window = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-sample", argc, argv)) > 0) sample = atof(argv[i + 1]);
  if ((i = ArgPos((char *)"-hs", argc, argv)) > 0) hs = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-negative", argc, argv)) > 0) negative = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-threads", argc, argv)) > 0) num_threads = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-iter", argc, argv)) > 0) iter = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-min-count", argc, argv)) > 0) min_count = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-classes", argc, argv)) > 0) classes = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-deepwalk", argc, argv)) > 0) deepwalk = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-walk-length", argc, argv)) > 0) walk_length = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-number-walks", argc, argv)) > 0) number_walks = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-undirected", argc, argv)) > 0) undirected = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-discard", argc, argv)) > 0) discard = atoi(argv[i + 1]);
  vocab = (struct vocab_word *)calloc(vocab_max_size, sizeof(struct vocab_word));
  vocab_hash = (int *)calloc(vocab_hash_size, sizeof(int));
  expTable = (real *)malloc((EXP_TABLE_SIZE + 1) * sizeof(real));
  for (i = 0; i < EXP_TABLE_SIZE; i++) {
    expTable[i] = exp((i / (real)EXP_TABLE_SIZE * 2 - 1) * MAX_EXP); // Precompute the exp() table
    expTable[i] = expTable[i] / (expTable[i] + 1);                   // Precompute f(x) = x / (x + 1)
  }
  if (deepwalk == 1) {
    RandomWalk();
  }
  TrainModel();
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpl $0x1, %edi
jne 0x4ec3
leaq 0x2714(%rip), %rdi      # 0x7399
callq 0x2360
leaq 0x272f(%rip), %rdi      # 0x73c0
callq 0x2360
leaq 0x272c(%rip), %rdi      # 0x73c9
callq 0x2360
leaq 0x2739(%rip), %rdi      # 0x73e2
callq 0x2360
leaq 0x273c(%rip), %rdi      # 0x73f1
callq 0x2360
leaq 0x275f(%rip), %rdi      # 0x7420
callq 0x2360
leaq 0x2763(%rip), %rdi      # 0x7430
callq 0x2360
leaq 0x2797(%rip), %rdi      # 0x7470
callq 0x2360
leaq 0x2798(%rip), %rdi      # 0x747d
callq 0x2360
leaq 0x27b7(%rip), %rdi      # 0x74a8
callq 0x2360
leaq 0x27ba(%rip), %rdi      # 0x74b7
callq 0x2360
leaq 0x27e0(%rip), %rdi      # 0x74e9
callq 0x2360
leaq 0x27e5(%rip), %rdi      # 0x74fa
callq 0x2360
leaq 0x283f(%rip), %rdi      # 0x7560
callq 0x2360
leaq 0x287f(%rip), %rdi      # 0x75ac
callq 0x2360
leaq 0x287e(%rip), %rdi      # 0x75b7
callq 0x2360
leaq 0x28a6(%rip), %rdi      # 0x75eb
callq 0x2360
leaq 0x28ab(%rip), %rdi      # 0x75fc
callq 0x2360
leaq 0x28f4(%rip), %rdi      # 0x7651
callq 0x2360
leaq 0x28f8(%rip), %rdi      # 0x7661
callq 0x2360
leaq 0x290d(%rip), %rdi      # 0x7682
callq 0x2360
leaq 0x290e(%rip), %rdi      # 0x768f
callq 0x2360
leaq 0x292d(%rip), %rdi      # 0x76ba
callq 0x2360
leaq 0x2933(%rip), %rdi      # 0x76cc
callq 0x2360
leaq 0x2971(%rip), %rdi      # 0x7716
callq 0x2360
leaq 0x2975(%rip), %rdi      # 0x7726
callq 0x2360
leaq 0x29bc(%rip), %rdi      # 0x7779
callq 0x2360
leaq 0x29c0(%rip), %rdi      # 0x7789
callq 0x2360
leaq 0x2a19(%rip), %rdi      # 0x77ee
callq 0x2360
leaq 0x2a1b(%rip), %rdi      # 0x77fc
callq 0x2360
leaq 0x2a4e(%rip), %rdi      # 0x783b
callq 0x2360
leaq 0x2a51(%rip), %rdi      # 0x784a
callq 0x2360
leaq 0x2a86(%rip), %rdi      # 0x788b
callq 0x2360
leaq 0x2a8e(%rip), %rdi      # 0x789f
callq 0x2360
leaq 0x2aab(%rip), %rdi      # 0x78c8
callq 0x2360
leaq 0x2ab3(%rip), %rdi      # 0x78dc
callq 0x2360
leaq 0x2af9(%rip), %rdi      # 0x792e
callq 0x2360
leaq 0x2afa(%rip), %rdi      # 0x793b
callq 0x2360
leaq 0x2b40(%rip), %rdi      # 0x798d
callq 0x2360
leaq 0x2b45(%rip), %rdi      # 0x799e
callq 0x2360
leaq 0x2b6f(%rip), %rdi      # 0x79d4
callq 0x2360
leaq 0x2b77(%rip), %rdi      # 0x79e8
callq 0x2360
leaq 0x2b98(%rip), %rdi      # 0x7a15
callq 0x2360
leaq 0x2ba1(%rip), %rdi      # 0x7a2a
callq 0x2360
leaq 0x2bce(%rip), %rdi      # 0x7a63
callq 0x2360
leaq 0x2bd5(%rip), %rdi      # 0x7a76
callq 0x2360
leaq 0x2c06(%rip), %rdi      # 0x7ab3
callq 0x2360
leaq 0x2c05(%rip), %rdi      # 0x7abe
callq 0x2360
jmp 0x5302
movq %rsi, %rbx
movl %edi, %ebp
xorl %eax, %eax
movb %al, 0x6460(%rip)       # 0xb330
movb %al, 0x64ca(%rip)       # 0xb3a0
movb %al, 0x6534(%rip)       # 0xb410
leaq 0x2356(%rip), %rdi      # 0x7239
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x4f06
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x637a(%rip)      # 0xb280
leaq 0x2332(%rip), %rdi      # 0x723f
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x4f2e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x6397(%rip), %rdi      # 0xb2c0
callq 0x21f0
leaq 0x2311(%rip), %rdi      # 0x7246
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x4f56
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x644f(%rip), %rdi      # 0xb3a0
callq 0x21f0
leaq 0x22f5(%rip), %rdi      # 0x7252
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x4f7e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x6497(%rip), %rdi      # 0xb410
callq 0x21f0
leaq 0x22d9(%rip), %rdi      # 0x725e
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x4fa5
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x62bf(%rip)      # 0xb264
leaq 0x22b9(%rip), %rdi      # 0x7265
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x4fcc
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x64b4(%rip)      # 0xb480
leaq 0x229a(%rip), %rdi      # 0x726d
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x4ff5
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x626d(%rip)      # 0xb260
jmp 0x4ffb
movl 0x6265(%rip), %eax      # 0xb260
testl %eax, %eax
je 0x5009
movl $0x3d4ccccd, 0x6287(%rip) # imm = 0x3D4CCCCD
leaq 0x2263(%rip), %rdi      # 0x7273
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5036
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x22b0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x625a(%rip)     # 0xb290
leaq 0x223d(%rip), %rdi      # 0x727a
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x505e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x62d7(%rip), %rdi      # 0xb330
callq 0x21f0
leaq 0x221d(%rip), %rdi      # 0x7282
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5085
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x61e3(%rip)      # 0xb268
leaq 0x21fe(%rip), %rdi      # 0x728a
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x50b2
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x22b0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x61e2(%rip)     # 0xb294
leaq 0x21d9(%rip), %rdi      # 0x7292
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x50d9
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x640f(%rip)      # 0xb4e8
leaq 0x21b6(%rip), %rdi      # 0x7296
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5100
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x6198(%rip)      # 0xb298
leaq 0x2199(%rip), %rdi      # 0x72a0
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5127
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x6149(%rip)      # 0xb270
leaq 0x217b(%rip), %rdi      # 0x72a9
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5151
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x6137(%rip)      # 0xb288
leaq 0x2157(%rip), %rdi      # 0x72af
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5178
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x60f4(%rip)      # 0xb26c
leaq 0x213b(%rip), %rdi      # 0x72ba
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x51a2
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x630e(%rip)      # 0xb4b0
leaq 0x211a(%rip), %rdi      # 0x72c3
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x51c9
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x632f(%rip)      # 0xb4f8
leaq 0x20fd(%rip), %rdi      # 0x72cd
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x51f0
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x60b0(%rip)      # 0xb2a0
leaq 0x20e3(%rip), %rdi      # 0x72da
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5217
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x608d(%rip)      # 0xb2a4
leaq 0x20ca(%rip), %rdi      # 0x72e8
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x523e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x605e(%rip)      # 0xb29c
leaq 0x20af(%rip), %rdi      # 0x72f4
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4311
testl %eax, %eax
jle 0x5265
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x6297(%rip)      # 0xb4fc
movq 0x600c(%rip), %rdi      # 0xb278
pushq $0x28
popq %rsi
callq 0x2160
movq %rax, 0x61fd(%rip)      # 0xb478
pushq $0x4
popq %rsi
movl $0x1c9c380, %edi        # imm = 0x1C9C380
callq 0x2160
movq %rax, 0x61f9(%rip)      # 0xb488
movl $0xfa4, %edi            # imm = 0xFA4
callq 0x22f0
movq %rax, %rbx
movq %rax, 0x6235(%rip)      # 0xb4d8
xorl %r14d, %r14d
cmpq $0x3e8, %r14            # imm = 0x3E8
je 0x52ef
cvtsi2ss %r14d, %xmm0
divss 0x1d78(%rip), %xmm0     # 0x7034
addss %xmm0, %xmm0
addss 0x1d84(%rip), %xmm0     # 0x704c
mulss 0x1d6c(%rip), %xmm0     # 0x703c
callq 0x23d0
movaps %xmm0, %xmm1
addss 0x1d58(%rip), %xmm1     # 0x7038
divss %xmm1, %xmm0
movss %xmm0, (%rbx,%r14,4)
incq %r14
jmp 0x52a6
cmpl $0x1, 0x6202(%rip)      # 0xb4f8
jne 0x52fd
callq 0x47ed
callq 0x3e06
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop