// File: /workspace/github_c_makefile_star2_O3/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 0x15e67(%rip), %rdi     # 0x2bd50
callq 0x5560
testq %rbx, %rbx
je 0x15f3b
movl 0x15e37(%rip), %esi     # 0x2bd30
movq %rbx, %rdi
callq 0x10dbe
movq 0x15e70(%rip), %rax     # 0x2bd78
testq %rax, %rax
je 0x15f49
movl 0x8(%rax), %eax
cmpl 0x8(%rbx), %eax
jne 0x15f49
movl 0x4(%rbx), %r14d
movq %r14, %rdi
callq 0x5360
movq %rax, 0x15e58(%rip)     # 0x2bd80
testq %rax, %rax
je 0x15f3b
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x52f0
leaq 0x15e46(%rip), %rdi     # 0x2bd88
callq 0x5280
jmp 0x15f79
cmpl $0x80000007, (%rbx)     # imm = 0x80000007
jne 0x15f79
leaq 0xb47a(%rip), %rdi      # 0x213d2
callq 0x10b31
movdqu 0x14(%rbx), %xmm0
movdqu 0x15dca(%rip), %xmm1    # 0x2bd34
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x15f8c
leaq 0x15dd0(%rip), %rdi     # 0x2bd50
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5340
movl 0x24(%rbx), %eax
cmpl $0x9, %eax
jg 0x15fa6
cmpl $0x2, %eax
je 0x15fcd
cmpl $0x9, %eax
jne 0x15f79
movl 0x15f58(%rip), %eax     # 0x2befc
jmp 0x15fe0
cmpl $0xa, %eax
je 0x15fda
cmpl $0xc, %eax
jne 0x15f79
movl 0x2c(%rbx), %eax
cmpl 0x15f5b(%rip), %eax     # 0x2bf14
jne 0x15f79
movl 0x15f4b(%rip), %eax     # 0x2bf0c
cmpl 0x30(%rbx), %eax
je 0x15f79
movl $0x1005, %edi           # imm = 0x1005
jmp 0x15fea
movl 0x15f21(%rip), %eax     # 0x2bef4
cmpl 0x2c(%rbx), %eax
je 0x15f79
jmp 0x15fe5
movl 0x15f24(%rip), %eax     # 0x2bf04
cmpl 0x30(%rbx), %eax
je 0x15f79
movl $0x1004, %edi           # imm = 0x1004
callq 0x7354
jmp 0x15f79