// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: validate_conditional_data_bar
lxw_error
_validate_conditional_data_bar(lxw_worksheet *self,
                               lxw_cond_format_obj *cond_format,
                               lxw_conditional_format *user_options)
{
    uint8_t min_rule_type = user_options->min_rule_type;
    uint8_t max_rule_type = user_options->max_rule_type;

    if (user_options->data_bar_2010
        || user_options->bar_solid
        || user_options->bar_no_border
        || user_options->bar_direction
        || user_options->bar_axis_position
        || user_options->bar_negative_color_same
        || user_options->bar_negative_border_color_same
        || user_options->bar_negative_color
        || user_options->bar_border_color
        || user_options->bar_negative_border_color
        || user_options->bar_axis_color) {

        cond_format->data_bar_2010 = LXW_TRUE;
        self->excel_version = 2010;
    }

    if (min_rule_type > LXW_CONDITIONAL_RULE_TYPE_MINIMUM
        && min_rule_type < LXW_CONDITIONAL_RULE_TYPE_MAXIMUM) {
        cond_format->min_rule_type = min_rule_type;
        cond_format->min_value = user_options->min_value;
        cond_format->min_value_string =
            lxw_strdup_formula(user_options->min_value_string);
    }
    else {
        cond_format->min_rule_type = LXW_CONDITIONAL_RULE_TYPE_MINIMUM;
        cond_format->min_value = 0;
    }

    if (max_rule_type > LXW_CONDITIONAL_RULE_TYPE_MINIMUM
        && max_rule_type < LXW_CONDITIONAL_RULE_TYPE_MAXIMUM) {
        cond_format->max_rule_type = max_rule_type;
        cond_format->max_value = user_options->max_value;
        cond_format->max_value_string =
            lxw_strdup_formula(user_options->max_value_string);
    }
    else {
        cond_format->max_rule_type = LXW_CONDITIONAL_RULE_TYPE_MAXIMUM;
        cond_format->max_value = 0;
    }

    if (cond_format->data_bar_2010) {
        if (min_rule_type == LXW_CONDITIONAL_RULE_TYPE_NONE)
            cond_format->auto_min = LXW_TRUE;
        if (max_rule_type == LXW_CONDITIONAL_RULE_TYPE_NONE)
            cond_format->auto_max = LXW_TRUE;
    }

    cond_format->bar_only = user_options->bar_only;
    cond_format->bar_solid = user_options->bar_solid;
    cond_format->bar_no_border = user_options->bar_no_border;
    cond_format->bar_direction = user_options->bar_direction;
    cond_format->bar_axis_position = user_options->bar_axis_position;
    cond_format->bar_negative_color_same =
        user_options->bar_negative_color_same;
    cond_format->bar_negative_border_color_same =
        user_options->bar_negative_border_color_same;

    if (user_options->bar_color != LXW_COLOR_UNSET)
        cond_format->bar_color = user_options->bar_color;
    else
        cond_format->bar_color = 0x638EC6;

    if (user_options->bar_negative_color != LXW_COLOR_UNSET)
        cond_format->bar_negative_color = user_options->bar_negative_color;
    else
        cond_format->bar_negative_color = 0xFF0000;

    if (user_options->bar_border_color != LXW_COLOR_UNSET)
        cond_format->bar_border_color = user_options->bar_border_color;
    else
        cond_format->bar_border_color = cond_format->bar_color;

    if (user_options->bar_negative_border_color != LXW_COLOR_UNSET)
        cond_format->bar_negative_border_color =
            user_options->bar_negative_border_color;
    else
        cond_format->bar_negative_border_color = 0xFF0000;

    if (user_options->bar_axis_color != LXW_COLOR_UNSET)
        cond_format->bar_axis_color = user_options->bar_axis_color;
    else
        cond_format->bar_axis_color = 0x000000;

    return LXW_NO_ERROR;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movb 0x30(%rdx), %r12b
movb 0x60(%rdx), %r15b
cmpb $0x0, 0x6d(%rdx)
jne 0x33fa8
cmpb $0x0, 0x6e(%r14)
jne 0x33fa8
cmpb $0x0, 0x7e(%r14)
jne 0x33fa8
cmpb $0x0, 0x7f(%r14)
jne 0x33fa8
cmpb $0x0, 0x80(%r14)
jne 0x33fa8
cmpb $0x0, 0x7c(%r14)
jne 0x33fa8
cmpb $0x0, 0x7d(%r14)
jne 0x33fa8
cmpl $0x0, 0x70(%r14)
jne 0x33fa8
cmpl $0x0, 0x74(%r14)
jne 0x33fa8
cmpl $0x0, 0x78(%r14)
jne 0x33fa8
cmpl $0x0, 0x84(%r14)
je 0x33fb5
movb $0x1, 0x50(%rbx)
movw $0x7da, 0x340(%rdi)     # imm = 0x7DA
leal -0x2(%r12), %eax
cmpb $0x3, %al
ja 0x33fdc
movb %r12b, 0x18(%rbx)
movsd 0x20(%r14), %xmm0
movsd %xmm0, 0x8(%rbx)
movq 0x28(%r14), %rdi
callq 0xc0e0
movq %rax, 0x10(%rbx)
jmp 0x33fe8
movb $0x1, 0x18(%rbx)
movq $0x0, 0x8(%rbx)
leal -0x2(%r15), %eax
cmpb $0x3, %al
ja 0x3400e
movb %r15b, 0x49(%rbx)
movsd 0x50(%r14), %xmm0
movsd %xmm0, 0x38(%rbx)
movq 0x58(%r14), %rdi
callq 0xc0e0
movq %rax, 0x40(%rbx)
jmp 0x3401a
movb $0x6, 0x49(%rbx)
movq $0x0, 0x38(%rbx)
cmpb $0x0, 0x50(%rbx)
je 0x34032
testb %r12b, %r12b
jne 0x34029
movb $0x1, 0x51(%rbx)
testb %r15b, %r15b
jne 0x34032
movb $0x1, 0x52(%rbx)
movb 0x6c(%r14), %al
movb %al, 0x53(%rbx)
movb 0x6e(%r14), %al
movb %al, 0x54(%rbx)
movb 0x80(%r14), %al
movb %al, 0x59(%rbx)
movl 0x7c(%r14), %eax
movl %eax, 0x55(%rbx)
movl 0x68(%r14), %eax
testl %eax, %eax
movl $0x638ec6, %ecx         # imm = 0x638EC6
cmovnel %eax, %ecx
movl %ecx, 0x5c(%rbx)
movq 0x70(%r14), %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movd %ecx, %xmm2
movdqa 0x12654(%rip), %xmm3    # 0x466d0
punpckldq %xmm2, %xmm3    # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
pand %xmm1, %xmm3
pandn %xmm0, %xmm1
por %xmm3, %xmm1
movq %xmm1, 0x60(%rbx)
movl 0x78(%r14), %eax
testl %eax, %eax
movl $0xff0000, %ecx         # imm = 0xFF0000
cmovnel %eax, %ecx
movl %ecx, 0x68(%rbx)
movl 0x84(%r14), %eax
movl %eax, 0x6c(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq