// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_spinbox.c
// Function: lv_spinbox_signal
static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * param)
{

    lv_res_t res = LV_RES_OK;

    /* Include the ancient signal function */
    if(sign != LV_SIGNAL_CONTROL) {
        res = ancestor_signal(spinbox, 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_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
    if(sign == LV_SIGNAL_CLEANUP) {
        /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
    } else if(sign == LV_SIGNAL_GET_TYPE) {
        lv_obj_type_t * buf = param;
        uint8_t i;
        for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
            if(buf->type[i] == NULL) break;
        }
        buf->type[i] = "lv_spinbox";
    } else if(sign == LV_SIGNAL_RELEASED) {
        /*If released with an ENCODER then move to the next digit*/
#if LV_USE_GROUP
        lv_indev_t * indev = lv_indev_get_act();
        if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
            if(lv_group_get_editing(lv_obj_get_group(spinbox))) {
                if(ext->step > 1) {
                    lv_spinbox_step_next(spinbox);
                } else {
                    /*Restart from the MSB*/
                    ext->step = 1;
                    uint32_t i;
                    for(i = 0; i < ext->digit_count; i++) {
                        int32_t new_step = ext->step * 10;
                        if(new_step >= ext->range_max) break;
                        ext->step = new_step;
                    }
                    lv_spinbox_step_prev(spinbox);
                }
            }
        }
#endif
    } else if(sign == LV_SIGNAL_CONTROL) {
        lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());

        uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
        if(c == LV_KEY_RIGHT) {
            if(indev_type == LV_INDEV_TYPE_ENCODER)
                lv_spinbox_increment(spinbox);
            else
                lv_spinbox_step_next(spinbox);
        } else if(c == LV_KEY_LEFT) {
            if(indev_type == LV_INDEV_TYPE_ENCODER)
                lv_spinbox_decrement(spinbox);
            else
                lv_spinbox_step_prev(spinbox);
        } else if(c == LV_KEY_UP) {
            lv_spinbox_increment(spinbox);
        } else if(c == LV_KEY_DOWN) {
            lv_spinbox_decrement(spinbox);
        } else {
            lv_ta_add_char(spinbox, c);
        }
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
cmpl $0x12, %esi
jne 0x1edfc
movq %rbx, %rdi
callq 0x6747
callq 0x35b3
movq %rax, %rdi
callq 0x35bb
movl (%r14), %esi
leal -0x11(%rsi), %ecx
cmpl $0x3, %ecx
ja 0x1ee93
leaq 0x1cb52(%rip), %rdx     # 0x3b930
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x4, %al
jne 0x1ee9d
movq %rbx, %rdi
callq 0x1f35a
jmp 0x1eeaf
movl %esi, %r15d
movzbl %r15b, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq *0x3f601(%rip)          # 0x5e410
movl %eax, %ebp
cmpb $0x1, %al
jne 0x1eeb2
cmpb $0x7, %r15b
jne 0x1ee38
leaq 0x1cb1a(%rip), %rsi     # 0x3b940
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x684b
movq %rbx, %rdi
callq 0x6747
movb $0x1, %bpl
cmpb $0xb, %r15b
jne 0x1eeb2
movq %rax, %r14
callq 0x35b3
movq %rax, %rdi
callq 0x35bb
cmpb $0x4, %al
jne 0x1eeb2
movq %rbx, %rdi
callq 0x4b8e
movq %rax, %rdi
callq 0x2aaa
testb %al, %al
je 0x1eeb2
cmpl $0x2, 0xac(%r14)
jl 0x1eebf
movq %rbx, %rdi
callq 0x1f2b2
jmp 0x1eeb2
cmpb $0x4, %al
jne 0x1eea7
movq %rbx, %rdi
callq 0x1f3b6
jmp 0x1eeaf
movq %rbx, %rdi
callq 0x1d175
jmp 0x1eeaf
movq %rbx, %rdi
callq 0x1f2b2
jmp 0x1eeaf
movq %rbx, %rdi
callq 0x1f302
movb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0xac(%r14)
movzwl 0xb0(%r14), %eax
andl $0xf, %eax
xorl %ecx, %ecx
pushq $0x1
popq %rdx
cmpl %eax, %ecx
jae 0x1eef5
imull $0xa, %edx, %edx
cmpl 0xa4(%r14), %edx
jge 0x1eef5
movl %edx, 0xac(%r14)
incl %ecx
jmp 0x1eeda
movq %rbx, %rdi
callq 0x1f302
jmp 0x1eeb2