// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_roller.c
// Function: lv_roller_signal
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param)
{
    lv_res_t res = LV_RES_OK;

    /*Don't let the drop down list to handle the control signals. It works differently*/
    if(sign != LV_SIGNAL_CONTROL && sign != LV_SIGNAL_FOCUS && sign != LV_SIGNAL_DEFOCUS) {
        /* Include the ancient signal function */
        res = ancestor_signal(roller, 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_roller_ext_t * ext = lv_obj_get_ext_attr(roller);

    if(sign == LV_SIGNAL_STYLE_CHG) {
        refr_height(roller);

        refr_position(roller, false);
    } else if(sign == LV_SIGNAL_CORD_CHG) {

        if(lv_obj_get_width(roller) != lv_area_get_width(param) ||
           lv_obj_get_height(roller) != lv_area_get_height(param)) {

            refr_height(roller);
#if LV_USE_ANIMATION
            lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
            lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
            refr_position(roller, false);
        }
    } else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
        lv_group_t * g             = lv_obj_get_group(roller);
        bool editing               = lv_group_get_editing(g);
        lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());

        /*Encoders need special handling*/
        if(indev_type == LV_INDEV_TYPE_ENCODER) {
            /*In navigate mode revert the original value*/
            if(!editing) {
                if(ext->ddlist.sel_opt_id != ext->ddlist.sel_opt_id_ori) {
                    ext->ddlist.sel_opt_id = ext->ddlist.sel_opt_id_ori;
                    refr_position(roller, true);
                }
            }
            /*Save the current state when entered to edit mode*/
            else {
                ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id;
            }
        } else {
            ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Save the current value. Used to revert this state if
                                                                    ENER wont't be pressed*/
        }
#endif
    } else if(sign == LV_SIGNAL_DEFOCUS) {
#if LV_USE_GROUP
        /*Revert the original state*/
        if(ext->ddlist.sel_opt_id != ext->ddlist.sel_opt_id_ori) {
            ext->ddlist.sel_opt_id = ext->ddlist.sel_opt_id_ori;
            refr_position(roller, true);
        }
#endif
    } else if(sign == LV_SIGNAL_CONTROL) {
        char c = *((char *)param);
        if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
            if(ext->ddlist.sel_opt_id + 1 < ext->ddlist.option_cnt) {
                uint16_t ori_id = ext->ddlist.sel_opt_id_ori; /*lv_roller_set_selceted will overwrite this*/
                lv_roller_set_selected(roller, ext->ddlist.sel_opt_id + 1, true);
                ext->ddlist.sel_opt_id_ori = ori_id;
            }
        } else if(c == LV_KEY_LEFT || c == LV_KEY_UP) {
            if(ext->ddlist.sel_opt_id > 0) {
                uint16_t ori_id = ext->ddlist.sel_opt_id_ori; /*lv_roller_set_selceted will overwrite this*/
                lv_roller_set_selected(roller, ext->ddlist.sel_opt_id - 1, true);
                ext->ddlist.sel_opt_id_ori = ori_id;
            }
        }
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movl %esi, %r13d
movq %rdi, %r14
leal -0x10(%r13), %eax
movb $0x1, %bl
cmpb $0x3, %al
jb 0xea9e
movzbl %r13b, %esi
movq %r14, %rdi
movq %r12, %rdx
callq *0x51884(%rip)          # 0x60318
movl %eax, %ebx
cmpb $0x1, %al
jne 0xebf9
cmpb $0x7, %r13b
jne 0xeac1
leaq 0x30a5e(%rip), %rsi     # 0x3f509
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6bf5
movq %r14, %rdi
callq 0x6ad8
movq %rax, %r15
movzbl %r13b, %eax
cmpl $0xf, %eax
jle 0xeb1d
cmpl $0x10, %eax
je 0xeb38
cmpl $0x11, %eax
je 0xeb73
cmpl $0x12, %eax
jne 0xebf9
movzbl (%r12), %eax
movl %eax, %ecx
andb $-0x2, %cl
cmpb $0x12, %cl
jne 0xec0a
movzwl 0x62(%r15), %eax
incl %eax
movzwl 0x60(%r15), %ecx
cmpl %ecx, %eax
jae 0xebf9
movzwl 0x64(%r15), %ebp
jmp 0xec25
cmpl $0x2, %eax
je 0xeb8e
cmpl $0x4, %eax
jne 0xebf9
movq %r14, %rdi
callq 0xf394
jmp 0xebef
movq %r14, %rdi
callq 0x4ea3
movq %rax, %rdi
callq 0x2b2b
movl %eax, %ebp
callq 0x3784
movq %rax, %rdi
callq 0x378c
movzwl 0x62(%r15), %ecx
cmpb $0x4, %al
jne 0xeb69
testb %bpl, %bpl
je 0xec3c
movw %cx, 0x64(%r15)
jmp 0xebf9
movzwl 0x64(%r15), %eax
cmpw %ax, 0x62(%r15)
je 0xebf9
movw %ax, 0x62(%r15)
movq %r14, %rdi
movl $0x1, %esi
jmp 0xebf4
movq %r14, %rdi
callq 0x5651
movzwl 0x4(%r12), %ecx
subw (%r12), %cx
incl %ecx
cmpw %cx, %ax
jne 0xebc3
movq %r14, %rdi
callq 0x567b
movzwl 0x6(%r12), %ecx
subw 0x2(%r12), %cx
incl %ecx
cmpw %cx, %ax
je 0xebf9
movq %r14, %rdi
callq 0xf394
movq %r14, %rdi
callq 0x26288
leaq -0x96d9(%rip), %rsi     # 0x5501
movq %rax, %rdi
callq 0x295b1
movzwl 0x62(%r15), %esi
movq %r14, %rdi
callq 0xc1d9
movq %r14, %rdi
xorl %esi, %esi
callq 0xf56f
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x14, %eax
je 0xec14
cmpl $0x11, %eax
jne 0xebf9
movzwl 0x62(%r15), %eax
testw %ax, %ax
je 0xebf9
movzwl 0x64(%r15), %ebp
decl %eax
movzwl %ax, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xf439
movw %bp, 0x64(%r15)
jmp 0xebf9
movzwl 0x64(%r15), %eax
cmpw %ax, %cx
jne 0xeb7f
jmp 0xebf9