// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/QMIThread.c
// Function: requestSetupDataCall
static int requestSetupDataCall(PROFILE_T *profile, int curIpFamily) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err = 0;
    UCHAR QMIType = (curIpFamily == IpFamilyV4) ? QMUX_TYPE_WDS : QMUX_TYPE_WDS_IPV6;

//DualIPSupported means can get ipv4 & ipv6 address at the same time, one wds for ipv4, the other wds for ipv6
    profile->curIpFamily = curIpFamily;
    pRequest = ComposeQMUXMsg(QMIType, QMIWDS_START_NETWORK_INTERFACE_REQ, WdsStartNwInterfaceReq, profile);
    err = QmiThreadSendQMITimeout(pRequest, &pResponse, 120 * 1000, __func__);
    qmi_rsp_check();

    if (le16_to_cpu(pMUXMsg->QMUXMsgHdrResp.QMUXResult) || le16_to_cpu(pMUXMsg->QMUXMsgHdrResp.QMUXError)) {
        PQMI_TLV_HDR pTLVHdr;

        pTLVHdr = GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x10);
        if (pTLVHdr) {
            uint16_t *data16 = (uint16_t *)(pTLVHdr+1);
            uint16_t call_end_reason = le16_to_cpu(data16[0]);
            dbg_time("call_end_reason is %d", call_end_reason);
        }

        pTLVHdr = GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x11);
        if (pTLVHdr) {
            uint16_t *data16 = (uint16_t *)(pTLVHdr+1);
            uint16_t call_end_reason_type = le16_to_cpu(data16[0]);
            uint16_t verbose_call_end_reason  = le16_to_cpu(data16[1]);

            dbg_time("call_end_reason_type is %d", call_end_reason_type);
            dbg_time("call_end_reason_verbose is %d", verbose_call_end_reason);
        }

        free(pResponse);
        return le16_to_cpu(pMUXMsg->QMUXMsgHdrResp.QMUXError);
    }

    if (curIpFamily == IpFamilyV4) {
        WdsConnectionIPv4Handle = le32_to_cpu(pResponse->MUXMsg.StartNwInterfaceResp.Handle);
        dbg_time("%s WdsConnectionIPv4Handle: 0x%08x", __func__, WdsConnectionIPv4Handle);
    } else {
        WdsConnectionIPv6Handle = le32_to_cpu(pResponse->MUXMsg.StartNwInterfaceResp.Handle);
        dbg_time("%s WdsConnectionIPv6Handle: 0x%08x", __func__, WdsConnectionIPv6Handle);
    }

    free(pResponse);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x14(%rbp), %edx
movl $0x11, %eax
movl $0x1, %ecx
cmpl $0x4, %edx
cmovel %ecx, %eax
movb %al, -0x35(%rbp)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x116(%rax)
movb -0x35(%rbp), %al
movq -0x10(%rbp), %rcx
movl $0x20, %esi
leaq 0x37e1(%rip), %rdx      # 0x13210
movzbl %al, %edi
callq 0x11170
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0x1d4c0, %edx          # imm = 0x1D4C0
leaq 0x1e2d3(%rip), %rcx     # 0x2dd22
callq 0xc670
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0xfa68
cmpq $0x0, -0x28(%rbp)
jne 0xfaea
jmp 0xfa6a
movq 0x2756f(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x13930
movq -0x68(%rbp), %rdi
movq %rax, %rdx
movl -0x34(%rbp), %r8d
leaq 0x1ded2(%rip), %rsi     # 0x2d961
leaq 0x1e28c(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
leaq 0x283c4(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xfadd
leaq 0x283b7(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x70(%rbp)
callq 0x13930
movq -0x70(%rbp), %rdi
movq %rax, %rdx
movl -0x34(%rbp), %r8d
leaq 0x1de92(%rip), %rsi     # 0x2d961
leaq 0x1e24c(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
jmp 0xfadf
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xff7c
movq -0x28(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xfb24
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xfbe6
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movw %ax, -0x38(%rbp)
movq 0x274a4(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x80(%rbp)
callq 0x13930
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x38(%rbp), %r9d
leaq 0x1de02(%rip), %rsi     # 0x2d973
leaq 0x1e1aa(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
leaq 0x282e2(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xfbe2
leaq 0x282d5(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x90(%rbp)
callq 0x13930
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x38(%rbp), %r9d
leaq 0x1dd9f(%rip), %rsi     # 0x2d973
leaq 0x1e147(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
jmp 0xfbe4
jmp 0xfbe6
jmp 0xfbe8
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xfc16
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xfe29
movq -0x28(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x10, %esi
callq 0xc580
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xfccc
movq -0x40(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzwl (%rax), %edi
callq 0x13ed0
movw %ax, -0x4a(%rbp)
movq 0x27382(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x98(%rbp)
callq 0x13930
movq -0x98(%rbp), %rdi
movq %rax, %rdx
movzwl -0x4a(%rbp), %ecx
leaq 0x1e0b5(%rip), %rsi     # 0x2dd37
movb $0x0, %al
callq 0x52c0
leaq 0x281d8(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xfcc8
leaq 0x281cb(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
callq 0x13930
movq -0xa0(%rbp), %rdi
movq %rax, %rdx
movzwl -0x4a(%rbp), %ecx
leaq 0x1e076(%rip), %rsi     # 0x2dd37
movb $0x0, %al
callq 0x52c0
jmp 0xfcca
jmp 0xfccc
movq -0x28(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x11, %esi
callq 0xc580
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xfe08
movq -0x40(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movzwl (%rax), %edi
callq 0x13ed0
movw %ax, -0x5a(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x13ed0
movw %ax, -0x5c(%rbp)
movq 0x272bb(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
callq 0x13930
movq -0xa8(%rbp), %rdi
movq %rax, %rdx
movzwl -0x5a(%rbp), %ecx
leaq 0x1e00a(%rip), %rsi     # 0x2dd53
movb $0x0, %al
callq 0x52c0
leaq 0x28111(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xfd8f
leaq 0x28104(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
callq 0x13930
movq -0xb0(%rbp), %rdi
movq %rax, %rdx
movzwl -0x5a(%rbp), %ecx
leaq 0x1dfcb(%rip), %rsi     # 0x2dd53
movb $0x0, %al
callq 0x52c0
jmp 0xfd91
jmp 0xfd93
movq 0x27246(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
callq 0x13930
movq -0xb8(%rbp), %rdi
movq %rax, %rdx
movzwl -0x5c(%rbp), %ecx
leaq 0x1dfb6(%rip), %rsi     # 0x2dd74
movb $0x0, %al
callq 0x52c0
leaq 0x2809c(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xfe04
leaq 0x2808f(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
callq 0x13930
movq -0xc0(%rbp), %rdi
movq %rax, %rdx
movzwl -0x5c(%rbp), %ecx
leaq 0x1df77(%rip), %rsi     # 0x2dd74
movb $0x0, %al
callq 0x52c0
jmp 0xfe06
jmp 0xfe08
movq -0x28(%rbp), %rdi
callq 0x5040
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
movl %eax, -0x4(%rbp)
jmp 0xff7c
cmpl $0x4, -0x14(%rbp)
jne 0xfed1
movq -0x28(%rbp), %rax
movl 0x17(%rax), %edi
callq 0x13f20
movl %eax, 0x27fbb(%rip)     # 0x37e00
movq 0x27194(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
callq 0x13930
movq -0xc8(%rbp), %rdi
movq %rax, %rdx
movl 0x27f94(%rip), %r8d     # 0x37e00
leaq 0x1df25(%rip), %rsi     # 0x2dd98
leaq 0x1dea8(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
leaq 0x27fe0(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xfeca
leaq 0x27fd3(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
callq 0x13930
movq -0xd0(%rbp), %rdi
movq %rax, %rdx
movl 0x27f4b(%rip), %r8d     # 0x37e00
leaq 0x1dedc(%rip), %rsi     # 0x2dd98
leaq 0x1de5f(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
jmp 0xfecc
jmp 0xff6c
movq -0x28(%rbp), %rax
movl 0x17(%rax), %edi
callq 0x13f20
movl %eax, 0x27f21(%rip)     # 0x37e04
movq 0x270f6(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
callq 0x13930
movq -0xd8(%rbp), %rdi
movq %rax, %rdx
movl 0x27efa(%rip), %r8d     # 0x37e04
leaq 0x1deb0(%rip), %rsi     # 0x2ddc1
leaq 0x1de0a(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
leaq 0x27f42(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xff68
leaq 0x27f35(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
callq 0x13930
movq -0xe0(%rbp), %rdi
movq %rax, %rdx
movl 0x27eb1(%rip), %r8d     # 0x37e04
leaq 0x1de67(%rip), %rsi     # 0x2ddc1
leaq 0x1ddc1(%rip), %rcx     # 0x2dd22
movb $0x0, %al
callq 0x52c0
jmp 0xff6a
jmp 0xff6c
movq -0x28(%rbp), %rdi
callq 0x5040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax,%rax)