// File: /workspace/github_c_makefile_star2_O0/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: send_sgr
static int send_sgr(uintattr_t cfg, uintattr_t cbg, int fg_is_default,
    int bg_is_default) {
    int rv;
    char nbuf[32];

    if (fg_is_default && bg_is_default) {
        return TB_OK;
    }

    switch (global.output_mode) {
        default:
        case TB_OUTPUT_NORMAL:
            send_literal(rv, "\x1b[");
            if (!fg_is_default) {
                send_literal(rv, "3");
                send_num(rv, nbuf, cfg - 1);
                if (!bg_is_default) {
                    send_literal(rv, ";");
                }
            }
            if (!bg_is_default) {
                send_literal(rv, "4");
                send_num(rv, nbuf, cbg - 1);
            }
            send_literal(rv, "m");
            break;

        case TB_OUTPUT_256:
        case TB_OUTPUT_216:
        case TB_OUTPUT_GRAYSCALE:
            send_literal(rv, "\x1b[");
            if (!fg_is_default) {
                send_literal(rv, "38;5;");
                send_num(rv, nbuf, cfg);
                if (!bg_is_default) {
                    send_literal(rv, ";");
                }
            }
            if (!bg_is_default) {
                send_literal(rv, "48;5;");
                send_num(rv, nbuf, cbg);
            }
            send_literal(rv, "m");
            break;

#ifdef TB_OPT_TRUECOLOR
        case TB_OUTPUT_TRUECOLOR:
            send_literal(rv, "\x1b[");
            if (!fg_is_default) {
                send_literal(rv, "38;2;");
                send_num(rv, nbuf, (cfg >> 16) & 0xff);
                send_literal(rv, ";");
                send_num(rv, nbuf, (cfg >> 8) & 0xff);
                send_literal(rv, ";");
                send_num(rv, nbuf, cfg & 0xff);
                if (!bg_is_default) {
                    send_literal(rv, ";");
                }
            }
            if (!bg_is_default) {
                send_literal(rv, "48;2;");
                send_num(rv, nbuf, (cbg >> 16) & 0xff);
                send_literal(rv, ";");
                send_num(rv, nbuf, (cbg >> 8) & 0xff);
                send_literal(rv, ";");
                send_num(rv, nbuf, cbg & 0xff);
            }
            send_literal(rv, "m");
            break;
#endif
    }
    return TB_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movw %si, %ax
movw %di, %si
movw %si, -0x6(%rbp)
movw %ax, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movl %ecx, -0x10(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0xdfc4
cmpl $0x0, -0x10(%rbp)
je 0xdfc4
movl $0x0, -0x4(%rbp)
jmp 0xe326
movl 0x2df0a(%rip), %eax     # 0x3bed4
movl %eax, -0x44(%rbp)
subl $0x1, %eax
je 0xdfe7
jmp 0xdfd4
movl -0x44(%rbp), %eax
addl $-0x2, %eax
subl $0x3, %eax
jb 0xe18c
jmp 0xdfe5
jmp 0xdfe7
leaq 0x2deaa(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x2687f(%rip), %rsi     # 0x3487b
movl $0x2, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe019
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
cmpl $0x0, -0xc(%rbp)
jne 0xe0d6
leaq 0x2de6e(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x26e8e(%rip), %rsi     # 0x34ec6
movl $0x1, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe055
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movzwl -0x6(%rbp), %edi
subl $0x1, %edi
leaq -0x40(%rbp), %rsi
callq 0xe330
movq -0x50(%rbp), %rsi
movslq %eax, %rdx
leaq 0x2de1d(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe09a
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
cmpl $0x0, -0x10(%rbp)
jne 0xe0d4
leaq 0x2ddf1(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x267cd(%rip), %rsi     # 0x34882
movl $0x1, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe0d2
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
jmp 0xe0d4
jmp 0xe0d6
cmpl $0x0, -0x10(%rbp)
jne 0xe155
leaq 0x2ddb5(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x26dd9(%rip), %rsi     # 0x34eca
movl $0x1, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe10e
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
leaq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movzwl -0x8(%rbp), %edi
subl $0x1, %edi
leaq -0x40(%rbp), %rsi
callq 0xe330
movq -0x58(%rbp), %rsi
movslq %eax, %rdx
leaq 0x2dd64(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe153
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
jmp 0xe155
leaq 0x2dd3c(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x25fc7(%rip), %rsi     # 0x34131
movl $0x1, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe187
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
jmp 0xe31f
leaq 0x2dd05(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x266da(%rip), %rsi     # 0x3487b
movl $0x2, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe1be
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
cmpl $0x0, -0xc(%rbp)
jne 0xe278
leaq 0x2dcc9(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x266a1(%rip), %rsi     # 0x3487e
movl $0x5, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe1fa
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
leaq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movzwl -0x6(%rbp), %edi
leaq -0x40(%rbp), %rsi
callq 0xe330
movq -0x60(%rbp), %rsi
movslq %eax, %rdx
leaq 0x2dc7b(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe23c
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
cmpl $0x0, -0x10(%rbp)
jne 0xe276
leaq 0x2dc4f(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x2662b(%rip), %rsi     # 0x34882
movl $0x1, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe274
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
jmp 0xe276
jmp 0xe278
cmpl $0x0, -0x10(%rbp)
jne 0xe2ee
leaq 0x2dc13(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x265f1(%rip), %rsi     # 0x34884
movl $0x5, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe2ad
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
leaq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
movzwl -0x8(%rbp), %edi
leaq -0x40(%rbp), %rsi
callq 0xe330
movq -0x68(%rbp), %rsi
movslq %eax, %rdx
leaq 0x2dbc8(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe2ec
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
jmp 0xe2ee
leaq 0x2dba3(%rip), %rdi     # 0x3be98
addq $0x1a8, %rdi            # imm = 0x1A8
leaq 0x25e2e(%rip), %rsi     # 0x34131
movl $0x1, %edx
callq 0x8ae0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0xe31d
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe326
jmp 0xe31f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop