// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_ta.c
// Function: lv_ta_add_text
void lv_ta_add_text(lv_obj_t * ta, const char * txt)
{
    LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
    LV_ASSERT_NULL(txt);

    lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);

    ta_insert_replace = NULL;
    lv_event_send(ta, LV_EVENT_INSERT, txt);
    if(ta_insert_replace) {
        if(ta_insert_replace[0] == '\0') return; /*Drop this text*/

        /*Add the replaced text directly it's different from the original*/
        if(strcmp(ta_insert_replace, txt)) {
            lv_ta_add_text(ta, ta_insert_replace);
            return;
        }
    }

    if(ext->pwd_mode != 0) pwd_char_hider(ta); /*Make sure all the current text contains only '*'*/

    /*Add the character one-by-one if not all characters are accepted or there is character limit.*/
    if(lv_ta_get_accepted_chars(ta) || lv_ta_get_max_length(ta)) {
        uint32_t i = 0;
        while(txt[i] != '\0') {
            uint32_t c = lv_txt_encoded_next(txt, &i);
            lv_ta_add_char(ta, lv_txt_unicode_to_encoded(c));
        }
        return;
    }

    /*If a new line was added it shouldn't show edge flash effect*/
    bool edge_flash_en = lv_ta_get_edge_flash(ta);
    lv_ta_set_edge_flash(ta, false);

    /*Insert the text*/
    lv_label_ins_text(ext->label, ext->cursor.pos, txt);
    lv_ta_clear_selection(ta);

    if(ext->pwd_mode != 0) {
        ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + strlen(txt) + 1);
        LV_ASSERT_MEM(ext->pwd_tmp);
        if(ext->pwd_tmp == NULL) return;

        lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, txt);

#if LV_USE_ANIMATION
        /*Auto hide characters*/
        lv_anim_t a;
        a.var            = ta;
        a.exec_cb        = (lv_anim_exec_xcb_t)pwd_char_hider_anim;
        a.time           = ext->pwd_show_time;
        a.act_time       = 0;
        a.ready_cb       = pwd_char_hider_anim_ready;
        a.start          = 0;
        a.end            = 1;
        a.repeat         = 0;
        a.repeat_pause   = 0;
        a.playback       = 0;
        a.playback_pause = 0;
        a.path_cb        = lv_anim_path_step;
        lv_anim_create(&a);
#else
        pwd_char_hider(ta);
#endif
    }

    /*Move the cursor after the new text*/
    lv_ta_set_cursor_pos(ta, lv_ta_get_cursor_pos(ta) + lv_txt_get_encoded_length(txt));

    /*Revert the original edge flash state*/
    lv_ta_set_edge_flash(ta, edge_flash_en);

    placeholder_update(ta);

    lv_event_send(ta, LV_EVENT_VALUE_CHANGED, NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movq %rdi, %rbx
pushq $0xf
popq %rbp
movq %r12, %r14
movq %rbx, %rdi
callq 0x7994
testb %al, %al
je 0x1d4e1
movq %r14, %rdi
callq 0x7994
testb %al, %al
je 0x1d4f2
movq %rbx, %rdi
callq 0x6747
movq %rax, %r15
andq $0x0, 0x40fc9(%rip)     # 0x5e408
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x4caf
movq 0x40fb5(%rip), %r12     # 0x5e408
testq %r12, %r12
je 0x1d472
cmpb $0x0, (%r12)
je 0x1d633
movq %r12, %rdi
movq %r14, %rsi
callq 0x20e0
testl %eax, %eax
jne 0x1d409
testb $0x1, 0x98(%r15)
je 0x1d484
movq %rbx, %rdi
callq 0x1ceb6
movq %rbx, %rdi
callq 0x1d99d
testq %rax, %rax
jne 0x1d49e
movq %rbx, %rdi
callq 0x1d9c9
testw %ax, %ax
je 0x1d503
movq %rsp, %r15
andl $0x0, (%r15)
xorl %eax, %eax
leaq 0x34182(%rip), %r12     # 0x51630
leaq 0x3416b(%rip), %r13     # 0x51620
movl %eax, %eax
cmpb $0x0, (%r14,%rax)
je 0x1d633
movq %r14, %rdi
movq %r15, %rsi
callq *(%r12)
movl %eax, %edi
callq *(%r13)
movq %rbx, %rdi
movl %eax, %esi
callq 0x1d175
movl (%rsp), %eax
jmp 0x1d4b5
leaq 0x1dc5c(%rip), %rdi     # 0x3b144
movq %rbx, %rsi
callq 0x7b01
jmp 0x1d4f0
leaq 0x1dc4b(%rip), %rdi     # 0x3b144
movq %r14, %rsi
callq 0x7b01
jmp 0x1d501
movq %rbx, %rdi
callq 0x24741
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2467a
movq 0x50(%r15), %rdi
movzwl 0x82(%r15), %esi
movq %r14, %rdx
callq 0x1a0c6
movq %rbx, %rdi
callq 0x1d650
testb $0x1, 0x98(%r15)
je 0x1d5ed
movq 0x60(%r15), %r12
movq %r12, %rdi
callq 0x2070
movq %rax, %r13
movq %r14, %rdi
callq 0x2070
leaq (%rax,%r13), %rsi
incq %rsi
movq %r12, %rdi
callq 0x27ad9
movq %rax, 0x60(%r15)
movq %rax, %rdi
callq 0x7994
movq 0x60(%r15), %rsi
testb %al, %al
je 0x1d642
testq %rsi, %rsi
je 0x1d633
movzwl 0x82(%r15), %eax
movq %rsi, %rdi
movl %eax, %esi
movq %r14, %rdx
callq 0x28cce
movq %rsp, %rdi
movq %rbx, (%rdi)
leaq 0xc6(%rip), %rax        # 0x1d670
movq %rax, 0x8(%rdi)
movzwl 0x72(%r15), %eax
movw %ax, 0x28(%rdi)
andw $0x0, 0x2a(%rdi)
leaq 0xae(%rip), %rax        # 0x1d671
movq %rax, 0x18(%rdi)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x20(%rdi)
andl $0x0, 0x2c(%rdi)
movb $0x0, 0x30(%rdi)
leaq 0xa3e5(%rip), %rax      # 0x279c9
movq %rax, 0x10(%rdi)
callq 0x27685
movq %rbx, %rdi
callq 0x1d8d0
movl %eax, %r15d
leaq 0x34051(%rip), %rax     # 0x51650
movq %r14, %rdi
callq *(%rax)
addl %r15d, %eax
movswl %ax, %esi
movq %rbx, %rdi
callq 0x1d679
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x2467a
movq %rbx, %rdi
callq 0x1d8ff
pushq $0xe
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4caf
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d9f7(%rip), %rdi     # 0x3b040
callq 0x7b01
jmp 0x1d64e