// File: /workspace/github_c_makefile_star2_O3/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 0x20e20
movq %rbx, %rdi
callq 0x6af7
callq 0x378a
movq %rax, %rdi
callq 0x3792
movl (%r14), %esi
leal -0x11(%rsi), %ecx
cmpl $0x3, %ecx
ja 0x20eb7
leaq 0x1ec2e(%rip), %rdx     # 0x3fa30
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x4, %al
jne 0x20ec1
movq %rbx, %rdi
callq 0x213c5
jmp 0x20ed3
movl %esi, %r15d
movzbl %r15b, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq *0x3f5dd(%rip)          # 0x60410
movl %eax, %ebp
cmpb $0x1, %al
jne 0x20ed6
cmpb $0x7, %r15b
jne 0x20e5c
leaq 0x1ebf6(%rip), %rsi     # 0x3fa40
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6c02
movq %rbx, %rdi
callq 0x6af7
movb $0x1, %bpl
cmpb $0xb, %r15b
jne 0x20ed6
movq %rax, %r14
callq 0x378a
movq %rax, %rdi
callq 0x3792
cmpb $0x4, %al
jne 0x20ed6
movq %rbx, %rdi
callq 0x4ed1
movq %rax, %rdi
callq 0x2b0b
testb %al, %al
je 0x20ed6
cmpl $0x2, 0xac(%r14)
jl 0x20ee3
movq %rbx, %rdi
callq 0x21316
jmp 0x20ed6
cmpb $0x4, %al
jne 0x20ecb
movq %rbx, %rdi
callq 0x21421
jmp 0x20ed3
movq %rbx, %rdi
callq 0x1f08f
jmp 0x20ed3
movq %rbx, %rdi
callq 0x21316
jmp 0x20ed3
movq %rbx, %rdi
callq 0x21369
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
je 0x20f1f
movl 0xa4(%r14), %ecx
xorl %edx, %edx
movl $0x1, %esi
addl %esi, %esi
leal (%rsi,%rsi,4), %esi
cmpl %ecx, %esi
jge 0x20f1f
movl %esi, 0xac(%r14)
incl %edx
cmpl %eax, %edx
jb 0x20f09
movq %rbx, %rdi
callq 0x21369
jmp 0x20ed6