// File: /workspace/github_c_makefile_star2_O0/neovim[P]libvterm/bin/unterm.c
// Function: dump_cell_color
static int dump_cell_color(const VTermColor *col, int sgri, int sgr[], int fg)
{
    /* Reset the color if the given color is the default color */
    if (fg && VTERM_COLOR_IS_DEFAULT_FG(col)) {
        sgr[sgri++] = 39;
        return sgri;
    }
    if (!fg && VTERM_COLOR_IS_DEFAULT_BG(col)) {
        sgr[sgri++] = 49;
        return sgri;
    }

    /* Decide whether to send an indexed color or an RGB color */
    if (VTERM_COLOR_IS_INDEXED(col)) {
        const uint8_t idx = col->indexed.idx;
        if (idx < 8) {
            sgr[sgri++] = (idx + (fg ? 30 : 40));
        }
        else if (idx < 16) {
            sgr[sgri++] = (idx - 8 + (fg ? 90 : 100));
        }
        else {
            sgr[sgri++] = (fg ? 38 : 48);
            sgr[sgri++] = 5;
            sgr[sgri++] = idx;
        }
    }
    else if (VTERM_COLOR_IS_RGB(col)) {
        sgr[sgri++] = (fg ? 38 : 48);
        sgr[sgri++] = 2;
        sgr[sgri++] = col->rgb.red;
        sgr[sgri++] = col->rgb.green;
        sgr[sgri++] = col->rgb.blue;
    }
    return sgri;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1cab
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1cab
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movl $0x27, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e8d
cmpl $0x0, -0x24(%rbp)
jne 0x1ce4
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1ce4
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movl $0x31, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e8d
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x1dda
movq -0x10(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x25(%rbp)
movzbl -0x25(%rbp), %eax
cmpl $0x8, %eax
jge 0x1d3d
movzbl -0x25(%rbp), %edx
movl -0x24(%rbp), %esi
movl $0x28, %eax
movl $0x1e, %ecx
cmpl $0x0, %esi
cmovnel %ecx, %eax
addl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1dd5
movzbl -0x25(%rbp), %eax
cmpl $0x10, %eax
jge 0x1d79
movzbl -0x25(%rbp), %edx
subl $0x8, %edx
movl -0x24(%rbp), %esi
movl $0x64, %eax
movl $0x5a, %ecx
cmpl $0x0, %esi
cmovnel %ecx, %eax
addl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1dd3
movl -0x24(%rbp), %ecx
movl $0x30, %edx
movl $0x26, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movl $0x5, (%rax,%rcx,4)
movzbl -0x25(%rbp), %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1dd5
jmp 0x1e87
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x1e85
movl -0x24(%rbp), %ecx
movl $0x30, %edx
movl $0x26, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movl $0x2, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1e87
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)