// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_annot_region_tools.cpp
// Function: get_benjamini_hochberg_corrected_p_values(std::vector<t_annot_region*, std::allocator<t_annot_region*>>*)
void get_benjamini_hochberg_corrected_p_values(vector<t_annot_region*>* regions)
{
	sort(regions->begin(), regions->end(), sort_regions_per_increasing_p_value);

	// Do BH corrections.
	for(int i_reg = 0; i_reg < (int)regions->size(); i_reg++)
	{
		double cur_region_rank = (double)i_reg + 1;

		t_significance_info* cur_reg_sig_info = regions->at(i_reg)->significance_info;
		cur_reg_sig_info->log_q_val = (cur_reg_sig_info->log_p_val + log((double)regions->size() / (double)cur_region_rank));
	} // i_reg loop.

	// Sort with respect to q-values.
	sort(regions->begin(), regions->end(), sort_regions_per_increasing_q_value);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbp
movq (%rdi), %r14
movq 0x8(%rdi), %r15
cmpq %r15, %r14
je 0x1876d
movq %r15, %rbx
subq %r14, %rbx
movq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x325(%rip), %rcx      # 0x1828a
movq %r14, %rdi
movq %r15, %rsi
callq 0x1c869
leaq 0x8(%r14), %r12
cmpq $0x81, %rbx
jl 0x186d6
movq %r15, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
movl $0x8, %r13d
movq %r12, %rbp
movq %r14, %r15
movq %r15, %rax
leaq (%r14,%r13), %r15
movq (%r14,%r13), %rbx
movq (%r14), %rcx
movq 0x40(%rbx), %rdx
movq 0x40(%rcx), %rcx
movsd (%rdx), %xmm0
movsd (%rcx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x18618
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x22b0
movq %r14, %rax
jmp 0x18653
movq (%rax), %rax
movq 0x40(%rax), %rax
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
movq %r15, %rax
jbe 0x18653
movq %rbp, %rcx
leaq -0x8(%rcx), %rax
movq -0x10(%rcx), %rdx
movq -0x8(%rcx), %rsi
movq %rsi, (%rcx)
movq 0x40(%rbx), %rcx
movq 0x40(%rdx), %rdx
movsd (%rdx), %xmm0
ucomisd (%rcx), %xmm0
movq %rax, %rcx
ja 0x1862f
movq %rbx, (%rax)
addq $0x8, %r13
addq $0x8, %rbp
cmpq $0x80, %r13
jne 0x185e1
subq $-0x80, %r14
movq 0x10(%rsp), %r8
cmpq %r8, %r14
movq 0x8(%rsp), %rbp
je 0x1876d
movq -0x8(%r14), %rcx
movq (%r14), %rax
movq 0x40(%rax), %rdx
movq 0x40(%rcx), %rcx
movsd (%rcx), %xmm0
ucomisd (%rdx), %xmm0
movq %r14, %rcx
jbe 0x186c5
movq %r14, %rdx
leaq -0x8(%rdx), %rcx
movq -0x10(%rdx), %rsi
movq -0x8(%rdx), %rdi
movq %rdi, (%rdx)
movq 0x40(%rax), %rdx
movq 0x40(%rsi), %rsi
movsd (%rsi), %xmm0
ucomisd (%rdx), %xmm0
movq %rcx, %rdx
ja 0x186a1
movq %rax, (%rcx)
addq $0x8, %r14
cmpq %r8, %r14
jne 0x18682
jmp 0x1876d
cmpq %r15, %r12
je 0x1876d
movq %r15, %rbx
movq %r14, %r13
movq %r13, %rdi
movq %r12, %r13
movq (%r12), %r15
movq (%r14), %rax
movq 0x40(%r15), %rcx
movq 0x40(%rax), %rax
movsd (%rcx), %xmm0
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x18722
movq %r13, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rax
jmp 0x1875d
movq (%rdi), %rax
movq 0x40(%rax), %rax
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
movq %r13, %rax
jbe 0x1875d
movq %r13, %rcx
leaq -0x8(%rcx), %rax
movq -0x10(%rcx), %rdx
movq -0x8(%rcx), %rsi
movq %rsi, (%rcx)
movq 0x40(%r15), %rcx
movq 0x40(%rdx), %rdx
movsd (%rdx), %xmm0
ucomisd (%rcx), %xmm0
movq %rax, %rcx
ja 0x18739
movq %r15, (%rax)
leaq 0x8(%r13), %r12
cmpq %rbx, %r12
jne 0x186e5
movq (%rbp), %r14
movq 0x8(%rbp), %r15
movq %r15, %r12
subq %r14, %r12
movq %r12, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x18816
xorl %esi, %esi
cmpq %rsi, %rdx
jbe 0x189f9
leaq 0x1(%rsi), %rbx
movl %ebx, %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movq (%r14,%rsi,8), %rax
movq 0x40(%rax), %r14
movsd (%r14), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rdx, %xmm2
punpckldq 0x1610d(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x16115(%rip), %xmm2    # 0x2e8e0
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
divsd %xmm1, %xmm0
callq 0x2120
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%r14)
movq (%rbp), %r14
movq 0x8(%rbp), %r15
movq %r15, %r12
subq %r14, %r12
movq %r12, %rdx
sarq $0x3, %rdx
movq %r12, %rax
shrq $0x3, %rax
cltq
movq %rbx, %rsi
cmpq %rax, %rbx
jl 0x1878c
cmpq %r15, %r14
je 0x189ea
bsrq %rdx, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x595(%rip), %rcx      # 0x1829e
movq %r14, %rdi
movq %r15, %rsi
callq 0x1c869
cmpq $0x81, %r12
jl 0x1894b
leaq 0x8(%r14), %rbx
movl $0x8, %r12d
movq %r14, %r13
movq %r13, %rdi
leaq (%r14,%r12), %r13
movq (%r14,%r12), %rbp
movq (%r14), %rax
movq 0x40(%rbp), %rcx
movq 0x40(%rax), %rax
movsd 0x8(%rcx), %xmm0
movsd 0x8(%rax), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x18898
movq %r13, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rax
jmp 0x188d6
movq (%rdi), %rax
movq 0x40(%rax), %rax
movsd 0x8(%rax), %xmm1
ucomisd %xmm0, %xmm1
movq %r13, %rax
jbe 0x188d6
movq %rbx, %rcx
leaq -0x8(%rcx), %rax
movq -0x10(%rcx), %rdx
movq -0x8(%rcx), %rsi
movq %rsi, (%rcx)
movq 0x40(%rbp), %rcx
movq 0x40(%rdx), %rdx
movsd 0x8(%rdx), %xmm0
ucomisd 0x8(%rcx), %xmm0
movq %rax, %rcx
ja 0x188b0
movq %rbp, (%rax)
addq $0x8, %r12
addq $0x8, %rbx
cmpq $0x80, %r12
jne 0x18858
subq $-0x80, %r14
cmpq %r15, %r14
je 0x189ea
movq -0x8(%r14), %rcx
movq (%r14), %rax
movq 0x40(%rax), %rdx
movq 0x40(%rcx), %rcx
movsd 0x8(%rcx), %xmm0
ucomisd 0x8(%rdx), %xmm0
movq %r14, %rcx
jbe 0x18942
movq %r14, %rdx
leaq -0x8(%rdx), %rcx
movq -0x10(%rdx), %rsi
movq -0x8(%rdx), %rdi
movq %rdi, (%rdx)
movq 0x40(%rax), %rdx
movq 0x40(%rsi), %rsi
movsd 0x8(%rsi), %xmm0
ucomisd 0x8(%rdx), %xmm0
movq %rcx, %rdx
ja 0x1891c
movq %rax, (%rcx)
addq $0x8, %r14
jmp 0x188f2
leaq 0x8(%r14), %rax
cmpq %r15, %rax
je 0x189ea
movq %r14, %rbx
movq %rbx, %rdi
movq %rax, %rbx
movq 0x8(%rdi), %r12
movq (%r14), %rax
movq 0x40(%r12), %rcx
movq 0x40(%rax), %rax
movsd 0x8(%rcx), %xmm0
movsd 0x8(%rax), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1899b
movq %rbx, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rax
jmp 0x189da
movq (%rdi), %rax
movq 0x40(%rax), %rax
movsd 0x8(%rax), %xmm1
ucomisd %xmm0, %xmm1
movq %rbx, %rax
jbe 0x189da
movq %rbx, %rcx
leaq -0x8(%rcx), %rax
movq -0x10(%rcx), %rdx
movq -0x8(%rcx), %rsi
movq %rsi, (%rcx)
movq 0x40(%r12), %rcx
movq 0x40(%rdx), %rdx
movsd 0x8(%rdx), %xmm0
ucomisd 0x8(%rcx), %xmm0
movq %rax, %rcx
ja 0x189b3
movq %r12, (%rax)
leaq 0x8(%rbx), %rax
cmpq %r15, %rax
jne 0x1895b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14ed6(%rip), %rdi     # 0x2d8d6
xorl %eax, %eax
callq 0x2270