// File: /workspace/github_c_makefile_star2_O3/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)
movl %esi, %r14d
movq %rdi, 0x8(%rsp)
leaq 0x90(%rsp), %rdx
movq %r8, 0x20(%rdx)
movq %r9, 0x28(%rdx)
testb %al, %al
je 0x375d
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 0x3b3c
movq 0x8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x10(%rsp)
movl $0x0, (%rsp)
xorl %ebp, %ebp
movsbl %bl, %r13d
movl $0x11, %edx
leaq 0x403b(%rip), %rdi      # 0x7828
movl %r13d, %esi
callq 0x1140
testq %rax, %rax
je 0x38e8
movsbl 0x1(%r15), %r12d
testl %r12d, %r12d
je 0x38e8
movl $0x11, %edx
leaq 0x4010(%rip), %rdi      # 0x7828
movl %r12d, %esi
callq 0x1140
testq %rax, %rax
je 0x38e8
cmpb $0x7b, 0x2(%r15)
jne 0x38e8
addq $0x2, %r15
movl (%rsp), %eax
movslq %eax, %rcx
movq %rcx, 0x20(%rsp)
incl %eax
movl %eax, (%rsp)
movl %r13d, %edi
callq 0x11b0
movl $0x9, %edx
movq %r14, 0x28(%rsp)
movl %ebp, %r14d
leaq 0x3fd5(%rip), %rbp      # 0x7839
movq %rbp, %rdi
movl %eax, %esi
callq 0x1140
movq %rax, %rbx
movslq %r12d, %rax
movq %rax, 0x18(%rsp)
movl %r12d, %edi
callq 0x11b0
subb %bpl, %bl
movl $0x9, %edx
movq %rbp, %rdi
movl %eax, %esi
callq 0x1140
movq %rax, %r12
subb %bpl, %r12b
movl %r14d, %ebp
movq 0x28(%rsp), %r14
callq 0x1260
movq (%rax), %rax
movslq %r13d, %rcx
movzwl (%rax,%rcx,2), %ecx
movq 0x18(%rsp), %rdx
movzwl (%rax,%rdx,2), %eax
shll $0x10, %eax
andl $0x1000000, %eax        # imm = 0x1000000
shll $0x8, %ecx
andl $0x10000, %ecx          # imm = 0x10000
orl %eax, %ecx
movzbl %r12b, %eax
shll $0x8, %eax
orl %ecx, %eax
movzbl %bl, %ecx
orl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x34(%rsp,%rax,4)
jmp 0x3ae1
cmpb $0x7b, %bl
je 0x3994
movzbl %bl, %eax
cmpl $0x7d, %eax
jne 0x399b
testl %ebp, %ebp
setg %al
cmpl $0x0, (%rsp)
setg %cl
orb %al, %cl
movl $0x7d, %eax
cmpb $0x1, %cl
jne 0x3a76
testl %ebp, %ebp
jle 0x3a00
decl %ebp
leal 0x1(%r14), %eax
movq 0x8(%rsp), %rcx
movl (%rcx), %ecx
addl %r14d, %ecx
js 0x398c
movq 0x8(%rsp), %rsi
movl 0x4(%rsi), %edx
addl 0x4(%rsp), %edx
cmpl %r14d, 0x8(%rsi)
setg %sil
testl %edx, %edx
setns %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x398c
movl 0x4(%rsp), %esi
movq 0x8(%rsp), %rdi
cmpl %esi, 0xc(%rdi)
jle 0x398c
movslq (%rsp), %rsi
movl 0x30(%rsp,%rsi,4), %esi
movl %ecx, %ecx
movl %edx, %edx
leaq (%rcx,%rcx,2), %rcx
shlq $0x6, %rcx
addq 0x10(%rsp), %rcx
movb $0x0, 0x2(%rcx,%rdx,8)
movw $0x7d, (%rcx,%rdx,8)
movl %esi, 0x3(%rcx,%rdx,8)
movl %eax, %r14d
jmp 0x3ae1
incl %ebp
jmp 0x3ae1
testb %bl, %bl
jns 0x3a76
movl %eax, %ecx
andl $-0x20, %ecx
movl $0x2, %edx
cmpl $0xc0, %ecx
je 0x39d1
movl %eax, %ecx
andl $-0x10, %ecx
movl $0x3, %edx
cmpl $0xe0, %ecx
jne 0x3a0c
movb 0x2(%r15), %al
andb $-0x40, %al
negb %al
jno 0x3a08
movzbl 0x1(%r15), %ecx
movl %ecx, %eax
andb $-0x40, %al
negb %al
jno 0x3a08
andl $0x3f, %ecx
cmpl $0x4, %edx
je 0x3a35
cmpl $0x3, %edx
jne 0x3a68
movzbl %bl, %eax
shll $0xc, %eax
shll $0x6, %ecx
orl %eax, %ecx
movzbl 0x2(%r15), %eax
andl $0x3f, %eax
jmp 0x3a64
decl (%rsp)
jmp 0x3ae1
xorl %eax, %eax
jmp 0x3a76
andl $-0x8, %eax
cmpl $0xf0, %eax
setne %cl
cmpb $-0xb, %bl
setae %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x3a76
movb 0x3(%r15), %cl
andb $-0x40, %cl
movl $0x4, %edx
negb %cl
jo 0x39c7
jmp 0x3a76
andl $0x7, %r13d
shll $0x12, %r13d
shll $0xc, %ecx
orl %r13d, %ecx
cmpl $0x10000, %ecx          # imm = 0x10000
jae 0x3b4e
movzbl 0x2(%r15), %edx
andl $0x3f, %edx
shll $0x6, %edx
movzbl 0x3(%r15), %eax
andl $0x3f, %eax
orl %edx, %eax
orl %ecx, %eax
jmp 0x3a76
andl $0x1f, %r13d
shll $0x6, %r13d
orl %ecx, %r13d
movl %r13d, %eax
leal 0x1(%r14), %ecx
movq 0x8(%rsp), %rdx
movl (%rdx), %edx
addl %r14d, %edx
js 0x3ade
movq 0x8(%rsp), %rdi
movl 0x4(%rdi), %esi
addl 0x4(%rsp), %esi
cmpl %r14d, 0x8(%rdi)
setg %dil
testl %esi, %esi
setns %r8b
andb %dil, %r8b
cmpb $0x1, %r8b
jne 0x3ade
movl 0x4(%rsp), %edi
movq 0x8(%rsp), %r8
cmpl %edi, 0xc(%r8)
jle 0x3ade
movslq (%rsp), %rdi
movl 0x30(%rsp,%rdi,4), %edi
movl %edx, %edx
movl %esi, %esi
leaq (%rdx,%rdx,2), %rdx
shlq $0x6, %rdx
addq 0x10(%rsp), %rdx
movb $0x0, 0x2(%rdx,%rsi,8)
movw %ax, (%rdx,%rsi,8)
movl %edi, 0x3(%rdx,%rsi,8)
movl %ecx, %r14d
movzbl (%r15), %eax
movl $0x1, %ecx
testb %al, %al
jns 0x3b2d
movl %eax, %edx
andl $-0x20, %edx
movl $0x2, %ecx
cmpl $0xc0, %edx
je 0x3b2d
movl %eax, %edx
andl $-0x10, %edx
movl $0x3, %ecx
cmpl $0xe0, %edx
je 0x3b2d
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 0x37dd
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c4e(%rip), %rdi      # 0x77a3
leaq 0x3ba4(%rip), %rsi      # 0x7700
leaq 0x3c8b(%rip), %rcx      # 0x77ee
movl $0xce, %edx
callq 0x10e0