// File: /workspace/github_cpp_makefile_star2_O1/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
movq %r13, %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x6820
movq (%r13), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x48(%rsp,%rax)
je 0x42f12
movq 0x3213d(%rip), %rdi     # 0x74fe8
leaq 0x1cdb6(%rip), %rsi     # 0x5fc68
movl $0xd, %edx
callq 0x64a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x3211e(%rip), %rdi     # 0x74fe8
callq 0x64a0
movq %rax, %rbx
leaq 0x1adb4(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x64a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
jmp 0x430af
movq %rbp, (%rsp)
movq %r15, 0x8(%rsp)
movq 0x10(%rbx), %rcx
movl 0x18(%rbx), %eax
movq %rbx, 0x20(%rsp)
subq (%rbx), %rcx
shlq $0x3, %rcx
addq %rax, %rcx
movq %rcx, 0x18(%rsp)
je 0x430af
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
xorl %r15d, %r15d
addq $0x3f, %rax
movq %rax, 0x10(%rsp)
leaq 0x28(%rsp), %r13
movl $0xfffffefb, %ebx       # imm = 0xFFFFFEFB
xorl %ebp, %ebp
leaq 0x3f(%rbp), %rax
testq %rbp, %rbp
cmovnsq %rbp, %rax
sarq $0x6, %rax
shlq $0x3, %rax
movq 0x20(%rsp), %rcx
addq (%rcx), %rax
movq %rbp, %rcx
andq 0x10(%rsp), %rcx
xorl %edx, %edx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
cmpq %rsi, %rcx
setbe %dl
movq -0x8(%rax,%rdx,8), %rax
btq %rbp, %rax
jae 0x4309a
movq (%rsp), %rax
movq (%rax), %rax
movl (%rax,%rbp,4), %esi
movq %r13, %rdi
callq 0x6290
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1cd70(%rip), %rsi     # 0x5fd36
callq 0x64a0
movq (%rsp), %rax
movq (%rax), %rax
movl (%rax,%rbp,4), %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
shlq $0x4, %rax
movq (%rcx,%rax), %rsi
movq %r14, %rdi
callq 0x6280
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1cd37(%rip), %rsi     # 0x5fd36
callq 0x64a0
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl %ebx, %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x18(%r14,%rax)
movq (%r12), %rax
imulq $0x218, %rbp, %rcx      # imm = 0x218
movsd (%rax,%rcx), %xmm0
movq %r14, %rdi
callq 0x66a0
movl $0x1, %r14d
movl $0x1, %edx
movq %r13, %rdi
leaq 0x1a5b6(%rip), %rsi     # 0x5d600
callq 0x64a0
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x40(%rsp,%rax), %ecx
andl %ebx, %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x40(%rsp,%rax)
movq (%r12), %rax
addq %r15, %rax
movsd (%rax,%r14,8), %xmm0
movq %r13, %rdi
callq 0x66a0
incq %r14
cmpq $0x6, %r14
jne 0x4303b
movl $0x1, %edx
movq %r13, %rdi
leaq 0x1d4b0(%rip), %rsi     # 0x60545
callq 0x64a0
incq %rbp
addq $0x218, %r15            # imm = 0x218
cmpq 0x18(%rsp), %rbp
jb 0x42f5e
movq 0x31eb2(%rip), %rax     # 0x74f68
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x30(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x28(%rsp,%rcx)
callq 0x6340
leaq 0x120(%rsp), %rdi
callq 0x60f0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x430f7
jmp 0x430f7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6610
movq %rbx, %rdi
callq 0x6770