// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_ta.c
// Function: lv_ta_scrollable_design
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode)
{
    if(mode == LV_DESIGN_COVER_CHK) {
        /*Return false if the object is not covers the mask_p area*/
        return scrl_design(scrl, mask, mode);
    } else if(mode == LV_DESIGN_DRAW_MAIN) {
        /*Draw the object*/
        scrl_design(scrl, mask, mode);
    } else if(mode == LV_DESIGN_DRAW_POST) {
        scrl_design(scrl, mask, mode);

        /*Draw the cursor*/
        lv_obj_t * ta     = lv_obj_get_parent(scrl);
        lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);

        if(ext->cursor.type == LV_CURSOR_NONE || (ext->cursor.type & LV_CURSOR_HIDDEN) || ext->cursor.state == 0) {
            return true; /*The cursor is not visible now*/
        }

        lv_style_t cur_style;
        get_cursor_style(ta, &cur_style);

        const char * txt = lv_label_get_text(ext->label);

        /*Draw he cursor according to the type*/
        lv_area_t cur_area;
        lv_area_copy(&cur_area, &ext->cursor.area);

        cur_area.x1 += ext->label->coords.x1;
        cur_area.y1 += ext->label->coords.y1;
        cur_area.x2 += ext->label->coords.x1;
        cur_area.y2 += ext->label->coords.y1;

        lv_opa_t opa_scale = lv_obj_get_opa_scale(ta);

        if(ext->cursor.type == LV_CURSOR_LINE) {
            lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);
        } else if(ext->cursor.type == LV_CURSOR_BLOCK) {
            lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);

            char letter_buf[8] = {0};
            memcpy(letter_buf, &txt[ext->cursor.txt_byte_pos], lv_txt_encoded_size(&txt[ext->cursor.txt_byte_pos]));

            cur_area.x1 += cur_style.body.padding.left;
            cur_area.y1 += cur_style.body.padding.top;
            lv_draw_label(&cur_area, mask, &cur_style, opa_scale, letter_buf, LV_TXT_FLAG_NONE, NULL, NULL, NULL, lv_obj_get_base_dir(ta));

        } else if(ext->cursor.type == LV_CURSOR_OUTLINE) {
            cur_style.body.opa = LV_OPA_TRANSP;
            if(cur_style.body.border.width == 0) cur_style.body.border.width = 1; /*Be sure the border will be drawn*/
            lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);
        } else if(ext->cursor.type == LV_CURSOR_UNDERLINE) {
            lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);
        }
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x1e4ad
cmpl $0x1, %edx
je 0x1e35f
cmpl $0x2, %edx
jne 0x1e4e7
movq 0x420ba(%rip), %rax     # 0x60400
movzbl %dl, %edx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movzbl %dl, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x42092(%rip)          # 0x60400
movq %r14, %rdi
callq 0x4abf
movq %rax, %r14
movq %rax, %rdi
callq 0x6ad8
movq %rax, %r15
movb 0x90(%rax), %al
testb $0xf, %al
sete %cl
andb $0x18, %al
cmpb $0x10, %al
setne %al
orb %cl, %al
jne 0x1e4e7
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x2027a
movq 0x50(%r15), %rdi
callq 0x1a239
movq 0x86(%r15), %rcx
movq %rcx, 0x20(%rsp)
movq 0x50(%r15), %rdx
movl 0x20(%rdx), %esi
addl %esi, %ecx
movw %cx, 0x20(%rsp)
movzwl 0x22(%rdx), %ecx
addw %cx, 0x22(%rsp)
addw %si, 0x24(%rsp)
movq %rax, %r12
addw %cx, 0x26(%rsp)
movq %r14, %rdi
callq 0x69cc
movzbl 0x90(%r15), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x1e4e7
leaq 0x2144b(%rip), %rdx     # 0x3f854
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movzbl %al, %ebp
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0x365ac
xorl %ecx, %ecx
leaq 0x28(%rsp), %r13
movq %rcx, (%r13)
movzwl 0x8e(%r15), %eax
addq %rax, %r12
leaq 0x351d2(%rip), %rax     # 0x53618
movq %r12, %rdi
callq *(%rax)
movzbl %al, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x20f0
leaq 0x30(%rsp), %r15
movzwl 0x1a(%r15), %eax
leaq 0x20(%rsp), %r12
addw %ax, (%r12)
movzwl 0x16(%r15), %eax
addw %ax, 0x2(%r12)
movq %r14, %rdi
callq 0x4abc
movzbl %al, %eax
movl %eax, 0x18(%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %ebp, %ecx
movq %r13, %r8
xorl %r9d, %r9d
callq 0x3a034
jmp 0x1e4e7
movzbl %dl, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x41f44(%rip)          # 0x60400
jmp 0x1e4e7
movb $0x0, 0x38(%rsp)
cmpw $0x0, 0x3c(%rsp)
jne 0x1e4d2
movw $0x1, 0x3c(%rsp)
movzbl %al, %ecx
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
callq 0x365ac
movb $0x1, %al
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq