// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_tabview.c
// Function: tabpage_pressing_handler
static void tabpage_pressing_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
{
    lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
    lv_indev_t * indev     = lv_indev_get_act();
    lv_point_t point_act;
    lv_indev_get_point(indev, &point_act);
    lv_coord_t x_diff = point_act.x - ext->point_last.x;
    lv_coord_t y_diff = point_act.y - ext->point_last.y;

    if(!ext->scroll_ver && (x_diff >= LV_INDEV_DEF_DRAG_LIMIT || x_diff <= -LV_INDEV_DEF_DRAG_LIMIT)) {
        ext->draging = 1;
        /*Check if the page is on the edge */
        if((lv_page_on_edge(tabpage, LV_PAGE_EDGE_LEFT) && x_diff > 0) ||
           (lv_page_on_edge(tabpage, LV_PAGE_EDGE_RIGHT) && x_diff < 0)) {
            if(ext->drag_hor == 0) {
                ext->point_last.x = point_act.x;
                ext->point_last.y = point_act.y;
            }
            ext->drag_hor = 1;
            lv_obj_set_drag(lv_page_get_scrl(tabpage), false);

        } else if(ext->drag_hor == 0) {
            ext->drag_hor = 0;
        }
    } else if(y_diff >= LV_INDEV_DEF_DRAG_LIMIT || y_diff <= -LV_INDEV_DEF_DRAG_LIMIT) {
        ext->drag_hor   = 0;
        ext->draging    = 1;
        ext->scroll_ver = 1;
    } else
        ext->draging = 0;

    if(ext->drag_hor) {
        lv_obj_set_x(ext->content, lv_obj_get_x(ext->content) + point_act.x - ext->point_last.x);
        ext->point_last.x = point_act.x;
        ext->point_last.y = point_act.y;

        /*Move the indicator*/
        const lv_style_t * tabs_style = lv_obj_get_style(ext->btns);
        lv_coord_t indic_size;
        lv_coord_t p;
        lv_coord_t indic_y;
        const lv_style_t * indic_style;

        switch(ext->btns_pos) {
            case LV_TABVIEW_BTNS_POS_TOP:
            case LV_TABVIEW_BTNS_POS_BOTTOM:
                indic_size  = lv_obj_get_width(ext->indic);
                indic_style = lv_obj_get_style(ext->indic);
                p = ((tabpage->coords.x1 - tabview->coords.x1) * (indic_size + tabs_style->body.padding.inner)) /
                    lv_obj_get_width(tabview);

                uint16_t id = ext->tab_cur;
                if(lv_obj_get_base_dir(tabview) == LV_BIDI_DIR_RTL) {
                    id = (ext->tab_cnt - (id + 1));
                }
                lv_obj_set_x(ext->indic, indic_size * id + tabs_style->body.padding.inner * id +
                                             indic_style->body.padding.left - p);
                break;
            case LV_TABVIEW_BTNS_POS_LEFT:
            case LV_TABVIEW_BTNS_POS_RIGHT:
                indic_size = lv_obj_get_height(ext->indic);
                indic_y = tabs_style->body.padding.top + ext->tab_cur * (indic_size + tabs_style->body.padding.inner);
                lv_obj_set_y(ext->indic, indic_y);
                break;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %r14
callq 0x6ad8
movq %rax, %rbx
callq 0x3784
leaq 0xc(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x3832
movzwl 0x2(%r12), %ecx
movzwl 0x22(%rbx), %edx
movb 0x2a(%rbx), %al
testb $0x8, %al
jne 0x12281
movzwl 0xc(%rsp), %r12d
subw 0x20(%rbx), %r12w
leal -0xa(%r12), %esi
cmpw $-0x14, %si
ja 0x12281
orb $0x2, %al
movb %al, 0x2a(%rbx)
movq %r15, %rdi
movl $0x1, %esi
callq 0x264e3
testw %r12w, %r12w
jle 0x12238
testb %al, %al
jne 0x1224f
movq %r15, %rdi
movl $0x4, %esi
callq 0x264e3
testw %r12w, %r12w
jns 0x12297
testb %al, %al
je 0x12297
movb 0x2a(%rbx), %al
testb $0x4, %al
jne 0x12268
movzwl 0xc(%rsp), %ecx
movw %cx, 0x20(%rbx)
movzwl 0xe(%rsp), %ecx
movw %cx, 0x22(%rbx)
orb $0x4, %al
movb %al, 0x2a(%rbx)
movq %r15, %rdi
callq 0x26288
movq %rax, %rdi
xorl %esi, %esi
callq 0x604d
jmp 0x12297
subl %edx, %ecx
addl $-0xa, %ecx
cmpw $-0x14, %cx
ja 0x12292
andb $-0xf, %al
orb $0xa, %al
jmp 0x12294
andb $-0x3, %al
movb %al, 0x2a(%rbx)
testb $0x4, 0x2a(%rbx)
je 0x12392
movq 0x10(%rbx), %r12
movq %r12, %rdi
callq 0x4bc6
addw 0xc(%rsp), %ax
subw 0x20(%rbx), %ax
movswl %ax, %esi
movq %r12, %rdi
callq 0x54c3
movzwl 0xc(%rsp), %eax
movw %ax, 0x20(%rbx)
movzwl 0xe(%rsp), %eax
movw %ax, 0x22(%rbx)
movq (%rbx), %rdi
callq 0x6697
movq %rax, %r12
testb $0x40, 0x2a(%rbx)
movq 0x8(%rbx), %rdi
jne 0x12370
callq 0x5651
movl %eax, %ebp
movq 0x8(%rbx), %rdi
callq 0x6697
movq %rax, 0x10(%rsp)
movswl 0x20(%r15), %eax
movswl 0x20(%r14), %ecx
subl %ecx, %eax
movswl %bp, %r15d
movswl 0x1e(%r12), %ebp
addl %r15d, %ebp
imull %eax, %ebp
movq %r14, %rdi
callq 0x5651
movswl %ax, %ecx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, %ebp
movzwl 0x24(%rbx), %r13d
movq %r14, %rdi
callq 0x4abc
cmpb $0x1, %al
jne 0x12348
notl %r13d
addw 0x26(%rbx), %r13w
movq 0x8(%rbx), %rdi
movzwl 0x1e(%r12), %eax
addl %r15d, %eax
imull %r13d, %eax
movq 0x10(%rsp), %rcx
movzwl 0x1a(%rcx), %ecx
subl %ebp, %ecx
addl %eax, %ecx
movswl %cx, %esi
callq 0x54c3
jmp 0x12392
callq 0x567b
addw 0x1e(%r12), %ax
imulw 0x24(%rbx), %ax
addw 0x16(%r12), %ax
movq 0x8(%rbx), %rdi
movswl %ax, %esi
callq 0x5501
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq