// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpb $0x0, 0x11c(%rdi)
jne 0x38b64
movl %r8d, %r13d
movl %ecx, %ebp
cmpl %ecx, %esi
movl %ecx, %r12d
cmoval %esi, %r12d
cmovbl %esi, %ebp
cmpw %r13w, %dx
movl %r8d, %r14d
cmoval %edx, %r14d
cmovbl %edx, %r13d
cmpl $0x100000, %r12d        # imm = 0x100000
setae %al
cmpw $0x4000, %r14w          # imm = 0x4000
setae %cl
orb %al, %cl
je 0x38aad
pushq $0x17
popq %r15
jmp 0x38ad5
movq %r9, %rbx
movq %rdi, 0x20(%rsp)
movl %ebp, %edi
movl %r12d, %esi
movq %r9, %rdx
callq 0xcf70
testl %eax, %eax
jne 0x38ad2
movq %rbx, %rdi
callq 0xc9d0
testl %eax, %eax
je 0x38ae7
movl %eax, %r15d
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
movl $0x1080, %esi           # imm = 0x1080
callq 0xc850
testq %rax, %rax
je 0x38cc2
movq %rax, 0x8(%rsp)
movl %r14d, %r15d
subl %r13d, %r15d
incl %r15d
movzwl %r15w, %edi
pushq $0x8
popq %rsi
callq 0xc850
testq %rax, %rax
je 0x38ced
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rcx)
movw %r15w, 0x32(%rcx)
movq %rcx, %r15
movl %ebp, 0x24(%rcx)
movw %r13w, 0x28(%rcx)
movl %r12d, 0x2c(%rcx)
movw %r14w, 0x30(%rcx)
movq %rcx, %rdi
callq 0xd0f0
pushq $0x1
popq %rcx
testl %eax, %eax
je 0x38b87
movq %r15, %rbx
movl %ecx, %r15d
movq %rbx, %rdi
callq 0x2c917
jmp 0x38ad5
movq 0x1a48d(%rip), %rax     # 0x52ff8
movq (%rax), %rcx
leaq 0xbee9(%rip), %rdi      # 0x44a5e
pushq $0x5e
popq %rsi
pushq $0x1
popq %rdx
callq 0xd000
pushq $0xb
jmp 0x38aa9
leaq 0x38(%r15), %rdi
movzwl %r13w, %r13d
movzwl %r14w, %r14d
movl %ebp, %esi
movl %r13d, %edx
movl %r12d, %ecx
movl %r14d, %r8d
callq 0xcd90
leaq 0x858(%r15), %rdi
movq %rdi, 0x18(%rsp)
movl %ebp, %esi
movl %r13d, %edx
movl %r12d, %ecx
movl %r14d, 0x14(%rsp)
movl %r14d, %r8d
callq 0xcd90
movq %rbx, %r14
testq %rbx, %rbx
movq %r15, %rbx
je 0x38c78
movq %rbx, %rdi
movq %r14, %rsi
callq 0xcae0
movb 0x10(%r14), %al
movb %al, 0x20(%rbx)
movb 0xd(%r14), %cl
movb %cl, 0x1a(%rbx)
movb 0xc(%r14), %cl
movb %cl, 0x19(%rbx)
movb 0x9(%r14), %cl
movb %cl, 0x1b(%rbx)
movb 0x8(%r14), %cl
movb %cl, 0x1d(%rbx)
movb 0xa(%r14), %dl
movb %dl, 0x1c(%rbx)
movb 0xb(%r14), %dl
movb %dl, 0x18(%rbx)
testb %cl, %cl
je 0x38c17
movb $0x1, 0x1b(%rbx)
cmpq $0x0, 0x18(%r14)
je 0x38c38
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd0a0
movl %eax, %r15d
testl %eax, %eax
jne 0x38b57
movb 0x10(%r14), %al
testb %al, %al
je 0x38c56
decl %r12d
movq 0x18(%rsp), %rdi
movl %ebp, %esi
movl %r13d, %edx
movl %r12d, %ecx
movl 0x14(%rsp), %r8d
callq 0xcd90
movq (%r14), %rdi
testq %rdi, %rdi
movq 0x8(%rsp), %rbx
je 0x38c78
callq 0xcd50
movq %rax, (%rbx)
pushq $0x1
popq %r15
testq %rax, %rax
je 0x38b57
movq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xcce0
movq %rbx, %rax
addq $0x1078, %rax           # imm = 0x1078
andq $0x0, 0x1078(%rbx)
movq 0x98(%r14), %rcx
movq 0x8(%rcx), %rcx
movq %rbx, (%rcx)
movq 0x98(%r14), %rcx
movq %rax, 0x8(%rcx)
incw 0xa0(%r14)
xorl %r15d, %r15d
jmp 0x38ad5
movq 0x1a32f(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x440d(%rip), %rsi      # 0x3d0e0
leaq 0xad06(%rip), %rdx      # 0x439e0
movl $0x2454, %ecx           # imm = 0x2454
xorl %eax, %eax
callq 0xc8d0
pushq $0x1
jmp 0x38aa9
movq 0x1a304(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x43e2(%rip), %rsi      # 0x3d0e0
leaq 0xacdb(%rip), %rdx      # 0x439e0
xorl %r15d, %r15d
movl $0x2457, %ecx           # imm = 0x2457
xorl %eax, %eax
callq 0xc8d0
movq 0x8(%rsp), %rbx
jmp 0x38b57