// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/workbook.c
// Function: populate_range_data_cache
STATIC void
_populate_range_data_cache(lxw_workbook *self, lxw_series_range *range)
{
    lxw_worksheet *worksheet;
    lxw_row_t row_num;
    lxw_col_t col_num;
    lxw_row *row_obj;
    lxw_cell *cell_obj;
    struct lxw_series_data_point *data_point;
    uint16_t num_data_points = 0;

    /* If ignore_cache is set then don't try to populate the cache. This flag
     * may be set manually, for testing, or due to a case where the cache
     * can't be calculated.
     */
    if (range->ignore_cache)
        return;

    /* Currently we only handle 2D ranges so ensure either the rows or cols
     * are the same.
     */
    if (range->first_row != range->last_row
        && range->first_col != range->last_col) {
        range->ignore_cache = LXW_TRUE;
        return;
    }

    /* Check that the sheetname exists. */
    worksheet = workbook_get_worksheet_by_name(self, range->sheetname);
    if (!worksheet) {
        LXW_WARN_FORMAT2("workbook_add_chart(): worksheet name '%s' "
                         "in chart formula '%s' doesn't exist.",
                         range->sheetname, range->formula);
        range->ignore_cache = LXW_TRUE;
        return;
    }

    /* We can't read the data when worksheet optimization is on. */
    if (worksheet->optimize) {
        range->ignore_cache = LXW_TRUE;
        return;
    }

    /* Iterate through the worksheet data and populate the range cache. */
    for (row_num = range->first_row; row_num <= range->last_row; row_num++) {
        row_obj = lxw_worksheet_find_row(worksheet, row_num);

        for (col_num = range->first_col; col_num <= range->last_col;
             col_num++) {

            data_point = calloc(1, sizeof(struct lxw_series_data_point));
            if (!data_point) {
                range->ignore_cache = LXW_TRUE;
                return;
            }

            cell_obj = lxw_worksheet_find_cell_in_row(row_obj, col_num);

            if (cell_obj) {
                if (cell_obj->type == NUMBER_CELL) {
                    data_point->number = cell_obj->u.number;
                }

                if (cell_obj->type == STRING_CELL) {
                    data_point->string = lxw_strdup(cell_obj->sst_string);
                    data_point->is_string = LXW_TRUE;
                    range->has_string_cache = LXW_TRUE;
                }
            }
            else {
                data_point->no_data = LXW_TRUE;
            }

            STAILQ_INSERT_TAIL(range->data_cache, data_point, list_pointers);
            num_data_points++;
        }
    }

    range->num_data_points = num_data_points;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw $0x0, -0x3a(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1c(%rax)
je 0x44095
jmp 0x4427e
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x14(%rcx), %eax
je 0x440c6
movq -0x10(%rbp), %rax
movzwl 0x18(%rax), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1a(%rcx), %ecx
cmpl %ecx, %eax
je 0x440c6
movq -0x10(%rbp), %rax
movb $0x1, 0x1c(%rax)
jmp 0x4427e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xcac0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x44116
movq 0x38f0f(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
leaq 0x2815c(%rip), %rsi     # 0x6c25e
movb $0x0, %al
callq 0xc8f0
movq -0x10(%rbp), %rax
movb $0x1, 0x1c(%rax)
jmp 0x4427e
movq -0x18(%rbp), %rax
cmpb $0x0, 0x11c(%rax)
je 0x44130
movq -0x10(%rbp), %rax
movb $0x1, 0x1c(%rax)
jmp 0x4427e
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x14(%rcx), %eax
ja 0x44272
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xc790
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movw 0x18(%rax), %ax
movw %ax, -0x1e(%rbp)
movzwl -0x1e(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x1a(%rcx), %ecx
cmpl %ecx, %eax
jg 0x44262
movl $0x1, %edi
movl $0x28, %esi
callq 0xc870
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x441a1
movq -0x10(%rbp), %rax
movb $0x1, 0x1c(%rax)
jmp 0x4427e
movq -0x28(%rbp), %rdi
movzwl -0x1e(%rbp), %esi
callq 0xc780
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x44208
movq -0x30(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x441d5
movq -0x30(%rbp), %rax
movsd 0x20(%rax), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x30(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x44206
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movb $0x1, (%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x1d(%rax)
jmp 0x44210
movq -0x38(%rbp), %rax
movb $0x1, 0x18(%rax)
jmp 0x44212
movq -0x38(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
addq $0x20, %rcx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x8(%rax)
movw -0x3a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x3a(%rbp)
movw -0x1e(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x1e(%rbp)
jmp 0x44166
jmp 0x44264
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4413a
movw -0x3a(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x1e(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)