// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_filter_column2
lxw_error
worksheet_filter_column2(lxw_worksheet *self, lxw_col_t col,
                         lxw_filter_rule *rule1, lxw_filter_rule *rule2,
                         uint8_t and_or)
{
    lxw_filter_rule_obj *rule_obj;
    uint16_t rule_index;

    if (!rule1 || !rule2) {
        LXW_WARN("worksheet_filter_column2(): rule parameter cannot be NULL");
        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    if (self->autofilter.in_use == LXW_FALSE) {
        LXW_WARN("worksheet_filter_column2(): "
                 "Worksheet autofilter range hasn't been defined. "
                 "Use worksheet_autofilter() first.");
        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    if (col < self->autofilter.first_col || col > self->autofilter.last_col) {
        LXW_WARN_FORMAT3("worksheet_filter_column2(): "
                         "Column '%d' is outside autofilter range "
                         "'%d <= col <= %d'.", col,
                         self->autofilter.first_col,
                         self->autofilter.last_col);
        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    /* Free any previous rule in the column slot. */
    rule_index = col - self->autofilter.first_col;
    _free_filter_rule(self->filter_rules[rule_index]);

    /* Create a new rule and copy user input. */
    rule_obj = calloc(1, sizeof(lxw_filter_rule_obj));
    RETURN_ON_MEM_ERROR(rule_obj, LXW_ERROR_MEMORY_MALLOC_FAILED);

    if (and_or == LXW_FILTER_AND)
        rule_obj->type = LXW_FILTER_TYPE_AND;
    else
        rule_obj->type = LXW_FILTER_TYPE_OR;

    rule_obj->col_num = rule_index;

    rule_obj->criteria1 = rule1->criteria;
    rule_obj->value1 = rule1->value;

    rule_obj->criteria2 = rule2->criteria;
    rule_obj->value2 = rule2->value;

    if (rule_obj->criteria1 != LXW_FILTER_CRITERIA_NON_BLANKS) {
        rule_obj->value1_string = lxw_strdup(rule1->value_string);
    }
    else {
        rule_obj->criteria1 = LXW_FILTER_CRITERIA_NOT_EQUAL_TO;
        rule_obj->value1_string = lxw_strdup(" ");
    }

    if (rule_obj->criteria2 != LXW_FILTER_CRITERIA_NON_BLANKS) {
        rule_obj->value2_string = lxw_strdup(rule2->value_string);
    }
    else {
        rule_obj->criteria2 = LXW_FILTER_CRITERIA_NOT_EQUAL_TO;
        rule_obj->value2_string = lxw_strdup(" ");
    }

    if (rule_obj->criteria1 == LXW_FILTER_CRITERIA_BLANKS)
        rule_obj->has_blanks = LXW_TRUE;

    if (rule_obj->criteria2 == LXW_FILTER_CRITERIA_BLANKS)
        rule_obj->has_blanks = LXW_TRUE;

    _set_custom_filter(rule_obj);

    self->filter_rules[rule_index] = rule_obj;
    self->filter_on = LXW_TRUE;
    self->autofilter.has_rules = LXW_TRUE;

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %r8b, %al
movq %rdi, -0x10(%rbp)
movw %si, -0x12(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movb %al, -0x29(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x5305c
cmpq $0x0, -0x28(%rbp)
jne 0x53080
movq 0x29f95(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1a184(%rip), %rsi     # 0x6d1f1
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x532e8
movq -0x10(%rbp), %rax
movzbl 0x1e4(%rax), %eax
cmpl $0x0, %eax
jne 0x530b4
movq 0x29f61(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1a196(%rip), %rsi     # 0x6d237
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x532e8
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f0(%rcx), %ecx
cmpl %ecx, %eax
jl 0x530da
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f2(%rcx), %ecx
cmpl %ecx, %eax
jle 0x53119
movq 0x29f17(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
movzwl -0x12(%rbp), %edx
movq -0x10(%rbp), %rax
movzwl 0x1f0(%rax), %ecx
movq -0x10(%rbp), %rax
movzwl 0x1f2(%rax), %r8d
leaq 0x1a1ab(%rip), %rsi     # 0x6d2b1
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x532e8
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f0(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x3a(%rbp)
movq -0x10(%rbp), %rax
movq 0x3b0(%rax), %rax
movzwl -0x3a(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x52fa0
movl $0x1, %edi
movl $0x38, %esi
callq 0xc870
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x53190
movq 0x29e91(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x12f5f(%rip), %rsi     # 0x660d0
leaq 0x1927c(%rip), %rdx     # 0x6c3f4
movl $0x2391, %ecx           # imm = 0x2391
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x532e8
jmp 0x53192
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
jne 0x531a4
movq -0x38(%rbp), %rax
movb $0x2, (%rax)
jmp 0x531ab
movq -0x38(%rbp), %rax
movb $0x3, (%rax)
movw -0x3a(%rbp), %cx
movq -0x38(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x20(%rbp), %rax
movb (%rax), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x20(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x28(%rbp), %rax
movb (%rax), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x7(%rax)
movq -0x28(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movq -0x38(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x8, %eax
je 0x5321c
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x5323b
movq -0x38(%rbp), %rax
movb $0x2, 0x6(%rax)
leaq 0x1744a(%rip), %rdi     # 0x6a675
callq 0xcd80
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movzbl 0x7(%rax), %eax
cmpl $0x8, %eax
je 0x53262
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x53281
movq -0x38(%rbp), %rax
movb $0x2, 0x7(%rax)
leaq 0x17404(%rip), %rdi     # 0x6a675
callq 0xcd80
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x7, %eax
jne 0x53296
movq -0x38(%rbp), %rax
movb $0x1, 0x2(%rax)
movq -0x38(%rbp), %rax
movzbl 0x7(%rax), %eax
cmpl $0x7, %eax
jne 0x532ab
movq -0x38(%rbp), %rax
movb $0x1, 0x2(%rax)
movq -0x38(%rbp), %rdi
callq 0xc240
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x3b0(%rax), %rax
movzwl -0x3a(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movb $0x1, 0x13a(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x1e5(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)