// File: /workspace/github_c_makefile_star2_O2/chriso[P]columnix/lib/predicate.c
// Function: cx_index_match_rows
bool cx_index_match_rows(const struct cx_predicate *predicate,
                         const struct cx_row_group *row_group,
                         struct cx_row_group_cursor *cursor, uint64_t *matches,
                         size_t *count)
{
    enum cx_column_type column_type =
        cx_row_group_column_type(row_group, predicate->column);
    uint64_t mask = 0;
    switch (predicate->type) {
        case CX_PREDICATE_TRUE:
            *count = cx_row_group_cursor_batch_count(cursor);
            mask = cx_mask_cap(cx_full_mask, *count);
            break;
        case CX_PREDICATE_NULL: {
            const uint64_t *nulls = cx_row_group_cursor_batch_nulls(
                cursor, predicate->column, count);
            if (!nulls)
                goto error;
            mask = *count ? *nulls : 0;
        } break;
        case CX_PREDICATE_EQ:
            if (!cx_index_match_rows_eq(predicate, cursor, column_type, &mask,
                                        count))
                goto error;
            break;
        case CX_PREDICATE_LT:
            if (!cx_index_match_rows_lt(predicate, cursor, column_type, &mask,
                                        count))
                goto error;
            break;
        case CX_PREDICATE_GT:
            if (!cx_index_match_rows_gt(predicate, cursor, column_type, &mask,
                                        count))
                goto error;
            break;
        case CX_PREDICATE_CONTAINS:
            assert(column_type == CX_COLUMN_STR);
            {
                const struct cx_string *values = cx_row_group_cursor_batch_str(
                    cursor, predicate->column, count);
                if (!values)
                    goto error;
                mask = cx_match_str_contains(
                    *count, values, &predicate->value.str,
                    predicate->case_sensitive, predicate->location);
            }
            break;
        case CX_PREDICATE_CUSTOM:
            if (!cx_index_match_rows_custom(predicate, cursor, column_type,
                                            &mask, count))
                goto error;
            break;
        case CX_PREDICATE_AND:
            mask = cx_full_mask;
            // short-circuit the remaining predicates once the mask is empty
            for (size_t i = 0; mask && i < predicate->operand_count; i++) {
                uint64_t operand_mask;
                if (!cx_index_match_rows(predicate->operands[i], row_group,
                                         cursor, &operand_mask, count))
                    goto error;
                mask &= operand_mask;
            }
            break;
        case CX_PREDICATE_OR:
            mask = 0;
            // short-circuit the remaining predicates once the mask is full
            for (size_t i = 0;
                 mask != cx_full_mask && i < predicate->operand_count; i++) {
                uint64_t operand_mask;
                if (!cx_index_match_rows(predicate->operands[i], row_group,
                                         cursor, &operand_mask, count))
                    goto error;
                mask |= operand_mask;
            }
            break;
    }
    *matches = predicate->negate ? cx_mask_cap(~mask, *count) : mask;
    return true;
error:
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
movq 0x8(%rdi), %rsi
movq %r13, %rdi
callq 0x5920
andq $0x0, 0x10(%rsp)
movl %eax, %ebp
movl (%r15), %eax
cmpq $0x8, %rax
ja 0x7980
leaq 0x42ac(%rip), %rcx      # 0xb99c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movl %ebp, %ecx
jmpq *%rax
movq %r12, %rdi
callq 0x5a60
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
pushq $-0x1
popq %rdi
movq %rax, %rsi
callq 0x8065
jmp 0x797b
xorl %eax, %eax
cmpl $0x5, %ebp
ja 0x797b
leaq 0x42ab(%rip), %rdx      # 0xb9d8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x1, 0x4(%r15)
jne 0x7dda
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5850
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movl 0x10(%r15), %edx
movq %rax, %rsi
callq 0x5930
jmp 0x797b
cmpl $0x5, %ebp
ja 0x7979
leaq 0x4286(%rip), %rax      # 0xba08
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpl $0x0, 0x4(%r15)
jne 0x7df9
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5540
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x7979
movq (%rax), %rax
cmpb $0x0, 0x10(%r15)
jne 0x797b
notq %rax
movq %rax, %rdi
jmp 0x7711
xorl %eax, %eax
cmpl $0x5, %ebp
ja 0x797b
leaq 0x4206(%rip), %rdx      # 0xb9f0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x1, 0x4(%r15)
jne 0x7e18
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5850
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movl 0x10(%r15), %edx
movq %rax, %rsi
callq 0x5270
jmp 0x797b
xorl %ebx, %ebx
leaq 0x18(%rsp), %rbp
xorl %r14d, %r14d
cmpq $-0x1, %rbx
je 0x7980
cmpq 0x20(%r15), %r14
jae 0x7980
movq 0x28(%r15), %rax
movq (%rax,%r14,8), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq 0x8(%rsp), %r8
callq 0x56b0
testb %al, %al
je 0x7d8b
orq 0x18(%rsp), %rbx
movq %rbx, 0x10(%rsp)
incq %r14
jmp 0x7839
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x50f0
testq %rax, %rax
je 0x7d8b
cmpq $0x0, (%rbx)
je 0x7979
movq (%rax), %rax
jmp 0x797b
cmpl $0x5, %ebp
jne 0x7d9c
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5610
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movl 0x38(%r15), %r8d
movq %rax, %rsi
callq 0x5550
jmp 0x797b
orq $-0x1, 0x10(%rsp)
pushq $-0x1
popq %rbx
xorl %r14d, %r14d
leaq 0x18(%rsp), %rbp
testq %rbx, %rbx
je 0x7980
cmpq 0x20(%r15), %r14
jae 0x7980
movq 0x28(%r15), %rax
movq (%rax,%r14,8), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq 0x8(%rsp), %r8
callq 0x56b0
testb %al, %al
je 0x7d8b
andq 0x18(%rsp), %rbx
movq %rbx, 0x10(%rsp)
incq %r14
jmp 0x7902
cmpl $0x5, %ebp
ja 0x7d8b
movq 0x8(%r15), %rsi
leaq 0x406d(%rip), %rax      # 0xb9c0
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpl $0x0, 0x4(%r15)
jne 0x7e37
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5540
jmp 0x7d58
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpb $0x1, 0x3d(%r15)
jne 0x799f
notq %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x8065
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movb $0x1, %al
jmp 0x7d8d
cmpl $0x4, 0x4(%r15)
jne 0x7dbb
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5640
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movsd 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5310
jmp 0x797b
cmpl $0x2, 0x4(%r15)
jne 0x7e56
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5900
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movq 0x10(%r15), %rdx
movq %rax, %rsi
callq 0x57f0
jmp 0x797b
cmpl $0x4, 0x4(%r15)
jne 0x7e75
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5640
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movsd 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5070
jmp 0x797b
cmpl $0x3, 0x4(%r15)
jne 0x7e94
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5860
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movss 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5a00
jmp 0x797b
cmpl $0x4, 0x4(%r15)
jne 0x7eb3
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5640
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movsd 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5120
jmp 0x797b
cmpl $0x2, 0x4(%r15)
jne 0x7ed2
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5900
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movq 0x10(%r15), %rdx
movq %rax, %rsi
callq 0x54f0
jmp 0x797b
cmpl $0x3, 0x4(%r15)
jne 0x7ef1
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5860
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movss 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5870
jmp 0x797b
cmpl $0x2, 0x4(%r15)
jne 0x7f10
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5900
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movq 0x10(%r15), %rdx
movq %rax, %rsi
callq 0x5700
jmp 0x797b
cmpl $0x5, 0x4(%r15)
jne 0x7f2f
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5610
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movq %rax, %rsi
callq 0x50d0
jmp 0x797b
cmpl $0x1, 0x4(%r15)
jne 0x7f4e
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5850
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movl 0x10(%r15), %edx
movq %rax, %rsi
callq 0x5690
jmp 0x797b
cmpl $0x4, 0x4(%r15)
jne 0x7f6d
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5640
jmp 0x7d58
cmpl $0x3, 0x4(%r15)
jne 0x7f8c
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5860
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
movss 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x58f0
jmp 0x797b
cmpl $0x5, 0x4(%r15)
jne 0x7fab
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5610
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movq %rax, %rsi
callq 0x53b0
jmp 0x797b
cmpl $0x2, 0x4(%r15)
jne 0x7fca
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5900
jmp 0x7d58
cmpl $0x5, 0x4(%r15)
jne 0x7fe9
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5610
testq %rax, %rax
je 0x7d8b
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movq %rax, %rsi
callq 0x5260
jmp 0x797b
cmpl $0x3, 0x4(%r15)
jne 0x8008
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5860
jmp 0x7d58
cmpl $0x1, 0x4(%r15)
jne 0x8027
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5850
jmp 0x7d58
cmpl $0x5, 0x4(%r15)
jne 0x8046
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5610
testq %rax, %rax
je 0x7d8b
movq 0x40(%r15), %r9
testq %r9, %r9
je 0x7980
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
movq 0x58(%r15), %r8
leaq 0x10(%rsp), %rcx
movl %ebp, %edi
movq %rax, %rdx
callq *%r9
testb %al, %al
jne 0x7980
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f2e(%rip), %rdi      # 0xbcd1
leaq 0x3d0a(%rip), %rsi      # 0xbab4
leaq 0x3d0f(%rip), %rcx      # 0xbac0
movl $0x30b, %edx            # imm = 0x30B
callq 0x5380
leaq 0x3edc(%rip), %rdi      # 0xbc9e
leaq 0x3ceb(%rip), %rsi      # 0xbab4
leaq 0x3fa1(%rip), %rcx      # 0xbd71
movl $0x289, %edx            # imm = 0x289
callq 0x5380
leaq 0x3e45(%rip), %rdi      # 0xbc26
leaq 0x3ccc(%rip), %rsi      # 0xbab4
leaq 0x3f82(%rip), %rcx      # 0xbd71
movl $0x271, %edx            # imm = 0x271
callq 0x5380
leaq 0x3d7b(%rip), %rdi      # 0xbb7b
leaq 0x3cad(%rip), %rsi      # 0xbab4
leaq 0x3d95(%rip), %rcx      # 0xbba3
movl $0x1b2, %edx            # imm = 0x1B2
callq 0x5380
leaq 0x3e07(%rip), %rdi      # 0xbc26
leaq 0x3c8e(%rip), %rsi      # 0xbab4
leaq 0x3ec1(%rip), %rcx      # 0xbcee
movl $0x21a, %edx            # imm = 0x21A
callq 0x5380
leaq 0x3d3d(%rip), %rdi      # 0xbb7b
leaq 0x3c6f(%rip), %rsi      # 0xbab4
leaq 0x3fa8(%rip), %rcx      # 0xbdf4
movl $0x2c7, %edx            # imm = 0x2C7
callq 0x5380
leaq 0x3df1(%rip), %rdi      # 0xbc4e
leaq 0x3c50(%rip), %rsi      # 0xbab4
leaq 0x3f06(%rip), %rcx      # 0xbd71
movl $0x279, %edx            # imm = 0x279
callq 0x5380
leaq 0x3e22(%rip), %rdi      # 0xbc9e
leaq 0x3c31(%rip), %rsi      # 0xbab4
leaq 0x3d19(%rip), %rcx      # 0xbba3
movl $0x1d7, %edx            # imm = 0x1D7
callq 0x5380
leaq 0x3ddb(%rip), %rdi      # 0xbc76
leaq 0x3c12(%rip), %rsi      # 0xbab4
leaq 0x3ec8(%rip), %rcx      # 0xbd71
movl $0x281, %edx            # imm = 0x281
callq 0x5380
leaq 0x3de4(%rip), %rdi      # 0xbc9e
leaq 0x3bf3(%rip), %rsi      # 0xbab4
leaq 0x3e26(%rip), %rcx      # 0xbcee
movl $0x232, %edx            # imm = 0x232
callq 0x5380
leaq 0x3d75(%rip), %rdi      # 0xbc4e
leaq 0x3bd4(%rip), %rsi      # 0xbab4
leaq 0x3cbc(%rip), %rcx      # 0xbba3
movl $0x1c7, %edx            # imm = 0x1C7
callq 0x5380
leaq 0x3d7e(%rip), %rdi      # 0xbc76
leaq 0x3bb5(%rip), %rsi      # 0xbab4
leaq 0x3c9d(%rip), %rcx      # 0xbba3
movl $0x1cf, %edx            # imm = 0x1CF
callq 0x5380
leaq 0x3d37(%rip), %rdi      # 0xbc4e
leaq 0x3b96(%rip), %rsi      # 0xbab4
leaq 0x3dc9(%rip), %rcx      # 0xbcee
movl $0x222, %edx            # imm = 0x222
callq 0x5380
leaq 0x3d90(%rip), %rdi      # 0xbcc6
leaq 0x3b77(%rip), %rsi      # 0xbab4
leaq 0x3e2d(%rip), %rcx      # 0xbd71
movl $0x291, %edx            # imm = 0x291
callq 0x5380
leaq 0x3cd1(%rip), %rdi      # 0xbc26
leaq 0x3b58(%rip), %rsi      # 0xbab4
leaq 0x3c40(%rip), %rcx      # 0xbba3
movl $0x1bf, %edx            # imm = 0x1BF
callq 0x5380
leaq 0x3d2a(%rip), %rdi      # 0xbc9e
leaq 0x3b39(%rip), %rsi      # 0xbab4
leaq 0x3e72(%rip), %rcx      # 0xbdf4
movl $0x2d7, %edx            # imm = 0x2D7
callq 0x5380
leaq 0x3ce3(%rip), %rdi      # 0xbc76
leaq 0x3b1a(%rip), %rsi      # 0xbab4
leaq 0x3d4d(%rip), %rcx      # 0xbcee
movl $0x22a, %edx            # imm = 0x22A
callq 0x5380
leaq 0x3d14(%rip), %rdi      # 0xbcc6
leaq 0x3afb(%rip), %rsi      # 0xbab4
leaq 0x3be3(%rip), %rcx      # 0xbba3
movl $0x1df, %edx            # imm = 0x1DF
callq 0x5380
leaq 0x3c7d(%rip), %rdi      # 0xbc4e
leaq 0x3adc(%rip), %rsi      # 0xbab4
leaq 0x3e15(%rip), %rcx      # 0xbdf4
movl $0x2cf, %edx            # imm = 0x2CF
callq 0x5380
leaq 0x3cd6(%rip), %rdi      # 0xbcc6
leaq 0x3abd(%rip), %rsi      # 0xbab4
leaq 0x3cf0(%rip), %rcx      # 0xbcee
movl $0x23a, %edx            # imm = 0x23A
callq 0x5380
leaq 0x3c67(%rip), %rdi      # 0xbc76
leaq 0x3a9e(%rip), %rsi      # 0xbab4
leaq 0x3dd7(%rip), %rcx      # 0xbdf4
movl $0x2d3, %edx            # imm = 0x2D3
callq 0x5380
leaq 0x3bf8(%rip), %rdi      # 0xbc26
leaq 0x3a7f(%rip), %rsi      # 0xbab4
leaq 0x3db8(%rip), %rcx      # 0xbdf4
movl $0x2cb, %edx            # imm = 0x2CB
callq 0x5380
leaq 0x3c79(%rip), %rdi      # 0xbcc6
leaq 0x3a60(%rip), %rsi      # 0xbab4
leaq 0x3d99(%rip), %rcx      # 0xbdf4
movl $0x2db, %edx            # imm = 0x2DB
callq 0x5380