// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_label.c
// Function: lv_label_set_text_fmt
void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...)
{
    LV_ASSERT_OBJ(label, LV_OBJX_NAME);
    LV_ASSERT_STR(fmt);

    lv_obj_invalidate(label);

    lv_label_ext_t * ext = lv_obj_get_ext_attr(label);

    /*If text is NULL then refresh */
    if(fmt == NULL) {
        lv_label_refr_text(label);
        return;
    }

    if(ext->text != NULL && ext->static_txt == 0) {
            lv_mem_free(ext->text);
            ext->text = NULL;
    }

    va_list ap, ap2;
    va_start(ap, fmt);
    va_copy(ap2, ap);

    /*Allocate space for the new text by using trick from C99 standard section 7.19.6.12 */
    uint32_t len = lv_vsnprintf(NULL, 0, fmt, ap);

    va_end(ap);
    

    ext->text = lv_mem_alloc(len+1);
    LV_ASSERT_MEM(ext->text);
    if(ext->text == NULL) return;
    ext->text[len-1] = 0; /* Ensure NULL termination */

    lv_vsnprintf(ext->text, len+1, fmt, ap2);

    va_end(ap2);
    ext->static_txt = 0; /*Now the text is dynamically allocated*/

    lv_label_refr_text(label);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
testb %al, %al
je 0x2b6a1
movaps %xmm0, -0xe0(%rbp)
movaps %xmm1, -0xd0(%rbp)
movaps %xmm2, -0xc0(%rbp)
movaps %xmm3, -0xb0(%rbp)
movaps %xmm4, -0xa0(%rbp)
movaps %xmm5, -0x90(%rbp)
movaps %xmm6, -0x80(%rbp)
movaps %xmm7, -0x70(%rbp)
movq %r9, -0xe8(%rbp)
movq %r8, -0xf0(%rbp)
movq %rcx, -0xf8(%rbp)
movq %rdx, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x2b6e4
movq -0x8(%rbp), %rsi
leaq 0x3ca1f(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x2b6e2
movq -0x10(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x2b703
movq -0x10(%rbp), %rsi
leaq 0x3ca00(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x2b701
movq -0x8(%rbp), %rdi
callq 0x7430
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x2b72e
movq -0x8(%rbp), %rdi
callq 0x2adc0
jmp 0x2b858
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2b767
movq -0x18(%rbp), %rax
movw 0x18(%rax), %ax
shrw $0x3, %ax
andw $0x1, %ax
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2b767
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x44ec0
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
leaq -0x30(%rbp), %rax
leaq -0x110(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
leaq -0x50(%rbp), %rax
leaq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq -0x10(%rbp), %rdx
leaq -0x30(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x48e40
movl %eax, -0x54(%rbp)
leaq -0x30(%rbp), %rax
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
callq 0x44d20
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0xd120
testb $0x1, %al
jne 0x2b7fa
movq -0x18(%rbp), %rax
movq (%rax), %rsi
leaq 0x3c851(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x2b7f8
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x2b806
jmp 0x2b858
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl -0x54(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
movq -0x10(%rbp), %rdx
leaq -0x50(%rbp), %rcx
callq 0x48e40
leaq -0x50(%rbp), %rax
movq -0x18(%rbp), %rax
movw 0x18(%rax), %cx
andw $-0x9, %cx
orw $0x0, %cx
movw %cx, 0x18(%rax)
movq -0x8(%rbp), %rdi
callq 0x2adc0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)