// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_page.c
// Function: lv_page_signal
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
{
    lv_res_t res;

    /* Include the ancient signal function */
    res = ancestor_signal(page, sign, param);
    if(res != LV_RES_OK) return res;
    if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);

    lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
    lv_obj_t * child;
    if(sign == LV_SIGNAL_CHILD_CHG) { /*Automatically move children to the scrollable object*/
        const lv_style_t * style_bg = lv_page_get_style(page, LV_PAGE_STYLE_BG);
        const lv_style_t * style_scrl = lv_page_get_style(page, LV_PAGE_STYLE_SCRL);
        lv_fit_t fit_left        = lv_page_get_scrl_fit_left(page);
        lv_fit_t fit_right        = lv_page_get_scrl_fit_right(page);
        lv_fit_t fit_top         = lv_page_get_scrl_fit_top(page);
        child                    = lv_obj_get_child(page, NULL);
        while(child != NULL) {
            if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) {
                lv_obj_t * tmp = child;
                child          = lv_obj_get_child(page, child); /*Get the next child before move this*/

                /* Reposition the child to take padding into account (Only if it's on (0;0) or (widht;height) coordinates now)
                 * It's required to keep new the object on the same coordinate if FIT is enabled.*/
                if((tmp->coords.x1 == page->coords.x1) && (fit_left == LV_FIT_TIGHT || fit_left == LV_FIT_FILL)) {
                    tmp->coords.x1 += style_scrl->body.padding.left;
                    tmp->coords.x2 += style_scrl->body.padding.left;
                }
                else if((tmp->coords.x2 == page->coords.x2) && (fit_right == LV_FIT_TIGHT || fit_right == LV_FIT_FILL)) {
                    tmp->coords.x1 -= style_scrl->body.padding.right + style_bg->body.padding.right;
                    tmp->coords.x2 -= style_scrl->body.padding.right + style_bg->body.padding.right;
                }
                if((tmp->coords.y1 == page->coords.y1) && (fit_top == LV_FIT_TIGHT || fit_top == LV_FIT_FILL)) {
                    tmp->coords.y1 += style_scrl->body.padding.top;
                    tmp->coords.y2 += style_scrl->body.padding.top;
                }
                lv_obj_set_parent(tmp, ext->scrl);
            } else {
                child = lv_obj_get_child(page, child);
            }
        }
    } else if(sign == LV_SIGNAL_STYLE_CHG) {
        ext->scrl->signal_cb(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords);

        /*The scrollbars are important only if they are visible now*/
        if(ext->sb.hor_draw || ext->sb.ver_draw) lv_page_sb_refresh(page);

        /*Refresh the ext. size because the scrollbars might be positioned out of the page*/
        lv_obj_refresh_ext_draw_pad(page);
    } else if(sign == LV_SIGNAL_CORD_CHG) {
        /*Refresh the scrollbar and notify the scrl if the size is changed*/
        if(ext->scrl != NULL && (lv_obj_get_width(page) != lv_area_get_width(param) ||
                                 lv_obj_get_height(page) != lv_area_get_height(param))) {
            /*If no hor_fit enabled set the scrollable's width to the page's width*/
            ext->scrl->signal_cb(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords);

            /*The scrollbars are important only if they are visible now*/
            if(ext->sb.hor_draw || ext->sb.ver_draw) lv_page_sb_refresh(page);
        }
    } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
        /*Ensure ext. size for the scrollbars if they are out of the page*/
        if(page->ext_draw_pad < (-ext->sb.style->body.padding.right))
            page->ext_draw_pad = -ext->sb.style->body.padding.right;
        if(page->ext_draw_pad < (-ext->sb.style->body.padding.bottom))
            page->ext_draw_pad = -ext->sb.style->body.padding.bottom;
    } else if(sign == LV_SIGNAL_CONTROL) {
        uint32_t c = *((uint32_t *)param);

        if(c == LV_KEY_DOWN) {
            lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4);
        } else if(c == LV_KEY_UP) {
            lv_page_scroll_ver(page, lv_obj_get_height(page) / 4);
        } else if(c == LV_KEY_RIGHT) {
            /*If the page can't be scrolled horizontally because it's not wide enough then scroll it
             * vertically*/
            if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page))
                lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4);
            else
                lv_page_scroll_hor(page, -lv_obj_get_width(page) / 4);
        } else if(c == LV_KEY_LEFT) {
            /*If the page can't be scrolled horizontally because it's not wide enough then scroll it
             * vertically*/
            if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page))
                lv_page_scroll_ver(page, lv_obj_get_height(page) / 4);
            else
                lv_page_scroll_hor(page, lv_obj_get_width(page) / 4);
        }
    } else if(sign == LV_SIGNAL_GET_EDITABLE) {
        bool * editable = (bool *)param;
        *editable       = true;
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
callq *0x3ae32(%rip)          # 0x60468
movl %eax, %ebx
cmpb $0x1, %al
jne 0x25993
cmpb $0x7, %bpl
jne 0x25663
leaq 0x1a3f7(%rip), %rsi     # 0x3fa44
movq %r12, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6bf5
movq %r14, %rdi
callq 0x6ad8
movq %rax, %r15
movzbl %bpl, %eax
leal -0x1(%rax), %ecx
cmpl $0x5, %ecx
ja 0x257d0
leaq 0x1a377(%rip), %rax     # 0x3f9fc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r14, %rdi
xorl %esi, %esi
callq 0x25ddf
movq %rax, 0x10(%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0x25ddf
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0x26288
movq %rax, %rdi
callq 0x2270e
movb %al, 0x7(%rsp)
movq %r14, %rdi
callq 0x26288
movq %rax, %rdi
callq 0x2273d
movb %al, 0x5(%rsp)
movq %r14, %rdi
callq 0x26288
movq %rax, %rdi
callq 0x2276a
movb %al, 0x6(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x51a3
testq %rax, %rax
je 0x25993
movq %rax, %rbp
andb $-0x3, 0x7(%rsp)
andb $-0x3, 0x5(%rsp)
andb $-0x3, 0x6(%rsp)
movq %rbp, %rdi
movl $0x2, %esi
callq 0x6a3c
movl %eax, %r13d
movq %r14, %rdi
movq %rbp, %rsi
callq 0x51a3
movq %rax, %r12
testb %r13b, %r13b
jne 0x257bf
movzwl 0x20(%rbp), %eax
cmpw 0x20(%r14), %ax
jne 0x2575e
cmpb $0x1, 0x7(%rsp)
jne 0x2575e
movq 0x8(%rsp), %rcx
movzwl 0x1a(%rcx), %ecx
addl %ecx, %eax
movw %ax, 0x20(%rbp)
addw %cx, 0x24(%rbp)
jmp 0x2578e
movzwl 0x24(%rbp), %ecx
cmpw 0x24(%r14), %cx
jne 0x2578e
cmpb $0x1, 0x5(%rsp)
jne 0x2578e
movq 0x10(%rsp), %rdx
movzwl 0x1c(%rdx), %edx
movq 0x8(%rsp), %rsi
addw 0x1c(%rsi), %dx
subl %edx, %eax
movw %ax, 0x20(%rbp)
subl %edx, %ecx
movw %cx, 0x24(%rbp)
movzwl 0x22(%rbp), %eax
cmpw 0x22(%r14), %ax
jne 0x257b3
cmpb $0x1, 0x6(%rsp)
jne 0x257b3
movq 0x8(%rsp), %rcx
movzwl 0x16(%rcx), %ecx
addl %ecx, %eax
movw %ax, 0x22(%rbp)
addw %cx, 0x26(%rbp)
movq 0x8(%r15), %rsi
movq %rbp, %rdi
callq 0x5255
movq %r12, %rbp
testq %r12, %r12
jne 0x25710
jmp 0x25993
cmpl $0x12, %eax
je 0x258b9
cmpl $0x13, %eax
jne 0x25993
movb $0x1, (%r12)
jmp 0x25993
movswl 0x5c(%r14), %edx
movq 0x10(%r15), %rax
movswl 0x1c(%rax), %ecx
negl %ecx
cmpl %ecx, %edx
jge 0x25804
movw %cx, 0x5c(%r14)
movswl 0x5c(%r14), %ecx
movswl 0x18(%rax), %eax
negl %eax
cmpl %eax, %ecx
jge 0x25993
movw %ax, 0x5c(%r14)
jmp 0x25993
cmpq $0x0, 0x8(%r15)
je 0x25993
movq %r14, %rdi
callq 0x5651
movzwl 0x4(%r12), %ecx
subw (%r12), %cx
incl %ecx
cmpw %cx, %ax
jne 0x25865
movq %r14, %rdi
callq 0x567b
movzwl 0x6(%r12), %ecx
subw 0x2(%r12), %cx
incl %ecx
cmpw %cx, %ax
je 0x25993
movq 0x8(%r15), %rdi
leaq 0x20(%rdi), %rdx
movl $0x2, %esi
callq *0x30(%rdi)
testb $0x3, 0x28(%r15)
je 0x25993
movq %r14, %rdi
callq 0x25e4c
jmp 0x25993
movq 0x8(%r15), %rdi
leaq 0x20(%rdi), %rdx
movl $0x2, %esi
callq *0x30(%rdi)
testb $0x3, 0x28(%r15)
je 0x258ac
movq %r14, %rdi
callq 0x25e4c
movq %r14, %rdi
callq 0x64f5
jmp 0x25993
movl (%r12), %eax
addl $-0x11, %eax
cmpl $0x3, %eax
ja 0x25993
leaq 0x1a144(%rip), %rcx     # 0x3fa14
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x26288
movq %rax, %rdi
callq 0x5651
movl %eax, %ebp
movq %r14, %rdi
callq 0x5651
cmpw %ax, %bp
jle 0x25916
movq %r14, %rdi
callq 0x5651
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %eax
sarl $0x2, %eax
negl %eax
movswl %ax, %esi
jmp 0x2596a
movq %r14, %rdi
callq 0x567b
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %eax
sarl $0x2, %eax
negl %eax
movswl %ax, %esi
jmp 0x2598b
movq %r14, %rdi
callq 0x26288
movq %rax, %rdi
callq 0x5651
movl %eax, %ebp
movq %r14, %rdi
callq 0x5651
cmpw %ax, %bp
jle 0x25974
movq %r14, %rdi
callq 0x5651
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %esi
sarl $0x2, %esi
movq %r14, %rdi
callq 0x2688e
jmp 0x25993
movq %r14, %rdi
callq 0x567b
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %esi
sarl $0x2, %esi
movq %r14, %rdi
callq 0x268f0
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq