// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_filter_list
lxw_error
worksheet_filter_list(lxw_worksheet *self, lxw_col_t col, const char **list)
{
    lxw_filter_rule_obj *rule_obj;
    uint16_t rule_index;
    uint8_t has_blanks = LXW_FALSE;
    uint16_t num_filters = 0;
    uint16_t input_list_index;
    uint16_t rule_obj_list_index;
    const char *str;
    char **tmp_list;

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

    if (self->autofilter.in_use == LXW_FALSE) {
        LXW_WARN("worksheet_filter_list(): "
                 "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_list(): "
                         "Column '%d' is outside autofilter range "
                         "'%d <= col <= %d'.", col,
                         self->autofilter.first_col,
                         self->autofilter.last_col);
        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    /* Count the number of non "Blanks" strings in the input list. */
    input_list_index = 0;
    while ((str = list[input_list_index]) != NULL) {
        if (strncmp(str, "Blanks", 6) == 0)
            has_blanks = LXW_TRUE;
        else
            num_filters++;

        input_list_index++;
    }

    /* There should be at least one filter string. */
    if (num_filters == 0) {
        LXW_WARN("worksheet_filter_list(): "
                 "list must have at least 1 non-blanks item.");
        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);

    tmp_list = calloc(num_filters + 1, sizeof(char *));
    GOTO_LABEL_ON_MEM_ERROR(tmp_list, mem_error);

    /* Copy input list (without any "Blanks" command) to an internal list. */
    input_list_index = 0;
    rule_obj_list_index = 0;
    while ((str = list[input_list_index]) != NULL) {
        if (strncmp(str, "Blanks", 6) != 0) {
            tmp_list[rule_obj_list_index] = lxw_strdup(str);
            rule_obj_list_index++;
        }

        input_list_index++;
    }

    rule_obj->list = tmp_list;
    rule_obj->num_list_filters = num_filters;
    rule_obj->is_custom = LXW_FALSE;
    rule_obj->col_num = rule_index;
    rule_obj->type = LXW_FILTER_TYPE_STRING_LIST;
    rule_obj->has_blanks = has_blanks;

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

    return LXW_NO_ERROR;

mem_error:
    free(rule_obj);
    return LXW_ERROR_MEMORY_MALLOC_FAILED;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movw %si, %ax
movq %rdi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movq %rdx, -0x20(%rbp)
movb $0x0, -0x2b(%rbp)
movw $0x0, -0x2e(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x5334c
movq 0x29cc9(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x19fdb(%rip), %rsi     # 0x6d314
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x5361c
movq -0x10(%rbp), %rax
movzbl 0x1e4(%rax), %eax
cmpl $0x0, %eax
jne 0x53380
movq 0x29c95(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x19fea(%rip), %rsi     # 0x6d357
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x5361c
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f0(%rcx), %ecx
cmpl %ecx, %eax
jl 0x533a6
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1f2(%rcx), %ecx
cmpl %ecx, %eax
jle 0x533e5
movq 0x29c4b(%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 0x19ffc(%rip), %rsi     # 0x6d3ce
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x5361c
movw $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movzwl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x5343b
movq -0x40(%rbp), %rdi
leaq 0x1aa28(%rip), %rsi     # 0x6de34
movl $0x6, %edx
callq 0xc1d0
cmpl $0x0, %eax
jne 0x53421
movb $0x1, -0x2b(%rbp)
jmp 0x5342d
movw -0x2e(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x2e(%rbp)
movw -0x30(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x30(%rbp)
jmp 0x533eb
movzwl -0x2e(%rbp), %eax
cmpl $0x0, %eax
jne 0x53468
movq 0x29bad(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x19fd9(%rip), %rsi     # 0x6d42e
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x5361c
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 0x534df
movq 0x29b42(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x12c10(%rip), %rsi     # 0x660d0
leaq 0x18f2d(%rip), %rdx     # 0x6c3f4
movl $0x23fb, %ecx           # imm = 0x23FB
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x5361c
jmp 0x534e1
movzwl -0x2e(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0xc870
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x53529
movq 0x29af1(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x12bbf(%rip), %rsi     # 0x660d0
leaq 0x18edc(%rip), %rdx     # 0x6c3f4
movl $0x23fe, %ecx           # imm = 0x23FE
movb $0x0, %al
callq 0xc8f0
jmp 0x5360c
jmp 0x5352b
movw $0x0, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
movq -0x20(%rbp), %rax
movzwl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x53599
movq -0x40(%rbp), %rdi
leaq 0x1a8dc(%rip), %rsi     # 0x6de34
movl $0x6, %edx
callq 0xc1d0
cmpl $0x0, %eax
je 0x5358b
movq -0x40(%rbp), %rdi
callq 0xcd80
movq %rax, %rdx
movq -0x48(%rbp), %rax
movzwl -0x32(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movw -0x32(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x32(%rbp)
movw -0x30(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x30(%rbp)
jmp 0x53537
movq -0x48(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
movw -0x2e(%rbp), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x28(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x1(%rax)
movw -0x2a(%rbp), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x28(%rbp), %rax
movb $0x4, (%rax)
movb -0x2b(%rbp), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x2(%rax)
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)
jmp 0x5361c
movq -0x28(%rbp), %rdi
callq 0xc0d0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)