// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: lxw_worksheet_new
lxw_worksheet *
lxw_worksheet_new(lxw_worksheet_init_data *init_data)
{
    lxw_worksheet *worksheet = calloc(1, sizeof(lxw_worksheet));
    GOTO_LABEL_ON_MEM_ERROR(worksheet, mem_error);

    worksheet->table = calloc(1, sizeof(struct lxw_table_rows));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->table, mem_error);
    RB_INIT(worksheet->table);

    worksheet->hyperlinks = calloc(1, sizeof(struct lxw_table_rows));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->hyperlinks, mem_error);
    RB_INIT(worksheet->hyperlinks);

    worksheet->comments = calloc(1, sizeof(struct lxw_table_rows));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->comments, mem_error);
    RB_INIT(worksheet->comments);

    /* Initialize the cached rows. */
    worksheet->table->cached_row_num = LXW_ROW_MAX + 1;
    worksheet->hyperlinks->cached_row_num = LXW_ROW_MAX + 1;
    worksheet->comments->cached_row_num = LXW_ROW_MAX + 1;

    if (init_data && init_data->optimize) {
        worksheet->array = calloc(LXW_COL_MAX, sizeof(struct lxw_cell *));
        GOTO_LABEL_ON_MEM_ERROR(worksheet->array, mem_error);
    }

    worksheet->col_options =
        calloc(LXW_COL_META_MAX, sizeof(lxw_col_options *));
    worksheet->col_options_max = LXW_COL_META_MAX;
    GOTO_LABEL_ON_MEM_ERROR(worksheet->col_options, mem_error);

    worksheet->col_formats = calloc(LXW_COL_META_MAX, sizeof(lxw_format *));
    worksheet->col_formats_max = LXW_COL_META_MAX;
    GOTO_LABEL_ON_MEM_ERROR(worksheet->col_formats, mem_error);

    worksheet->optimize_row = calloc(1, sizeof(struct lxw_row));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->optimize_row, mem_error);
    worksheet->optimize_row->height = LXW_DEF_ROW_HEIGHT;

    worksheet->merged_ranges = calloc(1, sizeof(struct lxw_merged_ranges));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->merged_ranges, mem_error);
    STAILQ_INIT(worksheet->merged_ranges);

    worksheet->image_props = calloc(1, sizeof(struct lxw_image_props));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->image_props, mem_error);
    STAILQ_INIT(worksheet->image_props);

    worksheet->chart_data = calloc(1, sizeof(struct lxw_chart_props));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->chart_data, mem_error);
    STAILQ_INIT(worksheet->chart_data);

    worksheet->comment_objs = calloc(1, sizeof(struct lxw_comment_objs));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->comment_objs, mem_error);
    STAILQ_INIT(worksheet->comment_objs);

    worksheet->header_image_objs = calloc(1, sizeof(struct lxw_comment_objs));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->header_image_objs, mem_error);
    STAILQ_INIT(worksheet->header_image_objs);

    worksheet->button_objs = calloc(1, sizeof(struct lxw_comment_objs));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->button_objs, mem_error);
    STAILQ_INIT(worksheet->button_objs);

    worksheet->selections = calloc(1, sizeof(struct lxw_selections));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->selections, mem_error);
    STAILQ_INIT(worksheet->selections);

    worksheet->data_validations =
        calloc(1, sizeof(struct lxw_data_validations));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->data_validations, mem_error);
    STAILQ_INIT(worksheet->data_validations);

    worksheet->table_objs = calloc(1, sizeof(struct lxw_table_objs));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->table_objs, mem_error);
    STAILQ_INIT(worksheet->table_objs);

    worksheet->external_hyperlinks = calloc(1, sizeof(struct lxw_rel_tuples));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->external_hyperlinks, mem_error);
    STAILQ_INIT(worksheet->external_hyperlinks);

    worksheet->external_drawing_links =
        calloc(1, sizeof(struct lxw_rel_tuples));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->external_drawing_links, mem_error);
    STAILQ_INIT(worksheet->external_drawing_links);

    worksheet->drawing_links = calloc(1, sizeof(struct lxw_rel_tuples));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->drawing_links, mem_error);
    STAILQ_INIT(worksheet->drawing_links);

    worksheet->vml_drawing_links = calloc(1, sizeof(struct lxw_rel_tuples));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->vml_drawing_links, mem_error);
    STAILQ_INIT(worksheet->vml_drawing_links);

    worksheet->external_table_links =
        calloc(1, sizeof(struct lxw_rel_tuples));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->external_table_links, mem_error);
    STAILQ_INIT(worksheet->external_table_links);

    if (init_data && init_data->optimize) {
        FILE *tmpfile;

        worksheet->optimize_buffer = NULL;
        worksheet->optimize_buffer_size = 0;
        tmpfile = lxw_get_filehandle(&worksheet->optimize_buffer,
                                     &worksheet->optimize_buffer_size,
                                     init_data->tmpdir);
        if (!tmpfile) {
            LXW_ERROR("Error creating tmpfile() for worksheet in "
                      "'constant_memory' mode.");
            goto mem_error;
        }

        worksheet->optimize_tmpfile = tmpfile;
        GOTO_LABEL_ON_MEM_ERROR(worksheet->optimize_tmpfile, mem_error);
        worksheet->file = worksheet->optimize_tmpfile;
    }

    worksheet->drawing_rel_ids =
        calloc(1, sizeof(struct lxw_drawing_rel_ids));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->drawing_rel_ids, mem_error);
    RB_INIT(worksheet->drawing_rel_ids);

    worksheet->vml_drawing_rel_ids =
        calloc(1, sizeof(struct lxw_vml_drawing_rel_ids));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->vml_drawing_rel_ids, mem_error);
    RB_INIT(worksheet->vml_drawing_rel_ids);

    worksheet->conditional_formats =
        calloc(1, sizeof(struct lxw_cond_format_hash));
    GOTO_LABEL_ON_MEM_ERROR(worksheet->conditional_formats, mem_error);
    RB_INIT(worksheet->conditional_formats);

    /* Initialize the worksheet dimensions. */
    worksheet->dim_rowmax = 0;
    worksheet->dim_colmax = 0;
    worksheet->dim_rowmin = LXW_ROW_MAX;
    worksheet->dim_colmin = LXW_COL_MAX;

    worksheet->default_row_height = LXW_DEF_ROW_HEIGHT;
    worksheet->default_row_pixels = 20;
    worksheet->default_col_pixels = 64;

    /* Initialize the page setup properties. */
    worksheet->fit_height = 0;
    worksheet->fit_width = 0;
    worksheet->page_start = 0;
    worksheet->print_scale = 100;
    worksheet->fit_page = 0;
    worksheet->orientation = LXW_TRUE;
    worksheet->page_order = 0;
    worksheet->page_setup_changed = LXW_FALSE;
    worksheet->page_view = LXW_FALSE;
    worksheet->paper_size = 0;
    worksheet->vertical_dpi = 0;
    worksheet->horizontal_dpi = 0;
    worksheet->margin_left = 0.7;
    worksheet->margin_right = 0.7;
    worksheet->margin_top = 0.75;
    worksheet->margin_bottom = 0.75;
    worksheet->margin_header = 0.3;
    worksheet->margin_footer = 0.3;
    worksheet->print_gridlines = 0;
    worksheet->screen_gridlines = 1;
    worksheet->print_options_changed = 0;
    worksheet->zoom = 100;
    worksheet->zoom_scale_normal = LXW_TRUE;
    worksheet->show_zeros = LXW_TRUE;
    worksheet->outline_on = LXW_TRUE;
    worksheet->outline_style = LXW_TRUE;
    worksheet->outline_below = LXW_TRUE;
    worksheet->outline_right = LXW_FALSE;
    worksheet->tab_color = LXW_COLOR_UNSET;
    worksheet->max_url_length = 2079;
    worksheet->comment_display_default = LXW_COMMENT_DISPLAY_HIDDEN;

    worksheet->header_footer_objs[0] = &worksheet->header_left_object_props;
    worksheet->header_footer_objs[1] = &worksheet->header_center_object_props;
    worksheet->header_footer_objs[2] = &worksheet->header_right_object_props;
    worksheet->header_footer_objs[3] = &worksheet->footer_left_object_props;
    worksheet->header_footer_objs[4] = &worksheet->footer_center_object_props;
    worksheet->header_footer_objs[5] = &worksheet->footer_right_object_props;

    if (init_data) {
        worksheet->name = init_data->name;
        worksheet->quoted_name = init_data->quoted_name;
        worksheet->tmpdir = init_data->tmpdir;
        worksheet->index = init_data->index;
        worksheet->hidden = init_data->hidden;
        worksheet->sst = init_data->sst;
        worksheet->optimize = init_data->optimize;
        worksheet->active_sheet = init_data->active_sheet;
        worksheet->first_sheet = init_data->first_sheet;
        worksheet->default_url_format = init_data->default_url_format;
        worksheet->max_url_length = init_data->max_url_length;
    }

    return worksheet;

mem_error:
    lxw_worksheet_free(worksheet);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
movl $0x3c8, %esi            # imm = 0x3C8
callq 0xc7f0
movq %rax, %rbx
testq %rax, %rax
je 0x2df8d
movl $0x1, %edi
movl $0x18, %esi
callq 0xc7f0
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x2df97
movq %rax, %r15
movl $0x1, %edi
movl $0x18, %esi
callq 0xc7f0
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x2dfa1
movq %rax, %r12
movl $0x1, %edi
movl $0x18, %esi
callq 0xc7f0
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x2dfab
movl $0x100001, %ecx         # imm = 0x100001
movl %ecx, 0x10(%r15)
movl %ecx, 0x10(%r12)
movl %ecx, 0x10(%rax)
testq %r14, %r14
je 0x2db06
cmpb $0x0, 0x3(%r14)
je 0x2db06
movl $0x4000, %edi           # imm = 0x4000
movl $0x8, %esi
callq 0xc7f0
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x2e02e
movl $0x80, %edi
movl $0x8, %esi
callq 0xc7f0
movq %rax, 0xf0(%rbx)
movw $0x80, 0xf8(%rbx)
testq %rax, %rax
je 0x2dfb5
movl $0x80, %edi
movl $0x8, %esi
callq 0xc7f0
movq %rax, 0x110(%rbx)
movw $0x80, 0x118(%rbx)
testq %rax, %rax
je 0x2dfbf
movl $0x1, %edi
movl $0x48, %esi
callq 0xc7f0
movq %rax, 0x120(%rbx)
testq %rax, %rax
je 0x2dfc9
movabsq $0x402e000000000000, %r15 # imm = 0x402E000000000000
movq %r15, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x2dfd3
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x60(%rbx)
testq %rax, %rax
je 0x2dfda
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0x2dfe1
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x80(%rbx)
testq %rax, %rax
je 0x2dfe8
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x88(%rbx)
testq %rax, %rax
je 0x2dfef
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x90(%rbx)
testq %rax, %rax
je 0x2dff6
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x2dffd
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x50(%rbx)
testq %rax, %rax
je 0x2e004
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x98(%rbx)
testq %rax, %rax
je 0x2e00b
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x218(%rbx)
testq %rax, %rax
je 0x2e012
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x220(%rbx)
testq %rax, %rax
je 0x2e019
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x228(%rbx)
testq %rax, %rax
je 0x2e020
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x230(%rbx)
testq %rax, %rax
je 0x2e027
movq %rax, 0x8(%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0xc7f0
movq %rax, 0x238(%rbx)
testq %rax, %rax
je 0x2e035
movq %rax, 0x8(%rax)
testq %r14, %r14
je 0x2dd8b
cmpb $0x0, 0x3(%r14)
je 0x2dd8b
leaq 0x10(%rbx), %rdi
leaq 0x18(%rbx), %rsi
movq 0x30(%r14), %rdx
callq 0xce00
testq %rax, %rax
je 0x2e051
movq %rax, 0x8(%rbx)
movq %rax, (%rbx)
movl $0x1, %edi
movl $0x8, %esi
callq 0xc7f0
movq %rax, 0x70(%rbx)
testq %rax, %rax
je 0x2e03c
movq $0x0, (%rax)
movl $0x1, %edi
movl $0x8, %esi
callq 0xc7f0
movq %rax, 0x78(%rbx)
testq %rax, %rax
je 0x2e043
movq $0x0, (%rax)
movl $0x1, %edi
movl $0x8, %esi
callq 0xc7f0
movq %rax, 0x58(%rbx)
testq %rax, %rax
je 0x2e04a
leaq 0x378(%rbx), %rcx
leaq 0x380(%rbx), %rdx
leaq 0x388(%rbx), %rsi
leaq 0x390(%rbx), %rdi
leaq 0x398(%rbx), %r8
movq %rbx, %r9
addq $0x3a0, %r9             # imm = 0x3A0
xorl %r10d, %r10d
movq $0x0, (%rax)
movq $0x100000, 0xa4(%rbx) # imm = 0x100000
movl $0x4000, 0xac(%rbx)     # imm = 0x4000
movq %r15, 0x198(%rbx)
movabsq $0x4000000014, %rax     # imm = 0x4000000014
movq %rax, 0x1a0(%rbx)
movl %r10d, 0x128(%rbx)
movl $0x640000, 0x130(%rbx)  # imm = 0x640000
movb %r10b, 0x13b(%rbx)
movb $0x1, %al
movb %al, 0x13d(%rbx)
movw %r10w, 0x136(%rbx)
movw %r10w, 0x12c(%rbx)
movl %r10d, 0x143(%rbx)
movaps 0x18761(%rip), %xmm0    # 0x465f0
movups %xmm0, 0x168(%rbx)
movaps 0x18763(%rip), %xmm0    # 0x46600
movups %xmm0, 0x178(%rbx)
movaps 0x18765(%rip), %xmm0    # 0x46610
movups %xmm0, 0x188(%rbx)
movb %r10b, 0x147(%rbx)
movb %al, 0x14b(%rbx)
movb %r10b, 0x149(%rbx)
movw $0x64, 0x138(%rbx)
movb %al, 0x14e(%rbx)
movb %al, 0x14c(%rbx)
movl $0x10101, 0x13f(%rbx)   # imm = 0x10101
movl %r10d, 0x164(%rbx)
movw $0x81f, 0x1f6(%rbx)     # imm = 0x81F
movb %al, 0x2ec(%rbx)
movq %rcx, 0x348(%rbx)
movq %rdx, 0x350(%rbx)
movq %rsi, 0x358(%rbx)
movq %rdi, 0x360(%rbx)
movq %r8, 0x368(%rbx)
movq %r9, 0x370(%rbx)
testq %r14, %r14
je 0x2e060
movups 0x28(%r14), %xmm0
movups %xmm0, 0xc0(%rbx)
movzwl (%r14), %eax
movw %ax, 0xd0(%rbx)
movb 0x2(%r14), %al
movb %al, 0xd4(%rbx)
movups 0x18(%r14), %xmm0
movups %xmm0, 0xb0(%rbx)
movb 0x3(%r14), %al
movb %al, 0x11c(%rbx)
movups 0x8(%r14), %xmm0
movups %xmm0, 0xd8(%rbx)
movq 0x38(%r14), %rax
movq %rax, 0x298(%rbx)
movzwl 0x40(%r14), %eax
movw %ax, 0x1f6(%rbx)
jmp 0x2e060
callq 0xe8b0
jmp 0x2e056
callq 0xe88e
jmp 0x2e056
callq 0xe86c
jmp 0x2e056
callq 0xe84a
jmp 0x2e056
callq 0xe828
jmp 0x2e056
callq 0xe804
jmp 0x2e056
callq 0xe7e0
jmp 0x2e056
callq 0xe7bc
jmp 0x2e056
callq 0xe798
jmp 0x2e056
callq 0xe774
jmp 0x2e056
callq 0xe750
jmp 0x2e056
callq 0xe72c
jmp 0x2e056
callq 0xe708
jmp 0x2e056
callq 0xe6e4
jmp 0x2e056
callq 0xe6c0
jmp 0x2e056
callq 0xe69c
jmp 0x2e056
callq 0xe678
jmp 0x2e056
callq 0xe654
jmp 0x2e056
callq 0xe630
jmp 0x2e056
callq 0xe60c
jmp 0x2e056
callq 0xe536
jmp 0x2e056
callq 0xe5e8
jmp 0x2e056
callq 0xe5c4
jmp 0x2e056
callq 0xe5a0
jmp 0x2e056
callq 0xe57c
jmp 0x2e056
callq 0xe558
movq %rbx, %rdi
callq 0xcdb0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq