// File: kobanium[P]Ray/src/learn/LearningUtility.cpp
// Function: OutputBTFMParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<btfm_t, std::allocator<btfm_t>> const&, std::vector<unsigned int, std::allocator<unsigned int>> const&, std::vector<bool, std::allocator<bool>> const&)
void
OutputBTFMParameter( const std::string filename, const std::vector<btfm_t> &data, const std::vector<unsigned int> &index_list, const std::vector<bool> &target )
{
  std::ofstream ofs(filename, std::ios::out);

  if (!ofs) {
    std::cerr << "Cannot open \"" << filename << "\"" << std::endl;
    return;
  }

  const std::size_t data_size = target.size();

  for (std::size_t i = 0; i < data_size; i++) {
    if (target[i]) {
      ofs << index_list[i] << "\t" << std::scientific << data[i].w;
      for (int j = 0; j < FM_DIMENSION; j++) {
        ofs << " " << std::scientific << data[i].v[j];
      }
      ofs << "\n";
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rsi, %rax
movq %rdi, %rsi
movq %rsi, -0x250(%rbp)
movq %rsi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x220(%rbp), %rdi
movl $0x10, %edx
callq 0x7a90
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x7220
movb %al, -0x245(%rbp)
jmp 0x7b689
movb -0x245(%rbp), %al
testb $0x1, %al
jne 0x7b698
jmp 0x7b733
movq 0x6b951(%rip), %rdi     # 0xe6ff0
leaq 0x336b2(%rip), %rsi     # 0xaed58
callq 0x7530
movq %rax, -0x258(%rbp)
jmp 0x7b6b4
movq -0x250(%rbp), %rsi
movq -0x258(%rbp), %rdi
callq 0x7480
movq %rax, -0x260(%rbp)
jmp 0x7b6d0
movq -0x260(%rbp), %rdi
leaq 0x313f5(%rip), %rsi     # 0xacad3
callq 0x7530
movq %rax, -0x268(%rbp)
jmp 0x7b6ec
movq -0x268(%rbp), %rdi
movq 0x6b86e(%rip), %rsi     # 0xe6f68
callq 0x75b0
jmp 0x7b701
movl $0x1, -0x230(%rbp)
jmp 0x7b8cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x7820
jmp 0x7b8e2
movq -0x20(%rbp), %rdi
callq 0x634c0
movq %rax, -0x238(%rbp)
movq $0x0, -0x240(%rbp)
movq -0x240(%rbp), %rax
cmpq -0x238(%rbp), %rax
jae 0x7b8c3
movq -0x20(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x7c780
movb %al, -0x269(%rbp)
jmp 0x7b77a
movb -0x269(%rbp), %al
testb $0x1, %al
jne 0x7b789
jmp 0x7b8aa
movq -0x18(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x7c680
movl (%rax), %esi
leaq -0x220(%rbp), %rdi
callq 0x7740
movq %rax, -0x278(%rbp)
jmp 0x7b7b0
movq -0x278(%rbp), %rdi
leaq 0x3366e(%rip), %rsi     # 0xaee2c
callq 0x7530
movq %rax, -0x280(%rbp)
jmp 0x7b7cc
movq -0x280(%rbp), %rdi
leaq -0xf8fa(%rip), %rsi     # 0x6bee0
callq 0x7170
movq %rax, -0x288(%rbp)
jmp 0x7b7e8
movq -0x10(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x7c7d0
movq -0x288(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x7a60
jmp 0x7b80a
movl $0x0, -0x244(%rbp)
cmpl $0x5, -0x244(%rbp)
jge 0x7b893
leaq 0x30c22(%rip), %rsi     # 0xac446
leaq -0x220(%rbp), %rdi
callq 0x7530
movq %rax, -0x290(%rbp)
jmp 0x7b839
movq -0x290(%rbp), %rdi
leaq -0xf967(%rip), %rsi     # 0x6bee0
callq 0x7170
movq %rax, -0x298(%rbp)
jmp 0x7b855
movq -0x10(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x7c7d0
movq -0x298(%rbp), %rdi
movslq -0x244(%rbp), %rcx
movsd 0x8(%rax,%rcx,8), %xmm0
callq 0x7a60
jmp 0x7b880
jmp 0x7b882
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0x7b814
leaq 0x33e6b(%rip), %rsi     # 0xaf705
leaq -0x220(%rbp), %rdi
callq 0x7530
jmp 0x7b8a8
jmp 0x7b8aa
jmp 0x7b8ac
movq -0x240(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x240(%rbp)
jmp 0x7b74e
movl $0x0, -0x230(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x7820
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0x228(%rbp), %rdi
callq 0x79b0
nop