// File: /workspace/github_c_makefile_star2_O3/Carton32[P]quectel-CM/QMIThread.c
// Function: requestQueryDataCall
static int requestQueryDataCall(UCHAR  *pConnectionStatus, int curIpFamily) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    PQMIWDS_PKT_SRVC_TLV pPktSrvc;
    UCHAR oldConnectionStatus = *pConnectionStatus;
    UCHAR QMIType = (curIpFamily == IpFamilyV4) ? QMUX_TYPE_WDS : QMUX_TYPE_WDS_IPV6;

    pRequest = ComposeQMUXMsg(QMIType, QMIWDS_GET_PKT_SRVC_STATUS_REQ, NULL, NULL);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    qmi_rsp_check_and_return();

    *pConnectionStatus = QWDS_PKT_DATA_DISCONNECTED;
    pPktSrvc = (PQMIWDS_PKT_SRVC_TLV)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x01);
    if (pPktSrvc) {
        *pConnectionStatus = pPktSrvc->ConnectionStatus;
        if ((le16_to_cpu(pPktSrvc->TLVLength) == 2) && (pPktSrvc->ReconfigReqd == 0x01))
            *pConnectionStatus = QWDS_PKT_DATA_DISCONNECTED;
    }

    if (*pConnectionStatus == QWDS_PKT_DATA_DISCONNECTED) {
        if (curIpFamily == IpFamilyV4)
            WdsConnectionIPv4Handle = 0;
        else
            WdsConnectionIPv6Handle = 0;
    }

    if (oldConnectionStatus != *pConnectionStatus || debug_qmi) {
        dbg_time("%s %sConnectionStatus: %s", __func__, (curIpFamily == IpFamilyV4) ? "IPv4" : "IPv6",
            (*pConnectionStatus == QWDS_PKT_DATA_CONNECTED) ? "CONNECTED" : "DISCONNECTED");
    }

    free(pResponse);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movb (%rdi), %r12b
xorl %edi, %edi
cmpl $0x4, %esi
setne %dil
shll $0x4, %edi
incl %edi
movl $0x22, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xd9a2
leaq 0x13de4(%rip), %rcx     # 0x20c0e
movq %rsp, %r15
movq %rax, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa273
movl %eax, %r14d
testl %eax, %eax
sets %al
movq (%r15), %r13
testq %r13, %r13
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xcebd
movq 0x1d164(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xea3b
leaq 0x13916(%rip), %rsi     # 0x20781
leaq 0x13d9c(%rip), %rcx     # 0x20c0e
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1de1f(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xcf79
callq 0xea3b
leaq 0x138e0(%rip), %rsi     # 0x20781
leaq 0x13d66(%rip), %rcx     # 0x20c0e
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xcf79
movzwl 0x10(%r13), %edi
callq 0xee73
testw %ax, %ax
jne 0xcedf
movzwl 0x12(%r13), %edi
callq 0xee73
testw %ax, %ax
je 0xcf8b
movzwl 0x12(%r13), %edi
callq 0xee73
movl %eax, %ebx
movq 0x1d0ce(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xea3b
movq %rax, %r12
movzwl 0x10(%r13), %edi
callq 0xee73
movzwl %ax, %r8d
movzwl %bx, %r14d
leaq 0x1387d(%rip), %rsi     # 0x20793
leaq 0x13cf1(%rip), %rcx     # 0x20c0e
movq %r15, %rdi
movq %r12, %rdx
movl %r14d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1dd74(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xcf70
callq 0xea3b
movq %rax, %r15
movzwl 0x10(%r13), %edi
callq 0xee73
movzwl %ax, %r8d
leaq 0x1383a(%rip), %rsi     # 0x20793
leaq 0x13cae(%rip), %rcx     # 0x20c0e
movq %rbx, %rdi
movq %r15, %rdx
movl %r14d, %r9d
xorl %eax, %eax
callq 0x52c0
movq (%rsp), %rdi
callq 0x5040
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, (%rbx)
movq (%rsp), %rdi
addq $0x9, %rdi
movl $0x1, %esi
callq 0xa1f8
testq %rax, %rax
je 0xcfc9
movq %rax, %r14
movb 0x3(%rax), %al
movb %al, (%rbx)
movzwl 0x1(%r14), %edi
callq 0xee73
cmpw $0x2, %ax
jne 0xcfc9
cmpb $0x1, 0x4(%r14)
jne 0xcfc9
movb $0x1, (%rbx)
jmp 0xcfcf
movb (%rbx), %al
cmpb $0x1, %al
jne 0xcfec
cmpl $0x4, %ebp
leaq 0x1dc63(%rip), %rax     # 0x2ac3c
leaq 0x1dc60(%rip), %rcx     # 0x2ac40
cmoveq %rax, %rcx
movl $0x0, (%rcx)
movb $0x1, %al
cmpb %al, %r12b
jne 0xd001
leaq 0x1d3d8(%rip), %rax     # 0x2a3d0
cmpl $0x0, (%rax)
je 0xd097
movq 0x1cfb8(%rip), %rax     # 0x29fc0
movq (%rax), %r12
callq 0xea3b
cmpl $0x4, %ebp
leaq 0x14f2f(%rip), %rcx     # 0x21f49
leaq 0x14f73(%rip), %r14     # 0x21f94
cmoveq %rcx, %r14
cmpb $0x2, (%rbx)
leaq 0x13c17(%rip), %r13     # 0x20c46
leaq 0x13c0d(%rip), %r15     # 0x20c43
movq %r15, %r9
cmoveq %r13, %r9
leaq 0x13bdf(%rip), %rsi     # 0x20c23
leaq 0x13bc3(%rip), %rcx     # 0x20c0e
movq %r12, %rdi
movq %rax, %rdx
movq %r14, %r8
xorl %eax, %eax
callq 0x52c0
leaq 0x1dc46(%rip), %rax     # 0x2aca8
movq (%rax), %r12
testq %r12, %r12
je 0xd097
callq 0xea3b
cmpb $0x2, (%rbx)
cmoveq %r13, %r15
leaq 0x13ba6(%rip), %rsi     # 0x20c23
leaq 0x13b8a(%rip), %rcx     # 0x20c0e
movq %r12, %rdi
movq %rax, %rdx
movq %r14, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x52c0
movq (%rsp), %rdi
callq 0x5040
xorl %r14d, %r14d
jmp 0xcf79