// File: 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
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x280(%rbp)
movl 0x100(%rdi), %eax
movl %eax, -0xc(%rbp)
movslq 0x104(%rdi), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq %rcx, %rdx
decq %rdx
movq %rcx, %rax
imulq %rdx, %rax
addq $-0x2, %rcx
imulq %rcx, %rax
shlq $0x2, %rax
movq %rax, -0x20(%rbp)
movsd 0x108(%rdi), %xmm0
cvtsi2sdq -0x20(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
addq $0xe0, %rdi
callq 0x20f0
movq %rax, %rsi
leaq -0x228(%rbp), %rdi
movq %rdi, -0x278(%rbp)
movl $0x10, %edx
callq 0x2280
movq -0x278(%rbp), %rdi
leaq 0x10a80(%rip), %rsi     # 0x1609b
callq 0x2230
movq %rax, -0x270(%rbp)
jmp 0x5629
movq -0x270(%rbp), %rdi
movsd -0x28(%rbp), %xmm0
callq 0x23e0
movq %rax, -0x288(%rbp)
jmp 0x5643
movq -0x288(%rbp), %rdi
movq 0x1b977(%rip), %rsi     # 0x20fc8
callq 0x2260
jmp 0x5658
leaq 0x10aa3(%rip), %rsi     # 0x16102
leaq -0x228(%rbp), %rdi
callq 0x2230
movq %rax, -0x290(%rbp)
jmp 0x5674
movq -0x290(%rbp), %rdi
movq 0x1b946(%rip), %rsi     # 0x20fc8
callq 0x2260
jmp 0x5689
movq -0x280(%rbp), %rdi
addq $0x48, %rdi
callq 0x8860
movq %rax, -0x240(%rbp)
movq -0x280(%rbp), %rdi
addq $0x48, %rdi
callq 0x8890
movq %rax, -0x248(%rbp)
leaq -0x240(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x88c0
testb $0x1, %al
jne 0x56d3
jmp 0x59af
leaq -0x240(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x8940
movq -0x298(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x24c(%rbp)
callq 0x8940
movq -0x298(%rbp), %rdi
movl 0x4(%rax), %eax
movl %eax, -0x250(%rbp)
callq 0x8940
movq -0x298(%rbp), %rdi
movl 0x8(%rax), %eax
movl %eax, -0x254(%rbp)
callq 0x8940
movq -0x280(%rbp), %rdi
movl 0xc(%rax), %eax
movl %eax, -0x258(%rbp)
movq $0x0, -0x260(%rbp)
movq $0x0, -0x268(%rbp)
movl -0x24c(%rbp), %esi
movl -0x250(%rbp), %edx
movl -0x254(%rbp), %ecx
cvtsi2sdl -0x258(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
leaq -0x260(%rbp), %r8
leaq -0x268(%rbp), %r9
callq 0x7610
jmp 0x577e
movsd -0x260(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x599c
movsd -0x268(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x599c
movq -0x280(%rbp), %rdi
addq $0xa8, %rdi
movslq -0x254(%rbp), %rsi
callq 0x8eb0
movq %rax, %rsi
leaq -0x228(%rbp), %rdi
callq 0x2210
movq %rax, -0x2a0(%rbp)
jmp 0x57de
movq -0x2a0(%rbp), %rdi
leaq 0x10912(%rip), %rsi     # 0x160fe
callq 0x2230
movq %rax, -0x2a8(%rbp)
jmp 0x57fa
movq -0x280(%rbp), %rdi
addq $0xa8, %rdi
movslq -0x24c(%rbp), %rsi
callq 0x8eb0
movq -0x2a8(%rbp), %rdi
movq %rax, %rsi
callq 0x2210
movq %rax, -0x2b0(%rbp)
jmp 0x582c
movq -0x2b0(%rbp), %rdi
leaq 0x108c6(%rip), %rsi     # 0x16100
callq 0x2230
movq %rax, -0x2b8(%rbp)
jmp 0x5848
movq -0x280(%rbp), %rdi
addq $0xa8, %rdi
movslq -0x250(%rbp), %rsi
callq 0x8eb0
movq -0x2b8(%rbp), %rdi
movq %rax, %rsi
callq 0x2210
movq %rax, -0x2c0(%rbp)
jmp 0x587a
movq -0x2c0(%rbp), %rdi
leaq 0x10825(%rip), %rsi     # 0x160ad
callq 0x2230
movq %rax, -0x2c8(%rbp)
jmp 0x5896
leaq -0x240(%rbp), %rdi
callq 0x8940
movq -0x2c8(%rbp), %rdi
movsd 0x10(%rax), %xmm0
callq 0x23e0
movq %rax, -0x2d0(%rbp)
jmp 0x58bc
movq -0x2d0(%rbp), %rdi
leaq 0x107e3(%rip), %rsi     # 0x160ad
callq 0x2230
movq %rax, -0x2d8(%rbp)
jmp 0x58d8
movq -0x2d8(%rbp), %rdi
movsd -0x260(%rbp), %xmm0
callq 0x23e0
movq %rax, -0x2e0(%rbp)
jmp 0x58f5
movq -0x2e0(%rbp), %rdi
leaq 0x107aa(%rip), %rsi     # 0x160ad
callq 0x2230
movq %rax, -0x2e8(%rbp)
jmp 0x5911
movq -0x2e8(%rbp), %rdi
movsd -0x268(%rbp), %xmm0
callq 0x23e0
movq %rax, -0x2f0(%rbp)
jmp 0x592e
movq -0x2f0(%rbp), %rdi
leaq 0x10771(%rip), %rsi     # 0x160ad
callq 0x2230
movq %rax, -0x2f8(%rbp)
jmp 0x594a
movq -0x2f8(%rbp), %rdi
movl -0x258(%rbp), %esi
callq 0x23a0
movq %rax, -0x300(%rbp)
jmp 0x5965
movq -0x300(%rbp), %rdi
movq 0x1b655(%rip), %rsi     # 0x20fc8
callq 0x2260
jmp 0x597a
jmp 0x599c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x2310
jmp 0x59c4
jmp 0x599e
leaq -0x240(%rbp), %rdi
callq 0x8960
jmp 0x56a0
leaq -0x228(%rbp), %rdi
callq 0x2310
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq -0x230(%rbp), %rdi
callq 0x23b0