// File: /workspace/github_c_makefile_star2_O0/termbox[P]termbox/termbox.c
// Function: write_sgr
static void write_sgr(uint16_t fg, uint16_t bg) {
    char buf[32];

    if (fg == TB_DEFAULT && bg == TB_DEFAULT)
        return;

    switch (outputmode) {
    case TB_OUTPUT_256:
    case TB_OUTPUT_216:
    case TB_OUTPUT_GRAYSCALE:
        WRITE_LITERAL("\033[");
        if (fg != TB_DEFAULT) {
            WRITE_LITERAL("38;5;");
            WRITE_INT(fg);
            if (bg != TB_DEFAULT) {
                WRITE_LITERAL(";");
            }
        }
        if (bg != TB_DEFAULT) {
            WRITE_LITERAL("48;5;");
            WRITE_INT(bg);
        }
        WRITE_LITERAL("m");
        break;
    case TB_OUTPUT_NORMAL:
    default:
        WRITE_LITERAL("\033[");
        if (fg != TB_DEFAULT) {
            WRITE_LITERAL("3");
            WRITE_INT(fg - 1);
            if (bg != TB_DEFAULT) {
                WRITE_LITERAL(";");
            }
        }
        if (bg != TB_DEFAULT) {
            WRITE_LITERAL("4");
            WRITE_INT(bg - 1);
        }
        WRITE_LITERAL("m");
        break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movw %si, %ax
movw %di, %cx
movw %cx, -0x2(%rbp)
movw %ax, -0x4(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x0, %eax
jne 0x578d
movzwl -0x4(%rbp), %eax
cmpl $0x0, %eax
jne 0x578d
jmp 0x5985
movl 0x49c9(%rip), %eax      # 0xa15c
movl %eax, -0x34(%rbp)
subl $0x1, %eax
je 0x589a
jmp 0x57a1
movl -0x34(%rbp), %eax
addl $-0x2, %eax
subl $0x2, %eax
ja 0x589c
jmp 0x57b2
leaq 0x51df(%rip), %rdi      # 0xa998
leaq 0x1ba8(%rip), %rsi      # 0x7368
movl $0x2, %edx
callq 0x55c0
movzwl -0x2(%rbp), %eax
cmpl $0x0, %eax
je 0x5835
leaq 0x51be(%rip), %rdi      # 0xa998
leaq 0x1bcd(%rip), %rsi      # 0x73ae
movl $0x5, %edx
callq 0x55c0
leaq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movzwl -0x2(%rbp), %edi
leaq -0x30(%rbp), %rsi
callq 0x5620
movq -0x40(%rbp), %rsi
movl %eax, %edx
leaq 0x518b(%rip), %rdi      # 0xa998
callq 0x55c0
movzwl -0x4(%rbp), %eax
cmpl $0x0, %eax
je 0x5833
leaq 0x5176(%rip), %rdi      # 0xa998
leaq 0x1b89(%rip), %rsi      # 0x73b2
movl $0x1, %edx
callq 0x55c0
jmp 0x5835
movzwl -0x4(%rbp), %eax
cmpl $0x0, %eax
je 0x587d
leaq 0x5153(%rip), %rdi      # 0xa998
leaq 0x1b68(%rip), %rsi      # 0x73b4
movl $0x5, %edx
callq 0x55c0
leaq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movzwl -0x4(%rbp), %edi
leaq -0x30(%rbp), %rsi
callq 0x5620
movq -0x48(%rbp), %rsi
movl %eax, %edx
leaq 0x5120(%rip), %rdi      # 0xa998
callq 0x55c0
leaq 0x5114(%rip), %rdi      # 0xa998
leaq 0x1acf(%rip), %rsi      # 0x735a
movl $0x1, %edx
callq 0x55c0
jmp 0x5985
jmp 0x589c
leaq 0x50f5(%rip), %rdi      # 0xa998
leaq 0x1abe(%rip), %rsi      # 0x7368
movl $0x2, %edx
callq 0x55c0
movzwl -0x2(%rbp), %eax
cmpl $0x0, %eax
je 0x5922
leaq 0x50d4(%rip), %rdi      # 0xa998
leaq 0x1aef(%rip), %rsi      # 0x73ba
movl $0x1, %edx
callq 0x55c0
leaq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movzwl -0x2(%rbp), %edi
subl $0x1, %edi
leaq -0x30(%rbp), %rsi
callq 0x5620
movq -0x50(%rbp), %rsi
movl %eax, %edx
leaq 0x509e(%rip), %rdi      # 0xa998
callq 0x55c0
movzwl -0x4(%rbp), %eax
cmpl $0x0, %eax
je 0x5920
leaq 0x5089(%rip), %rdi      # 0xa998
leaq 0x1a9c(%rip), %rsi      # 0x73b2
movl $0x1, %edx
callq 0x55c0
jmp 0x5922
movzwl -0x4(%rbp), %eax
cmpl $0x0, %eax
je 0x596d
leaq 0x5066(%rip), %rdi      # 0xa998
leaq 0x1a83(%rip), %rsi      # 0x73bc
movl $0x1, %edx
callq 0x55c0
leaq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movzwl -0x4(%rbp), %edi
subl $0x1, %edi
leaq -0x30(%rbp), %rsi
callq 0x5620
movq -0x58(%rbp), %rsi
movl %eax, %edx
leaq 0x5030(%rip), %rdi      # 0xa998
callq 0x55c0
leaq 0x5024(%rip), %rdi      # 0xa998
leaq 0x19df(%rip), %rsi      # 0x735a
movl $0x1, %edx
callq 0x55c0
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)