// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: check_and_copy_table_style
void
_check_and_copy_table_style(lxw_table_obj *table_obj,
                            lxw_table_options *user_options)
{
    if (!user_options)
        return;

    /* Set the defaults. */
    table_obj->style_type = LXW_TABLE_STYLE_TYPE_MEDIUM;
    table_obj->style_type_number = 9;

    if (user_options->style_type > LXW_TABLE_STYLE_TYPE_DARK) {
        LXW_WARN_FORMAT1
            ("worksheet_add_table(): invalid style_type = %d. "
             "Using default TableStyleMedium9", user_options->style_type);

        table_obj->style_type = LXW_TABLE_STYLE_TYPE_MEDIUM;
        table_obj->style_type_number = 9;
    }
    else {
        table_obj->style_type = user_options->style_type;
    }

    /* Each type (light, medium and dark) has a different number of styles. */
    if (user_options->style_type == LXW_TABLE_STYLE_TYPE_LIGHT) {
        if (user_options->style_type_number > 21) {
            LXW_WARN_FORMAT1("worksheet_add_table(): "
                             "invalid style_type_number = %d for style type "
                             "LXW_TABLE_STYLE_TYPE_LIGHT. "
                             "Using default TableStyleMedium9",
                             user_options->style_type);

            table_obj->style_type = LXW_TABLE_STYLE_TYPE_MEDIUM;
            table_obj->style_type_number = 9;
        }
        else {
            table_obj->style_type_number = user_options->style_type_number;
        }
    }

    if (user_options->style_type == LXW_TABLE_STYLE_TYPE_MEDIUM) {
        if (user_options->style_type_number < 1
            || user_options->style_type_number > 28) {
            LXW_WARN_FORMAT1("worksheet_add_table(): "
                             "invalid style_type_number = %d for style type "
                             "LXW_TABLE_STYLE_TYPE_MEDIUM. "
                             "Using default TableStyleMedium9",
                             user_options->style_type_number);

            table_obj->style_type = LXW_TABLE_STYLE_TYPE_MEDIUM;
            table_obj->style_type_number = 9;
        }
        else {
            table_obj->style_type_number = user_options->style_type_number;
        }
    }

    if (user_options->style_type == LXW_TABLE_STYLE_TYPE_DARK) {
        if (user_options->style_type_number < 1
            || user_options->style_type_number > 11) {
            LXW_WARN_FORMAT1("worksheet_add_table(): "
                             "invalid style_type_number = %d for style type "
                             "LXW_TABLE_STYLE_TYPE_DARK. "
                             "Using default TableStyleMedium9",
                             user_options->style_type_number);

            table_obj->style_type = LXW_TABLE_STYLE_TYPE_MEDIUM;
            table_obj->style_type_number = 9;
        }
        else {
            table_obj->style_type_number = user_options->style_type_number;
        }
    }
}

// Assembly:
testq %rsi, %rsi
je 0x2ff89
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movw $0x902, 0x1e(%rdi)      # imm = 0x902
movzbl 0xe(%rsi), %edx
movl %edx, %eax
cmpl $0x4, %edx
jae 0x2ff8a
movb %dl, 0x1e(%rbx)
cmpb $0x1, %al
jne 0x2ff5a
movb 0xf(%r14), %al
cmpb $0x16, %al
jb 0x2ff7f
movq 0x270be(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x16b6e(%rip), %rsi     # 0x46ab2
movl $0x1, %edx
xorl %eax, %eax
callq 0xc870
movw $0x902, 0x1e(%rbx)      # imm = 0x902
movb 0xe(%r14), %al
cmpb $0x2, %al
jne 0x2ff6f
movb 0xf(%r14), %cl
leal -0x1d(%rcx), %edx
movb $0x2, %al
cmpb $-0x1d, %dl
jbe 0x2ffb1
movb %cl, 0x1f(%rbx)
cmpb $0x3, %al
jne 0x2ff82
movb 0xf(%r14), %al
leal -0xc(%rax), %ecx
cmpb $-0xc, %cl
jbe 0x2ffd8
movb %al, 0x1f(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x27067(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x16abb(%rip), %rsi     # 0x46a56
xorl %eax, %eax
callq 0xc870
movb $0x9, 0x1f(%rbx)
movb 0xe(%r14), %al
movb $0x2, %dl
jmp 0x2ff24
movzbl %cl, %edx
movq 0x2703d(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x16b7a(%rip), %rsi     # 0x46b3f
xorl %eax, %eax
callq 0xc870
movb $0x2, 0x1e(%rbx)
movb 0xe(%r14), %al
movb $0x9, %cl
jmp 0x2ff6c
movzbl %al, %edx
movq 0x27016(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x16be1(%rip), %rsi     # 0x46bcd
xorl %eax, %eax
callq 0xc870
movb $0x2, 0x1e(%rbx)
movb $0x9, %al
jmp 0x2ff7f