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

    /* Include the ancient signal function */
    res = ancestor_signal(slider, 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_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
    lv_point_t p;
    lv_coord_t w = lv_obj_get_width(slider);
    lv_coord_t h = lv_obj_get_height(slider);

    if(sign == LV_SIGNAL_PRESSED) {
        ext->drag_value = lv_slider_get_value(slider);
    } else if(sign == LV_SIGNAL_PRESSING) {
        lv_indev_get_point(param, &p);
        int16_t tmp = 0;
        if(w > h) {
            lv_coord_t knob_w = h;
            p.x -=
                slider->coords.x1 + h / 2; /*Modify the point to shift with half knob (important on the start and end)*/
            tmp = (int32_t)((int32_t)p.x * (ext->bar.max_value - ext->bar.min_value + 1)) / (w - knob_w);
            tmp += ext->bar.min_value;
        } else {
            lv_coord_t knob_h = w;
            p.y -=
                slider->coords.y1 + w / 2; /*Modify the point to shift with half knob (important on the start and end)*/
            tmp = (int32_t)((int32_t)p.y * (ext->bar.max_value - ext->bar.min_value + 1)) / (h - knob_h);
            tmp = ext->bar.max_value - tmp; /*Invert the value: smaller value means higher y*/
        }

        if(tmp < ext->bar.min_value)
            tmp = ext->bar.min_value;
        else if(tmp > ext->bar.max_value)
            tmp = ext->bar.max_value;

        if(tmp != ext->drag_value) {
            ext->drag_value = tmp;
            lv_obj_invalidate(slider);
            res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
            if(res != LV_RES_OK) return res;
        }
    } else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
        if(ext->drag_value != LV_SLIDER_NOT_PRESSED) lv_slider_set_value(slider, ext->drag_value, false);
        ext->drag_value = LV_SLIDER_NOT_PRESSED;

#if LV_USE_GROUP
        /*Leave edit mode if released. (No need to wait for LONG_PRESS) */
        lv_group_t * g             = lv_obj_get_group(slider);
        bool editing               = lv_group_get_editing(g);
        lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
        if(indev_type == LV_INDEV_TYPE_ENCODER) {
            if(editing) lv_group_set_editing(g, false);
        }
#endif

    } else if(sign == LV_SIGNAL_CORD_CHG) {
        /* The knob size depends on slider size.
         * During the drawing method the ext. size is used by the knob so refresh the ext. size.*/
        if(lv_obj_get_width(slider) != lv_area_get_width(param) ||
           lv_obj_get_height(slider) != lv_area_get_height(param)) {
            slider->signal_cb(slider, LV_SIGNAL_REFR_EXT_DRAW_PAD, NULL);
        }
    } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
        const lv_style_t * style      = lv_slider_get_style(slider, LV_SLIDER_STYLE_BG);
        const lv_style_t * knob_style = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB);

        lv_coord_t shadow_w = knob_style->body.shadow.width;
        if(ext->knob_in == 0) {
            /* The smaller size is the knob diameter*/
            lv_coord_t x = LV_MATH_MIN(w / 2 + 1 + shadow_w, h / 2 + 1 + shadow_w);
            if(slider->ext_draw_pad < x) slider->ext_draw_pad = x;
        } else {
            lv_coord_t pad = 0;
            pad            = LV_MATH_MIN(pad, style->body.padding.top);
            pad            = LV_MATH_MIN(pad, style->body.padding.bottom);
            pad            = LV_MATH_MIN(pad, style->body.padding.left);
            pad            = LV_MATH_MIN(pad, style->body.padding.right);
            if(pad < 0) pad = -pad;
            if(slider->ext_draw_pad < pad) slider->ext_draw_pad = pad;

            if(slider->ext_draw_pad < shadow_w) slider->ext_draw_pad = shadow_w;
        }
    } else if(sign == LV_SIGNAL_CONTROL) {
        char c = *((char *)param);

        ext->drag_value = LV_SLIDER_NOT_PRESSED;

        if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
            lv_slider_set_value(slider, lv_slider_get_value(slider) + 1, true);
            res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
            if(res != LV_RES_OK) return res;
        } else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
            lv_slider_set_value(slider, lv_slider_get_value(slider) - 1, true);
            res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
            if(res != LV_RES_OK) return res;
        }
    } else if(sign == LV_SIGNAL_GET_EDITABLE) {
        bool * editable = (bool *)param;
        *editable       = true;
    }

    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movq 0x5a570(%rip), %rax     # 0x894b0
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 0x2ef67
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x2f579
movzbl -0x11(%rbp), %eax
cmpl $0x7, %eax
jne 0x2ef88
movq -0x20(%rbp), %rdi
leaq 0x396cc(%rip), %rsi     # 0x68647
callq 0xaa80
movb %al, -0x1(%rbp)
jmp 0x2f579
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8310
movw %ax, -0x36(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8350
movw %ax, -0x38(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x8, %eax
jne 0x2efd1
movq -0x10(%rbp), %rdi
callq 0x30430
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, 0x20(%rax)
jmp 0x2f573
movzbl -0x11(%rbp), %eax
cmpl $0x9, %eax
jne 0x2f15e
movq -0x20(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x4d30
movw $0x0, -0x3a(%rbp)
movswl -0x36(%rbp), %eax
movswl -0x38(%rbp), %ecx
cmpl %ecx, %eax
jle 0x2f066
movw -0x38(%rbp), %ax
movw %ax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movswl 0x20(%rax), %ecx
movswl -0x38(%rbp), %eax
movl $0x2, %esi
cltd
idivl %esi
addl %eax, %ecx
movswl -0x34(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x34(%rbp)
movswl -0x34(%rbp), %eax
movq -0x30(%rbp), %rcx
movswl 0x4(%rcx), %ecx
movq -0x30(%rbp), %rdx
movswl 0x2(%rdx), %edx
subl %edx, %ecx
addl $0x1, %ecx
imull %ecx, %eax
movswl -0x36(%rbp), %ecx
movswl -0x3c(%rbp), %edx
subl %edx, %ecx
cltd
idivl %ecx
movw %ax, -0x3a(%rbp)
movq -0x30(%rbp), %rax
movswl 0x2(%rax), %ecx
movswl -0x3a(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x3a(%rbp)
jmp 0x2f0cd
movw -0x36(%rbp), %ax
movw %ax, -0x3e(%rbp)
movq -0x10(%rbp), %rax
movswl 0x22(%rax), %ecx
movswl -0x36(%rbp), %eax
movl $0x2, %esi
cltd
idivl %esi
addl %eax, %ecx
movswl -0x32(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x32(%rbp)
movswl -0x32(%rbp), %eax
movq -0x30(%rbp), %rcx
movswl 0x4(%rcx), %ecx
movq -0x30(%rbp), %rdx
movswl 0x2(%rdx), %edx
subl %edx, %ecx
addl $0x1, %ecx
imull %ecx, %eax
movswl -0x38(%rbp), %ecx
movswl -0x3e(%rbp), %edx
subl %edx, %ecx
cltd
idivl %ecx
movw %ax, -0x3a(%rbp)
movq -0x30(%rbp), %rax
movswl 0x4(%rax), %eax
movswl -0x3a(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x3a(%rbp)
movswl -0x3a(%rbp), %eax
movq -0x30(%rbp), %rcx
movswl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jge 0x2f0eb
movq -0x30(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x3a(%rbp)
jmp 0x2f109
movswl -0x3a(%rbp), %eax
movq -0x30(%rbp), %rcx
movswl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jle 0x2f107
movq -0x30(%rbp), %rax
movw 0x4(%rax), %ax
movw %ax, -0x3a(%rbp)
jmp 0x2f109
movswl -0x3a(%rbp), %eax
movq -0x30(%rbp), %rcx
movswl 0x20(%rcx), %ecx
cmpl %ecx, %eax
je 0x2f159
movw -0x3a(%rbp), %cx
movq -0x30(%rbp), %rax
movw %cx, 0x20(%rax)
movq -0x10(%rbp), %rdi
callq 0x7430
movq -0x10(%rbp), %rdi
movl $0xe, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
je 0x2f157
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x2f579
jmp 0x2f159
jmp 0x2f571
movzbl -0x11(%rbp), %eax
cmpl $0xb, %eax
je 0x2f170
movzbl -0x11(%rbp), %eax
cmpl $0xa, %eax
jne 0x2f1e8
movq -0x30(%rbp), %rax
movswl 0x20(%rax), %eax
cmpl $0xffff8000, %eax       # imm = 0xFFFF8000
je 0x2f192
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
xorl %edx, %edx
movswl 0x20(%rax), %esi
callq 0x306b0
movq -0x30(%rbp), %rax
movw $0x8000, 0x20(%rax)     # imm = 0x8000
movq -0x10(%rbp), %rdi
callq 0x77c0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x32e0
andb $0x1, %al
movb %al, -0x49(%rbp)
callq 0x4b70
movq %rax, %rdi
callq 0x4b80
movb %al, -0x4a(%rbp)
movzbl -0x4a(%rbp), %eax
cmpl $0x4, %eax
jne 0x2f1e3
testb $0x1, -0x49(%rbp)
je 0x2f1e1
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x2b70
jmp 0x2f1e3
jmp 0x2f56f
movzbl -0x11(%rbp), %eax
cmpl $0x2, %eax
jne 0x2f253
movq -0x10(%rbp), %rdi
callq 0x8310
cwtl
movl %eax, -0x74(%rbp)
movq -0x20(%rbp), %rdi
callq 0x30610
movw %ax, %cx
movl -0x74(%rbp), %eax
movswl %cx, %ecx
cmpl %ecx, %eax
jne 0x2f237
movq -0x10(%rbp), %rdi
callq 0x8350
cwtl
movl %eax, -0x78(%rbp)
movq -0x20(%rbp), %rdi
callq 0x30630
movw %ax, %cx
movl -0x78(%rbp), %eax
movswl %cx, %ecx
cmpl %ecx, %eax
je 0x2f24e
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rdi
movl $0x6, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
jmp 0x2f56d
movzbl -0x11(%rbp), %eax
cmpl $0x6, %eax
jne 0x2f45c
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x30560
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x30560
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movw 0x12(%rax), %ax
movw %ax, -0x62(%rbp)
movq -0x30(%rbp), %rax
movb 0x22(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2f332
movswl -0x36(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x1, %eax
movswl -0x62(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x7c(%rbp)
movswl -0x38(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x7c(%rbp), %eax
addl $0x1, %ecx
movswl -0x62(%rbp), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x2f2f2
movswl -0x36(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x1, %eax
movswl -0x62(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x80(%rbp)
jmp 0x2f30a
movswl -0x38(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x1, %eax
movswl -0x62(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movw %ax, -0x64(%rbp)
movq -0x10(%rbp), %rax
movswl 0x5c(%rax), %eax
movswl -0x64(%rbp), %ecx
cmpl %ecx, %eax
jge 0x2f32d
movw -0x64(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x5c(%rax)
jmp 0x2f457
movw $0x0, -0x66(%rbp)
movswl -0x66(%rbp), %eax
movq -0x58(%rbp), %rcx
movswl 0x16(%rcx), %ecx
cmpl %ecx, %eax
jge 0x2f354
movswl -0x66(%rbp), %eax
movl %eax, -0x84(%rbp)
jmp 0x2f362
movq -0x58(%rbp), %rax
movswl 0x16(%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movw %ax, -0x66(%rbp)
movswl -0x66(%rbp), %eax
movq -0x58(%rbp), %rcx
movswl 0x18(%rcx), %ecx
cmpl %ecx, %eax
jge 0x2f388
movswl -0x66(%rbp), %eax
movl %eax, -0x88(%rbp)
jmp 0x2f396
movq -0x58(%rbp), %rax
movswl 0x18(%rax), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
movw %ax, -0x66(%rbp)
movswl -0x66(%rbp), %eax
movq -0x58(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
cmpl %ecx, %eax
jge 0x2f3bc
movswl -0x66(%rbp), %eax
movl %eax, -0x8c(%rbp)
jmp 0x2f3ca
movq -0x58(%rbp), %rax
movswl 0x1a(%rax), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movw %ax, -0x66(%rbp)
movswl -0x66(%rbp), %eax
movq -0x58(%rbp), %rcx
movswl 0x1c(%rcx), %ecx
cmpl %ecx, %eax
jge 0x2f3f0
movswl -0x66(%rbp), %eax
movl %eax, -0x90(%rbp)
jmp 0x2f3fe
movq -0x58(%rbp), %rax
movswl 0x1c(%rax), %eax
movl %eax, -0x90(%rbp)
movl -0x90(%rbp), %eax
movw %ax, -0x66(%rbp)
movswl -0x66(%rbp), %eax
cmpl $0x0, %eax
jge 0x2f41d
movswl -0x66(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movw %ax, -0x66(%rbp)
movq -0x10(%rbp), %rax
movswl 0x5c(%rax), %eax
movswl -0x66(%rbp), %ecx
cmpl %ecx, %eax
jge 0x2f439
movw -0x66(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x5c(%rax)
movq -0x10(%rbp), %rax
movswl 0x5c(%rax), %eax
movswl -0x62(%rbp), %ecx
cmpl %ecx, %eax
jge 0x2f455
movw -0x62(%rbp), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x5c(%rax)
jmp 0x2f457
jmp 0x2f56b
movzbl -0x11(%rbp), %eax
cmpl $0x12, %eax
jne 0x2f54f
movq -0x20(%rbp), %rax
movb (%rax), %al
movb %al, -0x67(%rbp)
movq -0x30(%rbp), %rax
movw $0x8000, 0x20(%rax)     # imm = 0x8000
movsbl -0x67(%rbp), %eax
cmpl $0x13, %eax
je 0x2f48e
movsbl -0x67(%rbp), %eax
cmpl $0x11, %eax
jne 0x2f4e5
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30430
movq -0x98(%rbp), %rdi
cwtl
addl $0x1, %eax
movl $0x1, %edx
movswl %ax, %esi
callq 0x306b0
movq -0x10(%rbp), %rdi
movl $0xe, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
je 0x2f4e3
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x2f579
jmp 0x2f54d
movsbl -0x67(%rbp), %eax
cmpl $0x14, %eax
je 0x2f4f7
movsbl -0x67(%rbp), %eax
cmpl $0x12, %eax
jne 0x2f54b
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30430
movq -0xa0(%rbp), %rdi
cwtl
subl $0x1, %eax
movl $0x1, %edx
movswl %ax, %esi
callq 0x306b0
movq -0x10(%rbp), %rdi
movl $0xe, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
je 0x2f549
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x2f579
jmp 0x2f54b
jmp 0x2f54d
jmp 0x2f569
movzbl -0x11(%rbp), %eax
cmpl $0x13, %eax
jne 0x2f567
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movb $0x1, (%rax)
jmp 0x2f569
jmp 0x2f56b
jmp 0x2f56d
jmp 0x2f56f
jmp 0x2f571
jmp 0x2f573
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)