// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_ta.c
// Function: lv_ta_add_char
void lv_ta_add_char(lv_obj_t * ta, uint32_t c)
{
    LV_ASSERT_OBJ(ta, LV_OBJX_NAME);

    lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);

    uint32_t letter_buf[2];
    letter_buf[0] = c;
    letter_buf[1] = '\0';

    ta_insert_replace = NULL;
    lv_event_send(ta, LV_EVENT_INSERT, letter_buf);
    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, (char *)letter_buf)) {
            lv_ta_add_text(ta, ta_insert_replace);
            return;
        }
    }

    if(ext->one_line && (c == '\n' || c == '\r')) {
        LV_LOG_INFO("Text area: line break ignored in one-line mode");
        return;
    }

    uint32_t c_uni = lv_txt_encoded_next((const char *)&c, NULL);

    if(char_is_accepted(ta, c_uni) == false) {
        LV_LOG_INFO("Character is no accepted by the text area (too long text or not in the "
                    "accepted list)");
        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);

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

    lv_label_ins_text(ext->label, ext->cursor.pos, (const char *)letter_buf); /*Insert the character*/
    lv_ta_clear_selection(ta);                                                /*Clear selection*/

    if(ext->pwd_mode != 0) {

        ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 2); /*+2: the new char + \0 */
        LV_ASSERT_MEM(ext->pwd_tmp);
        if(ext->pwd_tmp == NULL) return;

        lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, (const char *)letter_buf);

#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 character*/
    lv_ta_set_cursor_pos(ta, lv_ta_get_cursor_pos(ta) + 1);

    /*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 $0x58, %rsp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
callq 0x80d4
testb %al, %al
je 0x1e925
movq %rbx, %rdi
callq 0x6ad8
movq %rax, %r12
movl 0xc(%rsp), %eax
leaq 0x10(%rsp), %rdx
movl %eax, (%rdx)
movl $0x0, 0x4(%rdx)
movq $0x0, 0x41b27(%rip) # 0x60408
movq %rbx, %rdi
movl $0xf, %esi
callq 0x4fea
movq 0x41b13(%rip), %r15     # 0x60408
testq %r15, %r15
je 0x1e936
cmpb $0x0, (%r15)
je 0x1eb3a
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
je 0x1e936
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1eb68
jmp 0x1eb3a
leaq 0x20808(%rip), %rdi     # 0x3f134
movq %rbx, %rsi
callq 0x829e
jmp 0x1e934
testb $0x2, 0x98(%r12)
je 0x1e957
movl 0xc(%rsp), %eax
cmpl $0xa, %eax
je 0x1eb3a
cmpl $0xd, %eax
je 0x1eb3a
leaq 0x34cd2(%rip), %r13     # 0x53630
leaq 0xc(%rsp), %rdi
xorl %esi, %esi
callq *(%r13)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x6ad8
movq %rax, %r15
cmpq $0x0, 0x68(%rax)
jne 0x1e985
cmpw $0x0, 0x70(%r15)
je 0x1e9f9
cmpw $0x0, 0x70(%r15)
je 0x1e9b2
leaq 0x34cbc(%rip), %rax     # 0x53650
movq (%rax), %r14
movq %rbx, %rdi
callq 0x1fea7
movq %rax, %rdi
callq *%r14
movzwl 0x70(%r15), %ecx
cmpl %ecx, %eax
jae 0x1eb3a
cmpq $0x0, 0x68(%r15)
je 0x1e9f9
movq %r12, 0x18(%rsp)
leaq 0x20(%rsp), %r12
movl $0x0, (%r12)
movq 0x68(%r15), %rdi
movl 0x20(%rsp), %eax
movb (%rdi,%rax), %r14b
testb %r14b, %r14b
je 0x1eb3a
movq %r12, %rsi
callq *(%r13)
cmpl %ebp, %eax
jne 0x1e9cb
testb %r14b, %r14b
movq 0x18(%rsp), %r12
je 0x1eb3a
movq %rbx, %rdi
callq 0x263f0
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x26329
testb $0x1, 0x98(%r12)
je 0x1ea20
movq %rbx, %rdi
callq 0x1e59f
movq 0x50(%r12), %rdi
movzwl 0x82(%r12), %esi
leaq 0x10(%rsp), %rdx
callq 0x1b60c
movq %rbx, %rdi
callq 0x80d4
testb %al, %al
je 0x1eb49
testb $0x1, 0x98(%r12)
je 0x1eb02
movq 0x60(%r12), %r15
movq %r15, %rdi
callq 0x2070
leaq 0x2(%rax), %rsi
movq %r15, %rdi
callq 0x299f8
movq %rax, 0x60(%r12)
movq %rax, %rdi
callq 0x80d4
movq 0x60(%r12), %rsi
testb %al, %al
je 0x1eb5a
testq %rsi, %rsi
je 0x1eb3a
movzwl 0x82(%r12), %eax
leaq 0x10(%rsp), %rdx
movq %rsi, %rdi
movl %eax, %esi
callq 0x2acb7
leaq 0x20(%rsp), %rdi
movq %rbx, (%rdi)
leaq 0x335(%rip), %rax       # 0x1edef
movq %rax, 0x8(%rdi)
movzwl 0x72(%r12), %eax
movw %ax, 0x28(%rdi)
movw $0x0, 0x2a(%rdi)
leaq 0x31b(%rip), %rax       # 0x1edf0
movq %rax, 0x18(%rdi)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x20(%rdi)
andb $-0x4, 0x30(%rdi)
movl $0x0, 0x2c(%rdi)
leaq 0xadb1(%rip), %rax      # 0x298aa
movq %rax, 0x10(%rdi)
callq 0x29521
movq %rbx, %rdi
callq 0x1f045
incl %eax
movswl %ax, %esi
movq %rbx, %rdi
callq 0x1edf8
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x26329
movq %rbx, %rdi
callq 0x1f074
movq %rbx, %rdi
movl $0xe, %esi
xorl %edx, %edx
callq 0x4fea
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x205e4(%rip), %rdi     # 0x3f134
movq %rbx, %rsi
callq 0x829e
jmp 0x1eb58
leaq 0x204df(%rip), %rdi     # 0x3f040
callq 0x829e
jmp 0x1eb66