// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: QmiThreadRecvQMI
void QmiThreadRecvQMI(PQCQMIMSG pResponse) {
    pthread_mutex_lock(&cm_command_mutex);
    if (pResponse == NULL) {
        if (s_pRequest) {
            free(s_pRequest);
            s_pRequest = NULL;
            s_pResponse = NULL;
            pthread_cond_signal(&cm_command_cond);
        }
        pthread_mutex_unlock(&cm_command_mutex);
        return;
    }
    dump_qmi(pResponse, le16_to_cpu(pResponse->QMIHdr.Length) + 1);
    if (s_pRequest && is_response(s_pRequest, pResponse)) {
        free(s_pRequest);
        s_pRequest = NULL;
        s_pResponse = malloc(le16_to_cpu(pResponse->QMIHdr.Length) + 1);
        if (s_pResponse != NULL) {
            memcpy(s_pResponse, pResponse, le16_to_cpu(pResponse->QMIHdr.Length) + 1);
        }
        pthread_cond_signal(&cm_command_cond);
    } else if ((pResponse->QMIHdr.QMIType == QMUX_TYPE_CTL)
                    && (le16_to_cpu(pResponse->CTLMsg.QMICTLMsgHdrRsp.QMICTLType == QMICTL_REVOKE_CLIENT_ID_IND))) {
        qmidevice_send_event_to_main(MODEM_REPORT_RESET_EVENT);
    } else if ((pResponse->QMIHdr.QMIType == QMUX_TYPE_NAS)
                    && (le16_to_cpu(pResponse->MUXMsg.QMUXMsgHdrResp.Type) == QMINAS_SERVING_SYSTEM_IND)) {
        qmidevice_send_event_to_main(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
    } else if ((pResponse->QMIHdr.QMIType == QMUX_TYPE_WDS)
                    && (le16_to_cpu(pResponse->MUXMsg.QMUXMsgHdrResp.Type) == QMIWDS_GET_PKT_SRVC_STATUS_IND)) {
        qmidevice_send_event_to_main(RIL_UNSOL_DATA_CALL_LIST_CHANGED);
    } else if ((pResponse->QMIHdr.QMIType == QMUX_TYPE_NAS)
                    && (le16_to_cpu(pResponse->MUXMsg.QMUXMsgHdrResp.Type) == QMINAS_SYS_INFO_IND)) {
        qmidevice_send_event_to_main(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
    } else if ((pResponse->QMIHdr.QMIType == QMUX_TYPE_WDS_ADMIN)
                    && (le16_to_cpu(pResponse->MUXMsg.QMUXMsgHdrResp.Type) == QMI_WDA_SET_LOOPBACK_CONFIG_IND)) {
    	qmidevice_send_event_to_main_ext(RIL_UNSOL_LOOPBACK_CONFIG_IND,
            &pResponse->MUXMsg.SetLoopBackInd, sizeof(pResponse->MUXMsg.SetLoopBackInd));
    } else {
        if (debug_qmi)
            dbg_time("nobody care this qmi msg!!");
    }
    pthread_mutex_unlock(&cm_command_mutex);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x207f0(%rip), %rdi     # 0x2ac50
callq 0x5560
testq %rbx, %rbx
je 0xa4c2
movzwl 0x1(%rbx), %edi
callq 0xef61
movzwl %ax, %esi
incl %esi
movq %rbx, %rdi
callq 0xa137
movq 0x20791(%rip), %rax     # 0x2ac18
testq %rax, %rax
je 0xa55b
movb 0x4(%rax), %cl
cmpb 0x4(%rbx), %cl
jne 0xa55b
movb 0x5(%rax), %dl
cmpb 0x5(%rbx), %dl
jne 0xa55b
testb %cl, %cl
je 0xa4f8
movzwl 0x7(%rax), %edi
callq 0xef61
movl %eax, %ebp
movzwl 0x7(%rbx), %edi
callq 0xef61
jmp 0xa500
movq 0x2074f(%rip), %rdi     # 0x2ac18
testq %rdi, %rdi
je 0xa5cd
callq 0x5040
xorl %eax, %eax
movq %rax, 0x20738(%rip)     # 0x2ac18
movq %rax, 0x20739(%rip)     # 0x2ac20
leaq 0x2078a(%rip), %rdi     # 0x2ac78
callq 0x5280
jmp 0xa5cd
movzbl 0x7(%rax), %ebp
movzbl 0x7(%rbx), %eax
cmpw %ax, %bp
jne 0xa55b
movq 0x2070c(%rip), %rdi     # 0x2ac18
callq 0x5040
movq $0x0, 0x206fc(%rip) # 0x2ac18
movzwl 0x1(%rbx), %edi
callq 0xef61
movzwl %ax, %edi
incq %rdi
callq 0x5360
movq %rax, 0x206e9(%rip)     # 0x2ac20
testq %rax, %rax
je 0xa4e7
movq %rax, %r14
movzwl 0x1(%rbx), %edi
callq 0xef61
movzwl %ax, %edx
incq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x52f0
jmp 0xa4e7
cmpb $0x0, 0x4(%rbx)
je 0xa5ae
cmpb $0x3, 0x4(%rbx)
jne 0xa576
movzwl 0x9(%rbx), %edi
callq 0xef61
cmpw $0x24, %ax
je 0xa5a7
cmpb $0x1, 0x4(%rbx)
jne 0xa592
movzwl 0x9(%rbx), %edi
callq 0xef61
cmpw $0x22, %ax
jne 0xa592
movl $0x1005, %edi           # imm = 0x1005
jmp 0xa5c8
cmpb $0x3, 0x4(%rbx)
jne 0xa5dd
movzwl 0x9(%rbx), %edi
callq 0xef61
cmpw $0x4d, %ax
jne 0xa5dd
movl $0x1004, %edi           # imm = 0x1004
jmp 0xa5c8
xorl %edi, %edi
cmpw $0x24, 0x8(%rbx)
sete %dil
callq 0xef61
testw %ax, %ax
je 0xa561
movl $0x1006, %edi           # imm = 0x1006
callq 0x7444
leaq 0x2067c(%rip), %rdi     # 0x2ac50
popq %rbx
popq %r14
popq %rbp
jmp 0x5340
cmpb $0x1a, 0x4(%rbx)
jne 0xa60a
movzwl 0x9(%rbx), %edi
callq 0xef61
cmpw $0x2f, %ax
jne 0xa60a
addq $0x9, %rbx
movl $0x1007, %edi           # imm = 0x1007
movq %rbx, %rsi
movl $0xf, %edx
callq 0x745e
jmp 0xa5cd
leaq 0x1fdbf(%rip), %rax     # 0x2a3d0
cmpl $0x0, (%rax)
je 0xa5cd
movq 0x1f9a3(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xeb2f
leaq 0x16121(%rip), %rsi     # 0x2074d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x20668(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xa5cd
callq 0xeb2f
leaq 0x160f9(%rip), %rsi     # 0x2074d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0xa5cd