// File: /workspace/github_c_makefile_star2_O2/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, %r14
callq *0x4e0a2(%rip)          # 0x5e330
movl %eax, %ebx
cmpb $0x1, %al
jne 0x10417
cmpb $0x7, %bpl
jne 0x102b5
leaq 0x2b337(%rip), %rsi     # 0x3b5dc
movq %r12, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x684b
movq %r14, %rdi
callq 0x6747
movq %rax, %r15
cmpb $0xb, %bpl
je 0x10350
movzbl %bpl, %esi
cmpl $0x2, %esi
je 0x102fd
testl %esi, %esi
jne 0x1039f
xorl %ebx, %ebx
movq 0x18(%r15), %rdi
movzbl %bl, %eax
movq (%rdi,%rax,8), %rax
cmpb $0x0, (%rax)
je 0x10404
movq %rax, %rdi
callq 0x27a7a
incb %bl
jmp 0x102dd
movb $0x1, %bl
cmpq $0x0, 0x10(%r15)
je 0x10417
movq %r14, %rdi
callq 0x5308
movzwl 0x4(%r12), %ecx
subw (%r12), %cx
incl %ecx
cmpw %cx, %ax
jne 0x10343
movq %r14, %rdi
callq 0x5332
movzwl 0x6(%r12), %ecx
subw 0x2(%r12), %cx
incl %ecx
cmpw %cx, %ax
je 0x10417
movq %r14, %rdi
callq 0x10ae4
jmp 0x10417
callq 0x35b3
movq %rax, %rdi
callq 0x35bb
movb $0x1, %bl
cmpb $0x2, %al
je 0x10387
movzbl %al, %eax
cmpl $0x4, %eax
jne 0x10417
movq %r14, %rdi
callq 0x4b8e
movq %rax, %rdi
callq 0x2aaa
testb %al, %al
je 0x10417
movq (%r15), %r14
callq 0x60de
pushq $0x6
popq %rsi
movq %r14, %rdi
movq %rax, %rdx
callq 0x4caf
jmp 0x10417
movb $0x1, %bl
leal -0x10(%rsi), %eax
cmpl $0x3, %eax
jae 0x10422
movq (%r15), %rdi
testq %rdi, %rdi
je 0x103b7
movq %r12, %rdx
callq *0x30(%rdi)
cmpb $0x10, %bpl
jne 0x10417
callq 0x35b3
movq %rax, %rdi
callq 0x35bb
testb %al, %al
jne 0x103dd
xorl %edi, %edi
callq 0x7fb2
movq %rax, %rdi
callq 0x35bb
cmpb $0x4, %al
jne 0x103f5
movq %r14, %rdi
callq 0x4b8e
movq %rax, %rdi
callq 0x2aaa
testb %al, %al
je 0x10417
movq (%r15), %rdi
movzwl 0x24(%r15), %esi
callq 0x20433
jmp 0x10417
callq 0x27a7a
andq $0x0, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15)
movb $0x1, %bl
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x13, %esi
jne 0x10417
movb $0x1, (%r12)
jmp 0x10417