// File: /workspace/github_c_makefile_star2_O2/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 0x1fc87(%rip), %rdi     # 0x29c50
callq 0x5570
testq %rbx, %rbx
je 0xa02b
movzwl 0x1(%rbx), %edi
callq 0xe73e
movzwl %ax, %esi
incl %esi
movq %rbx, %rdi
callq 0x9ca8
movq 0x1fc28(%rip), %rax     # 0x29c18
testq %rax, %rax
je 0xa0c1
movb 0x4(%rax), %cl
cmpb 0x4(%rbx), %cl
jne 0xa0c1
movb 0x5(%rax), %dl
cmpb 0x5(%rbx), %dl
jne 0xa0c1
testb %cl, %cl
je 0xa061
movzwl 0x7(%rax), %edi
callq 0xe73e
movl %eax, %ebp
movzwl 0x7(%rbx), %edi
callq 0xe73e
jmp 0xa069
movq 0x1fbe6(%rip), %rdi     # 0x29c18
testq %rdi, %rdi
je 0xa134
callq 0x5040
andq $0x0, 0x1fbd0(%rip)     # 0x29c18
andq $0x0, 0x1fbd0(%rip)     # 0x29c20
leaq 0x1fc21(%rip), %rdi     # 0x29c78
callq 0x5280
jmp 0xa134
movzbl 0x7(%rax), %ebp
movzbl 0x7(%rbx), %eax
cmpw %ax, %bp
jne 0xa0c1
movq 0x1fba3(%rip), %rdi     # 0x29c18
callq 0x5040
andq $0x0, 0x1fb96(%rip)     # 0x29c18
movzwl 0x1(%rbx), %edi
callq 0xe73e
movzwl %ax, %edi
incq %rdi
callq 0x5360
movq %rax, 0x1fb83(%rip)     # 0x29c20
testq %rax, %rax
je 0xa050
movq %rax, %r14
movzwl 0x1(%rbx), %edi
callq 0xe73e
movzwl %ax, %edx
incq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x52f0
jmp 0xa050
movb 0x4(%rbx), %al
testb %al, %al
je 0xa0f8
cmpb $0x3, %al
jne 0xa0de
movzwl 0x9(%rbx), %edi
callq 0xe73e
cmpw $0x24, %ax
je 0xa12a
movb 0x4(%rbx), %al
cmpb $0x1, %al
jne 0xa117
movzwl 0x9(%rbx), %edi
callq 0xe73e
cmpw $0x22, %ax
jne 0xa114
movl $0x1005, %edi           # imm = 0x1005
jmp 0xa12f
xorl %edi, %edi
cmpw $0x24, 0x8(%rbx)
sete %dil
callq 0xe73e
testw %ax, %ax
je 0xa144
movl $0x1006, %edi           # imm = 0x1006
jmp 0xa12f
movb 0x4(%rbx), %al
cmpb $0x3, %al
jne 0xa14f
movzwl 0x9(%rbx), %edi
callq 0xe73e
cmpw $0x4d, %ax
jne 0xa14c
movl $0x1004, %edi           # imm = 0x1004
callq 0x7244
leaq 0x1fb15(%rip), %rdi     # 0x29c50
popq %rbx
popq %r14
popq %rbp
jmp 0x5340
movb 0x4(%rbx), %al
jmp 0xa0c8
movb 0x4(%rbx), %al
cmpb $0x1a, %al
jne 0xa178
movzwl 0x9(%rbx), %edi
callq 0xe73e
cmpw $0x2f, %ax
jne 0xa178
addq $0x9, %rbx
pushq $0xf
popq %rdx
movl $0x1007, %edi           # imm = 0x1007
movq %rbx, %rsi
callq 0x725c
jmp 0xa134
leaq 0x1f251(%rip), %rax     # 0x293d0
cmpl $0x0, (%rax)
je 0xa134
movq 0x1ee2d(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0x145af(%rip), %rsi     # 0x1e749
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x1fafa(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xa134
callq 0xe343
leaq 0x14583(%rip), %rsi     # 0x1e749
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0xa134