// File: /workspace/github_cpp_makefile_star2_O3/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 0x6810
movq (%r13), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x48(%rsp,%rax)
je 0x431da
movq 0x32e75(%rip), %rdi     # 0x75fe8
leaq 0x1cb6e(%rip), %rsi     # 0x5fce8
movl $0xd, %edx
callq 0x6490
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x32e56(%rip), %rdi     # 0x75fe8
callq 0x6490
movq %rax, %rbx
leaq 0x1aaec(%rip), %rsi     # 0x5dc8d
movl $0x1, %edx
movq %rax, %rdi
callq 0x6490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x63c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6290
jmp 0x43377
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 0x43377
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 0x43362
movq (%rsp), %rax
movq (%rax), %rax
movl (%rax,%rbp,4), %esi
movq %r13, %rdi
callq 0x6280
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1cb28(%rip), %rsi     # 0x5fdb6
callq 0x6490
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 0x6270
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1caef(%rip), %rsi     # 0x5fdb6
callq 0x6490
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 0x6690
movl $0x1, %r14d
movl $0x1, %edx
movq %r13, %rdi
leaq 0x1a2ee(%rip), %rsi     # 0x5d600
callq 0x6490
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 0x6690
incq %r14
cmpq $0x6, %r14
jne 0x43303
movl $0x1, %edx
movq %r13, %rdi
leaq 0x1d358(%rip), %rsi     # 0x606b5
callq 0x6490
incq %rbp
addq $0x218, %r15            # imm = 0x218
cmpq 0x18(%rsp), %rbp
jb 0x43226
movq 0x32bea(%rip), %rax     # 0x75f68
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 0x6330
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 0x433bf
jmp 0x433bf
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6600
movq %rbx, %rdi
callq 0x6760