// File: kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: InputLargePatternTarget(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<index_hash_t, std::allocator<index_hash_t>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<bool, std::allocator<bool>>&)
void
InputLargePatternTarget( const std::string filename, std::vector<index_hash_t> &index, std::vector<unsigned int> &list, std::vector<bool> &target )
{
  std::ifstream ifs(filename, std::ios::in);
  int target_index = 1;
  unsigned long long hash;


  if (ifs.fail()) {
    std::cerr << "Cannot open \"" << filename << "\"" << std::endl;
    return;
  }

  index.resize(HASH_MAX);

  for (index_hash_t &datum : index) {
    datum.hash = 0;
    datum.index = -1;
  }

  // 学習対称でないパターン用のデータ
  list.push_back(0);
  target.push_back(false);

  while (ifs >> hash) {
    const unsigned int trans = TransHash20(hash);
    unsigned int idx = trans;
    do {
      if (index[idx].hash == 0) break;
      idx++;
      if (idx >= HASH_MAX) idx = 0;
    } while (idx != trans);

    index[idx].hash = hash;
    index[idx].index = target_index++;
    list.push_back(idx);
    target.push_back(true);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rsi, %rax
movq %rdi, %rsi
movq %rsi, -0x280(%rbp)
movq %rsi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x228(%rbp), %rdi
movl $0x8, %edx
callq 0x78b0
movl $0x1, -0x22c(%rbp)
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x7030
movb %al, -0x275(%rbp)
jmp 0x7c123
movb -0x275(%rbp), %al
testb $0x1, %al
jne 0x7c132
jmp 0x7c1cd
movq 0x6aeb7(%rip), %rdi     # 0xe6ff0
leaq 0x32c18(%rip), %rsi     # 0xaed58
callq 0x7530
movq %rax, -0x288(%rbp)
jmp 0x7c14e
movq -0x280(%rbp), %rsi
movq -0x288(%rbp), %rdi
callq 0x7480
movq %rax, -0x290(%rbp)
jmp 0x7c16a
movq -0x290(%rbp), %rdi
leaq 0x3095b(%rip), %rsi     # 0xacad3
callq 0x7530
movq %rax, -0x298(%rbp)
jmp 0x7c186
movq -0x298(%rbp), %rdi
movq 0x6add4(%rip), %rsi     # 0xe6f68
callq 0x75b0
jmp 0x7c19b
movl $0x1, -0x248(%rbp)
jmp 0x7c3da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x7120
jmp 0x7c3ef
movq -0x10(%rbp), %rdi
movl $0x100000, %esi         # imm = 0x100000
callq 0x7c980
jmp 0x7c1dd
movq -0x10(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x250(%rbp), %rdi
callq 0x7ca10
movq %rax, -0x258(%rbp)
movq -0x250(%rbp), %rdi
callq 0x7ca40
movq %rax, -0x260(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x7ca70
testb $0x1, %al
jne 0x7c227
jmp 0x7c264
leaq -0x258(%rbp), %rdi
callq 0x7cab0
movq %rax, -0x268(%rbp)
movq -0x268(%rbp), %rax
movq $0x0, (%rax)
movq -0x268(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
leaq -0x258(%rbp), %rdi
callq 0x7cad0
jmp 0x7c20e
movq -0x18(%rbp), %rdi
movl $0x0, -0x26c(%rbp)
leaq -0x26c(%rbp), %rsi
callq 0x7c810
jmp 0x7c280
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x7c840
jmp 0x7c28d
jmp 0x7c28f
leaq -0x228(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x7690
movq %rax, -0x2a0(%rbp)
jmp 0x7c2ab
movq -0x2a0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x76e0
movb %al, -0x2a1(%rbp)
jmp 0x7c2c9
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0x7c2d8
jmp 0x7c3d0
movq -0x238(%rbp), %rdi
callq 0x7caf0
movl %eax, -0x2a8(%rbp)
jmp 0x7c2ec
movl -0x2a8(%rbp), %eax
movl %eax, -0x270(%rbp)
movl -0x270(%rbp), %eax
movl %eax, -0x274(%rbp)
movq -0x10(%rbp), %rdi
movl -0x274(%rbp), %eax
movl %eax, %esi
callq 0x7cb30
cmpq $0x0, (%rax)
jne 0x7c31d
jmp 0x7c352
movl -0x274(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x274(%rbp)
cmpl $0x100000, -0x274(%rbp) # imm = 0x100000
jb 0x7c342
movl $0x0, -0x274(%rbp)
jmp 0x7c344
movl -0x274(%rbp), %eax
cmpl -0x270(%rbp), %eax
jne 0x7c304
movq -0x238(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x10(%rbp), %rdi
movl -0x274(%rbp), %eax
movl %eax, %esi
callq 0x7cb30
movq -0x2b8(%rbp), %rcx
movq %rcx, (%rax)
movl -0x22c(%rbp), %eax
movl %eax, -0x2ac(%rbp)
incl %eax
movl %eax, -0x22c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x274(%rbp), %eax
movl %eax, %esi
callq 0x7cb30
movl -0x2ac(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rdi
leaq -0x274(%rbp), %rsi
callq 0x7c910
jmp 0x7c3bb
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x7c840
jmp 0x7c3cb
jmp 0x7c28f
movl $0x0, -0x248(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x7120
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
movq -0x240(%rbp), %rdi
callq 0x79b0
nopl (%rax,%rax)