// File: /workspace/github_c_makefile_star2_O3/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 0x1ecaa
cmpl $0x1, %edx
je 0x1eb5c
cmpl $0x2, %edx
jne 0x1ece3
movq 0x418bf(%rip), %rax     # 0x60400
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %edx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq *0x41893(%rip)          # 0x60400
movq %r14, %rdi
callq 0x4ab5
movq %rax, %r14
movq %rax, %rdi
callq 0x6af7
movq %rax, %r15
movb 0x90(%rax), %al
testb $0xf, %al
sete %cl
andb $0x18, %al
cmpb $0x10, %al
setne %al
orb %cl, %al
jne 0x1ece3
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x20a6e
movq 0x50(%r15), %rdi
callq 0x1aa00
movq %rax, %r12
movq 0x50(%r15), %rax
movq 0x20(%rax), %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
movq 0x86(%r15), %xmm1
paddw %xmm0, %xmm1
movq %xmm1, 0x20(%rsp)
movq %r14, %rdi
callq 0x69eb
movzbl 0x90(%r15), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x1ece3
leaq 0x20dc0(%rip), %rdx     # 0x3f9bc
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 0x36968
xorl %ecx, %ecx
leaq 0x28(%rsp), %r13
movq %rcx, (%r13)
movzwl 0x8e(%r15), %eax
addq %rax, %r12
leaq 0x349df(%rip), %rax     # 0x53618
movq %r12, %rdi
callq *(%rax)
movzbl %al, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x20f0
leaq 0x30(%rsp), %r15
movdqu 0x1a(%r15), %xmm0
leaq 0x20(%rsp), %r12
movq (%r12), %xmm1
pinsrw $0x1, 0x16(%r15), %xmm0
paddw %xmm1, %xmm0
movd %xmm0, (%r12)
movq %r14, %rdi
callq 0x4ab2
movzbl %al, %eax
movl %eax, 0x18(%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %ebp, %ecx
movq %r13, %r8
xorl %r9d, %r9d
callq 0x3a5ac
jmp 0x1ece3
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq *0x41748(%rip)          # 0x60400
jmp 0x1ece3
movb $0x0, 0x38(%rsp)
cmpw $0x0, 0x3c(%rsp)
jne 0x1ecce
movw $0x1, 0x3c(%rsp)
movzbl %al, %ecx
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
callq 0x36968
movb $0x1, %al
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq