// File: /workspace/github_cpp_makefile_star2_O1/fukunagatsu[P]LogicomeProfiler/logicome_profiler.cpp
// Function: LogicomeProfiler::SecondScreeningForFWER()
void LogicomeProfiler::SecondScreeningForFWER(){
  int N = _number_of_samples;
  long long int ne = _number_of_elements;
  long long int max_size_count = 4*ne*(ne-1)*(ne-2); 
  double threshold = _alpha/max_size_count;
  ofstream ofs(_output_file_name.c_str());
  ofs << "significance_level " << threshold << endl;
  ofs << "Logic_formula Pv_of_condition_a Pv_of_condition_b Pv_of_condition_c Logic_type"<< endl;
  
  for(vector<Node>::iterator it = _result_vector.begin(); it != _result_vector.end(); ++it){    
    int a  = it->a;
    int b  = it->b;
    int c  = it->c;
    int logic = it->l;
    double prob2 = 0.0;
    double prob3 = 0.0;
    CalcProbSecondCondition(a,b,c,logic,threshold,prob2,prob3);

    if(prob2 < threshold && prob3 < threshold){
      ofs << _name_vector[c] << "=" << _name_vector[a] << "," << _name_vector[b] << " " << it->pv << " "<< prob2 << " "<< prob3 << " " << logic << endl;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
movslq 0x104(%rdi), %r15
movsd 0x108(%rdi), %xmm0
movsd %xmm0, (%rsp)
movq 0xe0(%rdi), %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movl $0x10, %edx
callq 0x2240
leaq 0x5c4b(%rip), %rsi      # 0x90b3
movl $0x13, %edx
movq %r14, %rdi
callq 0x2270
leaq -0x1(%r15), %rax
imulq %r15, %rax
addq $-0x2, %r15
imulq %rax, %r15
shlq $0x2, %r15
cvtsi2sd %r15, %xmm1
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
leaq 0x28(%rsp), %rdi
movsd %xmm0, (%rsp)
callq 0x2330
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
leaq 0x5c43(%rip), %rsi      # 0x911a
leaq 0x28(%rsp), %r14
movl $0x4e, %edx
movq %r14, %rdi
callq 0x2270
movq 0x28(%rsp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
leaq 0x28(%rsp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
movq 0x48(%rbx), %r12
cmpq 0x50(%rbx), %r12
je 0x3702
addq $0x10, %r12
movl -0x10(%r12), %r14d
movl -0xc(%r12), %ebp
movl -0x8(%r12), %r15d
movl -0x4(%r12), %r13d
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %r15d, %ecx
movsd (%rsp), %xmm1
leaq 0x10(%rsp), %r8
leaq 0x8(%rsp), %r9
callq 0x57a6
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x36eb
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm0
movsd %xmm1, 0x18(%rsp)
ucomisd %xmm1, %xmm0
jbe 0x36eb
movslq %r15d, %rax
movq 0xa8(%rbx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
leaq 0x28(%rsp), %rdi
callq 0x2270
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5b40(%rip), %rsi      # 0x9116
callq 0x2270
movslq %r14d, %rax
movq 0xa8(%rbx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq %r15, %rdi
callq 0x2270
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5b0c(%rip), %rsi      # 0x9118
callq 0x2270
movslq %ebp, %rax
movq 0xa8(%rbx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq %r14, %rdi
callq 0x2270
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5a83(%rip), %rsi      # 0x90c5
callq 0x2270
movsd (%r12), %xmm0
movq %r14, %rdi
callq 0x2330
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5a5e(%rip), %rsi      # 0x90c5
callq 0x2270
movq %r14, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x2330
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5a39(%rip), %rsi      # 0x90c5
callq 0x2270
movq %r14, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x2330
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x5a14(%rip), %rsi      # 0x90c5
callq 0x2270
movq %r14, %rdi
movl %r13d, %esi
callq 0x2360
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
leaq -0x10(%r12), %rax
addq $0x18, %r12
addq $0x18, %rax
cmpq 0x50(%rbx), %rax
jne 0x3526
movq 0x98c7(%rip), %rax      # 0xcfd0
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 0x21d0
leaq 0x120(%rsp), %rdi
callq 0x20b0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3748
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x22d0
movq %rbx, %rdi
callq 0x2370
nop