// File: AndreRenaud[P]simple_uart/./acutest.h
// Function: acutest_colored_printf_
acutest_colored_printf_(int color, const char* fmt, ...)
{
    va_list args;
    char buffer[256];
    int n;

    va_start(args, fmt);
    vsnprintf(buffer, sizeof(buffer), fmt, args);
    va_end(args);
    buffer[sizeof(buffer)-1] = '\0';

    if(!acutest_colorize_) {
        return printf("%s", buffer);
    }

#if defined ACUTEST_UNIX_
    {
        const char* col_str;
        switch(color) {
            case ACUTEST_COLOR_RED_:                col_str = "\033[0;31m"; break;
            case ACUTEST_COLOR_GREEN_:              col_str = "\033[0;32m"; break;
            case ACUTEST_COLOR_YELLOW_:             col_str = "\033[0;33m"; break;
            case ACUTEST_COLOR_RED_INTENSIVE_:      col_str = "\033[1;31m"; break;
            case ACUTEST_COLOR_GREEN_INTENSIVE_:    col_str = "\033[1;32m"; break;
            case ACUTEST_COLOR_YELLOW_INTENSIVE_:   col_str = "\033[1;33m"; break;
            case ACUTEST_COLOR_DEFAULT_INTENSIVE_:  col_str = "\033[1m"; break;
            default:                                col_str = "\033[0m"; break;
        }
        printf("%s", col_str);
        n = printf("%s", buffer);
        printf("\033[0m");
        return n;
    }
#elif defined ACUTEST_WIN_
    {
        HANDLE h;
        CONSOLE_SCREEN_BUFFER_INFO info;
        WORD attr;

        h = GetStdHandle(STD_OUTPUT_HANDLE);
        GetConsoleScreenBufferInfo(h, &info);

        switch(color) {
            case ACUTEST_COLOR_RED_:                attr = FOREGROUND_RED; break;
            case ACUTEST_COLOR_GREEN_:              attr = FOREGROUND_GREEN; break;
            case ACUTEST_COLOR_YELLOW_:             attr = FOREGROUND_RED | FOREGROUND_GREEN; break;
            case ACUTEST_COLOR_RED_INTENSIVE_:      attr = FOREGROUND_RED | FOREGROUND_INTENSITY; break;
            case ACUTEST_COLOR_GREEN_INTENSIVE_:    attr = FOREGROUND_GREEN | FOREGROUND_INTENSITY; break;
            case ACUTEST_COLOR_DEFAULT_INTENSIVE_:  attr = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY; break;
            case ACUTEST_COLOR_YELLOW_INTENSIVE_:   attr = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; break;
            default:                                attr = 0; break;
        }
        if(attr != 0)
            SetConsoleTextAttribute(h, attr);
        n = printf("%s", buffer);
        SetConsoleTextAttribute(h, info.wAttributes);
        return n;
    }
#else
    n = printf("%s", buffer);
    return n;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
testb %al, %al
je 0x2bb7
movaps %xmm0, -0x1c0(%rbp)
movaps %xmm1, -0x1b0(%rbp)
movaps %xmm2, -0x1a0(%rbp)
movaps %xmm3, -0x190(%rbp)
movaps %xmm4, -0x180(%rbp)
movaps %xmm5, -0x170(%rbp)
movaps %xmm6, -0x160(%rbp)
movaps %xmm7, -0x150(%rbp)
movq %r9, -0x1c8(%rbp)
movq %r8, -0x1d0(%rbp)
movq %rcx, -0x1d8(%rbp)
movq %rdx, -0x1e0(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x30(%rbp), %rax
leaq -0x1f0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
leaq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq -0x30(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x20b0
leaq -0x30(%rbp), %rax
movb $0x0, -0x31(%rbp)
cmpl $0x0, 0xa83a(%rip)      # 0xd460
jne 0x2c45
leaq -0x130(%rbp), %rsi
leaq 0x6cce(%rip), %rdi      # 0x9904
movb $0x0, %al
callq 0x2160
movl %eax, -0x4(%rbp)
jmp 0x2d38
movl -0x8(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x1f8(%rbp)
subl $0xc, %eax
ja 0x2ce3
movq -0x1f8(%rbp), %rax
leaq 0x63a6(%rip), %rcx      # 0x9010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6c4b(%rip), %rax      # 0x98c5
movq %rax, -0x140(%rbp)
jmp 0x2cf1
leaq 0x6c43(%rip), %rax      # 0x98cd
movq %rax, -0x140(%rbp)
jmp 0x2cf1
leaq 0x6c3b(%rip), %rax      # 0x98d5
movq %rax, -0x140(%rbp)
jmp 0x2cf1
leaq 0x6c33(%rip), %rax      # 0x98dd
movq %rax, -0x140(%rbp)
jmp 0x2cf1
leaq 0x6c2b(%rip), %rax      # 0x98e5
movq %rax, -0x140(%rbp)
jmp 0x2cf1
leaq 0x6c23(%rip), %rax      # 0x98ed
movq %rax, -0x140(%rbp)
jmp 0x2cf1
leaq 0x6c1b(%rip), %rax      # 0x98f5
movq %rax, -0x140(%rbp)
jmp 0x2cf1
leaq 0x6c10(%rip), %rax      # 0x98fa
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rsi
leaq 0x6c05(%rip), %rdi      # 0x9904
movb $0x0, %al
callq 0x2160
leaq -0x130(%rbp), %rsi
leaq 0x6bf0(%rip), %rdi      # 0x9904
movb $0x0, %al
callq 0x2160
movl %eax, -0x134(%rbp)
leaq 0x6bd2(%rip), %rdi      # 0x98fa
movb $0x0, %al
callq 0x2160
movl -0x134(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
nopw %cs:(%rax,%rax)