// File: /workspace/github_c_makefile_star2_O2/Carton32[P]quectel-CM/mbim-cm.c
// Function: mbim_recv_command
static void mbim_recv_command(MBIM_MESSAGE_HEADER *pResponse, unsigned size)
{
    (void)size;
    pthread_mutex_lock(&mbim_command_mutex);

    if (pResponse)
        mbim_dump(pResponse, mbim_verbose);

    if (pResponse == NULL) {
        pthread_cond_signal(&mbim_command_cond);
    }
    else if (mbim_pRequest && le32toh(mbim_pRequest->TransactionId) == le32toh(pResponse->TransactionId)) {
        mbim_pResponse = mbim_alloc(le32toh(pResponse->MessageLength));
        if (mbim_pResponse)
            memcpy(mbim_pResponse, pResponse, le32toh(pResponse->MessageLength));
        pthread_cond_signal(&mbim_command_cond);
    }
    else if (le32toh(pResponse->MessageType) ==  MBIM_INDICATE_STATUS_MSG) {
        MBIM_INDICATE_STATUS_MSG_T *pIndMsg = (MBIM_INDICATE_STATUS_MSG_T *)pResponse;

        if (!memcmp(pIndMsg->DeviceServiceId.uuid, str2uuid(UUID_BASIC_CONNECT), 16))
        {
            switch (le32toh(pIndMsg->CID)) {
                case MBIM_CID_SUBSCRIBER_READY_STATUS: {
                    MBIM_SUBSCRIBER_READY_STATUS_T *pInfo = (MBIM_SUBSCRIBER_READY_STATUS_T *)pIndMsg->InformationBuffer;
                    if (oldReadyState != le32toh(pInfo->ReadyState))
                        qmidevice_send_event_to_main(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
                }
                break;
                case MBIM_CID_REGISTER_STATE: {
                    MBIM_REGISTRATION_STATE_INFO_T *pInfo = (MBIM_REGISTRATION_STATE_INFO_T *)pIndMsg->InformationBuffer;
                    if (oldRegisterState != le32toh(pInfo->RegisterState))
                        qmidevice_send_event_to_main(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
                }
                break;
                case MBIM_CID_PACKET_SERVICE: {
                    MBIM_PACKET_SERVICE_INFO_T *pInfo = (MBIM_PACKET_SERVICE_INFO_T *)pIndMsg->InformationBuffer;
                    MBIM_PACKET_SERVICE_STATE_E state = le32toh(pInfo->PacketServiceState);

                    if (oldPacketServiceState != state
                            && (1 || MBIMPacketServiceStateAttached == state || MBIMPacketServiceStateDetached == state))
                        qmidevice_send_event_to_main(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
                }
                break;
                case MBIM_CID_CONNECT: {
                    MBIM_CONNECT_T *pInfo = (MBIM_CONNECT_T *)pIndMsg->InformationBuffer;
                    if (pInfo->SessionId == (uint32_t)mbim_sessionID) {
                        MBIM_ACTIVATION_STATE_E state = le32toh(pInfo->ActivationState);

                        if (oldActivationState != state
                            && (1 || MBIMActivationStateActivated == state || MBIMActivationStateDeactivated == state))
                            qmidevice_send_event_to_main(RIL_UNSOL_DATA_CALL_LIST_CHANGED);
                    }
                }
                break;
                default:
                break;
            }
        }
    }

    pthread_mutex_unlock(&mbim_command_mutex);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x15d7e(%rip), %rdi     # 0x2ad50
callq 0x5570
testq %rbx, %rbx
je 0x15024
movl 0x15d4e(%rip), %esi     # 0x2ad30
movq %rbx, %rdi
callq 0x10583
movq 0x15d87(%rip), %rax     # 0x2ad78
testq %rax, %rax
je 0x15032
movl 0x8(%rax), %eax
cmpl 0x8(%rbx), %eax
jne 0x15032
movl 0x4(%rbx), %r14d
movq %r14, %rdi
callq 0x5360
movq %rax, 0x15d6f(%rip)     # 0x2ad80
testq %rax, %rax
je 0x15024
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x52f0
leaq 0x15d5d(%rip), %rdi     # 0x2ad88
callq 0x5280
jmp 0x15062
cmpl $0x80000007, (%rbx)     # imm = 0x80000007
jne 0x15062
leaq 0xa3ad(%rip), %rdi      # 0x1f3ee
callq 0x102de
movdqu 0x14(%rbx), %xmm0
movdqu 0x15ce1(%rip), %xmm1    # 0x2ad34
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x15075
leaq 0x15ce7(%rip), %rdi     # 0x2ad50
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5340
movl 0x24(%rbx), %eax
cmpl $0xc, %eax
je 0x150b8
cmpl $0x9, %eax
je 0x15099
cmpl $0xa, %eax
je 0x150a1
cmpl $0x2, %eax
jne 0x15062
movl 0x15e62(%rip), %eax     # 0x2aef4
cmpl 0x2c(%rbx), %eax
je 0x15062
jmp 0x150ac
movl 0x15e5d(%rip), %eax     # 0x2aefc
jmp 0x150a7
movl 0x15e5d(%rip), %eax     # 0x2af04
cmpl 0x30(%rbx), %eax
je 0x15062
movl $0x1004, %edi           # imm = 0x1004
callq 0x7244
jmp 0x15062
movl 0x2c(%rbx), %eax
cmpl 0x15e53(%rip), %eax     # 0x2af14
jne 0x15062
movl 0x15e43(%rip), %eax     # 0x2af0c
cmpl 0x30(%rbx), %eax
je 0x15062
movl $0x1005, %edi           # imm = 0x1005
jmp 0x150b1