// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x1c02a(%rip), %rdi     # 0x38f10
callq 0x5570
cmpq $0x0, -0x8(%rbp)
je 0x1cf01
movq -0x8(%rbp), %rdi
movl 0x1bff4(%rip), %esi     # 0x38ef0
callq 0x17560
cmpq $0x0, -0x8(%rbp)
jne 0x1cf19
leaq 0x1c039(%rip), %rdi     # 0x38f48
callq 0x5280
jmp 0x1d132
cmpq $0x0, 0x1c017(%rip)     # 0x38f38
je 0x1cfb5
movq 0x1c00a(%rip), %rax     # 0x38f38
movl 0x8(%rax), %edi
callq 0x191c0
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x191c0
movl %eax, %ecx
movl -0x48(%rbp), %eax
cmpl %ecx, %eax
jne 0x1cfb5
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x191c0
movl %eax, %eax
movl %eax, %edi
callq 0x5370
movq %rax, 0x1bfd6(%rip)     # 0x38f40
cmpq $0x0, 0x1bfce(%rip)     # 0x38f40
je 0x1cfa4
movq 0x1bfc5(%rip), %rax     # 0x38f40
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x191c0
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl %eax, %eax
movl %eax, %edx
callq 0x52f0
leaq 0x1bf9d(%rip), %rdi     # 0x38f48
callq 0x5280
jmp 0x1d130
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x191c0
cmpl $0x80000007, %eax       # imm = 0x80000007
jne 0x1d12e
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x14, %rax
movq %rax, -0x60(%rbp)
leaq 0x11654(%rip), %rdi     # 0x2e63a
callq 0x17000
movq %rax, %rcx
movq -0x60(%rbp), %rax
movups (%rcx), %xmm1
movups (%rax), %xmm0
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %eax
subl $0xffff, %eax           # imm = 0xFFFF
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1d12c
movq -0x18(%rbp), %rax
movl 0x24(%rax), %edi
callq 0x191c0
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0xa, %eax
ja 0x1d128
movq -0x68(%rbp), %rax
leaq 0x1155f(%rip), %rcx     # 0x2e59c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
addq $0x2c, %rax
movq %rax, -0x20(%rbp)
movl 0x1c06c(%rip), %eax     # 0x390c4
movl %eax, -0x6c(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %edi
callq 0x191c0
movl %eax, %ecx
movl -0x6c(%rbp), %eax
cmpl %ecx, %eax
je 0x1d079
movl $0x1004, %edi           # imm = 0x1004
callq 0x8240
jmp 0x1d12a
movq -0x18(%rbp), %rax
addq $0x2c, %rax
movq %rax, -0x28(%rbp)
movl 0x1c03c(%rip), %eax     # 0x390cc
movl %eax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x191c0
movl %eax, %ecx
movl -0x70(%rbp), %eax
cmpl %ecx, %eax
je 0x1d0b2
movl $0x1004, %edi           # imm = 0x1004
callq 0x8240
jmp 0x1d12a
movq -0x18(%rbp), %rax
addq $0x2c, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x191c0
movl %eax, -0x34(%rbp)
movl 0x1bfff(%rip), %eax     # 0x390d4
cmpl -0x34(%rbp), %eax
je 0x1d0e4
movl $0x1004, %edi           # imm = 0x1004
callq 0x8240
jmp 0x1d12a
movq -0x18(%rbp), %rax
addq $0x2c, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
cmpl 0x1bfe6(%rip), %eax     # 0x390e4
jne 0x1d126
movq -0x40(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x191c0
movl %eax, -0x44(%rbp)
movl 0x1bfc7(%rip), %eax     # 0x390dc
cmpl -0x44(%rbp), %eax
je 0x1d124
movl $0x1005, %edi           # imm = 0x1005
callq 0x8240
jmp 0x1d126
jmp 0x1d12a
jmp 0x1d12a
jmp 0x1d12c
jmp 0x1d12e
jmp 0x1d130
jmp 0x1d132
leaq 0x1bdd7(%rip), %rdi     # 0x38f10
callq 0x5350
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)