// File: /workspace/github_c_makefile_star2_O1/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 0x5736
leaq 0x1eb1(%rip), %rdi      # 0x73a9
callq 0x2360
leaq 0x1ecc(%rip), %rdi      # 0x73d0
callq 0x2360
leaq 0x1ec9(%rip), %rdi      # 0x73d9
callq 0x2360
leaq 0x1ed6(%rip), %rdi      # 0x73f2
callq 0x2360
leaq 0x1ed9(%rip), %rdi      # 0x7401
callq 0x2360
leaq 0x1efc(%rip), %rdi      # 0x7430
callq 0x2360
leaq 0x1f00(%rip), %rdi      # 0x7440
callq 0x2360
leaq 0x1f34(%rip), %rdi      # 0x7480
callq 0x2360
leaq 0x1f35(%rip), %rdi      # 0x748d
callq 0x2360
leaq 0x1f54(%rip), %rdi      # 0x74b8
callq 0x2360
leaq 0x1f57(%rip), %rdi      # 0x74c7
callq 0x2360
leaq 0x1f7d(%rip), %rdi      # 0x74f9
callq 0x2360
leaq 0x1f82(%rip), %rdi      # 0x750a
callq 0x2360
leaq 0x1fdc(%rip), %rdi      # 0x7570
callq 0x2360
leaq 0x201c(%rip), %rdi      # 0x75bc
callq 0x2360
leaq 0x201b(%rip), %rdi      # 0x75c7
callq 0x2360
leaq 0x2043(%rip), %rdi      # 0x75fb
callq 0x2360
leaq 0x2048(%rip), %rdi      # 0x760c
callq 0x2360
leaq 0x2091(%rip), %rdi      # 0x7661
callq 0x2360
leaq 0x2095(%rip), %rdi      # 0x7671
callq 0x2360
leaq 0x20aa(%rip), %rdi      # 0x7692
callq 0x2360
leaq 0x20ab(%rip), %rdi      # 0x769f
callq 0x2360
leaq 0x20ca(%rip), %rdi      # 0x76ca
callq 0x2360
leaq 0x20d0(%rip), %rdi      # 0x76dc
callq 0x2360
leaq 0x210e(%rip), %rdi      # 0x7726
callq 0x2360
leaq 0x2112(%rip), %rdi      # 0x7736
callq 0x2360
leaq 0x2159(%rip), %rdi      # 0x7789
callq 0x2360
leaq 0x215d(%rip), %rdi      # 0x7799
callq 0x2360
leaq 0x21b6(%rip), %rdi      # 0x77fe
callq 0x2360
leaq 0x21b8(%rip), %rdi      # 0x780c
callq 0x2360
leaq 0x21eb(%rip), %rdi      # 0x784b
callq 0x2360
leaq 0x21ee(%rip), %rdi      # 0x785a
callq 0x2360
leaq 0x2223(%rip), %rdi      # 0x789b
callq 0x2360
leaq 0x222b(%rip), %rdi      # 0x78af
callq 0x2360
leaq 0x2248(%rip), %rdi      # 0x78d8
callq 0x2360
leaq 0x2250(%rip), %rdi      # 0x78ec
callq 0x2360
leaq 0x2296(%rip), %rdi      # 0x793e
callq 0x2360
leaq 0x2297(%rip), %rdi      # 0x794b
callq 0x2360
leaq 0x22dd(%rip), %rdi      # 0x799d
callq 0x2360
leaq 0x22e2(%rip), %rdi      # 0x79ae
callq 0x2360
leaq 0x230c(%rip), %rdi      # 0x79e4
callq 0x2360
leaq 0x2314(%rip), %rdi      # 0x79f8
callq 0x2360
leaq 0x2335(%rip), %rdi      # 0x7a25
callq 0x2360
leaq 0x233e(%rip), %rdi      # 0x7a3a
callq 0x2360
leaq 0x236b(%rip), %rdi      # 0x7a73
callq 0x2360
leaq 0x2372(%rip), %rdi      # 0x7a86
callq 0x2360
leaq 0x23a3(%rip), %rdi      # 0x7ac3
callq 0x2360
leaq 0x23a2(%rip), %rdi      # 0x7ace
callq 0x2360
jmp 0x5b77
movq %rsi, %rbx
movl %edi, %ebp
xorl %eax, %eax
movb %al, 0x5bed(%rip)       # 0xb330
movb %al, 0x5c57(%rip)       # 0xb3a0
movb %al, 0x5cc1(%rip)       # 0xb410
leaq 0x1af3(%rip), %rdi      # 0x7249
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5779
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x5aff(%rip)      # 0xb278
leaq 0x1acf(%rip), %rdi      # 0x724f
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x57a1
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5b24(%rip), %rdi      # 0xb2c0
callq 0x2200
leaq 0x1aae(%rip), %rdi      # 0x7256
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x57c9
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5bdc(%rip), %rdi      # 0xb3a0
callq 0x2200
leaq 0x1a92(%rip), %rdi      # 0x7262
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x57f1
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5c24(%rip), %rdi      # 0xb410
callq 0x2200
leaq 0x1a76(%rip), %rdi      # 0x726e
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5818
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5a44(%rip)      # 0xb25c
leaq 0x1a56(%rip), %rdi      # 0x7275
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x583f
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5c41(%rip)      # 0xb480
leaq 0x1a37(%rip), %rdi      # 0x727d
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5866
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x59f2(%rip)      # 0xb258
cmpl $0x0, 0x59eb(%rip)      # 0xb258
je 0x5879
movl $0x3d4ccccd, 0x5a0f(%rip) # imm = 0x3D4CCCCD
leaq 0x1a03(%rip), %rdi      # 0x7283
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x58a6
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x59e2(%rip)     # 0xb288
leaq 0x19dd(%rip), %rdi      # 0x728a
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x58ce
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5a67(%rip), %rdi      # 0xb330
callq 0x2200
leaq 0x19bd(%rip), %rdi      # 0x7292
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x58f5
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x596b(%rip)      # 0xb260
leaq 0x199e(%rip), %rdi      # 0x729a
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5922
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x596a(%rip)     # 0xb28c
leaq 0x1979(%rip), %rdi      # 0x72a2
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5949
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5b9f(%rip)      # 0xb4e8
leaq 0x1956(%rip), %rdi      # 0x72a6
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5970
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5920(%rip)      # 0xb290
leaq 0x1939(%rip), %rdi      # 0x72b0
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5997
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x58d1(%rip)      # 0xb268
leaq 0x191b(%rip), %rdi      # 0x72b9
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x59c1
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x58bf(%rip)      # 0xb280
leaq 0x18f7(%rip), %rdi      # 0x72bf
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x59e8
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x587c(%rip)      # 0xb264
leaq 0x18db(%rip), %rdi      # 0x72ca
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5a12
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
cltq
movq %rax, 0x5a9e(%rip)      # 0xb4b0
leaq 0x18ba(%rip), %rdi      # 0x72d3
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5a39
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5abf(%rip)      # 0xb4f8
leaq 0x189d(%rip), %rdi      # 0x72dd
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5a60
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5838(%rip)      # 0xb298
leaq 0x1883(%rip), %rdi      # 0x72ea
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5a87
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5815(%rip)      # 0xb29c
leaq 0x186a(%rip), %rdi      # 0x72f8
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5aae
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x57e6(%rip)      # 0xb294
leaq 0x184f(%rip), %rdi      # 0x7304
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4653
testl %eax, %eax
jle 0x5ad5
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x2380
movl %eax, 0x5a27(%rip)      # 0xb4fc
movq 0x5794(%rip), %rdi      # 0xb270
movl $0x28, %esi
callq 0x2160
movq %rax, 0x598b(%rip)      # 0xb478
movl $0x1c9c380, %edi        # imm = 0x1C9C380
movl $0x4, %esi
callq 0x2160
movq %rax, 0x5985(%rip)      # 0xb488
movl $0xfa4, %edi            # imm = 0xFA4
callq 0x2300
movq %rax, %rbx
movq %rax, 0x59c1(%rip)      # 0xb4d8
xorl %r14d, %r14d
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
divss 0x150a(%rip), %xmm0     # 0x7034
addss %xmm0, %xmm0
addss 0x151a(%rip), %xmm0     # 0x7050
mulss 0x14fe(%rip), %xmm0     # 0x703c
callq 0x23d0
movaps %xmm0, %xmm1
addss 0x14ea(%rip), %xmm1     # 0x7038
divss %xmm1, %xmm0
movss %xmm0, (%rbx,%r14,4)
incq %r14
cmpq $0x3e8, %r14            # imm = 0x3E8
jne 0x5b1a
cmpl $0x1, 0x598d(%rip)      # 0xb4f8
jne 0x5b72
callq 0x4d62
callq 0x4155
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq