// File: ChnMasterOG[P]KmerGO2/stats_ml/stats.cpp
// Function: ranksums(std::vector<float, std::allocator<float>>&, std::vector<float, std::allocator<float>>&)
float ranksums(std::vector<float>& group1, std::vector<float>& group2)
{
	uint32_t n1 = group1.size(), n2 = group2.size();
	uint32_t i;
	float s = 0;
	std::vector<float> alldata;
	std::vector<float> ranked_data;

	alldata.insert(alldata.end(), group1.begin(), group1.end());
	alldata.insert(alldata.end(), group2.begin(), group2.end());

	getrank(alldata, ranked_data);
	for (i = 0; i < n1; i++) s += ranked_data[i];
	float expected = n1 * (n1 + n2 + 1) / 2.0;
	float z = (s - expected) / sqrt(n1 * n2 * (n1 + n2 + 1) / 12.0);

	if (fabs(z) >= 5.0) return 0.0;
	else
	{
		return 2 * (1 - normdist[(int)(fabs(z) * 10)][(int)(fabs(z) * 100) % 10]);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x40fbc0
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x40fbc0
movl %eax, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x40be60
leaq -0x58(%rbp), %rdi
callq 0x40be60
movq -0xf0(%rbp), %rdi
callq 0x40f900
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4168b0
movq -0x10(%rbp), %rdi
callq 0x40fac0
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x40f900
movq -0xf0(%rbp), %rdi
movq %rax, -0x78(%rbp)
movq -0x60(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x78(%rbp), %rcx
callq 0x416800
movq %rax, -0xe8(%rbp)
jmp 0x42aec3
movq -0xe8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x40f900
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4168b0
movq -0x18(%rbp), %rdi
callq 0x40fac0
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x40f900
movq -0x100(%rbp), %rdi
movq %rax, -0xb0(%rbp)
movq -0x98(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq -0xb0(%rbp), %rcx
callq 0x416800
movq %rax, -0xf8(%rbp)
jmp 0x42af45
movq -0xf8(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x410770
jmp 0x42af65
leaq -0xd0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x42a9e0
jmp 0x42af77
leaq -0xd0(%rbp), %rdi
callq 0x40c2b0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x42afed
movl -0x24(%rbp), %eax
movl %eax, %esi
leaq -0x58(%rbp), %rdi
callq 0x40b8d0
movss (%rax), %xmm0
addss -0x28(%rbp), %xmm0
movss %xmm0, -0x28(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x42af8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x42b19e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x40c2b0
jmp 0x42b19e
movl -0x1c(%rbp), %eax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
movl %eax, %ecx
leal 0x1(%rcx,%rdx), %ecx
imull %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd 0x18b4a5(%rip), %xmm1   # 0x5b64b0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xd4(%rbp)
movss -0x28(%rbp), %xmm0
movss -0xd4(%rbp), %xmm1
subss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x110(%rbp)
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %ecx
movl %esi, %eax
imull %ecx, %eax
movl %ecx, %edx
movl %esi, %ecx
leal 0x1(%rcx,%rdx), %ecx
imull %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd 0x18bea5(%rip), %xmm1   # 0x5b6f00
divsd %xmm1, %xmm0
callq 0x4ce690
movaps %xmm0, %xmm1
movsd -0x110(%rbp), %xmm0
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xd8(%rbp)
movss -0xd8(%rbp), %xmm0
callq 0x42b5a0
movss %xmm0, -0x104(%rbp)
jmp 0x42b096
movss -0x104(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x18be5e(%rip), %xmm1   # 0x5b6f08
ucomisd %xmm1, %xmm0
jb 0x42b0c7
xorps %xmm0, %xmm0
movss %xmm0, -0x4(%rbp)
movl $0x1, -0xdc(%rbp)
jmp 0x42b17e
movss -0xd8(%rbp), %xmm0
callq 0x42b5a0
movss %xmm0, -0x114(%rbp)
jmp 0x42b0de
movss -0x114(%rbp), %xmm0
movss 0x18be06(%rip), %xmm1   # 0x5b6ef4
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
cltq
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
leaq 0x20c1a9(%rip), %rax    # 0x6372b0
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movss -0xd8(%rbp), %xmm0
callq 0x42b5a0
movss %xmm0, -0x118(%rbp)
jmp 0x42b128
movss -0x118(%rbp), %xmm0
movss 0x18bdc0(%rip), %xmm1   # 0x5b6ef8
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl $0xa, %ecx
cltd
idivl %ecx
movq -0x120(%rbp), %rax
movslq %edx, %rcx
movsd 0x18bdbe(%rip), %xmm1   # 0x5b6f18
subsd (%rax,%rcx,8), %xmm1
movsd 0x18bda9(%rip), %xmm0   # 0x5b6f10
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4(%rbp)
movl $0x1, -0xdc(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x40c2b0
leaq -0x40(%rbp), %rdi
callq 0x40c2b0
movss -0x4(%rbp), %xmm0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x58(%rbp), %rdi
callq 0x40c2b0
leaq -0x40(%rbp), %rdi
callq 0x40c2b0
movq -0x80(%rbp), %rdi
callq 0x4d3c10
nopl (%rax)