// File: /workspace/github_c_makefile_star2_O3/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 0x58d0
movl %eax, %ebp
movq $0x0, 0x10(%rsp)
movl (%r15), %eax
cmpq $0x8, %rax
ja 0x7e8c
leaq 0x4df1(%rip), %rcx      # 0xc99c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r12, %rdi
callq 0x59f0
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
cmpq $0x41, %rax
jae 0x82d3
movq $-0x1, %rdx
movq $-0x1, %rsi
movl %eax, %ecx
shlq %cl, %rsi
cmpq $0x40, %rax
notq %rsi
cmoveq %rdx, %rsi
movq %rsi, 0x10(%rsp)
jmp 0x7e8c
xorl %eax, %eax
cmpl $0x5, %ebp
ja 0x7e87
movl %ebp, %ecx
leaq 0x4dce(%rip), %rdx      # 0xc9d8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x1, 0x4(%r15)
jne 0x8330
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5800
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movl 0x10(%r15), %edx
movq %rax, %rsi
callq 0x58e0
jmp 0x7e87
cmpl $0x5, %ebp
ja 0x7e85
movl %ebp, %eax
leaq 0x4da7(%rip), %rcx      # 0xca08
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x4(%r15)
jne 0x834f
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5500
testq %rax, %rax
je 0x82c2
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x7e85
cmpb $0x1, 0x10(%r15)
je 0x7dac
cmpq $0x41, %rcx
jae 0x82d3
movq $-0x1, %rdx
movq (%rax), %rsi
xorq %rdx, %rsi
movq $-0x1, %rax
shlq %cl, %rax
cmpq $0x40, %rcx
notq %rax
cmoveq %rdx, %rax
andq %rsi, %rax
jmp 0x7e87
xorl %eax, %eax
cmpl $0x5, %ebp
ja 0x7e87
movl %ebp, %ecx
leaq 0x4cff(%rip), %rdx      # 0xc9f0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x1, 0x4(%r15)
jne 0x836e
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5800
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movl 0x10(%r15), %edx
movq %rax, %rsi
callq 0x5240
jmp 0x7e87
xorl %ebx, %ebx
leaq 0x18(%rsp), %rbp
xorl %r14d, %r14d
cmpq 0x20(%r15), %r14
jae 0x7e8c
movq 0x28(%r15), %rax
movq (%rax,%r14,8), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq 0x8(%rsp), %r8
callq 0x5670
testb %al, %al
je 0x82c2
orq 0x18(%rsp), %rbx
movq %rbx, 0x10(%rsp)
incq %r14
cmpq $-0x1, %rbx
jne 0x7d40
jmp 0x7e8c
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x50d0
testq %rax, %rax
je 0x82c2
cmpq $0x0, (%rbx)
je 0x7e85
movq (%rax), %rax
jmp 0x7e87
cmpl $0x5, %ebp
jne 0x82f2
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x55d0
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movl 0x38(%r15), %r8d
movq %rax, %rsi
callq 0x5510
jmp 0x7e87
movq $-0x1, 0x10(%rsp)
movq $-0x1, %rbx
xorl %r14d, %r14d
leaq 0x18(%rsp), %rbp
cmpq 0x20(%r15), %r14
jae 0x7e8c
movq 0x28(%r15), %rax
movq (%rax,%r14,8), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq 0x8(%rsp), %r8
callq 0x5670
testb %al, %al
je 0x82c2
incq %r14
andq 0x18(%rsp), %rbx
movq %rbx, 0x10(%rsp)
jne 0x7e0f
jmp 0x7e8c
cmpl $0x5, %ebp
ja 0x82c2
movq 0x8(%r15), %rsi
movl %ebp, %eax
leaq 0x4b61(%rip), %rcx      # 0xc9c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x4(%r15)
jne 0x838d
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5500
jmp 0x828f
xorl %eax, %eax
movq %rax, 0x10(%rsp)
cmpb $0x1, 0x3d(%r15)
jne 0x7ece
movq 0x8(%rsp), %rax
movq (%rax), %rcx
cmpq $0x41, %rcx
jae 0x82d3
movq $-0x1, %rdx
movq 0x10(%rsp), %rsi
xorq %rdx, %rsi
movq $-0x1, %rax
shlq %cl, %rax
cmpq $0x40, %rcx
notq %rax
cmoveq %rdx, %rax
andq %rsi, %rax
jmp 0x7ed3
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movb $0x1, %al
jmp 0x82c4
cmpl $0x4, 0x4(%r15)
jne 0x8311
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5600
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movsd 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x52e0
jmp 0x7e87
cmpl $0x2, 0x4(%r15)
jne 0x83ac
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x58b0
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movq 0x10(%r15), %rdx
movq %rax, %rsi
callq 0x57a0
jmp 0x7e87
cmpl $0x4, 0x4(%r15)
jne 0x83cb
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5600
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movsd 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5060
jmp 0x7e87
cmpl $0x3, 0x4(%r15)
jne 0x83ea
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5810
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movss 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5990
jmp 0x7e87
cmpl $0x4, 0x4(%r15)
jne 0x8409
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5600
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movsd 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5100
jmp 0x7e87
cmpl $0x2, 0x4(%r15)
jne 0x8428
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x58b0
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movq 0x10(%r15), %rdx
movq %rax, %rsi
callq 0x54b0
jmp 0x7e87
cmpl $0x3, 0x4(%r15)
jne 0x8447
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5810
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movss 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x5820
jmp 0x7e87
cmpl $0x2, 0x4(%r15)
jne 0x8466
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x58b0
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movq 0x10(%r15), %rdx
movq %rax, %rsi
callq 0x56c0
jmp 0x7e87
cmpl $0x5, 0x4(%r15)
jne 0x8485
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x55d0
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movq %rax, %rsi
callq 0x50b0
jmp 0x7e87
cmpl $0x1, 0x4(%r15)
jne 0x84a4
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5800
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movl 0x10(%r15), %edx
movq %rax, %rsi
callq 0x5650
jmp 0x7e87
cmpl $0x4, 0x4(%r15)
jne 0x84c3
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5600
jmp 0x828f
cmpl $0x3, 0x4(%r15)
jne 0x84e2
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x5810
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
movss 0x10(%r15), %xmm0
movq %rax, %rsi
callq 0x58a0
jmp 0x7e87
cmpl $0x5, 0x4(%r15)
jne 0x8501
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x55d0
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movq %rax, %rsi
callq 0x5380
jmp 0x7e87
cmpl $0x2, 0x4(%r15)
jne 0x8520
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x58b0
jmp 0x828f
cmpl $0x5, 0x4(%r15)
jne 0x853f
movq 0x8(%r15), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x55d0
testq %rax, %rax
je 0x82c2
movq (%rbx), %rdi
leaq 0x10(%r15), %rdx
movzbl 0x3c(%r15), %ecx
movq %rax, %rsi
callq 0x5230
jmp 0x7e87
cmpl $0x3, 0x4(%r15)
jne 0x855e
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5810
jmp 0x828f
cmpl $0x1, 0x4(%r15)
jne 0x857d
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x5800
jmp 0x828f
cmpl $0x5, 0x4(%r15)
jne 0x859c
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0x55d0
testq %rax, %rax
je 0x82c2
movq 0x40(%r15), %r9
testq %r9, %r9
je 0x7e8c
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 0x7e8c
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x486e(%rip), %rdi      # 0xcb48
leaq 0x47d3(%rip), %rsi      # 0xcab4
leaq 0x486c(%rip), %rcx      # 0xcb54
movl $0x1a4, %edx            # imm = 0x1A4
callq 0x5350
leaq 0x49d8(%rip), %rdi      # 0xccd1
leaq 0x47b4(%rip), %rsi      # 0xcab4
leaq 0x47b9(%rip), %rcx      # 0xcac0
movl $0x30b, %edx            # imm = 0x30B
callq 0x5350
leaq 0x4986(%rip), %rdi      # 0xcc9e
leaq 0x4795(%rip), %rsi      # 0xcab4
leaq 0x4a4b(%rip), %rcx      # 0xcd71
movl $0x289, %edx            # imm = 0x289
callq 0x5350
leaq 0x48ef(%rip), %rdi      # 0xcc26
leaq 0x4776(%rip), %rsi      # 0xcab4
leaq 0x4a2c(%rip), %rcx      # 0xcd71
movl $0x271, %edx            # imm = 0x271
callq 0x5350
leaq 0x4825(%rip), %rdi      # 0xcb7b
leaq 0x4757(%rip), %rsi      # 0xcab4
leaq 0x483f(%rip), %rcx      # 0xcba3
movl $0x1b2, %edx            # imm = 0x1B2
callq 0x5350
leaq 0x48b1(%rip), %rdi      # 0xcc26
leaq 0x4738(%rip), %rsi      # 0xcab4
leaq 0x496b(%rip), %rcx      # 0xccee
movl $0x21a, %edx            # imm = 0x21A
callq 0x5350
leaq 0x47e7(%rip), %rdi      # 0xcb7b
leaq 0x4719(%rip), %rsi      # 0xcab4
leaq 0x4a52(%rip), %rcx      # 0xcdf4
movl $0x2c7, %edx            # imm = 0x2C7
callq 0x5350
leaq 0x489b(%rip), %rdi      # 0xcc4e
leaq 0x46fa(%rip), %rsi      # 0xcab4
leaq 0x49b0(%rip), %rcx      # 0xcd71
movl $0x279, %edx            # imm = 0x279
callq 0x5350
leaq 0x48cc(%rip), %rdi      # 0xcc9e
leaq 0x46db(%rip), %rsi      # 0xcab4
leaq 0x47c3(%rip), %rcx      # 0xcba3
movl $0x1d7, %edx            # imm = 0x1D7
callq 0x5350
leaq 0x4885(%rip), %rdi      # 0xcc76
leaq 0x46bc(%rip), %rsi      # 0xcab4
leaq 0x4972(%rip), %rcx      # 0xcd71
movl $0x281, %edx            # imm = 0x281
callq 0x5350
leaq 0x488e(%rip), %rdi      # 0xcc9e
leaq 0x469d(%rip), %rsi      # 0xcab4
leaq 0x48d0(%rip), %rcx      # 0xccee
movl $0x232, %edx            # imm = 0x232
callq 0x5350
leaq 0x481f(%rip), %rdi      # 0xcc4e
leaq 0x467e(%rip), %rsi      # 0xcab4
leaq 0x4766(%rip), %rcx      # 0xcba3
movl $0x1c7, %edx            # imm = 0x1C7
callq 0x5350
leaq 0x4828(%rip), %rdi      # 0xcc76
leaq 0x465f(%rip), %rsi      # 0xcab4
leaq 0x4747(%rip), %rcx      # 0xcba3
movl $0x1cf, %edx            # imm = 0x1CF
callq 0x5350
leaq 0x47e1(%rip), %rdi      # 0xcc4e
leaq 0x4640(%rip), %rsi      # 0xcab4
leaq 0x4873(%rip), %rcx      # 0xccee
movl $0x222, %edx            # imm = 0x222
callq 0x5350
leaq 0x483a(%rip), %rdi      # 0xccc6
leaq 0x4621(%rip), %rsi      # 0xcab4
leaq 0x48d7(%rip), %rcx      # 0xcd71
movl $0x291, %edx            # imm = 0x291
callq 0x5350
leaq 0x477b(%rip), %rdi      # 0xcc26
leaq 0x4602(%rip), %rsi      # 0xcab4
leaq 0x46ea(%rip), %rcx      # 0xcba3
movl $0x1bf, %edx            # imm = 0x1BF
callq 0x5350
leaq 0x47d4(%rip), %rdi      # 0xcc9e
leaq 0x45e3(%rip), %rsi      # 0xcab4
leaq 0x491c(%rip), %rcx      # 0xcdf4
movl $0x2d7, %edx            # imm = 0x2D7
callq 0x5350
leaq 0x478d(%rip), %rdi      # 0xcc76
leaq 0x45c4(%rip), %rsi      # 0xcab4
leaq 0x47f7(%rip), %rcx      # 0xccee
movl $0x22a, %edx            # imm = 0x22A
callq 0x5350
leaq 0x47be(%rip), %rdi      # 0xccc6
leaq 0x45a5(%rip), %rsi      # 0xcab4
leaq 0x468d(%rip), %rcx      # 0xcba3
movl $0x1df, %edx            # imm = 0x1DF
callq 0x5350
leaq 0x4727(%rip), %rdi      # 0xcc4e
leaq 0x4586(%rip), %rsi      # 0xcab4
leaq 0x48bf(%rip), %rcx      # 0xcdf4
movl $0x2cf, %edx            # imm = 0x2CF
callq 0x5350
leaq 0x4780(%rip), %rdi      # 0xccc6
leaq 0x4567(%rip), %rsi      # 0xcab4
leaq 0x479a(%rip), %rcx      # 0xccee
movl $0x23a, %edx            # imm = 0x23A
callq 0x5350
leaq 0x4711(%rip), %rdi      # 0xcc76
leaq 0x4548(%rip), %rsi      # 0xcab4
leaq 0x4881(%rip), %rcx      # 0xcdf4
movl $0x2d3, %edx            # imm = 0x2D3
callq 0x5350
leaq 0x46a2(%rip), %rdi      # 0xcc26
leaq 0x4529(%rip), %rsi      # 0xcab4
leaq 0x4862(%rip), %rcx      # 0xcdf4
movl $0x2cb, %edx            # imm = 0x2CB
callq 0x5350
leaq 0x4723(%rip), %rdi      # 0xccc6
leaq 0x450a(%rip), %rsi      # 0xcab4
leaq 0x4843(%rip), %rcx      # 0xcdf4
movl $0x2db, %edx            # imm = 0x2DB
callq 0x5350