// File: /workspace/github_c_makefile_star2_O0/neovim[P]libvterm/src/pen.c
// Function: vterm_state_getpen_color
static int vterm_state_getpen_color(const VTermColor *col, int argi, long args[], int fg)
{
    /* Do nothing if the given color is the default color */
    if (( fg && VTERM_COLOR_IS_DEFAULT_FG(col)) ||
        (!fg && VTERM_COLOR_IS_DEFAULT_BG(col))) {
        return argi;
    }

    /* 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) {
            args[argi++] = (idx + (fg ? 30 : 40));
        }
        else if (idx < 16) {
            args[argi++] = (idx - 8 + (fg ? 90 : 100));
        }
        else {
            args[argi++] = CSI_ARG_FLAG_MORE | (fg ? 38 : 48);
            args[argi++] = CSI_ARG_FLAG_MORE | 5;
            args[argi++] = idx;
        }
    }
    else if (VTERM_COLOR_IS_RGB(col)) {
        args[argi++] = CSI_ARG_FLAG_MORE | (fg ? 38 : 48);
        args[argi++] = CSI_ARG_FLAG_MORE | 2;
        args[argi++] = CSI_ARG_FLAG_MORE | col->rgb.red;
        args[argi++] = CSI_ARG_FLAG_MORE | col->rgb.green;
        args[argi++] = col->rgb.blue;
    }
    return argi;
}

// 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 0x5de7
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x5dfc
cmpl $0x0, -0x24(%rbp)
jne 0x5e07
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x5e07
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5fea
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x5f14
movq -0x10(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x25(%rbp)
movzbl -0x25(%rbp), %eax
cmpl $0x8, %eax
jge 0x5e64
movzbl -0x25(%rbp), %eax
movl -0x24(%rbp), %esi
movl $0x28, %ecx
movl $0x1e, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
movslq %eax, %rdx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x5f0f
movzbl -0x25(%rbp), %eax
cmpl $0x10, %eax
jge 0x5ea4
movzbl -0x25(%rbp), %eax
subl $0x8, %eax
movl -0x24(%rbp), %esi
movl $0x64, %ecx
movl $0x5a, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
movslq %eax, %rdx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x5f0d
movl -0x24(%rbp), %edx
movl $0x30, %eax
movl $0x26, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, %eax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movl $0x80000005, %edx       # imm = 0x80000005
movq %rdx, (%rax,%rcx,8)
movzbl -0x25(%rbp), %eax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x5f0f
jmp 0x5fe4
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x5fe2
movl -0x24(%rbp), %edx
movl $0x30, %eax
movl $0x26, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, %eax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movl $0x80000002, %edx       # imm = 0x80000002
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, %eax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, %eax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x5fe4
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop