// File: /workspace/github_c_makefile_star2_O3/Carton32[P]quectel-CM/QmiWwanCM.c
// Function: QmiWwanGetClientID
static UCHAR QmiWwanGetClientID(UCHAR QMIType) {
    PQCQMIMSG pResponse;

    QmiThreadSendQMI(ComposeQCTLMsg(QMICTL_GET_CLIENT_ID_REQ, CtlGetClientIdReq, &QMIType), &pResponse);

    if (pResponse) {
        USHORT QMUXResult = cpu_to_le16(pResponse->CTLMsg.QMICTLMsgHdrRsp.QMUXResult);       // QMI_RESULT_SUCCESS
        USHORT QMUXError = cpu_to_le16(pResponse->CTLMsg.QMICTLMsgHdrRsp.QMUXError);        // QMI_ERR_INVALID_ARG
        //UCHAR QMIType = pResponse->CTLMsg.GetClientIdRsp.QMIType;
        UCHAR ClientId = pResponse->CTLMsg.GetClientIdRsp.ClientId;

        if (!QMUXResult && !QMUXError && (QMIType == pResponse->CTLMsg.GetClientIdRsp.QMIType)) {
            switch (QMIType) {
                case QMUX_TYPE_WDS: dbg_time("Get clientWDS = %d", ClientId); break;
                case QMUX_TYPE_DMS: dbg_time("Get clientDMS = %d", ClientId); break;
                case QMUX_TYPE_NAS: dbg_time("Get clientNAS = %d", ClientId); break;
                case QMUX_TYPE_QOS: dbg_time("Get clientQOS = %d", ClientId); break;
                case QMUX_TYPE_WMS: dbg_time("Get clientWMS = %d", ClientId); break;
                case QMUX_TYPE_PDS: dbg_time("Get clientPDS = %d", ClientId); break;
                case QMUX_TYPE_UIM: dbg_time("Get clientUIM = %d", ClientId); break;
                case QMUX_TYPE_WDS_ADMIN: dbg_time("Get clientWDA = %d", ClientId);
                break;
                default: break;
            }
            return ClientId;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x7(%rsp), %rdx
movb %dil, (%rdx)
leaq 0x49a(%rip), %rsi       # 0x6780
movl $0x22, %edi
callq 0x65f9
leaq 0x17f3f(%rip), %rcx     # 0x1e236
leaq 0x8(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa273
movq (%rbx), %rax
testq %rax, %rax
je 0x63a8
movzwl 0xf(%rax), %edi
callq 0xee7e
movl %eax, %ebx
movq 0x8(%rsp), %rax
movzwl 0x11(%rax), %edi
callq 0xee7e
orw %bx, %ax
jne 0x63a8
movq 0x8(%rsp), %rcx
movzbl 0x7(%rsp), %eax
cmpb 0x16(%rcx), %al
jne 0x63a8
movb 0x17(%rcx), %bl
movzbl %bl, %ebp
leal -0x1(%rax), %ecx
cmpl $0xa, %ecx
ja 0x63b5
leaq 0x17caa(%rip), %rax     # 0x1e004
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x23c56(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17ed0(%rip), %rsi     # 0x1e249
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x24919(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17ea6(%rip), %rsi     # 0x1e249
jmp 0x65ad
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
cmpl $0x1a, %eax
jne 0x63aa
movq 0x23bff(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17f28(%rip), %rsi     # 0x1e2f8
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x248c2(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17efe(%rip), %rsi     # 0x1e2f8
jmp 0x65ad
movq 0x23bba(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17eca(%rip), %rsi     # 0x1e2df
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x2487d(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17e9c(%rip), %rsi     # 0x1e2df
jmp 0x65ad
movq 0x23b71(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17e1d(%rip), %rsi     # 0x1e27b
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x24834(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17def(%rip), %rsi     # 0x1e27b
jmp 0x65ad
movq 0x23b28(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17ded(%rip), %rsi     # 0x1e294
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x247eb(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17dbf(%rip), %rsi     # 0x1e294
jmp 0x65ad
movq 0x23adf(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17d72(%rip), %rsi     # 0x1e262
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x247a2(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17d44(%rip), %rsi     # 0x1e262
jmp 0x65ad
movq 0x23a96(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17d74(%rip), %rsi     # 0x1e2ad
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x24759(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17d46(%rip), %rsi     # 0x1e2ad
jmp 0x65ad
movq 0x23a50(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x17d47(%rip), %rsi     # 0x1e2c6
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
leaq 0x24713(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x63aa
callq 0xea3b
leaq 0x17d19(%rip), %rsi     # 0x1e2c6
movq %r14, %rdi
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52c0
jmp 0x63aa