// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_autofilter
lxw_error
worksheet_autofilter(lxw_worksheet *self, lxw_row_t first_row,
                     lxw_col_t first_col, lxw_row_t last_row,
                     lxw_col_t last_col)
{
    lxw_row_t tmp_row;
    lxw_col_t tmp_col;
    lxw_error err;
    lxw_filter_rule_obj **filter_rules;
    lxw_col_t num_filter_rules;

    /* Swap last row/col with first row/col as necessary */
    if (first_row > last_row) {
        tmp_row = last_row;
        last_row = first_row;
        first_row = tmp_row;
    }
    if (first_col > last_col) {
        tmp_col = last_col;
        last_col = first_col;
        first_col = tmp_col;
    }

    /* Check that column number is valid and store the max value */
    err = _check_dimensions(self, last_row, last_col, LXW_FALSE, LXW_FALSE);
    if (err)
        return err;

    /* Create a array to hold filter rules. */
    self->autofilter.in_use = LXW_FALSE;
    self->autofilter.has_rules = LXW_FALSE;
    _free_filter_rules(self);
    num_filter_rules = last_col - first_col + 1;
    filter_rules = calloc(num_filter_rules, sizeof(lxw_filter_rule_obj *));
    RETURN_ON_MEM_ERROR(filter_rules, LXW_ERROR_MEMORY_MALLOC_FAILED);

    self->autofilter.in_use = LXW_TRUE;
    self->autofilter.first_row = first_row;
    self->autofilter.first_col = first_col;
    self->autofilter.last_row = last_row;
    self->autofilter.last_col = last_col;

    self->filter_rules = filter_rules;
    self->num_filter_rules = num_filter_rules;

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movw %r8w, %ax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movw %dx, -0x16(%rbp)
movl %ecx, -0x1c(%rbp)
movw %ax, -0x1e(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x52c28
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x14(%rbp)
movzwl -0x16(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jle 0x52c4c
movw -0x1e(%rbp), %ax
movw %ax, -0x26(%rbp)
movw -0x16(%rbp), %ax
movw %ax, -0x1e(%rbp)
movw -0x26(%rbp), %ax
movw %ax, -0x16(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
xorl %r8d, %r8d
movzwl -0x1e(%rbp), %edx
movl %r8d, %ecx
callq 0x4ff90
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x52c76
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x52d58
movq -0x10(%rbp), %rax
movb $0x0, 0x1e4(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x1e5(%rax)
movq -0x10(%rbp), %rdi
callq 0x47390
movzwl -0x1e(%rbp), %eax
movzwl -0x16(%rbp), %ecx
subl %ecx, %eax
addl $0x1, %eax
movw %ax, -0x3a(%rbp)
movzwl -0x3a(%rbp), %eax
movl %eax, %edi
movl $0x8, %esi
callq 0xc870
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x52cee
movq 0x2a330(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x133fe(%rip), %rsi     # 0x660d0
leaq 0x1971b(%rip), %rdx     # 0x6c3f4
movl $0x231d, %ecx           # imm = 0x231D
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x52d58
jmp 0x52cf0
movq -0x10(%rbp), %rax
movb $0x1, 0x1e4(%rax)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1e8(%rax)
movw -0x16(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x1f0(%rax)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1ec(%rax)
movw -0x1e(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x1f2(%rax)
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x3b0(%rax)
movw -0x3a(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x3b8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)