// File: /workspace/github_c_makefile_star2_O3/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 0xd893
movzbl (%r15), %eax
cmpb $0x12, %al
movl $0x14, %ecx
cmovnel %eax, %ecx
cmpb $0x11, %cl
movl $0x13, %eax
cmovnel %ecx, %eax
leaq 0x3(%rsp), %r15
movb %al, (%r15)
movzbl %r14b, %r13d
movq %rbx, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq *0x52a52(%rip)          # 0x602f8
movl %eax, %ebp
cmpb $0x1, %al
jne 0xd8c3
cmpb $0x7, %r14b
jne 0xd8d4
leaq 0x31ceb(%rip), %rsi     # 0x3f5a4
movq %r15, %rdi
callq 0x6c02
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 0x6af7
movq %rax, %r12
cmpb $0xb, %r14b
je 0xd923
cmpl $0x4, %r13d
je 0xd916
cmpl $0x2, %r13d
jne 0xd959
movq %rbx, %rdi
callq 0x566d
movzwl 0x4(%r15), %ecx
subw (%r15), %cx
incl %ecx
movb $0x1, %bpl
cmpw %cx, %ax
je 0xd8c3
movq %rbx, %rdi
callq 0xdbdf
jmp 0xd8c3
movq %rbx, %rdi
callq 0xdbdf
movb $0x1, %bpl
jmp 0xd8c3
movq 0x10(%r12), %rdi
movb $0x1, %bpl
testq %rdi, %rdi
je 0xd8c3
callq 0x228e6
movzwl %ax, %eax
movl %eax, 0x4(%rsp)
cmpw $-0x1, %ax
je 0xd8c3
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
movl $0xe, %esi
callq 0x5018
jmp 0xd8c3
movl %r14d, %eax
andb $-0x4, %al
movb $0x1, %bpl
cmpb $0x10, %al
jne 0xd8c3
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0xd97c
movl %r13d, %esi
movq %r15, %rdx
callq *0x30(%rdi)
cmpb $0x10, %r14b
jne 0xd8c3
callq 0x378a
movq %rax, %rdi
callq 0x3792
cmpb $0x4, %al
jne 0xd8c3
movq 0x10(%r12), %rdi
callq 0x6af7
movq %rax, %r14
movq %rbx, %rdi
callq 0x4ed1
movq %rax, %rdi
callq 0x2b0b
testb %al, %al
je 0xd9c8
movw $0x0, 0x42(%r14)
jmp 0xd8c3
movw $0xffff, 0x42(%r14)     # imm = 0xFFFF
jmp 0xd8c3