// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_add_table
lxw_error
worksheet_add_table(lxw_worksheet *self, lxw_row_t first_row,
                    lxw_col_t first_col, lxw_row_t last_row,
                    lxw_col_t last_col, lxw_table_options *user_options)
{
    lxw_row_t tmp_row;
    lxw_col_t tmp_col;
    lxw_col_t num_cols;
    lxw_error err;
    lxw_table_obj *table_obj;
    lxw_table_column **columns;

    if (self->optimize) {
        LXW_WARN_FORMAT("worksheet_add_table(): "
                        "worksheet tables aren't supported in "
                        "'constant_memory' mode");
        return LXW_ERROR_FEATURE_NOT_SUPPORTED;
    }

    /* 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;
    }

    /* Check that column number is valid and store the max value */
    err = _check_dimensions(self, last_row, last_col, LXW_TRUE, LXW_TRUE);
    if (err)
        return err;

    num_cols = last_col - first_col + 1;

    /* Check that there are sufficient data rows. */
    err = _check_table_rows(first_row, last_row, user_options);
    if (err)
        return err;

    /* Check that the the table name is valid. */
    err = _check_table_name(user_options);
    if (err)
        return err;

    /* Create a table object to copy from the user options. */
    table_obj = calloc(1, sizeof(lxw_table_obj));
    RETURN_ON_MEM_ERROR(table_obj, LXW_ERROR_MEMORY_MALLOC_FAILED);

    columns = calloc(num_cols, sizeof(lxw_table_column *));
    GOTO_LABEL_ON_MEM_ERROR(columns, error);

    table_obj->columns = columns;
    table_obj->num_cols = num_cols;
    table_obj->first_row = first_row;
    table_obj->first_col = first_col;
    table_obj->last_row = last_row;
    table_obj->last_col = last_col;

    err = _set_default_table_columns(table_obj);
    if (err)
        goto error;

    /* Create the table range. */
    lxw_rowcol_to_range(table_obj->sqref,
                        first_row, first_col, last_row, last_col);
    lxw_rowcol_to_range(table_obj->filter_sqref,
                        first_row, first_col, last_row, last_col);

    /* Validate and copy user options to an internal object. */
    if (user_options) {

        _check_and_copy_table_style(table_obj, user_options);

        table_obj->total_row = user_options->total_row;
        table_obj->last_column = user_options->last_column;
        table_obj->first_column = user_options->first_column;
        table_obj->no_autofilter = user_options->no_autofilter;
        table_obj->no_header_row = user_options->no_header_row;
        table_obj->no_banded_rows = user_options->no_banded_rows;
        table_obj->banded_columns = user_options->banded_columns;

        if (user_options->no_header_row)
            table_obj->no_autofilter = LXW_TRUE;

        if (user_options->columns) {
            err = _set_custom_table_columns(table_obj, user_options);
            if (err)
                goto error;
        }

        if (user_options->total_row) {
            lxw_rowcol_to_range(table_obj->filter_sqref,
                                first_row, first_col, last_row - 1, last_col);
        }

        if (user_options->name) {
            table_obj->name = lxw_strdup(user_options->name);
            if (!table_obj->name) {
                err = LXW_ERROR_MEMORY_MALLOC_FAILED;
                goto error;
            }
        }
    }

    _write_table_column_data(self, table_obj);

    STAILQ_INSERT_TAIL(self->table_objs, table_obj, list_pointers);
    self->table_count++;

    return LXW_NO_ERROR;

error:
    _free_worksheet_table(table_obj);
    return err;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movw %r8w, %ax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movw %dx, -0x16(%rbp)
movl %ecx, -0x1c(%rbp)
movw %ax, -0x1e(%rbp)
movq %r9, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x11c(%rax)
je 0x53683
movq 0x29992(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x19e0e(%rip), %rsi     # 0x6d47e
movb $0x0, %al
callq 0xc8f0
movl $0xb, -0x4(%rbp)
jmp 0x53a01
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x5369d
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x14(%rbp)
movzwl -0x16(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jle 0x536c1
movw -0x1e(%rbp), %ax
movw %ax, -0x2e(%rbp)
movw -0x16(%rbp), %ax
movw %ax, -0x1e(%rbp)
movw -0x2e(%rbp), %ax
movw %ax, -0x16(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x1, %r8d
movzwl -0x1e(%rbp), %edx
movl %r8d, %ecx
callq 0x4ff90
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x536ee
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x53a01
movzwl -0x1e(%rbp), %eax
movzwl -0x16(%rbp), %ecx
subl %ecx, %eax
addl $0x1, %eax
movw %ax, -0x30(%rbp)
movl -0x14(%rbp), %edi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rdx
callq 0xcfa0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x53722
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x53a01
movq -0x28(%rbp), %rdi
callq 0xc9f0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x5373f
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x53a01
movl $0x1, %edi
movl $0x1080, %esi           # imm = 0x1080
callq 0xc870
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x53789
movq 0x29898(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x12966(%rip), %rsi     # 0x660d0
leaq 0x18c83(%rip), %rdx     # 0x6c3f4
movl $0x2454, %ecx           # imm = 0x2454
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x53a01
jmp 0x5378b
movzwl -0x30(%rbp), %eax
movl %eax, %edi
movl $0x8, %esi
callq 0xc870
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x537cf
movq 0x2984b(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x12919(%rip), %rsi     # 0x660d0
leaq 0x18c36(%rip), %rdx     # 0x6c3f4
movl $0x2457, %ecx           # imm = 0x2457
movb $0x0, %al
callq 0xc8f0
jmp 0x539f2
jmp 0x537d1
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movw -0x30(%rbp), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x32(%rax)
movl -0x14(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x24(%rax)
movw -0x16(%rbp), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x28(%rax)
movl -0x1c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x2c(%rax)
movw -0x1e(%rbp), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x30(%rax)
movq -0x40(%rbp), %rdi
callq 0xd120
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x5382c
jmp 0x539f2
movq -0x40(%rbp), %rdi
addq $0x38, %rdi
movl -0x14(%rbp), %esi
movw -0x16(%rbp), %ax
movl -0x1c(%rbp), %ecx
movzwl %ax, %edx
movzwl -0x1e(%rbp), %r8d
callq 0xcdc0
movq -0x40(%rbp), %rdi
addq $0x858, %rdi            # imm = 0x858
movl -0x14(%rbp), %esi
movw -0x16(%rbp), %ax
movl -0x1c(%rbp), %ecx
movzwl %ax, %edx
movzwl -0x1e(%rbp), %r8d
callq 0xcdc0
cmpq $0x0, -0x28(%rbp)
je 0x53987
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xcb20
movq -0x28(%rbp), %rax
movb 0x10(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x20(%rax)
movq -0x28(%rbp), %rax
movb 0xd(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x1a(%rax)
movq -0x28(%rbp), %rax
movb 0xc(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x19(%rax)
movq -0x28(%rbp), %rax
movb 0x9(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x1b(%rax)
movq -0x28(%rbp), %rax
movb 0x8(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x1d(%rax)
movq -0x28(%rbp), %rax
movb 0xa(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x1c(%rax)
movq -0x28(%rbp), %rax
movb 0xb(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x18(%rax)
movq -0x28(%rbp), %rax
cmpb $0x0, 0x8(%rax)
je 0x538f9
movq -0x40(%rbp), %rax
movb $0x1, 0x1b(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x53921
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xd0d0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x5391f
jmp 0x539f2
jmp 0x53921
movq -0x28(%rbp), %rax
cmpb $0x0, 0x10(%rax)
je 0x53950
movq -0x40(%rbp), %rdi
addq $0x858, %rdi            # imm = 0x858
movl -0x14(%rbp), %esi
movw -0x16(%rbp), %ax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movzwl %ax, %edx
movzwl -0x1e(%rbp), %r8d
callq 0xcdc0
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
je 0x53985
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x53983
movl $0x1, -0x34(%rbp)
jmp 0x539f2
jmp 0x53985
jmp 0x53987
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xcd10
movq -0x40(%rbp), %rax
movq $0x0, 0x1078(%rax)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
addq $0x1078, %rcx           # imm = 0x1078
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movw 0xa0(%rax), %cx
addw $0x1, %cx
movw %cx, 0xa0(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x53a01
movq -0x40(%rbp), %rdi
callq 0x46680
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)