// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movl %edx, 0x4(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, 0x18(%rsp)
leaq 0x90(%rsp), %rdx
movq %r8, 0x20(%rdx)
movq %r9, 0x28(%rdx)
testb %al, %al
je 0x3337
movaps %xmm0, 0xc0(%rsp)
movaps %xmm1, 0xd0(%rsp)
movaps %xmm2, 0xe0(%rsp)
movaps %xmm3, 0xf0(%rsp)
movaps %xmm4, 0x100(%rsp)
movaps %xmm5, 0x110(%rsp)
movaps %xmm6, 0x120(%rsp)
movaps %xmm7, 0x130(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movb $0x7, 0x30(%rsp)
movb $0x1, 0x32(%rsp)
leaq 0x70(%rsp), %rax
movq %rdx, 0x10(%rax)
leaq 0x360(%rsp), %rdx
movq %rdx, 0x8(%rax)
movabsq $0x3000000020, %rdx     # imm = 0x3000000020
movq %rdx, (%rax)
leaq 0x140(%rsp), %r12
movl $0x1e1, %esi            # imm = 0x1E1
movq %r12, %rdi
movq %rcx, %rdx
movq %rax, %rcx
callq 0x1090
xorl %ebp, %ebp
xorl %r14d, %r14d
movsbl (%r12), %ebx
testl %ebx, %ebx
je 0x34fa
movq %r12, %rdi
callq 0x352b
movslq %r14d, %r15
testb %al, %al
je 0x3469
movslq %ebx, %rax
movq %rax, 0x20(%rsp)
incl %r14d
movl %r14d, 0x14(%rsp)
movl %ebx, %edi
callq 0x11b0
movq %r15, 0x28(%rsp)
leaq 0x33c0(%rip), %r15      # 0x679d
movq %r15, %rdi
movl %eax, %esi
pushq $0x9
popq %r13
movq %r13, %rdx
callq 0x1140
movq %rax, %rbx
movsbl 0x1(%r12), %eax
movslq %eax, %r14
movl %r14d, %edi
callq 0x11b0
subb %r15b, %bl
movq %r15, %rdi
movl %eax, %esi
movq %r13, %rdx
callq 0x1140
movl %ebp, %r13d
movq %rax, %rbp
subb %r15b, %bpl
callq 0x1260
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movzwl (%rax,%rcx,2), %ecx
movzwl (%rax,%r14,2), %eax
movl 0x14(%rsp), %r14d
shll $0x10, %eax
andl $0x1000000, %eax        # imm = 0x1000000
shll $0x8, %ecx
andl $0x10000, %ecx          # imm = 0x10000
orl %eax, %ecx
movzbl %bpl, %eax
movl %r13d, %ebp
shll $0x8, %eax
orl %ecx, %eax
movzbl %bl, %ecx
orl %eax, %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x34(%rsp,%rax,4)
addq $0x2, %r12
jmp 0x34e3
cmpb $0x7b, %bl
je 0x34e1
movzbl %bl, %eax
cmpl $0x7d, %eax
jne 0x34aa
testl %ebp, %ebp
setg %al
testl %r14d, %r14d
setg %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x34aa
testl %ebp, %ebp
jle 0x34f5
decl %ebp
movq 0x8(%rsp), %rsi
leal 0x1(%rsi), %ebx
movl 0x30(%rsp,%r15,4), %ecx
movq 0x18(%rsp), %rdi
movl 0x4(%rsp), %edx
pushq $0x7d
popq %r8
jmp 0x34d3
movq %r12, %rdi
callq 0x31de
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x350c
movq 0x8(%rsp), %rsi
leal 0x1(%rsi), %ebx
movl 0x30(%rsp,%r15,4), %ecx
movzwl %ax, %r8d
movq 0x18(%rsp), %rdi
movl 0x4(%rsp), %edx
callq 0x2ea2
movl %ebx, %eax
movq %rax, 0x8(%rsp)
jmp 0x34e3
incl %ebp
movzbl (%r12), %edi
callq 0x327e
addq %rax, %r12
jmp 0x339a
decl %r14d
jmp 0x34e3
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31f4(%rip), %rdi      # 0x6707
leaq 0x314a(%rip), %rsi      # 0x6664
leaq 0x3231(%rip), %rcx      # 0x6752
movl $0xce, %edx
callq 0x10e0