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

    if (!rule) {
        LXW_WARN("worksheet_filter_column(): rule parameter cannot be NULL");
        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    if (self->autofilter.in_use == LXW_FALSE) {
        LXW_WARN("worksheet_filter_column(): "
                 "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_column(): "
                         "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);

    rule_obj->col_num = rule_index;
    rule_obj->type = LXW_FILTER_TYPE_SINGLE;
    rule_obj->criteria1 = rule->criteria;
    rule_obj->value1 = rule->value;

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

    if (rule_obj->criteria1 == 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 $0x30, %rsp
movw %si, %ax
movq %rdi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x52db2
movq 0x2a263(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1a332(%rip), %rsi     # 0x6d0d1
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x52f8e
movq -0x10(%rbp), %rax
movzbl 0x1e4(%rax), %eax
cmpl $0x0, %eax
jne 0x52de6
movq 0x2a22f(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1a343(%rip), %rsi     # 0x6d116
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x52f8e
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f0(%rcx), %ecx
cmpl %ecx, %eax
jl 0x52e0c
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f2(%rcx), %ecx
cmpl %ecx, %eax
jle 0x52e4b
movq 0x2a1e5(%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 0x1a357(%rip), %rsi     # 0x6d18f
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x52f8e
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f0(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x2a(%rbp)
movq -0x10(%rbp), %rax
movq 0x3b0(%rax), %rax
movzwl -0x2a(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x52fa0
movl $0x1, %edi
movl $0x38, %esi
callq 0xc870
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x52ec2
movq 0x2a15f(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1322d(%rip), %rsi     # 0x660d0
leaq 0x1954a(%rip), %rdx     # 0x6c3f4
movl $0x2350, %ecx           # imm = 0x2350
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x52f8e
jmp 0x52ec4
movw -0x2a(%rbp), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x28(%rbp), %rax
movb $0x1, (%rax)
movq -0x20(%rbp), %rax
movb (%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x20(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x28(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x8, %eax
je 0x52f1d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x52f3c
movq -0x28(%rbp), %rax
movb $0x2, 0x6(%rax)
leaq 0x17749(%rip), %rdi     # 0x6a675
callq 0xcd80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x7, %eax
jne 0x52f51
movq -0x28(%rbp), %rax
movb $0x1, 0x2(%rax)
movq -0x28(%rbp), %rdi
callq 0xc240
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x3b0(%rax), %rax
movzwl -0x2a(%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 $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)