// File: /workspace/github_c_makefile_star2_O2/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, %r15d
cmoval %edx, %r15d
movl %r8d, %r13d
cmovbl %edx, %r13d
testq %r9, %r9
je 0x36e69
movl %ecx, %r12d
movl %esi, %ebp
movq %rdi, %rbx
movl %edx, 0x18(%rsp)
movl %r8d, 0x1c(%rsp)
movq %r9, 0x30(%rsp)
movsd %xmm0, 0x8(%rsp)
movl %eax, 0x4(%rsp)
movzwl %r13w, %edx
movl %r14d, %esi
movl %edx, (%rsp)
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x36a6c
testl %eax, %eax
jne 0x36e6c
movq %rbx, %rdi
movzwl %r15w, %ebx
movq %rdi, 0x20(%rsp)
movl 0x4(%rsp), %esi
movl %ebx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x36a6c
testl %eax, %eax
jne 0x36e6c
movl %ebx, 0x14(%rsp)
pushq $0x1
popq %rdi
pushq $0x1c
popq %rsi
callq 0xc850
testq %rax, %rax
je 0x36fa5
cmpl %ebp, %r12d
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 0x36e7b
movl (%rsp), %edx
callq 0xca60
jmp 0x36e8c
pushq $0xc
popq %rax
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 0xcd90
movq 0x30(%rsp), %rdi
cmpb $0x7b, (%rdi)
jne 0x36ea2
cmpb $0x3d, 0x1(%rdi)
jne 0x36ea9
addq $0x2, %rdi
jmp 0x36eac
callq 0xc0f0
jmp 0x36eb1
incq %rdi
callq 0xcd50
movq %rax, %r12
movq %rax, %rdi
callq 0xc4c0
cmpb $0x7d, -0x1(%rax,%r12)
jne 0x36eca
movb $0x0, -0x1(%r12,%rax)
movq 0x70(%rsp), %rbx
pushq $0x1
popq %rdi
pushq $0x68
popq %rsi
callq 0xc850
movq %rax, %rbp
testq %rax, %rax
je 0x36fd0
movl %r14d, (%rbp)
movw %r13w, 0x4(%rbp)
movq %rbx, 0x10(%rbp)
movq %r12, 0x20(%rbp)
movq 0x28(%rsp), %rax
movq %rax, 0x30(%rbp)
cmpb $0x0, 0x78(%rsp)
je 0x36f10
movl $0x7, 0x8(%rbp)
jmp 0x36f17
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 0x36b65
cmpb $0x0, 0x78(%rsp)
je 0x36f48
movb $0x1, 0x151(%r12)
cmpb $0x0, 0x11c(%r12)
movl 0x4(%rsp), %eax
je 0x36f5e
xorl %eax, %eax
jmp 0x36e6c
movl %r14d, %ebp
cmpl %eax, %ebp
ja 0x36f57
xorl %r12d, %r12d
leal (%r12,%r13), %eax
cmpw %r15w, %ax
ja 0x36f9d
cmpl %r14d, %ebp
sete %cl
testw %r12w, %r12w
sete %dl
testb %dl, %cl
jne 0x36f98
movzwl %ax, %edx
xorps %xmm0, %xmm0
movq 0x20(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0xcaf0
incl %r12d
jmp 0x36f68
incl %ebp
movl 0x4(%rsp), %eax
jmp 0x36f61
movq 0x1c04c(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x612a(%rip), %rsi      # 0x3d0e0
leaq 0xca23(%rip), %rdx      # 0x439e0
movl $0x1f16, %ecx           # imm = 0x1F16
xorl %eax, %eax
callq 0xc8d0
pushq $0x1
jmp 0x36e6b
movq 0x1c021(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x60ff(%rip), %rsi      # 0x3d0e0
leaq 0xc9f8(%rip), %rdx      # 0x439e0
movl $0x3ad, %ecx            # imm = 0x3AD
xorl %eax, %eax
callq 0xc8d0
jmp 0x36f17