// File: /workspace/github_c_makefile_star2_O1/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, %ebp
movq %rdi, %r14
movb $0x0, 0x3(%rsp)
cmpl $0x12, %esi
jne 0xd956
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 %bpl, %r13d
movq %r14, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq *0x5298f(%rip)          # 0x602f8
movl %eax, %ebx
cmpb $0x1, %al
jne 0xda6c
cmpb $0x7, %bpl
jne 0xd98f
leaq 0x31b74(%rip), %rsi     # 0x3f4f4
movq %r15, %rdi
callq 0x6bf5
movl %eax, %ebx
jmp 0xda6c
movq %r14, %rdi
callq 0x6ad8
movq %rax, %r12
cmpb $0xb, %bpl
je 0xd9d5
cmpl $0x4, %r13d
je 0xd9c8
cmpl $0x2, %r13d
jne 0xda09
movq %r14, %rdi
callq 0x5651
movzwl 0x4(%r15), %ecx
subw (%r15), %cx
incl %ecx
cmpw %cx, %ax
je 0xda6c
movq %r14, %rdi
callq 0xdc88
jmp 0xda6c
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0xda6c
callq 0x22131
movzwl %ax, %eax
movl %eax, 0x4(%rsp)
cmpw $-0x1, %ax
je 0xda6c
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
movl $0xe, %esi
callq 0x4fea
jmp 0xda6c
movl %ebp, %eax
andb $-0x4, %al
cmpb $0x10, %al
jne 0xda6c
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0xda24
movl %r13d, %esi
movq %r15, %rdx
callq *0x30(%rdi)
cmpb $0x10, %bpl
jne 0xda6c
callq 0x3784
movq %rax, %rdi
callq 0x378c
cmpb $0x4, %al
jne 0xda6c
movq 0x10(%r12), %rdi
callq 0x6ad8
movq %rax, %r15
movq %r14, %rdi
callq 0x4ea3
movq %rax, %rdi
callq 0x2b2b
testb %al, %al
je 0xda65
movw $0x0, 0x42(%r15)
jmp 0xda6c
movw $0xffff, 0x42(%r15)     # imm = 0xFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq