// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_label.c
// Function: lv_label_create
lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("label create started");

    /*Create a basic object*/
    lv_obj_t * new_label = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_label);
    if(new_label == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_label);

    /*Extend the basic object to a label object*/
    lv_obj_allocate_ext_attr(new_label, sizeof(lv_label_ext_t));

    lv_label_ext_t * ext = lv_obj_get_ext_attr(new_label);
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    ext->text       = NULL;
    ext->static_txt = 0;
    ext->recolor    = 0;
    ext->body_draw  = 0;
    ext->align      = LV_LABEL_ALIGN_AUTO;
    ext->dot_end    = LV_LABEL_DOT_END_INV;
    ext->long_mode  = LV_LABEL_LONG_EXPAND;
#if LV_USE_ANIMATION
    ext->anim_speed = LV_LABEL_DEF_SCROLL_SPEED;
#endif
    ext->offset.x = 0;
    ext->offset.y = 0;

#if LV_LABEL_LONG_TXT_HINT
    ext->hint.line_start = -1;
    ext->hint.coord_y    = 0;
    ext->hint.y          = 0;
#endif

#if LV_LABEL_TEXT_SEL
    ext->txt_sel_start = LV_DRAW_LABEL_NO_TXT_SEL;
    ext->txt_sel_end   = LV_DRAW_LABEL_NO_TXT_SEL;
#endif
    ext->dot.tmp_ptr   = NULL;
    ext->dot_tmp_alloc = 0;

    lv_obj_set_design_cb(new_label, lv_label_design);
    lv_obj_set_signal_cb(new_label, lv_label_signal);

    /*Init the new label*/
    if(copy == NULL) {
        lv_obj_set_click(new_label, false);
        lv_label_set_long_mode(new_label, LV_LABEL_LONG_EXPAND);
        lv_label_set_text(new_label, "Text");
        lv_label_set_style(new_label, LV_LABEL_STYLE_MAIN, NULL); /*Inherit parent's style*/
    }
    /*Copy 'copy' if not NULL*/
    else {
        lv_label_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        lv_label_set_long_mode(new_label, lv_label_get_long_mode(copy));
        lv_label_set_recolor(new_label, lv_label_get_recolor(copy));
        lv_label_set_body_draw(new_label, lv_label_get_body_draw(copy));
        lv_label_set_align(new_label, lv_label_get_align(copy));
        if(copy_ext->static_txt == 0)
            lv_label_set_text(new_label, lv_label_get_text(copy));
        else
            lv_label_set_static_text(new_label, lv_label_get_text(copy));

        /*In DOT mode save the text byte-to-byte because a '\0' can be in the middle*/
        if(copy_ext->long_mode == LV_LABEL_LONG_DOT) {
            ext->text = lv_mem_realloc(ext->text, lv_mem_get_size(copy_ext->text));
            LV_ASSERT_MEM(ext->text);
            if(ext->text == NULL) return NULL;
            memcpy(ext->text, copy_ext->text, lv_mem_get_size(copy_ext->text));
        }

        if(copy_ext->dot_tmp_alloc && copy_ext->dot.tmp_ptr) {
            uint16_t len = (uint16_t    )strlen(copy_ext->dot.tmp_ptr);
            lv_label_set_dot_tmp(new_label, ext->dot.tmp_ptr, len);
        } else {
            memcpy(ext->dot.tmp, copy_ext->dot.tmp, sizeof(ext->dot.tmp));
        }
        ext->dot_tmp_alloc = copy_ext->dot_tmp_alloc;
        ext->dot_end       = copy_ext->dot_end;

        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_label);
    }

    LV_LOG_INFO("label created");

    return new_label;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
callq 0x42c9
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x1842b
testq %rbx, %rbx
je 0x184ea
cmpq $0x0, 0x46089(%rip)     # 0x5e3b0
jne 0x18338
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x46078(%rip)     # 0x5e3b0
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rbx, %rdi
callq 0x6747
movq %rax, %r14
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x1843c
testq %r14, %r14
je 0x184ea
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movabsq $0x1900000000ffff, %rax # imm = 0x1900000000FFFF
movq %rax, 0x10(%r14)
movl $0xfffffc80, %eax       # imm = 0xFFFFFC80
andl 0x18(%r14), %eax
orl $0x30, %eax
movw %ax, 0x18(%r14)
leaq 0x1cc(%rip), %rsi       # 0x18560
movq %rbx, %rdi
callq 0x6116
leaq 0x50b(%rip), %rsi       # 0x188ae
movq %rbx, %rdi
callq 0x60e6
testq %r12, %r12
je 0x1844d
movq %r12, %rdi
callq 0x6747
movq %rax, %r15
movq %r12, %rdi
callq 0x18bc5
movzbl %al, %esi
movq %rbx, %rdi
callq 0x189c5
movq %r12, %rdi
callq 0x18c50
movzbl %al, %esi
movq %rbx, %rdi
callq 0x18bf2
movq %r12, %rdi
callq 0x18ce9
movzbl %al, %esi
movq %rbx, %rdi
callq 0x18c80
movq %r12, %rdi
callq 0x18d7f
movzbl %al, %esi
movq %rbx, %rdi
callq 0x18d16
movzwl 0x18(%r15), %ebp
movq %r12, %rdi
callq 0x18db9
movq %rbx, %rdi
movq %rax, %rsi
testb $0x8, %bpl
jne 0x1847c
callq 0x18a9a
jmp 0x18481
leaq 0x22c0e(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x1843a
leaq 0x22bfd(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0x1844b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5c6f
movq %rbx, %rdi
xorl %esi, %esi
callq 0x189c5
leaq 0x23308(%rip), %rsi     # 0x3b770
movq %rbx, %rdi
callq 0x18a9a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5a3d
jmp 0x184ec
callq 0x18de4
movzwl 0x18(%r15), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpw $0x2, %cx
jne 0x184de
movq (%r14), %r12
movq (%r15), %rdi
callq 0x27b65
movl %eax, %esi
movq %r12, %rdi
callq 0x27ad9
movq %rax, (%r14)
movq %rax, %rdi
callq 0x7994
movq (%r14), %r12
testb %al, %al
je 0x1854f
testq %r12, %r12
je 0x184ea
movq (%r15), %r13
movq %r13, %rdi
callq 0x27b65
movl %eax, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x20f0
movzwl 0x18(%r15), %eax
btl $0x9, %eax
jb 0x184fe
movl 0x8(%r15), %edi
jmp 0x1851d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x1851d
callq 0x2070
movq 0x8(%r14), %rsi
movzwl %ax, %edx
movq %rbx, %rdi
callq 0x18e62
jmp 0x18521
movl %edi, 0x8(%r14)
movzwl 0x18(%r15), %eax
andl $0x200, %eax            # imm = 0x200
movl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
andl 0x18(%r14), %ecx
orl %eax, %ecx
movw %cx, 0x18(%r14)
movzwl 0x10(%r15), %eax
movw %ax, 0x10(%r14)
movq %rbx, %rdi
callq 0x5ae7
jmp 0x184ec
leaq 0x22aea(%rip), %rdi     # 0x3b040
movq %r12, %rsi
callq 0x7b01
jmp 0x1855e