// File: /workspace/github_c_makefile_star2_O3/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 0x3a0c0
movl %ecx, %ebp
movl %esi, %r12d
movq %rdi, %rbx
movl %edx, 0x20(%rsp)
movl %r8d, 0x24(%rsp)
movq %r9, 0x30(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %eax, 0x4(%rsp)
movzwl %r15w, %edx
movl %r14d, %esi
movl %edx, (%rsp)
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x39d04
testl %eax, %eax
jne 0x3a0c5
movq %rbx, %rdi
movzwl %r13w, %ebx
movq %rdi, 0x8(%rsp)
movl 0x4(%rsp), %esi
movl %ebx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x39d04
testl %eax, %eax
jne 0x3a0c5
movl %ebx, 0x1c(%rsp)
movl $0x1, %edi
movl $0x1c, %esi
callq 0xc7f0
testq %rax, %rax
je 0x3a220
cmpl %r12d, %ebp
setne %dl
movl 0x20(%rsp), %ecx
cmpw %cx, 0x24(%rsp)
setne %cl
orb %dl, %cl
movq %rax, 0x28(%rsp)
movq %rax, %rdi
movl %r14d, %esi
jne 0x3a0d4
movl (%rsp), %edx
callq 0xca00
jmp 0x3a0e5
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 0x1c(%rsp), %r8d
callq 0xcd10
movq 0x30(%rsp), %rdi
cmpb $0x7b, (%rdi)
jne 0x3a0fb
cmpb $0x3d, 0x1(%rdi)
jne 0x3a102
addq $0x2, %rdi
jmp 0x3a105
callq 0xc0e0
jmp 0x3a10a
incq %rdi
callq 0xcce0
movq %rax, %rbp
movq %rax, %rdi
callq 0xc480
cmpb $0x7d, -0x1(%rax,%rbp)
jne 0x3a121
movb $0x0, -0x1(%rbp,%rax)
movq 0x70(%rsp), %r12
movl $0x1, %edi
movl $0x68, %esi
callq 0xc7f0
testq %rax, %rax
je 0x3a22f
movl %r14d, (%rax)
movw %r15w, 0x4(%rax)
movq %r12, %rbx
movq %r12, 0x10(%rax)
movq %rbp, 0x20(%rax)
movq 0x28(%rsp), %rcx
movq %rcx, 0x30(%rax)
cmpb $0x0, 0x78(%rsp)
je 0x3a194
movl $0x7, 0x8(%rax)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax)
movq 0x8(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
movl (%rsp), %edx
movq %rax, %rcx
callq 0x39de8
movb $0x1, 0x151(%r12)
jmp 0x3a1bc
movl $0x6, 0x8(%rax)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax)
movq 0x8(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
movl (%rsp), %edx
movq %rax, %rcx
callq 0x39de8
xorl %eax, %eax
cmpb $0x0, 0x11c(%r12)
jne 0x3a0c5
movl %r14d, %ebp
xorl %r12d, %r12d
cmpl %r14d, %ebp
sete %al
testw %r12w, %r12w
sete %cl
testb %cl, %al
jne 0x3a1fd
leal (%r15,%r12), %eax
movzwl %ax, %edx
xorps %xmm0, %xmm0
movq 0x8(%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 0x3a1d3
incl %ebp
xorl %eax, %eax
cmpl 0x4(%rsp), %ebp
jbe 0x3a1d0
jmp 0x3a0c5
callq 0xf2fd
movl $0x1, %eax
jmp 0x3a0c5
movq %r12, %rbx
movq 0x1cdbf(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x5e9d(%rip), %rsi      # 0x400e0
leaq 0xc7aa(%rip), %rdx      # 0x469f4
movl $0x3ad, %ecx            # imm = 0x3AD
xorl %eax, %eax
callq 0xc870
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x28
movq 0x8(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
movl (%rsp), %edx
xorl %ecx, %ecx
callq 0x39de8
cmpb $0x0, 0x78(%rsp)
jne 0x3a189
jmp 0x3a1bc