// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpl %ecx, %esi
movl %ecx, %eax
cmoval %esi, %eax
movl %ecx, %r14d
cmovbl %esi, %r14d
cmpw %r8w, %dx
movl %r8d, %r13d
cmoval %edx, %r13d
movl %r8d, %r15d
cmovbl %edx, %r15d
testq %r9, %r9
je 0x39e62
movl %ecx, %ebp
movl %esi, %r12d
movq %rdi, %rbx
movl %edx, 0x18(%rsp)
movl %r8d, 0x1c(%rsp)
movq %r9, 0x30(%rsp)
movsd %xmm0, 0x8(%rsp)
movl %eax, 0x4(%rsp)
movzwl %r15w, %edx
movl %r14d, %esi
movl %edx, (%rsp)
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x39aa6
testl %eax, %eax
jne 0x39e67
movq %rbx, %rdi
movzwl %r13w, %ebx
movq %rdi, 0x20(%rsp)
movl 0x4(%rsp), %esi
movl %ebx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x39aa6
testl %eax, %eax
jne 0x39e67
movl %ebx, 0x14(%rsp)
movl $0x1, %edi
movl $0x1c, %esi
callq 0xc7f0
testq %rax, %rax
je 0x39fab
cmpl %r12d, %ebp
setne %dl
movl 0x18(%rsp), %ecx
cmpw %cx, 0x1c(%rsp)
setne %cl
orb %dl, %cl
movq %rax, 0x28(%rsp)
movq %rax, %rdi
movl %r14d, %esi
jne 0x39e76
movl (%rsp), %edx
callq 0xca00
jmp 0x39e87
movl $0xc, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%rsp), %edx
movl 0x4(%rsp), %ecx
movl 0x14(%rsp), %r8d
callq 0xcd10
movq 0x30(%rsp), %rdi
cmpb $0x7b, (%rdi)
jne 0x39e9d
cmpb $0x3d, 0x1(%rdi)
jne 0x39ea4
addq $0x2, %rdi
jmp 0x39ea7
callq 0xc0e0
jmp 0x39eac
incq %rdi
callq 0xcce0
movq %rax, %r12
movq %rax, %rdi
callq 0xc480
cmpb $0x7d, -0x1(%rax,%r12)
jne 0x39ec5
movb $0x0, -0x1(%r12,%rax)
movq 0x70(%rsp), %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0xc7f0
movq %rax, %rbp
testq %rax, %rax
je 0x39fba
movl %r14d, (%rbp)
movw %r15w, 0x4(%rbp)
movq %rbx, 0x10(%rbp)
movq %r12, 0x20(%rbp)
movq 0x28(%rsp), %rax
movq %rax, 0x30(%rbp)
cmpb $0x0, 0x78(%rsp)
je 0x39f0f
movl $0x7, 0x8(%rbp)
jmp 0x39f16
movl $0x6, 0x8(%rbp)
movsd 0x8(%rsp), %xmm0
movl (%rsp), %edx
movsd %xmm0, 0x28(%rbp)
movq 0x20(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
movq %rbp, %rcx
callq 0x39b8a
cmpb $0x0, 0x78(%rsp)
je 0x39f47
movb $0x1, 0x151(%r12)
xorl %eax, %eax
cmpb $0x0, 0x11c(%r12)
jne 0x39e67
movl %r14d, %ebp
xorl %r12d, %r12d
cmpl %r14d, %ebp
sete %al
testw %r12w, %r12w
sete %cl
testb %cl, %al
jne 0x39f88
leal (%r15,%r12), %eax
movzwl %ax, %edx
xorps %xmm0, %xmm0
movq 0x20(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0xca90
leal (%r15,%r12), %eax
incl %eax
movl %r12d, %ecx
incl %ecx
movl %ecx, %r12d
cmpw %r13w, %ax
jbe 0x39f5e
incl %ebp
xorl %eax, %eax
cmpl 0x4(%rsp), %ebp
jbe 0x39f5b
jmp 0x39e67
callq 0xef49
movl $0x1, %eax
jmp 0x39e67
callq 0xef25
jmp 0x39f16