// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x31fce
movq -0x8(%rbp), %rsi
leaq 0x36135(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x31fcc
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, 0x574e5(%rip) # 0x894d8
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rdx
movl $0xf, %esi
callq 0x7990
cmpq $0x0, 0x574cb(%rip)     # 0x894d8
je 0x3204f
movq 0x574c2(%rip), %rax     # 0x894d8
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x32023
jmp 0x32260
movq 0x574ae(%rip), %rdi     # 0x894d8
leaq -0x20(%rbp), %rsi
callq 0x20d0
cmpl $0x0, %eax
je 0x3204d
movq -0x8(%rbp), %rdi
movq 0x57495(%rip), %rsi     # 0x894d8
callq 0x32270
jmp 0x32260
jmp 0x3204f
movq -0x18(%rbp), %rax
movb 0x98(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x32076
cmpl $0xa, -0xc(%rbp)
je 0x32071
cmpl $0xd, -0xc(%rbp)
jne 0x32076
jmp 0x32260
leaq -0xc(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x4a63b(%rip), %rax     # 0x7c6c0
callq *(%rax)
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x325a0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x320a5
jmp 0x32260
movq -0x8(%rbp), %rdi
callq 0x32690
andb $0x1, %al
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x326b0
movq -0x18(%rbp), %rax
movb 0x98(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x320db
movq -0x8(%rbp), %rdi
callq 0x31aa0
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x82(%rax), %esi
leaq -0x20(%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 0x32211
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2060
movq -0x68(%rbp), %rdi
movq %rax, %rsi
addq $0x2, %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 0x32173
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rsi
leaq 0x35ed8(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x32171
movq -0x18(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0x32183
jmp 0x32260
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x82(%rax), %esi
leaq -0x20(%rbp), %rdx
callq 0x47080
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq 0x572(%rip), %rax       # 0x32720
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movw 0x72(%rax), %ax
movw %ax, -0x38(%rbp)
movw $0x0, -0x36(%rbp)
leaq 0x575(%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 0x1292c(%rip), %rax     # 0x44b30
movq %rax, -0x50(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x444a0
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
callq 0x32ab0
movq -0x70(%rbp), %rdi
movzwl %ax, %eax
addl $0x1, %eax
movswl %ax, %esi
callq 0x32770
movq -0x8(%rbp), %rdi
movb -0x25(%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 $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)