// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: validate_conditional_scale
lxw_error
_validate_conditional_scale(lxw_cond_format_obj *cond_format,
                            lxw_conditional_format *user_options)
{
    uint8_t min_rule_type = user_options->min_rule_type;
    uint8_t mid_rule_type = user_options->mid_rule_type;
    uint8_t max_rule_type = user_options->max_rule_type;

    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->type == LXW_CONDITIONAL_3_COLOR_SCALE) {
        if (mid_rule_type > LXW_CONDITIONAL_RULE_TYPE_MINIMUM
            && mid_rule_type < LXW_CONDITIONAL_RULE_TYPE_MAXIMUM) {
            cond_format->mid_rule_type = mid_rule_type;
            cond_format->mid_value = user_options->mid_value;
            cond_format->mid_value_string =
                lxw_strdup_formula(user_options->mid_value_string);
        }
        else {
            cond_format->mid_rule_type = LXW_CONDITIONAL_RULE_TYPE_PERCENTILE;
            cond_format->mid_value = 50;
        }
    }

    if (user_options->min_color != LXW_COLOR_UNSET)
        cond_format->min_color = user_options->min_color;
    else
        cond_format->min_color = 0xFF7128;

    if (user_options->max_color != LXW_COLOR_UNSET)
        cond_format->max_color = user_options->max_color;
    else
        cond_format->max_color = 0xFFEF9C;

    if (cond_format->type == LXW_CONDITIONAL_3_COLOR_SCALE) {
        if (user_options->min_color == LXW_COLOR_UNSET)
            cond_format->min_color = 0xF8696B;

        if (user_options->mid_color != LXW_COLOR_UNSET)
            cond_format->mid_color = user_options->mid_color;
        else
            cond_format->mid_color = 0xFFEB84;

        if (user_options->max_color == LXW_COLOR_UNSET)
            cond_format->max_color = 0x63BE7B;
    }

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movb 0x30(%rax), %al
movb %al, -0x11(%rbp)
movq -0x10(%rbp), %rax
movb 0x48(%rax), %al
movb %al, -0x12(%rbp)
movq -0x10(%rbp), %rax
movb 0x60(%rax), %al
movb %al, -0x13(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x1, %eax
jle 0x4cb36
movzbl -0x11(%rbp), %eax
cmpl $0x6, %eax
jge 0x4cb36
movb -0x11(%rbp), %cl
movq -0x8(%rbp), %rax
movb %cl, 0x18(%rax)
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xc0f0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x4cb4a
movq -0x8(%rbp), %rax
movb $0x1, 0x18(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movzbl -0x13(%rbp), %eax
cmpl $0x1, %eax
jle 0x4cb92
movzbl -0x13(%rbp), %eax
cmpl $0x6, %eax
jge 0x4cb92
movb -0x13(%rbp), %cl
movq -0x8(%rbp), %rax
movb %cl, 0x49(%rax)
movq -0x10(%rbp), %rax
movsd 0x50(%rax), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xc0f0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x4cba6
movq -0x8(%rbp), %rax
movb $0x6, 0x49(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x38(%rax)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xf, %eax
jne 0x4cc15
movzbl -0x12(%rbp), %eax
cmpl $0x1, %eax
jle 0x4cbfa
movzbl -0x12(%rbp), %eax
cmpl $0x6, %eax
jge 0x4cbfa
movb -0x12(%rbp), %cl
movq -0x8(%rbp), %rax
movb %cl, 0x31(%rax)
movq -0x10(%rbp), %rax
movsd 0x38(%rax), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xc0f0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x4cc13
movq -0x8(%rbp), %rax
movb $0x4, 0x31(%rax)
movq -0x8(%rbp), %rax
movsd 0x1f6d2(%rip), %xmm0    # 0x6c2e0
movsd %xmm0, 0x20(%rax)
jmp 0x4cc15
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
je 0x4cc2f
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x4cc3a
movq -0x8(%rbp), %rax
movl $0xff7128, 0x1c(%rax)   # imm = 0xFF7128
movq -0x10(%rbp), %rax
cmpl $0x0, 0x64(%rax)
je 0x4cc54
movq -0x10(%rbp), %rax
movl 0x64(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4c(%rax)
jmp 0x4cc5f
movq -0x8(%rbp), %rax
movl $0xffef9c, 0x4c(%rax)   # imm = 0xFFEF9C
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xf, %eax
jne 0x4ccbc
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jne 0x4cc80
movq -0x8(%rbp), %rax
movl $0xf8696b, 0x1c(%rax)   # imm = 0xF8696B
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
je 0x4cc9a
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x34(%rax)
jmp 0x4cca5
movq -0x8(%rbp), %rax
movl $0xffeb84, 0x34(%rax)   # imm = 0xFFEB84
movq -0x10(%rbp), %rax
cmpl $0x0, 0x64(%rax)
jne 0x4ccba
movq -0x8(%rbp), %rax
movl $0x63be7b, 0x4c(%rax)   # imm = 0x63BE7B
jmp 0x4ccbc
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)