// File: /workspace/github_c_makefile_star2_O1/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 0x15ca4(%rip), %rdi     # 0x2bd50
callq 0x5560
testq %rbx, %rbx
je 0x160fe
movl 0x15c74(%rip), %esi     # 0x2bd30
movq %rbx, %rdi
callq 0x10e8f
movq 0x15cad(%rip), %rax     # 0x2bd78
testq %rax, %rax
je 0x1610c
movl 0x8(%rax), %eax
cmpl 0x8(%rbx), %eax
jne 0x1610c
movl 0x4(%rbx), %r14d
movq %r14, %rdi
callq 0x5360
movq %rax, 0x15c95(%rip)     # 0x2bd80
testq %rax, %rax
je 0x160fe
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x52f0
leaq 0x15c83(%rip), %rdi     # 0x2bd88
callq 0x5280
jmp 0x1613c
cmpl $0x80000007, (%rbx)     # imm = 0x80000007
jne 0x1613c
leaq 0xb28f(%rip), %rdi      # 0x213aa
callq 0x10c1b
movdqu 0x14(%rbx), %xmm0
movdqu 0x15c07(%rip), %xmm1    # 0x2bd34
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x1614f
leaq 0x15c0d(%rip), %rdi     # 0x2bd50
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5340
movl 0x24(%rbx), %eax
cmpl $0x9, %eax
jg 0x16169
cmpl $0x2, %eax
je 0x16190
cmpl $0x9, %eax
jne 0x1613c
movl 0x15d95(%rip), %eax     # 0x2befc
jmp 0x161a3
cmpl $0xa, %eax
je 0x1619d
cmpl $0xc, %eax
jne 0x1613c
movl 0x2c(%rbx), %eax
cmpl 0x15d98(%rip), %eax     # 0x2bf14
jne 0x1613c
movl 0x15d88(%rip), %eax     # 0x2bf0c
cmpl 0x30(%rbx), %eax
je 0x1613c
movl $0x1005, %edi           # imm = 0x1005
jmp 0x161ad
movl 0x15d5e(%rip), %eax     # 0x2bef4
cmpl 0x2c(%rbx), %eax
je 0x1613c
jmp 0x161a8
movl 0x15d61(%rip), %eax     # 0x2bf04
cmpl 0x30(%rbx), %eax
je 0x1613c
movl $0x1004, %edi           # imm = 0x1004
callq 0x7444
jmp 0x1613c