// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
callq *0x3a754(%rip)          # 0x60468
movl %eax, %ebx
cmpb $0x1, %al
jne 0x2609a
cmpb $0x7, %bpl
jne 0x25d41
leaq 0x19eb1(%rip), %rsi     # 0x3fbdc
movq %r12, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6c02
movq %r14, %rdi
callq 0x6af7
movq %rax, 0x10(%rsp)
movzbl %bpl, %eax
movb $0x1, %bl
leal -0x1(%rax), %ecx
cmpl $0x5, %ecx
ja 0x25ec5
leaq 0x19e2d(%rip), %rax     # 0x3fb94
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r14, %rdi
xorl %esi, %esi
callq 0x264cb
movq %rax, 0x20(%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0x264cb
movq %rax, 0x18(%rsp)
movq %r14, %rdi
callq 0x2695e
movq %rax, %rdi
callq 0x22e90
movl %eax, %r15d
movq %r14, %rdi
callq 0x2695e
movq %rax, %rdi
callq 0x22ebf
movl %eax, %r13d
movq %r14, %rdi
callq 0x2695e
movq %rax, %rdi
callq 0x22eec
movl %eax, %r12d
movq %r14, %rdi
xorl %esi, %esi
callq 0x51a7
testq %rax, %rax
je 0x2609a
movq %rax, %rbp
andb $-0x3, %r15b
movb %r15b, 0xf(%rsp)
andb $-0x3, %r13b
movb %r13b, 0xe(%rsp)
andb $-0x3, %r12b
movl %r12d, %r15d
movq %rbp, %rdi
movl $0x2, %esi
callq 0x6a5b
movl %eax, %r13d
movq %r14, %rdi
movq %rbp, %rsi
callq 0x51a7
movq %rax, %r12
testb %r13b, %r13b
jne 0x25eb4
movzwl 0x20(%rbp), %eax
cmpw 0x20(%r14), %ax
jne 0x25e4a
cmpb $0x1, 0xf(%rsp)
jne 0x25e4a
movq 0x18(%rsp), %rcx
movzwl 0x1a(%rcx), %ecx
addl %ecx, %eax
movw %ax, 0x20(%rbp)
addw %cx, 0x24(%rbp)
movl %r15d, %edi
jmp 0x25e7f
movzwl 0x24(%rbp), %ecx
cmpw 0x24(%r14), %cx
movb 0xe(%rsp), %dl
movl %r15d, %edi
jne 0x25e7f
cmpb $0x1, %dl
jne 0x25e7f
movq 0x20(%rsp), %rdx
movzwl 0x1c(%rdx), %edx
movq 0x18(%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 0x25ea3
cmpb $0x1, %dil
jne 0x25ea3
movq 0x18(%rsp), %rcx
movzwl 0x16(%rcx), %ecx
addl %ecx, %eax
movw %ax, 0x22(%rbp)
addw %cx, 0x26(%rbp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rsi
movq %rbp, %rdi
callq 0x5259
movq %r12, %rbp
testq %r12, %r12
jne 0x25df9
jmp 0x2609a
cmpl $0x12, %eax
je 0x25fc0
cmpl $0x13, %eax
jne 0x2609a
movb $0x1, (%r12)
jmp 0x2609a
movswl 0x5c(%r14), %eax
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rcx
movswl 0x1c(%rcx), %edx
negl %edx
cmpl %edx, %eax
jge 0x25f01
movw %dx, 0x5c(%r14)
movswl %dx, %eax
movswl 0x18(%rcx), %ecx
negl %ecx
cmpl %ecx, %eax
jge 0x2609a
movw %cx, 0x5c(%r14)
jmp 0x2609a
movq 0x10(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2609a
movq %r14, %rdi
callq 0x566d
movzwl 0x4(%r12), %ecx
subw (%r12), %cx
incl %ecx
cmpw %cx, %ax
jne 0x25f62
movq %r14, %rdi
callq 0x5697
movzwl 0x6(%r12), %ecx
subw 0x2(%r12), %cx
incl %ecx
cmpw %cx, %ax
je 0x2609a
movq 0x10(%rsp), %r15
movq 0x8(%r15), %rdi
leaq 0x20(%rdi), %rdx
movl $0x2, %esi
callq *0x30(%rdi)
testb $0x3, 0x28(%r15)
je 0x2609a
movq %r14, %rdi
callq 0x26538
jmp 0x2609a
movq 0x10(%rsp), %r15
movq 0x8(%r15), %rdi
leaq 0x20(%rdi), %rdx
movl $0x2, %esi
callq *0x30(%rdi)
testb $0x3, 0x28(%r15)
je 0x25fb3
movq %r14, %rdi
callq 0x26538
movq %r14, %rdi
callq 0x6514
jmp 0x2609a
movl (%r12), %eax
addl $-0x11, %eax
cmpl $0x3, %eax
ja 0x2609a
leaq 0x19bd5(%rip), %rcx     # 0x3fbac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x2695e
movq %rax, %rdi
callq 0x566d
movl %eax, %ebp
movq %r14, %rdi
callq 0x566d
cmpw %ax, %bp
jle 0x2601d
movq %r14, %rdi
callq 0x566d
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %eax
sarl $0x2, %eax
negl %eax
movswl %ax, %esi
jmp 0x26071
movq %r14, %rdi
callq 0x5697
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %eax
sarl $0x2, %eax
negl %eax
movswl %ax, %esi
jmp 0x26092
movq %r14, %rdi
callq 0x2695e
movq %rax, %rdi
callq 0x566d
movl %eax, %ebp
movq %r14, %rdi
callq 0x566d
cmpw %ax, %bp
jle 0x2607b
movq %r14, %rdi
callq 0x566d
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %esi
sarl $0x2, %esi
movq %r14, %rdi
callq 0x26f64
jmp 0x2609a
movq %r14, %rdi
callq 0x5697
leal 0x3(%rax), %ecx
testw %ax, %ax
cmovnsl %eax, %ecx
movswl %cx, %esi
sarl $0x2, %esi
movq %r14, %rdi
callq 0x26fc6
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq