// File: /workspace/github_c_makefile_star2_O0/Leeheng86[P]word2vec/word2vec.c
// Function: RandomWalkThread(void*)
void *RandomWalkThread(void *id) {
  long long thread_id = (long long)id;

  std::string new_train_file = std::string(train_file).append("_walks").append(std::to_string(thread_id));
  printf("Loaded and preprocessed edge file, save walks to file %s\n", new_train_file.c_str());
  FILE *fin = fopen(new_train_file.c_str(), "wb");

  std::unordered_map<std::string, std::vector<std::string> >::iterator it = std::next(umap.begin(), (int)thread_id);
  while (it != umap.end()) {
    //printf("[%lld] process node %s\n", thread_id, (it->first).c_str());

    for (int i = 0; i < number_walks; i++) {
      std::unordered_map<std::string, std::vector<std::string> >::iterator itt = it;
      std::string str;
      std::vector<std::string> v;
      append(v, itt->first);
      itt = umap.find(WalkTo(itt->second));
      for (int j = 0; j <= walk_length; j++) {
        append(v, itt->first);
        itt = umap.find(WalkTo(itt->second));
      }
      join(v, ' ', str);
      fprintf(fin, "%s\n", str.c_str());
    }

    if (!IsNextIElementsEnd(it, num_threads)) {
      it = std::next(it, num_threads);
    } else {
      it = umap.end();
    }
  }
  fclose(fin);
  pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
callq 0x34e0
movq -0x1b0(%rbp), %rdx
leaq 0xd8ab(%rip), %rsi      # 0x14340
leaq -0x50(%rbp), %rdi
callq 0x8780
jmp 0x6aa0
leaq 0x76ee(%rip), %rsi      # 0xe195
leaq -0x50(%rbp), %rdi
callq 0x3540
movq %rax, -0x1b8(%rbp)
jmp 0x6ab9
movq -0x10(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x8830
jmp 0x6acb
movq -0x1b8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3570
movq %rax, -0x1c0(%rbp)
jmp 0x6ae7
movq -0x1c0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x3120
jmp 0x6af9
leaq -0x88(%rbp), %rdi
callq 0x3190
leaq -0x50(%rbp), %rdi
callq 0x3190
leaq -0x51(%rbp), %rdi
callq 0x32d0
leaq -0x30(%rbp), %rdi
callq 0x3110
movq %rax, %rsi
leaq 0x7672(%rip), %rdi      # 0xe19c
xorl %eax, %eax
callq 0x3060
jmp 0x6b33
leaq -0x30(%rbp), %rdi
callq 0x3110
movq %rax, %rdi
leaq 0x7579(%rip), %rsi      # 0xe0bf
callq 0x3330
movq %rax, -0x1c8(%rbp)
jmp 0x6b54
movq -0x1c8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0xda17(%rip), %rdi      # 0x14580
callq 0x8990
movq %rax, -0xa0(%rbp)
movslq -0x10(%rbp), %rsi
movq -0xa0(%rbp), %rdi
callq 0x8960
movq %rax, -0x1d0(%rbp)
jmp 0x6b8e
movq -0x1d0(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq 0xd9dd(%rip), %rdi      # 0x14580
callq 0x8540
movq %rax, -0xa8(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x89c0
testb $0x1, %al
jne 0x6bcb
jmp 0x6f88
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl 0xd743(%rip), %eax      # 0x14324
jge 0x6ef6
movq -0x98(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x33d0
leaq -0xf0(%rbp), %rdi
callq 0x8160
leaq -0xb8(%rbp), %rdi
callq 0x89f0
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x3120
jmp 0x6c2a
leaq -0xf0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x6900
jmp 0x6c3f
leaq -0x110(%rbp), %rdi
callq 0x3190
leaq -0xb8(%rbp), %rdi
callq 0x89f0
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x138(%rbp), %rdi
callq 0x6820
jmp 0x6c6c
leaq 0xd90d(%rip), %rdi      # 0x14580
leaq -0x138(%rbp), %rsi
callq 0x8a20
movq %rax, -0x1d8(%rbp)
jmp 0x6c88
movq -0x1d8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x3190
movl $0x0, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpl 0xd65a(%rip), %eax      # 0x14320
jg 0x6e61
leaq -0xb8(%rbp), %rdi
callq 0x89f0
movq %rax, %rsi
leaq -0x160(%rbp), %rdi
callq 0x3120
jmp 0x6ce9
leaq -0xf0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x6900
jmp 0x6cfe
leaq -0x160(%rbp), %rdi
callq 0x3190
leaq -0xb8(%rbp), %rdi
callq 0x89f0
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x188(%rbp), %rdi
callq 0x6820
jmp 0x6d2b
leaq 0xd84e(%rip), %rdi      # 0x14580
leaq -0x188(%rbp), %rsi
callq 0x8a20
movq %rax, -0x1e0(%rbp)
jmp 0x6d47
movq -0x1e0(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3190
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x6cba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x6dc0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x6db7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
leaq -0x50(%rbp), %rdi
callq 0x3190
leaq -0x51(%rbp), %rdi
callq 0x32d0
jmp 0x6faa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x6fa1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x6ed9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x3190
jmp 0x6ed9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x3190
jmp 0x6ed9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x3190
jmp 0x6ed9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3190
jmp 0x6ed9
leaq -0xf0(%rbp), %rdi
movl $0x20, %esi
leaq -0xd8(%rbp), %rdx
callq 0x6990
jmp 0x6e7b
movq -0x90(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3110
movq -0x1e8(%rbp), %rdi
movq %rax, %rdx
leaq 0x7355(%rip), %rsi      # 0xe1fb
movb $0x0, %al
callq 0x33f0
leaq -0xf0(%rbp), %rdi
callq 0x8400
leaq -0xd8(%rbp), %rdi
callq 0x3190
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x6bd5
leaq -0xf0(%rbp), %rdi
callq 0x8400
leaq -0xd8(%rbp), %rdi
callq 0x3190
jmp 0x6fa1
movq -0x98(%rbp), %rax
movq %rax, -0x190(%rbp)
movl 0xd3e6(%rip), %esi      # 0x142f0
movq -0x190(%rbp), %rdi
callq 0x6880
testb $0x1, %al
jne 0x6f62
movq -0x98(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movslq 0xd3c1(%rip), %rsi      # 0x142f0
movq -0x1a0(%rbp), %rdi
callq 0x8960
movq %rax, -0x1f0(%rbp)
jmp 0x6f44
movq -0x1f0(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x6f83
leaq 0xd617(%rip), %rdi      # 0x14580
callq 0x8540
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x6b9c
movq -0x90(%rbp), %rdi
callq 0x3280
jmp 0x6f96
xorl %eax, %eax
movl %eax, %edi
callq 0x34d0
jmp 0x6fa1
leaq -0x30(%rbp), %rdi
callq 0x3190
movq -0x60(%rbp), %rdi
callq 0x34c0
nopw %cs:(%rax,%rax)