// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_tabview.c
// Function: lv_tabview_signal
static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * param)
{
    lv_res_t res;

    /* Include the ancient signal function */
    res = ancestor_signal(tabview, 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_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
    if(sign == LV_SIGNAL_CLEANUP) {
        uint8_t i;
        for(i = 0; ext->tab_name_ptr[i][0] != '\0'; i++) lv_mem_free(ext->tab_name_ptr[i]);

        lv_mem_free(ext->tab_name_ptr);
        ext->tab_name_ptr = NULL;
        ext->btns         = NULL; /*These objects were children so they are already invalid*/
        ext->content      = NULL;
    } else if(sign == LV_SIGNAL_CORD_CHG) {
        if(ext->content != NULL && (lv_obj_get_width(tabview) != lv_area_get_width(param) ||
                                    lv_obj_get_height(tabview) != lv_area_get_height(param))) {
            tabview_realign(tabview);
        }
    } else if(sign == LV_SIGNAL_RELEASED) {
#if LV_USE_GROUP
        /*If released by a KEYPAD or ENCODER then really the tab buttons should be released.
         * So simulate a CLICK on the tab buttons*/
        lv_indev_t * indev         = lv_indev_get_act();
        lv_indev_type_t indev_type = lv_indev_get_type(indev);
        if(indev_type == LV_INDEV_TYPE_KEYPAD ||
           (indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(tabview)))) {
            lv_event_send(ext->btns, LV_EVENT_CLICKED, lv_event_get_data());
        }
#endif
    } else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROL) {
        /* The button matrix is not in a group (the tab view is in it) but it should handle the
         * group signals. So propagate the related signals to the button matrix manually*/
        if(ext->btns) {
            ext->btns->signal_cb(ext->btns, sign, param);
        }

        if(sign == LV_SIGNAL_FOCUS) {
            lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
            /*If not focused by an input device assume the last input device*/
            if(indev_type == LV_INDEV_TYPE_NONE) {
                indev_type = lv_indev_get_type(lv_indev_get_next(NULL));
            }

            /*With ENCODER select the first button only in edit mode*/
            if(indev_type == LV_INDEV_TYPE_ENCODER) {
#if LV_USE_GROUP
                lv_group_t * g = lv_obj_get_group(tabview);
                if(lv_group_get_editing(g)) {
                    lv_btnm_set_pressed(ext->btns, ext->tab_cur);
                }
#endif
            } else {
                lv_btnm_set_pressed(ext->btns, ext->tab_cur);
            }
        }
    } else if(sign == LV_SIGNAL_GET_EDITABLE) {
        bool * editable = (bool *)param;
        *editable       = true;
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r15
callq *0x4f3f2(%rip)          # 0x60330
movl %eax, %ebx
cmpb $0x1, %al
jne 0x110e1
cmpb $0x7, %bpl
jne 0x10f65
leaq 0x2e767(%rip), %rsi     # 0x3f6bc
movq %r12, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6c02
movq %r15, %rdi
callq 0x6af7
movq %rax, %r14
cmpb $0xb, %bpl
je 0x11021
movzbl %bpl, %esi
cmpl $0x2, %esi
je 0x10fce
testl %esi, %esi
jne 0x11072
movq 0x18(%r14), %rax
movq (%rax), %rdi
cmpb $0x0, (%rdi)
je 0x10fb0
movb $0x1, %bl
callq 0x2a006
movq 0x18(%r14), %rax
movzbl %bl, %ebx
movq (%rax,%rbx,8), %rdi
incb %bl
cmpb $0x0, (%rdi)
jne 0x10f99
movq %rax, %rdi
callq 0x2a006
movq $0x0, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movb $0x1, %bl
jmp 0x110e1
movb $0x1, %bl
cmpq $0x0, 0x10(%r14)
je 0x110e1
movq %r15, %rdi
callq 0x566d
movzwl 0x4(%r12), %ecx
subw (%r12), %cx
incl %ecx
cmpw %cx, %ax
jne 0x11014
movq %r15, %rdi
callq 0x5697
movzwl 0x6(%r12), %ecx
subw 0x2(%r12), %cx
incl %ecx
cmpw %cx, %ax
je 0x110e1
movq %r15, %rdi
callq 0x11808
jmp 0x110e1
callq 0x378a
movq %rax, %rdi
callq 0x3792
movb $0x1, %bl
cmpb $0x2, %al
je 0x11058
movzbl %al, %eax
cmpl $0x4, %eax
jne 0x110e1
movq %r15, %rdi
callq 0x4ed1
movq %rax, %rdi
callq 0x2b0b
testb %al, %al
je 0x110e1
movq (%r14), %r14
callq 0x6473
movq %r14, %rdi
movl $0x6, %esi
movq %rax, %rdx
callq 0x5018
jmp 0x110e1
movb $0x1, %bl
leal -0x10(%rsi), %eax
cmpl $0x3, %eax
jae 0x110d7
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1108a
movq %r12, %rdx
callq *0x30(%rdi)
cmpb $0x10, %bpl
jne 0x110e1
callq 0x378a
movq %rax, %rdi
callq 0x3792
testb %al, %al
jne 0x110b0
xorl %edi, %edi
callq 0x874d
movq %rax, %rdi
callq 0x3792
cmpb $0x4, %al
jne 0x110c8
movq %r15, %rdi
callq 0x4ed1
movq %rax, %rdi
callq 0x2b0b
testb %al, %al
je 0x110e1
movq (%r14), %rdi
movzwl 0x24(%r14), %esi
callq 0x22559
jmp 0x110e1
cmpl $0x13, %esi
jne 0x110e1
movb $0x1, (%r12)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq