// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/workbook.c
// Function: prepare_defined_names
STATIC void
_prepare_defined_names(lxw_workbook *self)
{
    lxw_worksheet *worksheet;
    lxw_sheet *sheet;
    char app_name[LXW_DEFINED_NAME_LENGTH];
    char range[LXW_DEFINED_NAME_LENGTH];
    char area[LXW_MAX_CELL_RANGE_LENGTH];
    char first_col[8];
    char last_col[8];

    STAILQ_FOREACH(sheet, self->sheets, list_pointers) {
        if (sheet->is_chartsheet)
            continue;
        else
            worksheet = sheet->u.worksheet;
        /*
         * Check for autofilter settings and store them.
         */
        if (worksheet->autofilter.in_use) {

            lxw_snprintf(app_name, LXW_DEFINED_NAME_LENGTH,
                         "%s!_FilterDatabase", worksheet->quoted_name);

            lxw_rowcol_to_range_abs(area,
                                    worksheet->autofilter.first_row,
                                    worksheet->autofilter.first_col,
                                    worksheet->autofilter.last_row,
                                    worksheet->autofilter.last_col);

            lxw_snprintf(range, LXW_DEFINED_NAME_LENGTH, "%s!%s",
                         worksheet->quoted_name, area);

            /* Autofilters are the only defined name to set the hidden flag. */
            _store_defined_name(self, "_xlnm._FilterDatabase", app_name,
                                range, worksheet->index, LXW_TRUE);
        }

        /*
         * Check for Print Area settings and store them.
         */
        if (worksheet->print_area.in_use) {

            lxw_snprintf(app_name, LXW_DEFINED_NAME_LENGTH,
                         "%s!Print_Area", worksheet->quoted_name);

            /* Check for print area that is the max row range. */
            if (worksheet->print_area.first_row == 0
                && worksheet->print_area.last_row == LXW_ROW_MAX - 1) {

                lxw_col_to_name(first_col,
                                worksheet->print_area.first_col, LXW_FALSE);

                lxw_col_to_name(last_col,
                                worksheet->print_area.last_col, LXW_FALSE);

                lxw_snprintf(area, LXW_MAX_CELL_RANGE_LENGTH - 1, "$%s:$%s",
                             first_col, last_col);

            }
            /* Check for print area that is the max column range. */
            else if (worksheet->print_area.first_col == 0
                     && worksheet->print_area.last_col == LXW_COL_MAX - 1) {

                lxw_snprintf(area, LXW_MAX_CELL_RANGE_LENGTH - 1, "$%d:$%d",
                             worksheet->print_area.first_row + 1,
                             worksheet->print_area.last_row + 1);

            }
            else {
                lxw_rowcol_to_range_abs(area,
                                        worksheet->print_area.first_row,
                                        worksheet->print_area.first_col,
                                        worksheet->print_area.last_row,
                                        worksheet->print_area.last_col);
            }

            lxw_snprintf(range, LXW_DEFINED_NAME_LENGTH, "%s!%s",
                         worksheet->quoted_name, area);

            _store_defined_name(self, "_xlnm.Print_Area", app_name,
                                range, worksheet->index, LXW_FALSE);
        }

        /*
         * Check for repeat rows/cols. aka, Print Titles and store them.
         */
        if (worksheet->repeat_rows.in_use || worksheet->repeat_cols.in_use) {
            if (worksheet->repeat_rows.in_use
                && worksheet->repeat_cols.in_use) {
                lxw_snprintf(app_name, LXW_DEFINED_NAME_LENGTH,
                             "%s!Print_Titles", worksheet->quoted_name);

                lxw_col_to_name(first_col,
                                worksheet->repeat_cols.first_col, LXW_FALSE);

                lxw_col_to_name(last_col,
                                worksheet->repeat_cols.last_col, LXW_FALSE);

                lxw_snprintf(range, LXW_DEFINED_NAME_LENGTH,
                             "%s!$%s:$%s,%s!$%d:$%d",
                             worksheet->quoted_name, first_col,
                             last_col, worksheet->quoted_name,
                             worksheet->repeat_rows.first_row + 1,
                             worksheet->repeat_rows.last_row + 1);

                _store_defined_name(self, "_xlnm.Print_Titles", app_name,
                                    range, worksheet->index, LXW_FALSE);
            }
            else if (worksheet->repeat_rows.in_use) {

                lxw_snprintf(app_name, LXW_DEFINED_NAME_LENGTH,
                             "%s!Print_Titles", worksheet->quoted_name);

                lxw_snprintf(range, LXW_DEFINED_NAME_LENGTH,
                             "%s!$%d:$%d", worksheet->quoted_name,
                             worksheet->repeat_rows.first_row + 1,
                             worksheet->repeat_rows.last_row + 1);

                _store_defined_name(self, "_xlnm.Print_Titles", app_name,
                                    range, worksheet->index, LXW_FALSE);
            }
            else if (worksheet->repeat_cols.in_use) {
                lxw_snprintf(app_name, LXW_DEFINED_NAME_LENGTH,
                             "%s!Print_Titles", worksheet->quoted_name);

                lxw_col_to_name(first_col,
                                worksheet->repeat_cols.first_col, LXW_FALSE);

                lxw_col_to_name(last_col,
                                worksheet->repeat_cols.last_col, LXW_FALSE);

                lxw_snprintf(range, LXW_DEFINED_NAME_LENGTH,
                             "%s!$%s:$%s", worksheet->quoted_name,
                             first_col, last_col);

                _store_defined_name(self, "_xlnm.Print_Titles", app_name,
                                    range, worksheet->index, LXW_FALSE);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x3eb18
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3e5d7
jmp 0x3eb07
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1e4(%rax)
je 0x3e6af
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
movl $0x80, %esi
leaq 0x2dbba(%rip), %rdx     # 0x6c1cc
movb $0x0, %al
callq 0xc5d0
leaq -0x140(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1e8(%rax), %esi
movq -0x10(%rbp), %rax
movw 0x1f0(%rax), %dx
movq -0x10(%rbp), %rax
movl 0x1ec(%rax), %ecx
movq -0x10(%rbp), %rax
movzwl %dx, %edx
movzwl 0x1f2(%rax), %r8d
callq 0xc470
leaq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
leaq -0x140(%rbp), %r8
movl $0x80, %esi
leaq 0x2db67(%rip), %rdx     # 0x6c1df
movb $0x0, %al
callq 0xc5d0
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
movq -0x10(%rbp), %rax
leaq 0x2db49(%rip), %rsi     # 0x6c1e5
movl $0x1, %r9d
movswl 0xd0(%rax), %r8d
callq 0x3f240
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1d4(%rax)
je 0x3e850
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
movl $0x80, %esi
leaq 0x2db1d(%rip), %rdx     # 0x6c1fb
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1d8(%rax)
jne 0x3e761
movq -0x10(%rbp), %rax
cmpl $0xfffff, 0x1dc(%rax)   # imm = 0xFFFFF
jne 0x3e761
leaq -0x148(%rbp), %rdi
movq -0x10(%rbp), %rax
xorl %edx, %edx
movzwl 0x1e0(%rax), %esi
callq 0xc5e0
leaq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rax
xorl %edx, %edx
movzwl 0x1e2(%rax), %esi
callq 0xc5e0
leaq -0x140(%rbp), %rdi
leaq -0x148(%rbp), %rcx
leaq -0x150(%rbp), %r8
movl $0x1b, %esi
leaq 0x2db01(%rip), %rdx     # 0x6c256
movb $0x0, %al
callq 0xc5d0
jmp 0x3e7f7
movq -0x10(%rbp), %rax
movzwl 0x1e0(%rax), %eax
cmpl $0x0, %eax
jne 0x3e7bb
movq -0x10(%rbp), %rax
movzwl 0x1e2(%rax), %eax
cmpl $0x3fff, %eax           # imm = 0x3FFF
jne 0x3e7bb
leaq -0x140(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1d8(%rax), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl 0x1dc(%rax), %r8d
addl $0x1, %r8d
movl $0x1b, %esi
leaq 0x2da86(%rip), %rdx     # 0x6c238
movb $0x0, %al
callq 0xc5d0
jmp 0x3e7f5
leaq -0x140(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1d8(%rax), %esi
movq -0x10(%rbp), %rax
movw 0x1e0(%rax), %dx
movq -0x10(%rbp), %rax
movl 0x1dc(%rax), %ecx
movq -0x10(%rbp), %rax
movzwl %dx, %edx
movzwl 0x1e2(%rax), %r8d
callq 0xc470
jmp 0x3e7f7
leaq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
leaq -0x140(%rbp), %r8
movl $0x80, %esi
leaq 0x2d9c3(%rip), %rdx     # 0x6c1df
movb $0x0, %al
callq 0xc5d0
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
movq -0x10(%rbp), %rax
leaq 0x2d9c9(%rip), %rsi     # 0x6c209
xorl %r9d, %r9d
movswl 0xd0(%rax), %r8d
callq 0x3f240
movq -0x10(%rbp), %rax
movzbl 0x1c0(%rax), %eax
cmpl $0x0, %eax
jne 0x3e874
movq -0x10(%rbp), %rax
movzbl 0x1cc(%rax), %eax
cmpl $0x0, %eax
je 0x3eb05
movq -0x10(%rbp), %rax
movzbl 0x1c0(%rax), %eax
cmpl $0x0, %eax
je 0x3e98c
movq -0x10(%rbp), %rax
movzbl 0x1cc(%rax), %eax
cmpl $0x0, %eax
je 0x3e98c
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
movl $0x80, %esi
leaq 0x2d960(%rip), %rdx     # 0x6c21a
movb $0x0, %al
callq 0xc5d0
leaq -0x148(%rbp), %rdi
movq -0x10(%rbp), %rax
xorl %edx, %edx
movzwl 0x1ce(%rax), %esi
callq 0xc5e0
leaq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rax
xorl %edx, %edx
movzwl 0x1d0(%rax), %esi
callq 0xc5e0
leaq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
leaq -0x148(%rbp), %r8
leaq -0x150(%rbp), %r9
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %r11
movq -0x10(%rbp), %rax
movl 0x1c4(%rax), %r10d
addl $0x1, %r10d
movq -0x10(%rbp), %rax
movl 0x1c8(%rax), %eax
addl $0x1, %eax
movl $0x80, %esi
leaq 0x2d8e4(%rip), %rdx     # 0x6c22a
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0xc5d0
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
movq -0x10(%rbp), %rax
leaq 0x2d8c9(%rip), %rsi     # 0x6c240
xorl %r9d, %r9d
movswl 0xd0(%rax), %r8d
callq 0x3f240
jmp 0x3eb03
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1c0(%rax)
je 0x3ea37
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
movl $0x80, %esi
leaq 0x2d85f(%rip), %rdx     # 0x6c21a
movb $0x0, %al
callq 0xc5d0
leaq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x1c4(%rax), %r8d
addl $0x1, %r8d
movq -0x10(%rbp), %rax
movl 0x1c8(%rax), %r9d
addl $0x1, %r9d
movl $0x80, %esi
leaq 0x2d837(%rip), %rdx     # 0x6c235
movb $0x0, %al
callq 0xc5d0
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
movq -0x10(%rbp), %rax
leaq 0x2d81e(%rip), %rsi     # 0x6c240
xorl %r9d, %r9d
movswl 0xd0(%rax), %r8d
callq 0x3f240
jmp 0x3eb01
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1cc(%rax)
je 0x3eaff
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
movl $0x80, %esi
leaq 0x2d7b4(%rip), %rdx     # 0x6c21a
movb $0x0, %al
callq 0xc5d0
leaq -0x148(%rbp), %rdi
movq -0x10(%rbp), %rax
xorl %edx, %edx
movzwl 0x1ce(%rax), %esi
callq 0xc5e0
leaq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rax
xorl %edx, %edx
movzwl 0x1d0(%rax), %esi
callq 0xc5e0
leaq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rcx
leaq -0x148(%rbp), %r8
leaq -0x150(%rbp), %r9
movl $0x80, %esi
leaq 0x2d788(%rip), %rdx     # 0x6c253
movb $0x0, %al
callq 0xc5d0
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0x120(%rbp), %rcx
movq -0x10(%rbp), %rax
leaq 0x2d751(%rip), %rsi     # 0x6c240
xorl %r9d, %r9d
movswl 0xd0(%rax), %r8d
callq 0x3f240
jmp 0x3eb01
jmp 0x3eb03
jmp 0x3eb05
jmp 0x3eb07
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x3e5be
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)