// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %r14
leaq 0x28(%rsp), %r13
pushq $0x10
popq %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0x6800
movq (%r13), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x48(%rsp,%rax)
je 0x2d15b
movq 0x33edf(%rip), %rdi     # 0x60ff0
leaq 0x19ba0(%rip), %rsi     # 0x46cb8
callq 0x63c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x6350
leaq 0x179ac(%rip), %rsi     # 0x44adb
movq %rax, %rdi
callq 0x63c0
movq %rax, %rdi
callq 0x6190
leaq 0x28(%rsp), %rdi
callq 0x65e0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movq %rbx, 0x18(%rsp)
subq (%rbx), %rax
leaq (%rcx,%rax,8), %rax
movq %rax, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x28(%rsp), %r13
movl $0xfffffefb, %r15d      # imm = 0xFFFFFEFB
leaq 0x172bd(%rip), %r14     # 0x4444e
xorl %esi, %esi
cmpq 0x20(%rsp), %rsi
je 0x2d13f
movq 0x18(%rsp), %rdi
movq %rsi, (%rsp)
callq 0x2d754
testb %al, %al
je 0x2d291
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rsp), %rcx
movl (%rax,%rcx,4), %esi
movq %r13, %rdi
callq 0x6270
movq %rax, %rdi
leaq 0x19bb5(%rip), %rsi     # 0x46d86
callq 0x63c0
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq (%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
movq 0x10(%rsp), %rdx
movq (%rdx), %rdx
shlq $0x4, %rcx
movq (%rdx,%rcx), %rsi
movq %rax, %rdi
callq 0x6260
movq %rax, %rdi
leaq 0x19b7f(%rip), %rsi     # 0x46d86
callq 0x63c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl %r15d, %edx
orl $0x100, %edx            # imm = 0x100
movl %edx, 0x18(%rax,%rcx)
movq (%r12), %rcx
imulq $0x218, (%rsp), %rdx    # imm = 0x218
movsd (%rcx,%rdx), %xmm0
movq %rax, %rdi
callq 0x6670
pushq $0x1
popq %rbp
cmpq $0x6, %rbp
je 0x2d282
movq %r13, %rdi
movq %r14, %rsi
callq 0x63c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl %r15d, %edx
orl $0x100, %edx            # imm = 0x100
movl %edx, 0x18(%rax,%rcx)
movq (%r12), %rcx
addq %rbx, %rcx
movsd (%rcx,%rbp,8), %xmm0
movq %rax, %rdi
callq 0x6670
incq %rbp
jmp 0x2d240
movq %r13, %rdi
leaq 0x1a349(%rip), %rsi     # 0x475d5
callq 0x63c0
movq (%rsp), %rsi
incq %rsi
addq $0x218, %rbx            # imm = 0x218
jmp 0x2d193
jmp 0x2d2a8
jmp 0x2d2a8
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x65e0
movq %rbx, %rdi
callq 0x6740