// File: chhylp123[P]hifiasm/Correct.cpp
// Function: push_emask_flt(kv_emask_t*, unsigned long*, unsigned long, unsigned long, kv_ul_ov_t*)
uint32_t push_emask_flt(kv_emask_t *in, uint64_t *flt, uint64_t flt_n, uint64_t qn, kv_ul_ov_t *res)
{
    uint32_t k = 0, z = 0, tn, rn0 = res->n; ul_ov_t *p;
    while (k < in->n && z < flt_n) {
        if (in->a[k].tn < (flt[z]>>32)) {
            k++;
        } else if((flt[z]>>32) < in->a[k].tn) {
            z++;
        } else {///in->a[k].tn == (flt[z]>>32)
            for (tn = in->a[k].tn; k < in->n && in->a[k].tn == tn; k++) {
                kv_pushp(ul_ov_t, *res, &p);
                p->qn = qn; p->qs = in->a[k].qs; p->qe = in->a[k].qe; 
                p->tn = in->a[k].tn; p->ts = in->a[k].ts; p->te = in->a[k].te; 
                p->rev = in->a[k].rev; p->el = in->a[k].full; p->sec = k;
            }
            for (; z < flt_n && (flt[z]>>32) == tn; z++);
        }
    }
    return res->n-rn0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x38(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x41(%rbp)
jae 0x7acf6
movl -0x30(%rbp), %eax
cmpq -0x18(%rbp), %rax
setb %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x7ad02
jmp 0x7afb6
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
movl -0x30(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jae 0x7ad37
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x7afb1
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl -0x2c(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
jae 0x7ad6c
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x7afaf
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x42(%rbp)
jae 0x7adb2
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x34(%rbp), %eax
sete %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
testb $0x1, %al
jne 0x7adbe
jmp 0x7af6a
jmp 0x7adc0
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x7ae24
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x7adee
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x50(%rbp)
jmp 0x7adf9
movl $0x2, %eax
movq %rax, -0x50(%rbp)
jmp 0x7adf9
movq -0x50(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movb 0x1c(%rax), %al
shrb $0x7, %al
movzbl %al, %edx
movq -0x40(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movb 0x1c(%rax), %al
shrb $0x6, %al
andb $0x1, %al
movzbl %al, %edx
movq -0x40(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x1, %edx
shll $0x1e, %edx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movl -0x2c(%rbp), %edx
movq -0x40(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x7ad82
jmp 0x7af6c
movl -0x30(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x51(%rbp)
jae 0x7af97
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl -0x34(%rbp), %ecx
cmpq %rcx, %rax
sete %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x7afa0
jmp 0x7afad
jmp 0x7afa2
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x7af6c
jmp 0x7afaf
jmp 0x7afb1
jmp 0x7acd5
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x38(%rbp), %ecx
subq %rcx, %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)