// File: /workspace/github_c_makefile_star2_O1/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, %r14d
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
leaq 0x90(%rsp), %rdx
movq %r8, 0x20(%rdx)
movq %r9, 0x28(%rdx)
testb %al, %al
je 0x37ac
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), %r15
movl $0x1e1, %esi            # imm = 0x1E1
movq %r15, %rdi
movq %rcx, %rdx
movq %rax, %rcx
callq 0x1090
movb (%r15), %bl
testb %bl, %bl
je 0x3a49
leaq 0x10(%r12), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x4(%rsp)
xorl %ebp, %ebp
movl %r14d, 0x10(%rsp)
movq %r12, 0x20(%rsp)
movsbl %bl, %r13d
movl $0x11, %edx
leaq 0x3f6d(%rip), %rdi      # 0x77b0
movl %r13d, %esi
callq 0x1140
testq %rax, %rax
je 0x3938
movsbl 0x1(%r15), %esi
testl %esi, %esi
je 0x3938
movl $0x11, %edx
leaq 0x3f43(%rip), %rdi      # 0x77b0
callq 0x1140
testq %rax, %rax
je 0x3938
cmpb $0x7b, 0x2(%r15)
jne 0x3938
movl 0x4(%rsp), %eax
movslq %eax, %rcx
movq %rcx, 0x28(%rsp)
incl %eax
movl %eax, 0x4(%rsp)
movl %r13d, %edi
callq 0x11b0
movl $0x9, %edx
movl %ebp, 0x14(%rsp)
leaq 0x3f11(%rip), %rbp      # 0x77c1
movq %rbp, %rdi
movl %eax, %esi
callq 0x1140
movq %rax, %rbx
movsbq 0x1(%r15), %r12
movl %r12d, %edi
callq 0x11b0
subb %bpl, %bl
movl $0x9, %edx
movq %rbp, %rdi
movl %eax, %esi
callq 0x1140
movq %rax, %r14
subb %bpl, %r14b
movl 0x14(%rsp), %ebp
callq 0x1270
movq (%rax), %rax
movsbq %r13b, %rcx
movzwl (%rax,%rcx,2), %ecx
movzwl (%rax,%r12,2), %eax
movq 0x20(%rsp), %r12
shll $0x10, %eax
andl $0x1000000, %eax        # imm = 0x1000000
shll $0x8, %ecx
andl $0x10000, %ecx          # imm = 0x10000
orl %eax, %ecx
movzbl %r14b, %eax
movl 0x10(%rsp), %r14d
shll $0x8, %eax
orl %ecx, %eax
movzbl %bl, %ecx
orl %eax, %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x34(%rsp,%rax,4)
addq $0x2, %r15
jmp 0x39e6
cmpb $0x7b, %bl
je 0x396a
movzbl %bl, %eax
cmpl $0x7d, %eax
jne 0x396e
testl %ebp, %ebp
setg %cl
cmpl $0x0, 0x4(%rsp)
setg %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x3965
testl %ebp, %ebp
jle 0x3a43
decl %ebp
jmp 0x3981
cmpb $0x7b, %bl
jne 0x396e
incl %ebp
jmp 0x39e6
movq %r15, %rdi
callq 0x364e
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x3a5b
movq 0x8(%rsp), %rdi
leal 0x1(%rdi), %ecx
movl (%r12), %edx
addl %edi, %edx
js 0x39df
movl 0x4(%r12), %esi
addl %r14d, %esi
cmpl %edi, 0x8(%r12)
setg %dil
testl %esi, %esi
setns %r8b
andb %dil, %r8b
cmpb $0x1, %r8b
jne 0x39df
cmpl %r14d, 0xc(%r12)
jle 0x39df
movslq 0x4(%rsp), %rdi
movl 0x30(%rsp,%rdi,4), %edi
movl %edx, %edx
movl %esi, %esi
leaq (%rdx,%rdx,2), %rdx
shlq $0x6, %rdx
addq 0x18(%rsp), %rdx
movb $0x0, 0x2(%rdx,%rsi,8)
movw %ax, (%rdx,%rsi,8)
movl %edi, 0x3(%rdx,%rsi,8)
movl %ecx, %eax
movq %rax, 0x8(%rsp)
movzbl (%r15), %eax
movl $0x1, %ecx
testb %al, %al
jns 0x3a32
movl %eax, %edx
andl $-0x20, %edx
movl $0x2, %ecx
cmpl $0xc0, %edx
je 0x3a32
movl %eax, %edx
andl $-0x10, %edx
movl $0x3, %ecx
cmpl $0xe0, %edx
je 0x3a32
movl %eax, %ecx
andl $-0x8, %ecx
cmpl $0xf0, %ecx
sete %cl
cmpb $-0xb, %al
setb %al
andb %cl, %al
movzbl %al, %ecx
shll $0x2, %ecx
movb (%r15,%rcx), %bl
addq %rcx, %r15
testb %bl, %bl
jne 0x3833
jmp 0x3a49
decl 0x4(%rsp)
jmp 0x39e6
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3cc9(%rip), %rdi      # 0x772b
leaq 0x3c1f(%rip), %rsi      # 0x7688
leaq 0x3d06(%rip), %rcx      # 0x7776
movl $0xce, %edx
callq 0x10e0