// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_roller.c
// Function: lv_roller_scrl_signal
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param)
{
    lv_res_t res;

    /* Include the ancient signal function */
    res = ancestor_scrl_signal(roller_scrl, sign, param);
    if(res != LV_RES_OK) return res;

    lv_indev_t * indev    = lv_indev_get_act();
    int32_t id            = -1;
    lv_obj_t * roller     = lv_obj_get_parent(roller_scrl);
    lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);

    if(ext->ddlist.label == NULL)
        return LV_RES_INV; /*On delete the ddlist signal deletes the label so nothing left to do
                              here*/

    const lv_style_t * style_label = lv_obj_get_style(ext->ddlist.label);
    const lv_font_t * font         = style_label->text.font;
    lv_coord_t font_h              = lv_font_get_line_height(font);

    if(sign == LV_SIGNAL_DRAG_END) {
        /*If dragged then align the list to have an element in the middle*/
        lv_coord_t label_y1   = ext->ddlist.label->coords.y1 - roller->coords.y1;
        lv_coord_t label_unit = font_h + style_label->text.line_space;
        lv_coord_t mid        = (roller->coords.y2 - roller->coords.y1) / 2;

        id = (mid - label_y1 + style_label->text.line_space / 2) / label_unit;

        if(id < 0) id = 0;
        if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;

        ext->ddlist.sel_opt_id     = id;
        ext->ddlist.sel_opt_id_ori = id;
        res                        = lv_event_send(roller, LV_EVENT_VALUE_CHANGED, &id);
        if(res != LV_RES_OK) return res;
    }
    /*If picked an option by clicking then set it*/
    else if(sign == LV_SIGNAL_RELEASED) {
        if(!lv_indev_is_dragging(indev)) {
            id = ext->ddlist.sel_opt_id;
#if LV_USE_GROUP
            /*In edit mode go to navigate mode if an option is selected*/
            lv_group_t * g = lv_obj_get_group(roller);
            bool editing   = lv_group_get_editing(g);
            if(editing) lv_group_set_editing(g, false);
#endif
        }
    } else if(sign == LV_SIGNAL_PRESSED) {
#if LV_USE_ANIMATION
        lv_anim_del(roller_scrl, (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
    }

    /*Position the scrollable according to the new selected option*/
    if(id != -1) {
        refr_position(roller, 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 0x705f3(%rip), %rax     # 0x893e0
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 0x18e14
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x18ffd
callq 0x4b70
movq %rax, -0x30(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
callq 0x71b0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x18e52
movb $0x0, -0x1(%rbp)
jmp 0x18ffd
movq -0x48(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xa080
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x19680
movzbl %al, %eax
movw %ax, -0x5a(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0xf, %eax
jne 0x18f75
movq -0x48(%rbp), %rax
movq 0x50(%rax), %rax
movswl 0x22(%rax), %eax
movq -0x40(%rbp), %rcx
movswl 0x22(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x5c(%rbp)
movswl -0x5a(%rbp), %eax
movq -0x50(%rbp), %rcx
movswl 0x32(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x5e(%rbp)
movq -0x40(%rbp), %rax
movswl 0x26(%rax), %eax
movq -0x40(%rbp), %rcx
movswl 0x22(%rcx), %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, -0x60(%rbp)
movswl -0x60(%rbp), %eax
movswl -0x5c(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x70(%rbp)
movq -0x50(%rbp), %rax
movswl 0x32(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x70(%rbp), %eax
addl %ecx, %eax
movswl -0x5e(%rbp), %ecx
cltd
idivl %ecx
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x18f11
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
movzwl 0x60(%rcx), %ecx
cmpl %ecx, %eax
jl 0x18f2e
movq -0x48(%rbp), %rax
movzwl 0x60(%rax), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movw %ax, %cx
movq -0x48(%rbp), %rax
movw %cx, 0x62(%rax)
movl -0x34(%rbp), %eax
movw %ax, %cx
movq -0x48(%rbp), %rax
movw %cx, 0x64(%rax)
movq -0x40(%rbp), %rdi
movl $0xe, %esi
leaq -0x34(%rbp), %rdx
callq 0x7990
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
je 0x18f73
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x18ffd
jmp 0x18fe3
movzbl -0x11(%rbp), %eax
cmpl $0xb, %eax
jne 0x18fc6
movq -0x30(%rbp), %rdi
callq 0x4dc0
testb $0x1, %al
jne 0x18fc4
movq -0x48(%rbp), %rax
movzwl 0x62(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x40(%rbp), %rdi
callq 0x77c0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x32e0
andb $0x1, %al
movb %al, -0x69(%rbp)
testb $0x1, -0x69(%rbp)
je 0x18fc2
movq -0x68(%rbp), %rdi
xorl %esi, %esi
callq 0x2b70
jmp 0x18fc4
jmp 0x18fe1
movzbl -0x11(%rbp), %eax
cmpl $0x8, %eax
jne 0x18fdf
movq -0x10(%rbp), %rdi
leaq -0x10eba(%rip), %rsi    # 0x8120
callq 0x44560
jmp 0x18fe1
jmp 0x18fe3
cmpl $-0x1, -0x34(%rbp)
je 0x18ff7
movq -0x40(%rbp), %rdi
movl $0x1, %esi
callq 0x194e0
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)