// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movb $0x1, -0x21(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x12, %eax
je 0x34cd3
movq 0x54836(%rip), %rax     # 0x894e0
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 0x34cd1
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x34ee8
jmp 0x34cd3
movzbl -0x11(%rbp), %eax
cmpl $0x7, %eax
jne 0x34cf4
movq -0x20(%rbp), %rdi
leaq 0x339a7(%rip), %rsi     # 0x6868e
callq 0xaa80
movb %al, -0x1(%rbp)
jmp 0x34ee8
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x30(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
jne 0x34d0f
jmp 0x34ee2
movzbl -0x11(%rbp), %eax
cmpl $0x7, %eax
jne 0x34d62
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x7, %eax
jge 0x34d4a
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x34d3e
jmp 0x34d4a
jmp 0x34d40
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x34d24
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
leaq 0x33935(%rip), %rdx     # 0x6868e
movq %rdx, (%rax,%rcx,8)
jmp 0x34ee0
movzbl -0x11(%rbp), %eax
cmpl $0xb, %eax
jne 0x34e36
callq 0x4b70
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x4b80
movzbl %al, %eax
cmpl $0x4, %eax
jne 0x34e31
movq -0x10(%rbp), %rdi
callq 0x77c0
movq %rax, %rdi
callq 0x32e0
testb $0x1, %al
jne 0x34da7
jmp 0x34e2f
movq -0x30(%rbp), %rax
cmpl $0x1, 0xac(%rax)
jle 0x34dbf
movq -0x10(%rbp), %rdi
callq 0x35640
jmp 0x34e2d
movq -0x30(%rbp), %rax
movl $0x1, 0xac(%rax)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x30(%rbp), %rcx
movw 0xb0(%rcx), %cx
andw $0xf, %cx
movzwl %cx, %ecx
cmpl %ecx, %eax
jae 0x34e24
movq -0x30(%rbp), %rax
imull $0xa, 0xac(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0xa4(%rcx), %eax
jl 0x34e0c
jmp 0x34e24
movl -0x50(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0xac(%rax)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x34dd4
movq -0x10(%rbp), %rdi
callq 0x356c0
jmp 0x34e2f
jmp 0x34e31
jmp 0x34ede
movzbl -0x11(%rbp), %eax
cmpl $0x12, %eax
jne 0x34edc
callq 0x4b70
movq %rax, %rdi
callq 0x4b80
movb %al, -0x51(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x58(%rbp)
cmpl $0x13, -0x58(%rbp)
jne 0x34e81
movzbl -0x51(%rbp), %eax
cmpl $0x4, %eax
jne 0x34e76
movq -0x10(%rbp), %rdi
callq 0x357c0
jmp 0x34e7f
movq -0x10(%rbp), %rdi
callq 0x35640
jmp 0x34eda
cmpl $0x14, -0x58(%rbp)
jne 0x34ea6
movzbl -0x51(%rbp), %eax
cmpl $0x4, %eax
jne 0x34e9b
movq -0x10(%rbp), %rdi
callq 0x358a0
jmp 0x34ea4
movq -0x10(%rbp), %rdi
callq 0x356c0
jmp 0x34ed8
cmpl $0x11, -0x58(%rbp)
jne 0x34eb7
movq -0x10(%rbp), %rdi
callq 0x357c0
jmp 0x34ed6
cmpl $0x12, -0x58(%rbp)
jne 0x34ec8
movq -0x10(%rbp), %rdi
callq 0x358a0
jmp 0x34ed4
movq -0x10(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0x31fa0
jmp 0x34ed6
jmp 0x34ed8
jmp 0x34eda
jmp 0x34edc
jmp 0x34ede
jmp 0x34ee0
jmp 0x34ee2
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)