// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x22
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xd53c
leaq 0x12230(%rip), %rcx     # 0x1ec24
movq %rsp, %r15
movq %rax, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x9e8b
movl %eax, %r14d
testl %eax, %eax
sets %al
movq (%r15), %r13
testq %r13, %r13
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xca87
movq 0x1c592(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0x11d4c(%rip), %rsi     # 0x1e781
leaq 0x121e8(%rip), %rcx     # 0x1ec24
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1d255(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xcb43
callq 0xe343
leaq 0x11d16(%rip), %rsi     # 0x1e781
leaq 0x121b2(%rip), %rcx     # 0x1ec24
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xcb43
movzwl 0x10(%r13), %edi
callq 0xe73e
testw %ax, %ax
jne 0xcaa9
movzwl 0x12(%r13), %edi
callq 0xe73e
testw %ax, %ax
je 0xcb55
movzwl 0x12(%r13), %edi
callq 0xe73e
movl %eax, %ebx
movq 0x1c4fc(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movq %rax, %r12
movzwl 0x10(%r13), %edi
callq 0xe73e
movzwl %ax, %r8d
movzwl %bx, %r14d
leaq 0x11cb3(%rip), %rsi     # 0x1e793
leaq 0x1213d(%rip), %rcx     # 0x1ec24
movq %r15, %rdi
movq %r12, %rdx
movl %r14d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1d1aa(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xcb3a
callq 0xe343
movq %rax, %r15
movzwl 0x10(%r13), %edi
callq 0xe73e
movzwl %ax, %r8d
leaq 0x11c70(%rip), %rsi     # 0x1e793
leaq 0x120fa(%rip), %rcx     # 0x1ec24
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
pushq $0x1
popq %rsi
callq 0x9e14
testq %rax, %rax
je 0xcb91
movq %rax, %r14
movb 0x3(%rax), %al
movb %al, (%rbx)
movzwl 0x1(%r14), %edi
callq 0xe73e
cmpw $0x2, %ax
jne 0xcb91
cmpb $0x1, 0x4(%r14)
jne 0xcb91
movb $0x1, (%rbx)
jmp 0xcb97
movb (%rbx), %al
cmpb $0x1, %al
jne 0xcbb1
cmpl $0x4, %ebp
leaq 0x1d09b(%rip), %rax     # 0x29c3c
leaq 0x1d098(%rip), %rcx     # 0x29c40
cmoveq %rax, %rcx
andl $0x0, (%rcx)
movb $0x1, %al
cmpb %al, %r12b
jne 0xcbc6
leaq 0x1c813(%rip), %rax     # 0x293d0
cmpl $0x0, (%rax)
je 0xcc5c
movq 0x1c3eb(%rip), %rax     # 0x28fb8
movq (%rax), %r12
callq 0xe343
cmpl $0x4, %ebp
leaq 0x13386(%rip), %rcx     # 0x1ff65
leaq 0x133ca(%rip), %r14     # 0x1ffb0
cmoveq %rcx, %r14
cmpb $0x2, (%rbx)
leaq 0x12068(%rip), %r13     # 0x1ec5c
leaq 0x1205e(%rip), %r15     # 0x1ec59
movq %r15, %r9
cmoveq %r13, %r9
leaq 0x12030(%rip), %rsi     # 0x1ec39
leaq 0x12014(%rip), %rcx     # 0x1ec24
movq %r12, %rdi
movq %rax, %rdx
movq %r14, %r8
xorl %eax, %eax
callq 0x52c0
leaq 0x1d081(%rip), %rax     # 0x29ca8
movq (%rax), %r12
testq %r12, %r12
je 0xcc5c
callq 0xe343
cmpb $0x2, (%rbx)
cmoveq %r13, %r15
leaq 0x11ff7(%rip), %rsi     # 0x1ec39
leaq 0x11fdb(%rip), %rcx     # 0x1ec24
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 0xcb43