// 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<index_hash_t, std::allocator<index_hash_t>> 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> &list, const std::vector<index_hash_t> &index, 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 << list[i] << "\t" << index[list[i]].hash << "\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 $0x2c0, %rsp            # imm = 0x2C0
movq %rsi, %rax
movq %rdi, %rsi
movq %rsi, -0x258(%rbp)
movq %rsi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
leaq -0x228(%rbp), %rdi
movl $0x10, %edx
callq 0x7a90
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x7220
movb %al, -0x24d(%rbp)
jmp 0x7b94d
movb -0x24d(%rbp), %al
testb $0x1, %al
jne 0x7b95c
jmp 0x7b9f7
movq 0x6b68d(%rip), %rdi     # 0xe6ff0
leaq 0x333ee(%rip), %rsi     # 0xaed58
callq 0x7530
movq %rax, -0x260(%rbp)
jmp 0x7b978
movq -0x258(%rbp), %rsi
movq -0x260(%rbp), %rdi
callq 0x7480
movq %rax, -0x268(%rbp)
jmp 0x7b994
movq -0x268(%rbp), %rdi
leaq 0x31131(%rip), %rsi     # 0xacad3
callq 0x7530
movq %rax, -0x270(%rbp)
jmp 0x7b9b0
movq -0x270(%rbp), %rdi
movq 0x6b5aa(%rip), %rsi     # 0xe6f68
callq 0x75b0
jmp 0x7b9c5
movl $0x1, -0x238(%rbp)
jmp 0x7bbf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x7820
jmp 0x7bc05
movq -0x28(%rbp), %rdi
callq 0x634c0
movq %rax, -0x240(%rbp)
movq $0x0, -0x248(%rbp)
movq -0x248(%rbp), %rax
cmpq -0x240(%rbp), %rax
jae 0x7bbe6
movq -0x28(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x7c780
movb %al, -0x271(%rbp)
jmp 0x7ba3e
movb -0x271(%rbp), %al
testb $0x1, %al
jne 0x7ba4d
jmp 0x7bbcd
movq -0x18(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x7c680
movl (%rax), %esi
leaq -0x228(%rbp), %rdi
callq 0x7740
movq %rax, -0x280(%rbp)
jmp 0x7ba74
movq -0x280(%rbp), %rdi
leaq 0x333aa(%rip), %rsi     # 0xaee2c
callq 0x7530
movq %rax, -0x288(%rbp)
jmp 0x7ba90
movq -0x20(%rbp), %rax
movq %rax, -0x298(%rbp)
movq -0x18(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x7c680
movq -0x298(%rbp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x7c7f0
movq -0x288(%rbp), %rdi
movq (%rax), %rsi
callq 0x74c0
movq %rax, -0x290(%rbp)
jmp 0x7bad3
movq -0x290(%rbp), %rdi
leaq 0x3334b(%rip), %rsi     # 0xaee2c
callq 0x7530
movq %rax, -0x2a0(%rbp)
jmp 0x7baef
movq -0x2a0(%rbp), %rdi
leaq -0xfc1d(%rip), %rsi     # 0x6bee0
callq 0x7170
movq %rax, -0x2a8(%rbp)
jmp 0x7bb0b
movq -0x10(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x7c7d0
movq -0x2a8(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x7a60
jmp 0x7bb2d
movl $0x0, -0x24c(%rbp)
cmpl $0x5, -0x24c(%rbp)
jge 0x7bbb6
leaq 0x308ff(%rip), %rsi     # 0xac446
leaq -0x228(%rbp), %rdi
callq 0x7530
movq %rax, -0x2b0(%rbp)
jmp 0x7bb5c
movq -0x2b0(%rbp), %rdi
leaq -0xfc8a(%rip), %rsi     # 0x6bee0
callq 0x7170
movq %rax, -0x2b8(%rbp)
jmp 0x7bb78
movq -0x10(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x7c7d0
movq -0x2b8(%rbp), %rdi
movslq -0x24c(%rbp), %rcx
movsd 0x8(%rax,%rcx,8), %xmm0
callq 0x7a60
jmp 0x7bba3
jmp 0x7bba5
movl -0x24c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24c(%rbp)
jmp 0x7bb37
leaq 0x33b48(%rip), %rsi     # 0xaf705
leaq -0x228(%rbp), %rdi
callq 0x7530
jmp 0x7bbcb
jmp 0x7bbcd
jmp 0x7bbcf
movq -0x248(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x248(%rbp)
jmp 0x7ba12
movl $0x0, -0x238(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x7820
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
movq -0x230(%rbp), %rdi
callq 0x79b0
nopw %cs:(%rax,%rax)