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

    lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
    uint16_t cur_pos  = ext->cursor.pos;

    if(cur_pos == 0) return;

    ta_insert_replace = NULL;
    char del_buf[2]   = {LV_KEY_DEL, '\0'};
    lv_event_send(ta, LV_EVENT_INSERT, del_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, del_buf)) {
            lv_ta_add_text(ta, ta_insert_replace);
            return;
        }
    }

    char * label_txt = lv_label_get_text(ext->label);
    /*Delete a character*/
    lv_txt_cut(label_txt, ext->cursor.pos - 1, 1);
    /*Refresh the label*/
    lv_label_set_text(ext->label, label_txt);
    lv_ta_clear_selection(ta);

    /*Don't let 'width == 0' because cursor will not be visible*/
    if(lv_obj_get_width(ext->label) == 0) {
        const lv_style_t * style = lv_obj_get_style(ext->label);
        lv_obj_set_width(ext->label, style->line.width);
    }

    if(ext->pwd_mode != 0) {
        uint32_t byte_pos = lv_txt_encoded_get_byte_id(ext->pwd_tmp, ext->cursor.pos - 1);
        lv_txt_cut(ext->pwd_tmp, ext->cursor.pos - 1, lv_txt_encoded_size(&label_txt[byte_pos]));

        ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 1);
        LV_ASSERT_MEM(ext->pwd_tmp);
        if(ext->pwd_tmp == NULL) return;
    }

    /*Move the cursor to the place of the deleted character*/
    lv_ta_set_cursor_pos(ta, ext->cursor.pos - 1);

    placeholder_update(ta);

    lv_event_send(ta, LV_EVENT_VALUE_CHANGED, NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x32cbb
movq -0x8(%rbp), %rsi
leaq 0x35448(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x32cb9
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movw 0x82(%rax), %ax
movw %ax, -0x12(%rbp)
movzwl -0x12(%rbp), %eax
cmpl $0x0, %eax
jne 0x32ce5
jmp 0x32ef5
movq $0x0, 0x567e8(%rip) # 0x894d8
movw 0x3598f(%rip), %ax      # 0x68686
movw %ax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x14(%rbp), %rdx
movl $0xf, %esi
callq 0x7990
cmpq $0x0, 0x567c3(%rip)     # 0x894d8
je 0x32d57
movq 0x567ba(%rip), %rax     # 0x894d8
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x32d2b
jmp 0x32ef5
movq 0x567a6(%rip), %rdi     # 0x894d8
leaq -0x14(%rbp), %rsi
callq 0x20d0
cmpl $0x0, %eax
je 0x32d55
movq -0x8(%rbp), %rdi
movq 0x5678d(%rip), %rsi     # 0x894d8
callq 0x32270
jmp 0x32ef5
jmp 0x32d57
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x2abc0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movzwl 0x82(%rax), %esi
subl $0x1, %esi
movl $0x1, %edx
callq 0x47130
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x2a630
movq -0x8(%rbp), %rdi
callq 0x326e0
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x8310
cwtl
cmpl $0x0, %eax
jne 0x32dd7
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xa080
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x28(%rbp), %rax
movswl 0x3e(%rax), %esi
callq 0x8430
movq -0x10(%rbp), %rax
movb 0x98(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x32ec0
leaq 0x498da(%rip), %rax     # 0x7c6d0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x60(%rcx), %rdi
movq -0x10(%rbp), %rcx
movzwl 0x82(%rcx), %esi
subl $0x1, %esi
callq *%rax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x82(%rax), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
leaq 0x49870(%rip), %rax     # 0x7c6a8
movq (%rax), %rax
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %ecx
addq %rcx, %rdi
callq *%rax
movq -0x48(%rbp), %rdi
movl -0x3c(%rbp), %esi
movzbl %al, %edx
callq 0x47130
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2060
movq -0x38(%rbp), %rdi
movq %rax, %rsi
addq $0x1, %rsi
callq 0x44f70
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0xd120
testb $0x1, %al
jne 0x32eb1
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
leaq 0x3519a(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x32eaf
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0x32ebe
jmp 0x32ef5
jmp 0x32ec0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzwl 0x82(%rax), %eax
subl $0x1, %eax
movswl %ax, %esi
callq 0x32770
movq -0x8(%rbp), %rdi
callq 0x32b00
movq -0x8(%rbp), %rdi
movl $0xe, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)