// File: /workspace/github_c_makefile_star2_O3/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 0x5a01
leaq 0x1c32(%rip), %rdi      # 0x73f5
callq 0x2360
leaq 0x1c4d(%rip), %rdi      # 0x741c
callq 0x2360
leaq 0x1c4a(%rip), %rdi      # 0x7425
callq 0x2360
leaq 0x1c57(%rip), %rdi      # 0x743e
callq 0x2360
leaq 0x1c5a(%rip), %rdi      # 0x744d
callq 0x2360
leaq 0x1c7d(%rip), %rdi      # 0x747c
callq 0x2360
leaq 0x1c81(%rip), %rdi      # 0x748c
callq 0x2360
leaq 0x1cb5(%rip), %rdi      # 0x74cc
callq 0x2360
leaq 0x1cb6(%rip), %rdi      # 0x74d9
callq 0x2360
leaq 0x1cd5(%rip), %rdi      # 0x7504
callq 0x2360
leaq 0x1cd8(%rip), %rdi      # 0x7513
callq 0x2360
leaq 0x1cfe(%rip), %rdi      # 0x7545
callq 0x2360
leaq 0x1d03(%rip), %rdi      # 0x7556
callq 0x2360
leaq 0x1d5d(%rip), %rdi      # 0x75bc
callq 0x2360
leaq 0x1d9d(%rip), %rdi      # 0x7608
callq 0x2360
leaq 0x1d9c(%rip), %rdi      # 0x7613
callq 0x2360
leaq 0x1dc4(%rip), %rdi      # 0x7647
callq 0x2360
leaq 0x1dc9(%rip), %rdi      # 0x7658
callq 0x2360
leaq 0x1e12(%rip), %rdi      # 0x76ad
callq 0x2360
leaq 0x1e16(%rip), %rdi      # 0x76bd
callq 0x2360
leaq 0x1e2b(%rip), %rdi      # 0x76de
callq 0x2360
leaq 0x1e2c(%rip), %rdi      # 0x76eb
callq 0x2360
leaq 0x1e4b(%rip), %rdi      # 0x7716
callq 0x2360
leaq 0x1e51(%rip), %rdi      # 0x7728
callq 0x2360
leaq 0x1e8f(%rip), %rdi      # 0x7772
callq 0x2360
leaq 0x1e93(%rip), %rdi      # 0x7782
callq 0x2360
leaq 0x1eda(%rip), %rdi      # 0x77d5
callq 0x2360
leaq 0x1ede(%rip), %rdi      # 0x77e5
callq 0x2360
leaq 0x1f37(%rip), %rdi      # 0x784a
callq 0x2360
leaq 0x1f39(%rip), %rdi      # 0x7858
callq 0x2360
leaq 0x1f6c(%rip), %rdi      # 0x7897
callq 0x2360
leaq 0x1f6f(%rip), %rdi      # 0x78a6
callq 0x2360
leaq 0x1fa4(%rip), %rdi      # 0x78e7
callq 0x2360
leaq 0x1fac(%rip), %rdi      # 0x78fb
callq 0x2360
leaq 0x1fc9(%rip), %rdi      # 0x7924
callq 0x2360
leaq 0x1fd1(%rip), %rdi      # 0x7938
callq 0x2360
leaq 0x2017(%rip), %rdi      # 0x798a
callq 0x2360
leaq 0x2018(%rip), %rdi      # 0x7997
callq 0x2360
leaq 0x205e(%rip), %rdi      # 0x79e9
callq 0x2360
leaq 0x2063(%rip), %rdi      # 0x79fa
callq 0x2360
leaq 0x208d(%rip), %rdi      # 0x7a30
callq 0x2360
leaq 0x2095(%rip), %rdi      # 0x7a44
callq 0x2360
leaq 0x20b6(%rip), %rdi      # 0x7a71
callq 0x2360
leaq 0x20bf(%rip), %rdi      # 0x7a86
callq 0x2360
leaq 0x20ec(%rip), %rdi      # 0x7abf
callq 0x2360
leaq 0x20f3(%rip), %rdi      # 0x7ad2
callq 0x2360
leaq 0x2124(%rip), %rdi      # 0x7b0f
callq 0x2360
leaq 0x2123(%rip), %rdi      # 0x7b1a
callq 0x2360
jmp 0x5e45
movq %rsi, %rbx
movl %edi, %ebp
xorl %eax, %eax
movb %al, 0x5922(%rip)       # 0xb330
movb %al, 0x598c(%rip)       # 0xb3a0
movb %al, 0x59f6(%rip)       # 0xb410
leaq 0x1874(%rip), %rdi      # 0x7295
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5a44
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x5834(%rip)      # 0xb278
leaq 0x1850(%rip), %rdi      # 0x729b
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5a6c
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5859(%rip), %rdi      # 0xb2c0
callq 0x2200
leaq 0x182f(%rip), %rdi      # 0x72a2
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5a94
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5911(%rip), %rdi      # 0xb3a0
callq 0x2200
leaq 0x1813(%rip), %rdi      # 0x72ae
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5abc
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5959(%rip), %rdi      # 0xb410
callq 0x2200
leaq 0x17f7(%rip), %rdi      # 0x72ba
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5ae3
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5779(%rip)      # 0xb25c
leaq 0x17d7(%rip), %rdi      # 0x72c1
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5b0a
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5976(%rip)      # 0xb480
leaq 0x17b8(%rip), %rdi      # 0x72c9
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5b33
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5727(%rip)      # 0xb258
jmp 0x5b39
movl 0x571f(%rip), %eax      # 0xb258
testl %eax, %eax
je 0x5b47
movl $0x3d4ccccd, 0x5741(%rip) # imm = 0x3D4CCCCD
leaq 0x1781(%rip), %rdi      # 0x72cf
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5b74
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x5714(%rip)     # 0xb288
leaq 0x175b(%rip), %rdi      # 0x72d6
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5b9c
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5799(%rip), %rdi      # 0xb330
callq 0x2200
leaq 0x173b(%rip), %rdi      # 0x72de
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5bc3
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x569d(%rip)      # 0xb260
leaq 0x171c(%rip), %rdi      # 0x72e6
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5bf0
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x569c(%rip)     # 0xb28c
leaq 0x16f7(%rip), %rdi      # 0x72ee
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5c17
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x58d1(%rip)      # 0xb4e8
leaq 0x16d4(%rip), %rdi      # 0x72f2
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5c3e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5652(%rip)      # 0xb290
leaq 0x16b7(%rip), %rdi      # 0x72fc
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5c65
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5603(%rip)      # 0xb268
leaq 0x1699(%rip), %rdi      # 0x7305
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5c8f
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x55f1(%rip)      # 0xb280
leaq 0x1675(%rip), %rdi      # 0x730b
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5cb6
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x55ae(%rip)      # 0xb264
leaq 0x1659(%rip), %rdi      # 0x7316
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5ce0
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x57d0(%rip)      # 0xb4b0
leaq 0x1638(%rip), %rdi      # 0x731f
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5d07
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x57f1(%rip)      # 0xb4f8
leaq 0x161b(%rip), %rdi      # 0x7329
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5d2e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x556a(%rip)      # 0xb298
leaq 0x1601(%rip), %rdi      # 0x7336
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5d55
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5547(%rip)      # 0xb29c
leaq 0x15e8(%rip), %rdi      # 0x7344
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5d7c
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5518(%rip)      # 0xb294
leaq 0x15cd(%rip), %rdi      # 0x7350
movl %ebp, %esi
movq %rbx, %rdx
callq 0x48fd
testl %eax, %eax
jle 0x5da3
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5759(%rip)      # 0xb4fc
movq 0x54c6(%rip), %rdi      # 0xb270
movl $0x28, %esi
callq 0x2160
movq %rax, 0x56bd(%rip)      # 0xb478
movl $0x1c9c380, %edi        # imm = 0x1C9C380
movl $0x4, %esi
callq 0x2160
movq %rax, 0x56b7(%rip)      # 0xb488
movl $0xfa4, %edi            # imm = 0xFA4
callq 0x2300
movq %rax, %rbx
movq %rax, 0x56f3(%rip)      # 0xb4d8
xorl %r14d, %r14d
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
divss 0x12b4(%rip), %xmm0     # 0x70ac
addss %xmm0, %xmm0
addss 0x12c4(%rip), %xmm0     # 0x70c8
mulss 0x12a8(%rip), %xmm0     # 0x70b4
callq 0x23d0
movaps %xmm0, %xmm1
addss 0x1294(%rip), %xmm1     # 0x70b0
divss %xmm1, %xmm0
movss %xmm0, (%rbx,%r14,4)
incq %r14
cmpq $0x3e8, %r14            # imm = 0x3E8
jne 0x5de8
cmpl $0x1, 0x56bf(%rip)      # 0xb4f8
jne 0x5e40
callq 0x5027
callq 0x4234
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq