// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movb $0x1, %bl
cmpl $0x12, %esi
je 0x20611
movzbl %bpl, %esi
movq %r14, %rdi
movq %r12, %rdx
callq *0x3fe09(%rip)          # 0x60410
movl %eax, %ebx
cmpb $0x1, %al
jne 0x20738
cmpb $0x7, %bpl
jne 0x2062e
leaq 0x1f29e(%rip), %rsi     # 0x3f8bc
movq %r12, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6bf5
movq %r14, %rdi
callq 0x6ad8
cmpb $0x12, %bpl
je 0x206d7
movq %rax, %r15
movzbl %bpl, %eax
cmpl $0xb, %eax
jne 0x20738
callq 0x3784
movq %rax, %rdi
callq 0x378c
cmpb $0x4, %al
jne 0x20738
movq %r14, %rdi
callq 0x4ea3
movq %rax, %rdi
callq 0x2b2b
testb %al, %al
je 0x20738
cmpl $0x2, 0xac(%r15)
jge 0x2070e
movl $0x1, 0xac(%r15)
testb $0xf, 0xb0(%r15)
je 0x20726
movl 0xa4(%r15), %eax
movl 0xac(%r15), %ecx
xorl %edx, %edx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
cmpl %eax, %ecx
jge 0x20726
movl %ecx, 0xac(%r15)
incl %edx
movzwl 0xb0(%r15), %esi
andl $0xf, %esi
cmpl %esi, %edx
jb 0x206b4
jmp 0x20726
callq 0x3784
movq %rax, %rdi
callq 0x378c
movl (%r12), %esi
leal -0x11(%rsi), %ecx
cmpl $0x3, %ecx
ja 0x20730
leaq 0x1f1b5(%rip), %rdx     # 0x3f8ac
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x4, %al
jne 0x2070e
movq %r14, %rdi
callq 0x20bd9
jmp 0x20738
movq %r14, %rdi
callq 0x20b2a
jmp 0x20738
cmpb $0x4, %al
jne 0x20726
movq %r14, %rdi
callq 0x20c48
jmp 0x20738
movq %r14, %rdi
callq 0x20b7d
jmp 0x20738
movq %r14, %rdi
callq 0x1e89b
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq