// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x322a2
movq -0x8(%rbp), %rsi
leaq 0x35e61(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x322a0
movq -0x10(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x322c1
movq -0x10(%rbp), %rsi
leaq 0x35e42(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x322bf
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x18(%rbp)
movq $0x0, 0x571ff(%rip) # 0x894d8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0xf, %esi
callq 0x7990
cmpq $0x0, 0x571e5(%rip)     # 0x894d8
je 0x32335
movq 0x571dc(%rip), %rax     # 0x894d8
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x32309
jmp 0x32595
movq 0x571c8(%rip), %rdi     # 0x894d8
movq -0x10(%rbp), %rsi
callq 0x20d0
cmpl $0x0, %eax
je 0x32333
movq -0x8(%rbp), %rdi
movq 0x571af(%rip), %rsi     # 0x894d8
callq 0x32270
jmp 0x32595
jmp 0x32335
movq -0x18(%rbp), %rax
movb 0x98(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x32352
movq -0x8(%rbp), %rdi
callq 0x31aa0
movq -0x8(%rbp), %rdi
callq 0x32bf0
cmpq $0x0, %rax
jne 0x32372
movq -0x8(%rbp), %rdi
callq 0x32c40
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x323c9
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x323c4
leaq 0x4a330(%rip), %rax     # 0x7c6c0
movq (%rax), %rax
movq -0x10(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq *%rax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq 0x4a301(%rip), %rax     # 0x7c6b0
movq (%rax), %rax
movl -0x20(%rbp), %edi
callq *%rax
movq -0x68(%rbp), %rdi
movl %eax, %esi
callq 0x31fa0
jmp 0x32379
jmp 0x32595
movq -0x8(%rbp), %rdi
callq 0x32690
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x326b0
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x82(%rax), %esi
movq -0x10(%rbp), %rdx
callq 0x2c8a0
movq -0x8(%rbp), %rdi
callq 0x326e0
movq -0x18(%rbp), %rax
movb 0x98(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x32529
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2060
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2060
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdi
addq %rax, %rsi
addq $0x1, %rsi
callq 0x44f70
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0xd120
testb $0x1, %al
jne 0x3248b
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rsi
leaq 0x35bc0(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x32489
movq -0x18(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0x3249b
jmp 0x32595
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x82(%rax), %esi
movq -0x10(%rbp), %rdx
callq 0x47080
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq 0x25a(%rip), %rax       # 0x32720
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movw 0x72(%rax), %ax
movw %ax, -0x38(%rbp)
movw $0x0, -0x36(%rbp)
leaq 0x25d(%rip), %rax       # 0x32740
movq %rax, -0x48(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x1, -0x3c(%rbp)
movb -0x30(%rbp), %al
andb $-0x3, %al
orb $0x0, %al
movb %al, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
movb -0x30(%rbp), %al
andb $-0x2, %al
orb $0x0, %al
movb %al, -0x30(%rbp)
movw $0x0, -0x34(%rbp)
leaq 0x12614(%rip), %rax     # 0x44b30
movq %rax, -0x50(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x444a0
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x32ab0
movzwl %ax, %eax
movl %eax, -0x7c(%rbp)
leaq 0x4a196(%rip), %rax     # 0x7c6e0
movq (%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x88(%rbp), %rdi
movl %eax, %ecx
movl -0x7c(%rbp), %eax
addl %ecx, %eax
movswl %ax, %esi
callq 0x32770
movq -0x8(%rbp), %rdi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x326b0
movq -0x8(%rbp), %rdi
callq 0x32b00
movq -0x8(%rbp), %rdi
movl $0xe, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
addq $0x90, %rsp
popq %rbp
retq
nop