// File: chhylp123[P]hifiasm/anchor.cpp
// Function: get_mz1(char const*, int, int, int, unsigned int, int, ha_abuf_s*, void const*, ha_pt_s*, int, kvec_t_u8_warp*, kvec_t_u64_warp*, ha_pt_s*, int, int, float, st_mt_t*, int, int, void*, unsigned long)
uint64_t get_mz1(const char *str, int len, int w, int k, uint32_t rid, int is_hpc, ha_abuf_t *ab, const void *hf, ha_pt_t *ha_idx, int sample_dist, kvec_t_u8_warp* k_flag, kvec_t_u64_warp* dbg_ct, ha_pt_t *pt, int min_freq, int32_t dp_min_len, float dp_e, st_mt_t *mt, int32_t ws, int32_t is_unique, void *km, uint64_t beg_i)
{
	ab->mz.n = beg_i;
	// get the list of anchors
	mz1_ha_sketch(str, len, w, k, 0, !(asm_opt.flag & HA_F_NO_HPC), &ab->mz, hf, asm_opt.mz_sample_dist, k_flag, dbg_ct, NULL, -1, asm_opt.dp_min_len, -1, mt, asm_opt.mz_rewin, 0, NULL);

	radix_sort_ha_mz1_v_srt(ab->mz.a + beg_i, ab->mz.a + ab->mz.n);

	if(ha_idx) {
		uint64_t i;

		if (ab->mz.m > ab->old_mz_m) {
			ab->old_mz_m = ab->mz.m;
			REALLOC(ab->seed, ab->old_mz_m);
		}

		for (i = 0; i < ab->mz.n; ++i) {
			ab->seed[i].a = NULL;
			ab->seed[i].n = ha_pt_cnt(ha_idx, ab->mz.a[i].x);
		}
	}

	return ab->mz.n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq 0x78(%rbp), %rax
movq 0x70(%rbp), %rax
movl 0x68(%rbp), %eax
movl 0x60(%rbp), %eax
movq 0x58(%rbp), %rax
movl 0x50(%rbp), %eax
movl 0x48(%rbp), %eax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movl %esi, -0x34(%rbp)
movl %edx, -0x38(%rbp)
movl %ecx, -0x3c(%rbp)
movl %r8d, -0x40(%rbp)
movl %r9d, -0x44(%rbp)
movss %xmm0, -0x48(%rbp)
movq 0x78(%rbp), %rax
movl %eax, %ecx
movq 0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x30(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
movl -0x3c(%rbp), %ecx
leaq 0x210e36(%rip), %rax    # 0x3c47f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %r9d
movq 0x10(%rbp), %r13
addq $0x18, %r13
movq 0x18(%rbp), %r12
leaq 0x210e10(%rip), %rax    # 0x3c47f8
movl 0xa8(%rax), %r15d
movq 0x30(%rbp), %r14
movq 0x38(%rbp), %rbx
leaq 0x210dfa(%rip), %rax    # 0x3c47f8
movl 0x1f8(%rax), %r11d
movq 0x58(%rbp), %r10
leaq 0x210de8(%rip), %rax    # 0x3c47f8
movl 0xa0(%rax), %eax
movl %eax, -0x54(%rbp)
xorl %r8d, %r8d
xorl %eax, %eax
movl -0x54(%rbp), %eax
movss 0x1cb647(%rip), %xmm0   # 0x37f070
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movl %r15d, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
movl %r11d, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movl $0x0, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
callq 0x196540
movq 0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq 0x78(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq 0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0x10(%rbp), %rax
movl 0x18(%rax), %eax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x1a04f0
cmpq $0x0, 0x20(%rbp)
je 0x1b3b6b
movq 0x10(%rbp), %rax
movl 0x1c(%rax), %eax
movq 0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jbe 0x1b3af2
movq 0x10(%rbp), %rax
movl 0x1c(%rax), %ecx
movq 0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq 0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %esi
shlq $0x4, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq 0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
cmpq %rcx, %rax
jae 0x1b3b69
movq 0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movq 0x20(%rbp), %rdi
movq 0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x1879f0
movl %eax, %ecx
movq 0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x50(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x1b3afa
jmp 0x1b3b6b
movq 0x10(%rbp), %rax
movl 0x18(%rax), %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)