// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_page.c
// Function: lv_page_sb_refresh
static void lv_page_sb_refresh(lv_obj_t * page)
{
    lv_page_ext_t * ext      = lv_obj_get_ext_attr(page);
    const lv_style_t * style = lv_obj_get_style(page);
    lv_obj_t * scrl          = ext->scrl;
    lv_coord_t size_tmp;
    lv_coord_t scrl_w = lv_obj_get_width(scrl);
    lv_coord_t scrl_h = lv_obj_get_height(scrl);
    lv_coord_t obj_w  = lv_obj_get_width(page);
    lv_coord_t obj_h  = lv_obj_get_height(page);

    /*Always let 'scrollbar width' padding above, under, left and right to the scrollbars
     * else:
     * - horizontal and vertical scrollbars can overlap on the corners
     * - if the page has radius the scrollbar can be out of the radius  */
    lv_coord_t sb_hor_pad = LV_MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.right);
    lv_coord_t sb_ver_pad = LV_MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.bottom);

    if(ext->sb.mode == LV_SB_MODE_OFF) return;

    if(ext->sb.mode == LV_SB_MODE_ON) {
        ext->sb.hor_draw = 1;
        ext->sb.ver_draw = 1;
    }

    /*Invalidate the current (old) scrollbar areas*/
    lv_disp_t * disp = lv_obj_get_disp(page);
    lv_area_t sb_area_tmp;
    if(ext->sb.hor_draw != 0) {
        lv_area_copy(&sb_area_tmp, &ext->sb.hor_area);
        sb_area_tmp.x1 += page->coords.x1;
        sb_area_tmp.y1 += page->coords.y1;
        sb_area_tmp.x2 += page->coords.x1;
        sb_area_tmp.y2 += page->coords.y1;
        lv_inv_area(disp, &sb_area_tmp);
    }
    if(ext->sb.ver_draw != 0) {
        lv_area_copy(&sb_area_tmp, &ext->sb.ver_area);
        sb_area_tmp.x1 += page->coords.x1;
        sb_area_tmp.y1 += page->coords.y1;
        sb_area_tmp.x2 += page->coords.x1;
        sb_area_tmp.y2 += page->coords.y1;
        lv_inv_area(disp, &sb_area_tmp);
    }

    if(ext->sb.mode == LV_SB_MODE_DRAG && lv_indev_is_dragging(lv_indev_get_act()) == false) {
        ext->sb.hor_draw = 0;
        ext->sb.ver_draw = 0;
        return;
    }

    /*Full sized horizontal scrollbar*/
    if(scrl_w <= obj_w - style->body.padding.left - style->body.padding.right) {
        lv_area_set_width(&ext->sb.hor_area, obj_w - 2 * sb_hor_pad);
        lv_area_set_pos(&ext->sb.hor_area, sb_hor_pad,
                        obj_h - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.bottom);
        if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.hor_draw = 0;
    }
    /*Smaller horizontal scrollbar*/
    else {
        size_tmp =
            (obj_w * (obj_w - (2 * sb_hor_pad))) / (scrl_w + style->body.padding.left + style->body.padding.right);
        if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
        lv_area_set_width(&ext->sb.hor_area, size_tmp);

        lv_area_set_pos(&ext->sb.hor_area,
                        sb_hor_pad +
                            (-(lv_obj_get_x(scrl) - style->body.padding.left) * (obj_w - size_tmp - 2 * sb_hor_pad)) /
                                (scrl_w + style->body.padding.left + style->body.padding.right - obj_w),
                        obj_h - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.bottom);

        if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.hor_draw = 1;
    }

    /*Full sized vertical scroll bar*/
    if(scrl_h <= obj_h - style->body.padding.top - style->body.padding.bottom) {
        lv_area_set_height(&ext->sb.ver_area, obj_h - 2 * sb_ver_pad);
        lv_area_set_pos(&ext->sb.ver_area,
                        obj_w - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.right, sb_ver_pad);
        if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.ver_draw = 0;
    }
    /*Smaller vertical scroll bar*/
    else {
        size_tmp =
            (obj_h * (obj_h - (2 * sb_ver_pad))) / (scrl_h + style->body.padding.top + style->body.padding.bottom);
        if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
        lv_area_set_height(&ext->sb.ver_area, size_tmp);

        lv_area_set_pos(&ext->sb.ver_area,
                        obj_w - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.right,
                        sb_ver_pad + (-(lv_obj_get_y(scrl) - ext->sb.style->body.padding.bottom) *
                                      (obj_h - size_tmp - 2 * sb_ver_pad)) /
                                         (scrl_h + style->body.padding.top + style->body.padding.bottom - obj_h));

        if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.ver_draw = 1;
    }

    /*Invalidate the new scrollbar areas*/
    if(ext->sb.hor_draw != 0) {
        lv_area_copy(&sb_area_tmp, &ext->sb.hor_area);
        sb_area_tmp.x1 += page->coords.x1;
        sb_area_tmp.y1 += page->coords.y1;
        sb_area_tmp.x2 += page->coords.x1;
        sb_area_tmp.y2 += page->coords.y1;
        lv_inv_area(disp, &sb_area_tmp);
    }
    if(ext->sb.ver_draw != 0) {
        lv_area_copy(&sb_area_tmp, &ext->sb.ver_area);
        sb_area_tmp.x1 += page->coords.x1;
        sb_area_tmp.y1 += page->coords.y1;
        sb_area_tmp.x2 += page->coords.x1;
        sb_area_tmp.y2 += page->coords.y1;
        lv_inv_area(disp, &sb_area_tmp);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
callq 0x6af7
movq %rax, %r14
movq %rbx, %rdi
callq 0x66b6
movq %rax, %r12
movq 0x8(%r14), %r15
movq %r15, %rdi
callq 0x566d
movl %eax, %ebp
movq %r15, %rdi
callq 0x5697
movw %ax, 0x30(%rsp)
movq %rbx, %rdi
callq 0x566d
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
callq 0x5697
movl %eax, 0x18(%rsp)
movq 0x10(%r14), %rax
movzwl 0x1e(%rax), %eax
movzwl 0x1c(%r12), %r13d
cmpw %r13w, %ax
cmovgl %eax, %r13d
movzwl 0x18(%r12), %edx
cmpw %dx, %ax
cmovgl %eax, %edx
movl 0x28(%r14), %eax
movl %eax, %ecx
shrl $0x2, %ecx
andl $0x7, %ecx
je 0x26920
movq %r15, 0x40(%rsp)
movq %rdx, 0x28(%rsp)
cmpl $0x1, %ecx
jne 0x265d8
orb $0x3, %al
movb %al, 0x28(%r14)
movq %rbx, %rdi
callq 0x5061
movq %rax, %r15
movb 0x28(%r14), %al
testb $0x1, %al
je 0x26614
movq 0x20(%rbx), %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
movq 0x18(%r14), %xmm1
paddw %xmm0, %xmm1
leaq 0x38(%rsp), %rsi
movq %xmm1, (%rsi)
movq %r15, %rdi
callq 0x7170
movb 0x28(%r14), %al
testb $0x2, %al
je 0x26641
movq 0x20(%rbx), %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
movq 0x20(%r14), %xmm1
paddw %xmm0, %xmm1
leaq 0x38(%rsp), %rsi
movq %xmm1, (%rsi)
movq %r15, %rdi
callq 0x7170
movb 0x28(%r14), %al
andb $0x1c, %al
cmpb $0x8, %al
jne 0x2665c
callq 0x378a
movq %rax, %rdi
callq 0x3869
testb %al, %al
je 0x268b9
movq %rbx, 0x20(%rsp)
movswl %bp, %ebx
movl 0xc(%rsp), %edx
movswl %dx, %ebp
movswl 0x1a(%r12), %eax
movswl 0x1c(%r12), %ecx
addl %eax, %ecx
movl %ebp, %eax
subl %ecx, %eax
cmpl %ebx, %eax
movq %r15, 0x10(%rsp)
jge 0x26730
movswl %r13w, %eax
movq %rax, 0x48(%rsp)
leal (%rax,%rax), %edx
movl %ebp, %eax
subl %edx, %eax
imull %ebp, %eax
addl %ebx, %ecx
cltd
idivl %ecx
cmpw $0xd, %ax
movl $0xc, %ecx
cmovgel %eax, %ecx
leaq 0x18(%r14), %rdi
movq %rdi, 0x50(%rsp)
movzwl %cx, %r15d
movl %r15d, %esi
callq 0x28ccd
movq 0x40(%rsp), %rdi
callq 0x4bdd
cwtl
movswl 0x1a(%r12), %ecx
movswl 0x1c(%r12), %esi
addl %ecx, %esi
subl %eax, %ecx
movq 0x48(%rsp), %rax
leal (%r15,%rax,2), %eax
subl %ebp, %ebx
subl %eax, %ebp
imull %ecx, %ebp
addl %ebx, %esi
movl %ebp, %eax
cltd
idivl %esi
addl %r13d, %eax
movq 0x10(%r14), %rcx
movzwl 0x1e(%rcx), %edx
addw 0x18(%rcx), %dx
movl 0x18(%rsp), %r15d
movl %r15d, %ecx
subl %edx, %ecx
movswl %ax, %esi
movswl %cx, %edx
movq 0x50(%rsp), %rdi
callq 0x28ce2
movb 0x28(%r14), %al
movl %eax, %ecx
andb $0x18, %cl
cmpb $0x8, %cl
jne 0x26780
orb $0x1, %al
jmp 0x2677c
leaq 0x18(%r14), %rbp
movl %edx, %ecx
subl %r13d, %ecx
subl %r13d, %ecx
movswl %cx, %esi
movq %rbp, %rdi
callq 0x28ccd
movq 0x10(%r14), %rax
movzwl 0x1e(%rax), %ecx
addw 0x18(%rax), %cx
movl 0x18(%rsp), %r15d
movl %r15d, %eax
subl %ecx, %eax
movswl %ax, %edx
movswl %r13w, %esi
movq %rbp, %rdi
callq 0x28ce2
movb 0x28(%r14), %al
movl %eax, %ecx
andb $0x18, %cl
cmpb $0x8, %cl
jne 0x26780
andb $-0x12, %al
movb %al, 0x28(%r14)
movswl 0x30(%rsp), %ebx
movswl %r15w, %ebp
movswl 0x16(%r12), %eax
movswl 0x18(%r12), %ecx
addl %eax, %ecx
movl %ebp, %eax
subl %ecx, %eax
cmpl %ebx, %eax
jge 0x2685b
movswl 0x28(%rsp), %eax
movq %rax, 0x18(%rsp)
leal (%rax,%rax), %edx
movl %ebp, %eax
subl %edx, %eax
imull %ebp, %eax
addl %ebx, %ecx
cltd
idivl %ecx
cmpw $0xd, %ax
movl $0xc, %ecx
cmovgel %eax, %ecx
movq %r14, %r15
addq $0x20, %r15
movzwl %cx, %esi
movq %rsi, 0x30(%rsp)
movq %r15, %rdi
callq 0x28cd7
movq 0x10(%r14), %rax
movzwl 0x1e(%rax), %ecx
addw 0x1c(%rax), %cx
movl 0xc(%rsp), %r13d
subl %ecx, %r13d
movq 0x40(%rsp), %rdi
callq 0x4c15
cwtl
movq 0x10(%r14), %rcx
movswl 0x18(%rcx), %ecx
subl %eax, %ecx
movq 0x18(%rsp), %rax
movq 0x30(%rsp), %rdx
leal (%rdx,%rax,2), %eax
subl %ebp, %ebx
subl %eax, %ebp
imull %ecx, %ebp
movswl 0x16(%r12), %eax
movswl 0x18(%r12), %ecx
addl %eax, %ecx
addl %ebx, %ecx
movl %ebp, %eax
cltd
idivl %ecx
addl 0x28(%rsp), %eax
movswl %ax, %edx
movswl %r13w, %esi
movq %r15, %rdi
callq 0x28ce2
movb 0x28(%r14), %al
movl %eax, %ecx
andb $0x18, %cl
cmpb $0x8, %cl
jne 0x268c0
orb $0x2, %al
movq 0x20(%rsp), %rbx
jmp 0x268ae
movl %r15d, %ecx
movq %r14, %r15
addq $0x20, %r15
movq 0x28(%rsp), %rbx
subl %ebx, %ecx
subl %ebx, %ecx
movswl %cx, %esi
movq %r15, %rdi
callq 0x28cd7
movq 0x10(%r14), %rax
movzwl 0x1e(%rax), %ecx
addw 0x1c(%rax), %cx
movl 0xc(%rsp), %eax
subl %ecx, %eax
movswl %ax, %esi
movswl %bx, %edx
movq %r15, %rdi
callq 0x28ce2
movb 0x28(%r14), %al
movl %eax, %ecx
andb $0x18, %cl
cmpb $0x8, %cl
movq 0x20(%rsp), %rbx
jne 0x268c5
andb $-0x13, %al
movq 0x10(%rsp), %r15
movb %al, 0x28(%r14)
jmp 0x268ca
andb $-0x4, 0x28(%r14)
jmp 0x26920
movq 0x20(%rsp), %rbx
movq 0x10(%rsp), %r15
testb $0x1, %al
je 0x268f7
movq 0x20(%rbx), %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
movq 0x18(%r14), %xmm1
paddw %xmm0, %xmm1
leaq 0x38(%rsp), %rsi
movq %xmm1, (%rsi)
movq %r15, %rdi
callq 0x7170
movb 0x28(%r14), %al
testb $0x2, %al
je 0x26920
movq 0x20(%rbx), %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
movq 0x20(%r14), %xmm1
paddw %xmm0, %xmm1
leaq 0x38(%rsp), %rsi
movq %xmm1, (%rsi)
movq %r15, %rdi
callq 0x7170
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq