// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/./Correct.h
// Function: SetSnpMatrix(haplotype_evdience_alloc*, unsigned int*, unsigned long*, int, void*)
inline void SetSnpMatrix(haplotype_evdience_alloc* h, uint32_t *nn_snp, uint64_t *overlap_num, int32_t set_matrix, void *km)
{
    if(nn_snp && overlap_num) {
        if(!km) kv_resize(SnpStats, h->snp_stat, *nn_snp);
        else kv_resize_km(km, SnpStats, h->snp_stat, *nn_snp);
        h->snp_stat.n = 0; h->overlap = *overlap_num; h->core_snp = 0;
    } 

    if(set_matrix) {
        uint64_t n_snp = nn_snp? *nn_snp:h->snp_stat.n;
        uint64_t n_ovlp = overlap_num? *overlap_num:h->overlap;
        uint64_t new_size = n_snp* n_ovlp;
        if(h->snp_matrix_size < new_size) {
            h->snp_matrix_size = new_size;
            if(!km) REALLOC(h->snp_matrix, h->snp_matrix_size);
            else KREALLOC(km, h->snp_matrix, h->snp_matrix_size);
        }
        memset(h->snp_matrix, -1, n_snp * n_ovlp);

        if(h->r_snp_size < n_ovlp) {
            h->r_snp_size = n_ovlp;
            if(!km) REALLOC(h->r_snp, h->r_snp_size);
            else KREALLOC(km, h->r_snp, h->r_snp_size);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %r14
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
jne 0x53e09
movq 0x228(%rbx), %rcx
movl (%r12), %eax
testq %r14, %r14
je 0x53d97
cmpq %rax, %rcx
jae 0x53df1
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
incq %rcx
movq %rcx, 0x228(%rbx)
movq 0x218(%rbx), %rsi
imulq $0x28, %rcx, %rdx
movq %r14, %rdi
callq 0x1a3acc
jmp 0x53dea
cmpq %rax, %rcx
jae 0x53df1
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
incq %rcx
movq %rcx, 0x228(%rbx)
movq 0x218(%rbx), %rdi
imulq $0x28, %rcx, %rsi
callq 0x2370
movq %rax, 0x218(%rbx)
andq $0x0, 0x220(%rbx)
movl (%r15), %eax
movl %eax, 0x1c8(%rbx)
andl $0x0, 0x1c4(%rbx)
testl %ebp, %ebp
je 0x53ecb
testq %r12, %r12
je 0x53e1c
movl (%r12), %r12d
jmp 0x53e23
movq 0x220(%rbx), %r12
testq %r15, %r15
je 0x53e2d
movq (%r15), %r15
jmp 0x53e34
movl 0x1c8(%rbx), %r15d
imulq %r15, %r12
movl 0x1d8(%rbx), %eax
cmpq %rax, %r12
jbe 0x53e63
movl %r12d, 0x1d8(%rbx)
movq 0x1d0(%rbx), %rsi
movl %r12d, %edx
testq %r14, %r14
je 0x53e6c
movq %r14, %rdi
callq 0x1a3acc
jmp 0x53e77
movq 0x1d0(%rbx), %rdi
jmp 0x53e81
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, 0x1d0(%rbx)
movl $0xff, %esi
movq %r12, %rdx
callq 0x20e0
movl 0x1e8(%rbx), %eax
cmpq %rax, %r15
jbe 0x53ecb
movl %r15d, 0x1e8(%rbx)
movq 0x1e0(%rbx), %rsi
movl %r15d, %edx
testq %r14, %r14
je 0x53eb9
movq %r14, %rdi
callq 0x1a3acc
jmp 0x53ec4
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x2370
movq %rax, 0x1e0(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq