// File: /workspace/github_c_makefile_star2_O2/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 0x2cd45
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 0x2cd46
movb %dl, 0x1e(%rbx)
cmpb $0x1, %al
jne 0x2cd16
movb 0xf(%r14), %al
cmpb $0x16, %al
jb 0x2cd3b
movq 0x26300(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x16d9c(%rip), %rsi     # 0x43a9e
pushq $0x1
popq %rdx
xorl %eax, %eax
callq 0xc8d0
movw $0x902, 0x1e(%rbx)      # imm = 0x902
movb 0xe(%r14), %al
cmpb $0x2, %al
jne 0x2cd2b
movb 0xf(%r14), %cl
leal -0x1d(%rcx), %edx
movb $0x2, %al
cmpb $-0x1d, %dl
jbe 0x2cd6d
movb %cl, 0x1f(%rbx)
cmpb $0x3, %al
jne 0x2cd3e
movb 0xf(%r14), %al
leal -0xc(%rax), %ecx
cmpb $-0xc, %cl
jbe 0x2cd94
movb %al, 0x1f(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x262ab(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x16ceb(%rip), %rsi     # 0x43a42
xorl %eax, %eax
callq 0xc8d0
movb $0x9, 0x1f(%rbx)
movb 0xe(%r14), %al
movb $0x2, %dl
jmp 0x2cce2
movzbl %cl, %edx
movq 0x26281(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x16daa(%rip), %rsi     # 0x43b2b
xorl %eax, %eax
callq 0xc8d0
movb $0x2, 0x1e(%rbx)
movb 0xe(%r14), %al
movb $0x9, %cl
jmp 0x2cd28
movzbl %al, %edx
movq 0x2625a(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x16e11(%rip), %rsi     # 0x43bb9
xorl %eax, %eax
callq 0xc8d0
movb $0x2, 0x1e(%rbx)
movb $0x9, %al
jmp 0x2cd3b