// File: /workspace/github_c_makefile_star2_O0/aremmell[P]libsir/src/sirhelpers.c
// Function: _sir_validtextcolor
bool __sir_validtextcolor(sir_colormode mode, sir_textcolor color, const char* func,
    const char* file, uint32_t line) {
    bool valid = false;
    switch (mode) {
        case SIRCM_16:
            /* in 16-color mode:
             * compare to 30..37, 39, 40..47, 49, 90..97, 100..107. */
            valid = SIRTC_DEFAULT == color ||
                    (color >= 30U && color <= 37U) || color == 39U ||
                    (color >= 40U && color <= 47U) || color == 49U ||
                    (color >= 90U && color <= 97U) || (color >= 100U && color <= 107U);
            break;
        case SIRCM_256:
            /* in 256-color mode: compare to 0..255. sir_textcolor is unsigned,
             * so only need to ensure it's <= 255. */
            valid = SIRTC_DEFAULT == color || color <= 255U;
            break;
        case SIRCM_RGB: {
            /* in RGB-color mode: mask and compare to 0x00ffffff. */
            valid = SIRTC_DEFAULT == color || ((color & 0xff000000U) == 0U);
            break;
        }
        case SIRCM_INVALID: // GCOVR_EXCL_START
        default:
            valid = false;
            break;
    } // GCOVR_EXCL_STOP

    if (!valid) {
        _sir_selflog("invalid text color for mode %d %08"PRIx32" (%"PRIu32")",
            mode, color, color);
        (void)__sir_seterror(_SIR_E_TEXTCOLOR, func, file, line);
    }

    return valid;
}

// Assembly:
subq $0x38, %rsp
movl %edi, 0x34(%rsp)
movl %esi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movl %r8d, 0x1c(%rsp)
movb $0x0, 0x1b(%rsp)
movl 0x34(%rsp), %eax
movq %rax, 0x10(%rsp)
subq $0x3, %rax
ja 0x82fa
movq 0x10(%rsp), %rax
leaq 0x8d29(%rip), %rcx      # 0x10f28
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, %al
movl $0x100, %ecx            # imm = 0x100
cmpl 0x30(%rsp), %ecx
movb %al, 0xf(%rsp)
je 0x8290
cmpl $0x1e, 0x30(%rsp)
jb 0x822d
movb $0x1, %al
cmpl $0x25, 0x30(%rsp)
movb %al, 0xf(%rsp)
jbe 0x8290
movb $0x1, %al
cmpl $0x27, 0x30(%rsp)
movb %al, 0xf(%rsp)
je 0x8290
cmpl $0x28, 0x30(%rsp)
jb 0x824e
movb $0x1, %al
cmpl $0x2f, 0x30(%rsp)
movb %al, 0xf(%rsp)
jbe 0x8290
movb $0x1, %al
cmpl $0x31, 0x30(%rsp)
movb %al, 0xf(%rsp)
je 0x8290
cmpl $0x5a, 0x30(%rsp)
jb 0x826f
movb $0x1, %al
cmpl $0x61, 0x30(%rsp)
movb %al, 0xf(%rsp)
jbe 0x8290
xorl %eax, %eax
cmpl $0x64, 0x30(%rsp)
movb %al, 0xe(%rsp)
jb 0x8288
cmpl $0x6b, 0x30(%rsp)
setbe %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0x1b(%rsp)
jmp 0x82ff
movb $0x1, %al
movl $0x100, %ecx            # imm = 0x100
cmpl 0x30(%rsp), %ecx
movb %al, 0xd(%rsp)
je 0x82bc
cmpl $0xff, 0x30(%rsp)
setbe %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
andb $0x1, %al
movb %al, 0x1b(%rsp)
jmp 0x82ff
movb $0x1, %al
movl $0x100, %ecx            # imm = 0x100
cmpl 0x30(%rsp), %ecx
movb %al, 0xc(%rsp)
je 0x82ec
movl 0x30(%rsp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
cmpl $0x0, %eax
sete %al
movb %al, 0xc(%rsp)
movb 0xc(%rsp), %al
andb $0x1, %al
movb %al, 0x1b(%rsp)
jmp 0x82ff
jmp 0x82fa
movb $0x0, 0x1b(%rsp)
testb $0x1, 0x1b(%rsp)
jne 0x8338
movl 0x34(%rsp), %esi
movl 0x30(%rsp), %edx
movl 0x30(%rsp), %ecx
leaq 0x8cc3(%rip), %rdi      # 0x10fdc
movb $0x0, %al
callq 0x8070
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl 0x1c(%rsp), %ecx
movl $0x80120000, %edi       # imm = 0x80120000
callq 0x3940
movb 0x1b(%rsp), %al
andb $0x1, %al
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)