// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/miniwfa.c
// Function: mwf_ksim
static double mwf_ksim(void *km, int32_t l1, const char *s1, int32_t l2, const char *s2, int32_t k)
{
	int32_t i, i0, j, n_a, n1 = 0, n2 = 0, t1 = 0, t2 = 0;
	double p1, p2;
	uint64_t *a;
	if (l1 < k || l2 < k) return 0;
	assert(k >= 2 && k <= 15);
	KMALLOC(km, a, l1 + l2);
	n_a = mg_fc_kmer(l1, s1, 0, k, a);
	n_a += mg_fc_kmer(l2, s2, 1, k, &a[n_a]);
	radix_sort_gfa64(a, a + n_a);
	for (i0 = 0, i = 1; i <= n_a; ++i) {
		if (i == n_a || a[i0]>>33 != a[i]>>33) {
			int32_t m1, m2, min;
			for (j = i0; j < i && (a[j]>>32&1) == 0; ++j) {}
			m1 = j - i0, m2 = i - j;
			min = m1 < m2? m1 : m2;
			n1 += m1, n2 += m2;
			if (m1 > 0 && m2 > 0)
				t1 += min, t2 += min;
			i0 = i;
		}
	}
	kfree(km, a);
	p1 = (double)t1 / n1, p2 = (double)t2 / n2;
	return p1 > p2? p1 : p2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x34(%rbp), %eax
jl 0x1e7fd
movl -0x24(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x1e80a
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x1ea21
cmpl $0x2, -0x34(%rbp)
jl 0x1e818
cmpl $0xf, -0x34(%rbp)
jg 0x1e818
jmp 0x1e837
leaq 0x1e72e(%rip), %rdi     # 0x3cf4d
leaq 0x1e46e(%rip), %rsi     # 0x3cc94
movl $0x2ce, %edx            # imm = 0x2CE
leaq 0x1e793(%rip), %rcx     # 0x3cfc5
callq 0x2170
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addl -0x24(%rbp), %eax
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x2890
movq %rax, -0x70(%rbp)
movl -0x14(%rbp), %edi
movq -0x20(%rbp), %rsi
movl -0x34(%rbp), %ecx
movq -0x70(%rbp), %r8
xorl %edx, %edx
callq 0x200c0
movl %eax, -0x44(%rbp)
movl -0x24(%rbp), %edi
movq -0x30(%rbp), %rsi
movl -0x34(%rbp), %ecx
movq -0x70(%rbp), %r8
movslq -0x44(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r8
movl $0x1, %edx
callq 0x200c0
addl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x70(%rbp), %rdi
movq -0x70(%rbp), %rsi
movslq -0x44(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x5440
movl $0x0, -0x3c(%rbp)
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x1e9b9
movl -0x38(%rbp), %eax
cmpl -0x44(%rbp), %eax
je 0x1e8f5
movq -0x70(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq -0x70(%rbp), %rcx
movslq -0x38(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x21, %rcx
cmpq %rcx, %rax
je 0x1e9a9
movl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x38(%rbp), %ecx
movb %al, -0x7d(%rbp)
jge 0x1e926
movq -0x70(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
andq $0x1, %rax
cmpq $0x0, %rax
sete %al
movb %al, -0x7d(%rbp)
movb -0x7d(%rbp), %al
testb $0x1, %al
jne 0x1e92f
jmp 0x1e93c
jmp 0x1e931
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1e8fb
movl -0x40(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x38(%rbp), %eax
subl -0x40(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x78(%rbp), %eax
jge 0x1e961
movl -0x74(%rbp), %eax
movl %eax, -0x84(%rbp)
jmp 0x1e96a
movl -0x78(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x74(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x78(%rbp), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x74(%rbp)
jle 0x1e9a3
cmpl $0x0, -0x78(%rbp)
jle 0x1e9a3
movl -0x7c(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x7c(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x1e9ab
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1e8b8
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x2670
cvtsi2sdl -0x50(%rbp), %xmm0
cvtsi2sdl -0x48(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
cvtsi2sdl -0x54(%rbp), %xmm0
cvtsi2sdl -0x4c(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x60(%rbp), %xmm0
ucomisd -0x68(%rbp), %xmm0
jbe 0x1ea07
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
jmp 0x1ea14
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x90, %rsp
popq %rbp
retq
nop