// File: /workspace/github_cpp_makefile_star2_O3/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 0x183e4
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 -0x32d(%rip), %rcx      # 0x17f16
movq %r14, %rdi
movq %r15, %rsi
callq 0x1c455
leaq 0x8(%r14), %r12
cmpq $0x81, %rbx
jl 0x18358
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 0x182ac
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x22b0
movq %r14, %rcx
jmp 0x182e0
movq (%rax), %rax
movq 0x40(%rax), %rcx
movsd (%rcx), %xmm1
ucomisd %xmm0, %xmm1
movq %r15, %rcx
jbe 0x182e0
movq %rbp, %rcx
movq %rax, (%rcx)
movq -0x10(%rcx), %rax
movq 0x40(%rbx), %rdx
movq 0x40(%rax), %rsi
movsd (%rsi), %xmm0
addq $-0x8, %rcx
ucomisd (%rdx), %xmm0
ja 0x182c3
movq %rbx, (%rcx)
addq $0x8, %r13
addq $0x8, %rbp
cmpq $0x80, %r13
jne 0x18275
subq $-0x80, %r14
movq 0x10(%rsp), %r8
cmpq %r8, %r14
movq 0x8(%rsp), %rbp
je 0x183e4
movq -0x8(%r14), %rcx
movq (%r14), %rax
movq 0x40(%rax), %rdx
movq 0x40(%rcx), %rsi
movsd (%rsi), %xmm0
ucomisd (%rdx), %xmm0
movq %r14, %rdx
jbe 0x18347
movq %r14, %rdx
movq %rcx, (%rdx)
movq -0x10(%rdx), %rcx
movq 0x40(%rax), %rsi
movq 0x40(%rcx), %rdi
movsd (%rdi), %xmm0
addq $-0x8, %rdx
ucomisd (%rsi), %xmm0
ja 0x1832a
movq %rax, (%rdx)
addq $0x8, %r14
cmpq %r8, %r14
jne 0x1830b
jmp 0x183e4
cmpq %r15, %r12
je 0x183e4
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 0x183a4
movq %r13, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rcx
jmp 0x183d8
movq (%rdi), %rax
movq 0x40(%rax), %rcx
movsd (%rcx), %xmm1
ucomisd %xmm0, %xmm1
movq %r13, %rcx
jbe 0x183d8
movq %r13, %rcx
movq %rax, (%rcx)
movq -0x10(%rcx), %rax
movq 0x40(%r15), %rdx
movq 0x40(%rax), %rsi
movsd (%rsi), %xmm0
addq $-0x8, %rcx
ucomisd (%rdx), %xmm0
ja 0x183bb
movq %r15, (%rcx)
leaq 0x8(%r13), %r12
cmpq %rbx, %r12
jne 0x18367
movq (%rbp), %r14
movq 0x8(%rbp), %r15
movq %r15, %r12
subq %r14, %r12
movq %r12, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x1848a
xorl %esi, %esi
cmpq %rsi, %rdx
jbe 0x18658
leaq 0x1(%rsi), %rbx
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movq (%r14,%rsi,8), %rax
movq 0x40(%rax), %r14
movsd (%r14), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rdx, %xmm2
punpckldq 0x15499(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x154a1(%rip), %xmm2    # 0x2d8e0
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 0x18403
cmpq %r15, %r14
je 0x18649
bsrq %rdx, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x57d(%rip), %rcx      # 0x17f2a
movq %r14, %rdi
movq %r15, %rsi
callq 0x1c455
cmpq $0x81, %r12
jl 0x185b1
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 0x1850c
movq %r13, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rcx
jmp 0x18543
movq (%rdi), %rax
movq 0x40(%rax), %rcx
movsd 0x8(%rcx), %xmm1
ucomisd %xmm0, %xmm1
movq %r13, %rcx
jbe 0x18543
movq %rbx, %rcx
movq %rax, (%rcx)
movq -0x10(%rcx), %rax
movq 0x40(%rbp), %rdx
movq 0x40(%rax), %rsi
movsd 0x8(%rsi), %xmm0
addq $-0x8, %rcx
ucomisd 0x8(%rdx), %xmm0
ja 0x18524
movq %rbp, (%rcx)
addq $0x8, %r12
addq $0x8, %rbx
cmpq $0x80, %r12
jne 0x184cc
subq $-0x80, %r14
cmpq %r15, %r14
je 0x18649
movq -0x8(%r14), %rcx
movq (%r14), %rax
movq 0x40(%rax), %rdx
movq 0x40(%rcx), %rsi
movsd 0x8(%rsi), %xmm0
ucomisd 0x8(%rdx), %xmm0
movq %r14, %rdx
jbe 0x185a8
movq %r14, %rdx
movq %rcx, (%rdx)
movq -0x10(%rdx), %rcx
movq 0x40(%rax), %rsi
movq 0x40(%rcx), %rdi
movsd 0x8(%rdi), %xmm0
addq $-0x8, %rdx
ucomisd 0x8(%rsi), %xmm0
ja 0x18589
movq %rax, (%rdx)
addq $0x8, %r14
jmp 0x1855f
leaq 0x8(%r14), %rax
cmpq %r15, %rax
je 0x18649
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 0x18601
movq %rbx, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rcx
jmp 0x18639
movq (%rdi), %rax
movq 0x40(%rax), %rcx
movsd 0x8(%rcx), %xmm1
ucomisd %xmm0, %xmm1
movq %rbx, %rcx
jbe 0x18639
movq %rbx, %rcx
movq %rax, (%rcx)
movq -0x10(%rcx), %rax
movq 0x40(%r12), %rdx
movq 0x40(%rax), %rsi
movsd 0x8(%rsi), %xmm0
addq $-0x8, %rcx
ucomisd 0x8(%rdx), %xmm0
ja 0x18619
movq %r12, (%rcx)
leaq 0x8(%rbx), %rax
cmpq %r15, %rax
jne 0x185c1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14271(%rip), %rdi     # 0x2c8d0
xorl %eax, %eax
callq 0x2270