// File: kobanium[P]Ray/src/learn/MinorizationMaximization.cpp
// Function: InitializeLearning()
static void
InitializeLearning( void )
{
  const std::string md2_target_path = GetWorkingDirectory() + PATH_SEPARATOR +
    LEARNING_RESULT_DIR_NAME + PATH_SEPARATOR +
    PATTERN_TARGET_DIR_NAME + PATH_SEPARATOR +
    MD2_TARGET_FILE_NAME;
  unsigned int transpose[16];

  InputMD2Target(md2_target_path, md2_index, md2_list, md2_target);

  InitializeLearningData(previous_distance, TRAIN_THREAD_NUM, PREVIOUS_DISTANCE_MAX);
  InitializeLearningData(pat3, TRAIN_THREAD_NUM, PAT3_MAX);
  InitializeLearningData(md2, TRAIN_THREAD_NUM, md2_target.size());
  InitializeLearningData(capture, TRAIN_THREAD_NUM, SIM_CAPTURE_MAX);
  InitializeLearningData(save_extension, TRAIN_THREAD_NUM, SIM_SAVE_EXTENSION_MAX);
  InitializeLearningData(atari, TRAIN_THREAD_NUM, SIM_ATARI_MAX);
  InitializeLearningData(extension, TRAIN_THREAD_NUM, SIM_EXTENSION_MAX);
  InitializeLearningData(dame, TRAIN_THREAD_NUM, SIM_DAME_MAX);
  InitializeLearningData(throw_in, TRAIN_THREAD_NUM, SIM_THROW_IN_MAX);

  pat3_index = std::vector<int>(PAT3_MAX, -1);
  for (unsigned int pat_3x3 = 0; pat_3x3 < static_cast<unsigned int>(PAT3_MAX); pat_3x3++) {
    if (pat3_index[pat_3x3] == -1) {
      Pat3Transpose16(pat_3x3, transpose);
      const int tc = GetUniquePattern(transpose, 16);
      for (int i = 0; i < tc; i++) {
        pat3_index[transpose[i]] = pat_3x3;
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x2ccc0
movq -0x188(%rbp), %rsi
leaq 0x77b04(%rip), %rdx     # 0xea290
leaq -0xc0(%rbp), %rdi
callq 0x632c0
jmp 0x7279a
leaq 0x3c5cf(%rip), %rdx     # 0xaed70
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x63310
jmp 0x727b6
leaq 0x77ad3(%rip), %rdx     # 0xea290
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x632c0
jmp 0x727cf
leaq 0x3c5aa(%rip), %rdx     # 0xaed80
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x63310
jmp 0x727e5
leaq 0x77aa4(%rip), %rdx     # 0xea290
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x632c0
jmp 0x727fb
leaq 0x3c58d(%rip), %rdx     # 0xaed8f
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x63310
jmp 0x72811
leaq -0x40(%rbp), %rdi
callq 0x7ae8
leaq -0x60(%rbp), %rdi
callq 0x7ae8
leaq -0x80(%rbp), %rdi
callq 0x7ae8
leaq -0xa0(%rbp), %rdi
callq 0x7ae8
leaq -0xc0(%rbp), %rdi
callq 0x7ae8
leaq -0xe0(%rbp), %rdi
callq 0x7ae8
leaq -0x150(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x71f0
jmp 0x72862
leaq 0x77a5f(%rip), %rsi     # 0xea2c8
leaq 0x77b48(%rip), %rdx     # 0xea3b8
leaq 0x77b59(%rip), %rcx     # 0xea3d0
leaq -0x150(%rbp), %rdi
callq 0x7bd90
jmp 0x72885
leaq -0x150(%rbp), %rdi
callq 0x7ae8
leaq 0x77a48(%rip), %rdi     # 0xea2e0
movl $0x8, %esi
movl $0x3, %edx
callq 0x72f20
jmp 0x728a9
leaq 0x77a48(%rip), %rdi     # 0xea2f8
movl $0x8, %esi
movl $0x10000, %edx          # imm = 0x10000
callq 0x72f20
jmp 0x728c1
leaq 0x77b08(%rip), %rdi     # 0xea3d0
callq 0x634c0
movl %eax, %edx
leaq 0x77a3a(%rip), %rdi     # 0xea310
movl $0x8, %esi
callq 0x72f20
jmp 0x728e2
leaq 0x77a3f(%rip), %rdi     # 0xea328
movl $0x8, %esi
movl $0x14, %edx
callq 0x72f20
jmp 0x728fa
leaq 0x77a3f(%rip), %rdi     # 0xea340
movl $0x8, %esi
movl $0x7, %edx
callq 0x72f20
jmp 0x72912
leaq 0x77a3f(%rip), %rdi     # 0xea358
movl $0x8, %esi
movl $0xa, %edx
callq 0x72f20
jmp 0x7292a
leaq 0x77a3f(%rip), %rdi     # 0xea370
movl $0x8, %esi
movl $0x5, %edx
callq 0x72f20
jmp 0x72942
leaq 0x77a3f(%rip), %rdi     # 0xea388
movl $0x8, %esi
movl $0x3, %edx
callq 0x72f20
jmp 0x7295a
leaq 0x77a3f(%rip), %rdi     # 0xea3a0
movl $0x8, %esi
movl $0x2, %edx
callq 0x72f20
jmp 0x72972
movl $0xffffffff, -0x16c(%rbp) # imm = 0xFFFFFFFF
leaq -0x16d(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x4d840
movq -0x190(%rbp), %rcx
leaq -0x168(%rbp), %rdi
movl $0x10000, %esi          # imm = 0x10000
leaq -0x16c(%rbp), %rdx
callq 0x4d860
jmp 0x729b0
leaq 0x778f9(%rip), %rdi     # 0xea2b0
leaq -0x168(%rbp), %rsi
callq 0x63560
leaq -0x168(%rbp), %rdi
callq 0x2d610
leaq -0x16d(%rbp), %rdi
callq 0x4d8e0
movl $0x0, -0x174(%rbp)
cmpl $0x10000, -0x174(%rbp)  # imm = 0x10000
jae 0x72bd1
movl -0x174(%rbp), %eax
movl %eax, %esi
leaq 0x778ac(%rip), %rdi     # 0xea2b0
callq 0x63590
cmpl $-0x1, (%rax)
jne 0x72bbb
movl -0x174(%rbp), %edi
leaq -0x130(%rbp), %rsi
callq 0x92da0
jmp 0x72a26
leaq -0x130(%rbp), %rdi
movl $0x10, %esi
callq 0x7c400
movl %eax, -0x194(%rbp)
jmp 0x72a3f
movl -0x194(%rbp), %eax
movl %eax, -0x178(%rbp)
movl $0x0, -0x17c(%rbp)
movl -0x17c(%rbp), %eax
cmpl -0x178(%rbp), %eax
jge 0x72bb9
movl -0x174(%rbp), %eax
movl %eax, -0x198(%rbp)
movslq -0x17c(%rbp), %rax
movl -0x130(%rbp,%rax,4), %eax
movl %eax, %esi
leaq 0x77826(%rip), %rdi     # 0xea2b0
callq 0x63590
movl -0x198(%rbp), %ecx
movl %ecx, (%rax)
movl -0x17c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x17c(%rbp)
jmp 0x72a55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x72b54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x72b48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x72b3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x72b33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x72b2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x7ae8
leaq -0x60(%rbp), %rdi
callq 0x7ae8
leaq -0x80(%rbp), %rdi
callq 0x7ae8
leaq -0xa0(%rbp), %rdi
callq 0x7ae8
leaq -0xc0(%rbp), %rdi
callq 0x7ae8
leaq -0xe0(%rbp), %rdi
callq 0x7ae8
jmp 0x72bec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x72be3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x7ae8
jmp 0x72be3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x16d(%rbp), %rdi
callq 0x4d8e0
jmp 0x72be3
jmp 0x72bbb
jmp 0x72bbd
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x174(%rbp)
jmp 0x729e5
leaq -0x20(%rbp), %rdi
callq 0x7ae8
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x7ae8
movq -0xe8(%rbp), %rdi
callq 0x79b0
nopl (%rax,%rax)