// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movq 0x6d123(%rip), %rax     # 0x89400
movq -0x10(%rbp), %rdi
movb -0x11(%rbp), %cl
movq -0x20(%rbp), %rdx
movzbl %cl, %esi
callq *%rax
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
je 0x1c304
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x1c576
movzbl -0x11(%rbp), %eax
cmpl $0x7, %eax
jne 0x1c325
movq -0x20(%rbp), %rdi
leaq 0x4c194(%rip), %rsi     # 0x684ac
callq 0xaa80
movb %al, -0x1(%rbp)
jmp 0x1c576
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x30(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
jne 0x1c3ab
movb $0x0, -0x31(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movzbl -0x31(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x1c376
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movzbl -0x31(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x44ec0
movb -0x31(%rbp), %al
addb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x1c33f
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44ec0
movq -0x30(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x10(%rax)
jmp 0x1c570
movzbl -0x11(%rbp), %eax
cmpl $0x2, %eax
jne 0x1c413
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1c40e
movq -0x10(%rbp), %rdi
callq 0x8310
cwtl
movl %eax, -0x5c(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1e430
movw %ax, %cx
movl -0x5c(%rbp), %eax
movswl %cx, %ecx
cmpl %ecx, %eax
jne 0x1c405
movq -0x10(%rbp), %rdi
callq 0x8350
cwtl
movl %eax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1e450
movw %ax, %cx
movl -0x60(%rbp), %eax
movswl %cx, %ecx
cmpl %ecx, %eax
je 0x1c40e
movq -0x10(%rbp), %rdi
callq 0x1d0e0
jmp 0x1c56e
movzbl -0x11(%rbp), %eax
cmpl $0xb, %eax
jne 0x1c480
callq 0x4b70
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x4b80
movb %al, -0x41(%rbp)
movzbl -0x41(%rbp), %eax
cmpl $0x2, %eax
je 0x1c45a
movzbl -0x41(%rbp), %eax
cmpl $0x4, %eax
jne 0x1c47b
movq -0x10(%rbp), %rdi
callq 0x77c0
movq %rax, %rdi
callq 0x32e0
testb $0x1, %al
jne 0x1c45a
jmp 0x1c47b
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x9cb0
movq -0x68(%rbp), %rdi
movq %rax, %rdx
movl $0x6, %esi
callq 0x7990
jmp 0x1c56c
movzbl -0x11(%rbp), %eax
cmpl $0x10, %eax
je 0x1c49f
movzbl -0x11(%rbp), %eax
cmpl $0x11, %eax
je 0x1c49f
movzbl -0x11(%rbp), %eax
cmpl $0x12, %eax
jne 0x1c550
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
je 0x1c4c7
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rcx), %rdi
movb -0x11(%rbp), %cl
movq -0x20(%rbp), %rdx
movzbl %cl, %esi
callq *%rax
movzbl -0x11(%rbp), %eax
cmpl $0x10, %eax
jne 0x1c54e
callq 0x4b70
movq %rax, %rdi
callq 0x4b80
movb %al, -0x42(%rbp)
movzbl -0x42(%rbp), %eax
cmpl $0x0, %eax
jne 0x1c4fd
xorl %eax, %eax
movl %eax, %edi
callq 0xded0
movq %rax, %rdi
callq 0x4b80
movb %al, -0x42(%rbp)
movzbl -0x42(%rbp), %eax
cmpl $0x4, %eax
jne 0x1c538
movq -0x10(%rbp), %rdi
callq 0x77c0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x32e0
testb $0x1, %al
jne 0x1c522
jmp 0x1c536
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movzwl 0x24(%rax), %esi
callq 0x376b0
jmp 0x1c54c
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movzwl 0x24(%rax), %esi
callq 0x376b0
jmp 0x1c54e
jmp 0x1c56a
movzbl -0x11(%rbp), %eax
cmpl $0x13, %eax
jne 0x1c568
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movb $0x1, (%rax)
jmp 0x1c56a
jmp 0x1c56c
jmp 0x1c56e
jmp 0x1c570
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x70, %rsp
popq %rbp
retq
nop