// File: /workspace/github_c_makefile_star2_O1/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 0xda86
leaq 0x13d09(%rip), %rcx     # 0x20c12
movq %rsp, %r15
movq %rax, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa317
movl %eax, %r14d
testl %eax, %eax
sets %al
movq (%r15), %r13
testq %r13, %r13
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xcf9c
movq 0x1d085(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xeb2f
leaq 0x1383b(%rip), %rsi     # 0x20785
leaq 0x13cc1(%rip), %rcx     # 0x20c12
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1dd40(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xd058
callq 0xeb2f
leaq 0x13805(%rip), %rsi     # 0x20785
leaq 0x13c8b(%rip), %rcx     # 0x20c12
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xd058
movzwl 0x10(%r13), %edi
callq 0xef61
testw %ax, %ax
jne 0xcfbe
movzwl 0x12(%r13), %edi
callq 0xef61
testw %ax, %ax
je 0xd06a
movzwl 0x12(%r13), %edi
callq 0xef61
movl %eax, %ebx
movq 0x1cfef(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
movq %rax, %r12
movzwl 0x10(%r13), %edi
callq 0xef61
movzwl %ax, %r8d
movzwl %bx, %r14d
leaq 0x137a2(%rip), %rsi     # 0x20797
leaq 0x13c16(%rip), %rcx     # 0x20c12
movq %r15, %rdi
movq %r12, %rdx
movl %r14d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1dc95(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xd04f
callq 0xeb2f
movq %rax, %r15
movzwl 0x10(%r13), %edi
callq 0xef61
movzwl %ax, %r8d
leaq 0x1375f(%rip), %rsi     # 0x20797
leaq 0x13bd3(%rip), %rcx     # 0x20c12
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 0xa29c
testq %rax, %rax
je 0xd0a6
movq %rax, %r14
movb 0x3(%rax), %al
movb %al, (%rbx)
movzwl 0x1(%r14), %edi
callq 0xef61
cmpw $0x2, %ax
jne 0xd0a6
cmpb $0x1, 0x4(%r14)
jne 0xd0a6
movb $0x1, (%rbx)
movb (%rbx), %al
cmpb $0x1, %al
jne 0xd0c7
cmpl $0x4, %ebp
leaq 0x1db86(%rip), %rcx     # 0x2ac3c
leaq 0x1db83(%rip), %rdx     # 0x2ac40
cmoveq %rcx, %rdx
movl $0x0, (%rdx)
cmpb %al, %r12b
jne 0xd0dc
leaq 0x1d2fd(%rip), %rax     # 0x2a3d0
cmpl $0x0, (%rax)
je 0xd172
movq 0x1cedd(%rip), %rax     # 0x29fc0
movq (%rax), %r12
callq 0xeb2f
cmpl $0x4, %ebp
leaq 0x14e2c(%rip), %rcx     # 0x21f21
leaq 0x14e70(%rip), %r14     # 0x21f6c
cmoveq %rcx, %r14
cmpb $0x2, (%rbx)
leaq 0x13b40(%rip), %r13     # 0x20c4a
leaq 0x13b36(%rip), %r15     # 0x20c47
movq %r15, %r9
cmoveq %r13, %r9
leaq 0x13b08(%rip), %rsi     # 0x20c27
leaq 0x13aec(%rip), %rcx     # 0x20c12
movq %r12, %rdi
movq %rax, %rdx
movq %r14, %r8
xorl %eax, %eax
callq 0x52c0
leaq 0x1db6b(%rip), %rax     # 0x2aca8
movq (%rax), %r12
testq %r12, %r12
je 0xd172
callq 0xeb2f
cmpb $0x2, (%rbx)
cmoveq %r13, %r15
leaq 0x13acf(%rip), %rsi     # 0x20c27
leaq 0x13ab3(%rip), %rcx     # 0x20c12
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 0xd058