// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: store_array_formula
lxw_error
_store_array_formula(lxw_worksheet *self,
                     lxw_row_t first_row,
                     lxw_col_t first_col,
                     lxw_row_t last_row,
                     lxw_col_t last_col,
                     const char *formula, lxw_format *format, double result,
                     uint8_t is_dynamic)
{
    lxw_cell *cell;
    lxw_row_t tmp_row;
    lxw_col_t tmp_col;
    char *formula_copy;
    char *range;
    lxw_error err;

    /* 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;
    }

    if (!formula)
        return LXW_ERROR_NULL_PARAMETER_IGNORED;

    /* Check that row and col are valid and store max and min values. */
    err = _check_dimensions(self, first_row, first_col, LXW_FALSE, LXW_FALSE);
    if (err)
        return err;

    err = _check_dimensions(self, last_row, last_col, LXW_FALSE, LXW_FALSE);
    if (err)
        return err;

    /* Define the array range. */
    range = calloc(1, LXW_MAX_CELL_RANGE_LENGTH);
    RETURN_ON_MEM_ERROR(range, LXW_ERROR_MEMORY_MALLOC_FAILED);

    if (first_row == last_row && first_col == last_col)
        lxw_rowcol_to_cell(range, first_row, first_col);
    else
        lxw_rowcol_to_range(range, first_row, first_col, last_row, last_col);

    /* Copy and trip leading "{=" from formula. */
    if (formula[0] == '{')
        if (formula[1] == '=')
            formula_copy = lxw_strdup(formula + 2);
        else
            formula_copy = lxw_strdup(formula + 1);
    else
        formula_copy = lxw_strdup_formula(formula);

    /* Strip trailing "}" from formula. */
    if (formula_copy[strlen(formula_copy) - 1] == '}')
        formula_copy[strlen(formula_copy) - 1] = '\0';

    /* Create a new array formula cell object. */
    cell = _new_array_formula_cell(first_row, first_col,
                                   formula_copy, range, format, is_dynamic);

    cell->formula_result = result;

    _insert_cell(self, first_row, first_col, cell);

    if (is_dynamic)
        self->has_dynamic_arrays = LXW_TRUE;

    /* Pad out the rest of the area with formatted zeroes. */
    if (!self->optimize) {
        for (tmp_row = first_row; tmp_row <= last_row; tmp_row++) {
            for (tmp_col = first_col; tmp_col <= last_col; tmp_col++) {
                if (tmp_row == first_row && tmp_col == first_col)
                    continue;

                worksheet_write_number(self, tmp_row, tmp_col, 0, format);
            }
        }
    }

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movw %r8w, %ax
movb 0x18(%rbp), %r8b
movq 0x10(%rbp), %r8
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movw %dx, -0x16(%rbp)
movl %ecx, -0x1c(%rbp)
movw %ax, -0x1e(%rbp)
movq %r9, -0x28(%rbp)
movsd %xmm0, -0x30(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x505f9
movl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x14(%rbp)
movzwl -0x16(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jle 0x5061d
movw -0x1e(%rbp), %ax
movw %ax, -0x3e(%rbp)
movw -0x16(%rbp), %ax
movw %ax, -0x1e(%rbp)
movw -0x3e(%rbp), %ax
movw %ax, -0x16(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x50630
movl $0xc, -0x4(%rbp)
jmp 0x5087f
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
xorl %r8d, %r8d
movzwl -0x16(%rbp), %edx
movl %r8d, %ecx
callq 0x4ff90
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0x5065a
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5087f
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
xorl %r8d, %r8d
movzwl -0x1e(%rbp), %edx
movl %r8d, %ecx
callq 0x4ff90
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0x50684
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5087f
movl $0x1, %edi
movl $0x1c, %esi
callq 0xc870
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x506ce
movq 0x2c953(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x15a21(%rip), %rsi     # 0x660d0
leaq 0x1bd3e(%rip), %rdx     # 0x6c3f4
movl $0x1f16, %ecx           # imm = 0x1F16
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x5087f
jmp 0x506d0
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x506f6
movzwl -0x16(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jne 0x506f6
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %esi
movzwl -0x16(%rbp), %edx
callq 0xca90
jmp 0x50711
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %esi
movw -0x16(%rbp), %ax
movl -0x1c(%rbp), %ecx
movzwl %ax, %edx
movzwl -0x1e(%rbp), %r8d
callq 0xcdc0
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0x50750
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x5073d
movq -0x28(%rbp), %rdi
addq $0x2, %rdi
callq 0xcd80
movq %rax, -0x48(%rbp)
jmp 0x5074e
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
callq 0xcd80
movq %rax, -0x48(%rbp)
jmp 0x5075d
movq -0x28(%rbp), %rdi
callq 0xc0f0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rdi
callq 0xc4e0
movq %rax, %rcx
movq -0x60(%rbp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x7d, %eax
jne 0x507a2
movq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x48(%rbp), %rdi
callq 0xc4e0
movq %rax, %rcx
movq -0x68(%rbp), %rax
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movl -0x14(%rbp), %edi
movw -0x16(%rbp), %ax
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq 0x10(%rbp), %r8
movzwl %ax, %esi
movzbl 0x18(%rbp), %r9d
callq 0x50890
movq %rax, -0x38(%rbp)
movsd -0x30(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movw -0x16(%rbp), %ax
movq -0x38(%rbp), %rcx
movzwl %ax, %edx
callq 0x50170
cmpb $0x0, 0x18(%rbp)
je 0x507fc
movq -0x10(%rbp), %rax
movb $0x1, 0x151(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x11c(%rax)
jne 0x50878
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
ja 0x50876
movw -0x16(%rbp), %ax
movw %ax, -0x3e(%rbp)
movzwl -0x3e(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jg 0x50869
movl -0x3c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x50841
movzwl -0x3e(%rbp), %eax
movzwl -0x16(%rbp), %ecx
cmpl %ecx, %eax
jne 0x50841
jmp 0x5085b
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %esi
movw -0x3e(%rbp), %ax
movq 0x10(%rbp), %rcx
xorps %xmm0, %xmm0
movzwl %ax, %edx
callq 0xcb30
movw -0x3e(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x3e(%rbp)
jmp 0x5081f
jmp 0x5086b
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5080f
jmp 0x50878
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)