// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_mbox.c
// Function: lv_mbox_signal
static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
{
    lv_res_t res;

    /*Translate LV_KEY_UP/DOWN to LV_KEY_LEFT/RIGHT */
    char c_trans = 0;
    if(sign == LV_SIGNAL_CONTROL) {
        c_trans = *((char *)param);
        if(c_trans == LV_KEY_DOWN) c_trans = LV_KEY_LEFT;
        if(c_trans == LV_KEY_UP) c_trans = LV_KEY_RIGHT;

        param = &c_trans;
    }

    /* Include the ancient signal function */
    res = ancestor_signal(mbox, 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_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
    if(sign == LV_SIGNAL_CORD_CHG) {
        if(lv_obj_get_width(mbox) != lv_area_get_width(param)) {
            mbox_realign(mbox);
        }
    } else if(sign == LV_SIGNAL_STYLE_CHG) {
        mbox_realign(mbox);
    } else if(sign == LV_SIGNAL_RELEASED) {
        if(ext->btnm) {
            uint32_t btn_id = lv_btnm_get_active_btn(ext->btnm);
            if(btn_id != LV_BTNM_BTN_NONE) lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id);
        }
    } else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROL ||
              sign == LV_SIGNAL_GET_EDITABLE) {
        if(ext->btnm) {
            ext->btnm->signal_cb(ext->btnm, sign, param);
        }

        /* The button matrix with ENCODER input supposes it's in a group but in this case it isn't
         * (Only the message box's container) So so some actions here instead*/
        if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
            lv_indev_t * indev         = lv_indev_get_act();
            lv_indev_type_t indev_type = lv_indev_get_type(indev);
            if(indev_type == LV_INDEV_TYPE_ENCODER) {
                /*In navigation mode don't select any button but in edit mode select the fist*/
                lv_btnm_ext_t * btnm_ext = lv_obj_get_ext_attr(ext->btnm);
                if(lv_group_get_editing(lv_obj_get_group(mbox)))
                    btnm_ext->btn_id_pr = 0;
                else
                    btnm_ext->btn_id_pr = LV_BTNM_BTN_NONE;
            }
#endif
        }
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %rbx
movb $0x0, 0x3(%rsp)
cmpl $0x12, %esi
jne 0xce3f
movzbl (%r15), %eax
cmpb $0x12, %al
pushq $0x14
popq %rcx
cmovnel %eax, %ecx
cmpb $0x11, %cl
pushq $0x13
popq %rax
cmovnel %ecx, %eax
leaq 0x3(%rsp), %r15
movb %al, (%r15)
movzbl %r14b, %r13d
movq %rbx, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq *0x514a6(%rip)          # 0x5e2f8
movl %eax, %ebp
cmpb $0x1, %al
jne 0xce6f
cmpb $0x7, %r14b
jne 0xce80
leaq 0x2e69f(%rip), %rsi     # 0x3b504
movq %r15, %rdi
callq 0x684b
movl %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x6747
movq %rax, %r12
cmpb $0xb, %r14b
je 0xcecf
cmpl $0x4, %r13d
je 0xcec2
cmpl $0x2, %r13d
jne 0xcf03
movq %rbx, %rdi
callq 0x5308
movzwl 0x4(%r15), %ecx
subw (%r15), %cx
incl %ecx
movb $0x1, %bpl
cmpw %cx, %ax
je 0xce6f
movq %rbx, %rdi
callq 0xd170
jmp 0xce6f
movq %rbx, %rdi
callq 0xd170
movb $0x1, %bpl
jmp 0xce6f
movq 0x10(%r12), %rdi
movb $0x1, %bpl
testq %rdi, %rdi
je 0xce6f
callq 0x207b0
movzwl %ax, %eax
movl %eax, 0x4(%rsp)
cmpw $-0x1, %ax
je 0xce6f
pushq $0xe
popq %rsi
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0x4caf
jmp 0xce6f
movl %r14d, %eax
andb $-0x4, %al
movb $0x1, %bpl
cmpb $0x10, %al
jne 0xce6f
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0xcf26
movl %r13d, %esi
movq %r15, %rdx
callq *0x30(%rdi)
cmpb $0x10, %r14b
jne 0xce6f
callq 0x35b3
movq %rax, %rdi
callq 0x35bb
cmpb $0x4, %al
jne 0xce6f
movq 0x10(%r12), %rdi
callq 0x6747
movq %rax, %r14
movq %rbx, %rdi
callq 0x4b8e
movq %rax, %rdi
callq 0x2aaa
testb %al, %al
je 0xcf71
andw $0x0, 0x42(%r14)
jmp 0xce6f
orw $-0x1, 0x42(%r14)
jmp 0xce6f