// File: /workspace/github_c_makefile_star2_O0/skeeto[P]goblin-com/src/display.c
// Function: panel_printf
void
panel_printf(panel_t *p, int x, int y, const char *format, ...)
{
    int f = 0;
    font_t font[16] = {FONT_DEFAULT};
    char buffer[DISPLAY_WIDTH * 6 + 1];
    va_list ap;
    va_start(ap, format);
    vsnprintf(buffer, sizeof(buffer), format, ap);
    va_end(ap);
    int nest = 0;
    for (char *s = buffer; *s; s += utf8_charlen((uint8_t)*s)) {
        if (is_color_directive(s)) {
            font[++f] = font_decode(s);
            s += 2;
        } else if (*s == '}' && (nest > 0 || f > 0)) {
            if (nest > 0) {
                nest--;
                panel_putc(p, x++, y, font[f], *s);
            } else {
                f--;
            }
        } else if (*s == '{') {
            nest++;
        } else {
            uint32_t c = utf8_to_32((uint8_t *)s);
            assert(c <= UINT16_MAX);
            panel_putc(p, x++, y, font[f], c);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x350, %rsp            # imm = 0x350
testb %al, %al
je 0x4c57
movaps %xmm0, -0x310(%rbp)
movaps %xmm1, -0x300(%rbp)
movaps %xmm2, -0x2f0(%rbp)
movaps %xmm3, -0x2e0(%rbp)
movaps %xmm4, -0x2d0(%rbp)
movaps %xmm5, -0x2c0(%rbp)
movaps %xmm6, -0x2b0(%rbp)
movaps %xmm7, -0x2a0(%rbp)
movq %r9, -0x318(%rbp)
movq %r8, -0x320(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x1130
movb $0x7, -0x60(%rbp)
movb $0x1, -0x5e(%rbp)
leaq -0x270(%rbp), %rax
leaq -0x340(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
leaq -0x250(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x270(%rbp), %rcx
movl $0x1e1, %esi            # imm = 0x1E1
callq 0x1090
leaq -0x270(%rbp), %rax
movl $0x0, -0x274(%rbp)
leaq -0x250(%rbp), %rax
movq %rax, -0x280(%rbp)
movq -0x280(%rbp), %rax
cmpb $0x0, (%rax)
je 0x4e87
movq -0x280(%rbp), %rdi
callq 0x4e90
testb $0x1, %al
jne 0x4d16
jmp 0x4d64
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cltq
movq %rax, -0x348(%rbp)
movq -0x280(%rbp), %rdi
callq 0x4f20
movl %eax, %ecx
movq -0x348(%rbp), %rax
movl %ecx, -0x284(%rbp)
movl -0x284(%rbp), %ecx
movl %ecx, -0x60(%rbp,%rax,4)
movq -0x280(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x280(%rbp)
jmp 0x4e63
movq -0x280(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7d, %eax
jne 0x4dd7
cmpl $0x0, -0x274(%rbp)
jg 0x4d82
cmpl $0x0, -0x1c(%rbp)
jle 0x4dd7
cmpl $0x0, -0x274(%rbp)
jle 0x4dc9
movl -0x274(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x274(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %edx
movslq -0x1c(%rbp), %rcx
movq -0x280(%rbp), %rax
movsbl (%rax), %eax
movl -0x60(%rbp,%rcx,4), %ecx
movzwl %ax, %r8d
callq 0x4440
jmp 0x4dd2
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4e61
movq -0x280(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0x4df7
movl -0x274(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x274(%rbp)
jmp 0x4e5f
movq -0x280(%rbp), %rdi
callq 0x4a80
movl %eax, -0x288(%rbp)
cmpl $0xffff, -0x288(%rbp)   # imm = 0xFFFF
ja 0x4e17
jmp 0x4e36
leaq 0x4a1d(%rip), %rdi      # 0x983b
leaq 0x4973(%rip), %rsi      # 0x9798
movl $0xce, %edx
leaq 0x4a55(%rip), %rcx      # 0x9886
callq 0x1100
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %edx
movslq -0x1c(%rbp), %rcx
movl -0x288(%rbp), %eax
movl -0x60(%rbp,%rcx,4), %ecx
movzwl %ax, %r8d
callq 0x4440
jmp 0x4e61
jmp 0x4e63
jmp 0x4e65
movq -0x280(%rbp), %rax
movzbl (%rax), %edi
callq 0x4b80
addq -0x280(%rbp), %rax
movq %rax, -0x280(%rbp)
jmp 0x4cf4
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq