// File: kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: InputMD2Target(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<int, std::allocator<int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<bool, std::allocator<bool>>&)
void
InputMD2Target( const std::string filename, std::vector<int> &md2_index, std::vector<unsigned int> &md2_list, std::vector<bool> &md2_target )
{
  std::ifstream ifs(filename, std::ios::in);
  int target_index = 1;
  unsigned int index, md2_transpose16[16];

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

  md2_index = std::vector<int>(MD2_MAX, 0);

  // 学習対象でないMD2パターン用のデータ
  md2_list.push_back(0);
  md2_target.push_back(false);

  while (ifs >> index) {
    MD2Transpose16(index, md2_transpose16);
    for (int i = 0; i < 16; i++) {
      md2_index[md2_transpose16[i]] = target_index;
    }
    md2_list.push_back(index);
    md2_target.push_back(true);
    target_index++;
  }
  std::cerr << "MD2 Target : " << md2_target.size() << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rsi, %rax
movq %rdi, %rsi
movq %rsi, -0x2b8(%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, -0x2a9(%rbp)
jmp 0x7bdf3
movb -0x2a9(%rbp), %al
testb $0x1, %al
jne 0x7be02
jmp 0x7be91
movq 0x6b1e7(%rip), %rdi     # 0xe6ff0
leaq 0x32f48(%rip), %rsi     # 0xaed58
callq 0x7530
movq %rax, -0x2c0(%rbp)
jmp 0x7be1e
movq -0x2b8(%rbp), %rsi
movq -0x2c0(%rbp), %rdi
callq 0x7480
movq %rax, -0x2c8(%rbp)
jmp 0x7be3a
movq -0x2c8(%rbp), %rdi
leaq 0x30c8b(%rip), %rsi     # 0xacad3
callq 0x7530
movq %rax, -0x2d0(%rbp)
jmp 0x7be56
movq -0x2d0(%rbp), %rdi
movq 0x6b104(%rip), %rsi     # 0xe6f68
callq 0x75b0
jmp 0x7be6b
movl $0x1, -0x280(%rbp)
jmp 0x7c08c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x7c0a1
movl $0x0, -0x29c(%rbp)
leaq -0x29d(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x4d840
movq -0x2d8(%rbp), %rcx
leaq -0x298(%rbp), %rdi
movl $0x1000000, %esi        # imm = 0x1000000
leaq -0x29c(%rbp), %rdx
callq 0x4d860
jmp 0x7becf
movq -0x10(%rbp), %rdi
leaq -0x298(%rbp), %rsi
movq %rsi, -0x2e0(%rbp)
callq 0x63560
movq -0x2e0(%rbp), %rdi
callq 0x2d610
leaq -0x29d(%rbp), %rdi
callq 0x4d8e0
movq -0x18(%rbp), %rdi
movl $0x0, -0x2a4(%rbp)
leaq -0x2a4(%rbp), %rsi
callq 0x7c810
jmp 0x7bf1a
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x7c840
jmp 0x7bf27
jmp 0x7bf29
leaq -0x228(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x70a0
movq %rax, -0x2e8(%rbp)
jmp 0x7bf45
movq -0x2e8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x76e0
movb %al, -0x2e9(%rbp)
jmp 0x7bf63
movb -0x2e9(%rbp), %al
testb $0x1, %al
jne 0x7bf72
jmp 0x7c030
movl -0x230(%rbp), %edi
leaq -0x270(%rbp), %rsi
callq 0x93060
jmp 0x7bf86
movl $0x0, -0x2a8(%rbp)
cmpl $0x10, -0x2a8(%rbp)
jge 0x7bffa
movl -0x22c(%rbp), %eax
movl %eax, -0x2f0(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x2a8(%rbp), %rax
movl -0x270(%rbp,%rax,4), %eax
movl %eax, %esi
callq 0x63590
movl -0x2f0(%rbp), %ecx
movl %ecx, (%rax)
movl -0x2a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a8(%rbp)
jmp 0x7bf90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x29d(%rbp), %rdi
callq 0x4d8e0
jmp 0x7c0a1
movq -0x18(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x7c910
jmp 0x7c00c
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x7c840
jmp 0x7c01c
movl -0x22c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22c(%rbp)
jmp 0x7bf29
movq 0x6afb9(%rip), %rdi     # 0xe6ff0
leaq 0x32df0(%rip), %rsi     # 0xaee2e
callq 0x7530
movq %rax, -0x2f8(%rbp)
jmp 0x7c04c
movq -0x20(%rbp), %rdi
callq 0x634c0
movq -0x2f8(%rbp), %rdi
movq %rax, %rsi
callq 0x7100
movq %rax, -0x300(%rbp)
jmp 0x7c06d
movq -0x300(%rbp), %rdi
movq 0x6aeed(%rip), %rsi     # 0xe6f68
callq 0x75b0
jmp 0x7c082
movl $0x0, -0x280(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x7120
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x228(%rbp), %rdi
callq 0x7120
movq -0x278(%rbp), %rdi
callq 0x79b0
nopl (%rax)