// File: /workspace/github_c_makefile_star2_O2/Carton32[P]quectel-CM/QMIThread.c
// Function: requestGetProfile
static int requestGetProfile(PROFILE_T *profile) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    PQMIWDS_APNNAME pApnName;
    PQMIWDS_USERNAME pUserName;
    PQMIWDS_PASSWD pPassWd;
    PQMIWDS_AUTH_PREFERENCE pAuthPref;
    PQMIWDS_IPTYPE pIpType;
    const char *ipStr[] = {"IPV4", "NULL", "IPV6", "IPV4V6"};

    profile->old_apn[0] = profile->old_user[0] = profile->old_password[0] = '\0';
    profile->old_auth = 0;
    profile->old_iptype = 0;
    if (profile->enable_ipv4 && profile->enable_ipv6)
        profile->iptype = 3;
    else if (profile->enable_ipv6)
        profile->iptype = 2;
    else
        profile->iptype = 0;

    if (!profile->pdp)
        return 0;

_re_check:
    pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_GET_PROFILE_SETTINGS_REQ, WdsGetProfileSettingsReqSend, profile);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    if (err == 0 && pResponse && le16_to_cpu(pResponse->MUXMsg.QMUXMsgHdrResp.QMUXResult)
        && le16_to_cpu(pResponse->MUXMsg.QMUXMsgHdrResp.QMUXError) == QMI_ERR_EXTENDED_INTERNAL)
    {
        free(pResponse);
        pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_CREATE_PROFILE_REQ, WdsCreateProfileSettingsReqSend, profile);
        err = QmiThreadSendQMI(pRequest, &pResponse);
        qmi_rsp_check_and_return();
        free(pResponse);
        goto _re_check;
    }
    qmi_rsp_check_and_return();

    pApnName = (PQMIWDS_APNNAME)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x14);
    pUserName = (PQMIWDS_USERNAME)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1B);
    pPassWd = (PQMIWDS_PASSWD)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1C);
    pAuthPref = (PQMIWDS_AUTH_PREFERENCE)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1D);
    pIpType = (PQMIWDS_IPTYPE)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x11);

    if (pApnName/* && le16_to_cpu(pApnName->TLVLength)*/)
        uchar2char(profile->old_apn, sizeof(profile->old_apn), &pApnName->ApnName, le16_to_cpu(pApnName->TLVLength));
    if (pUserName/*  && pUserName->UserName*/)
        uchar2char(profile->old_user, sizeof(profile->old_user), &pUserName->UserName, le16_to_cpu(pUserName->TLVLength));
    if (pPassWd/*  && le16_to_cpu(pPassWd->TLVLength)*/)
        uchar2char(profile->old_password, sizeof(profile->old_password), &pPassWd->Passwd, le16_to_cpu(pPassWd->TLVLength));
    if (pAuthPref/*  && le16_to_cpu(pAuthPref->TLVLength)*/) {
        profile->old_auth = pAuthPref->AuthPreference;
    }
    if (pIpType) {
        profile->old_iptype = pIpType->IPType;
    }

    dbg_time("%s[%d] %s/%s/%s/%d/%s", __func__, profile->pdp, profile->old_apn, profile->old_user, profile->old_password, profile->old_auth, ipStr[profile->old_iptype]);

    free(pResponse);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %ebp, %ebp
movb %bpl, 0x2d6(%rdi)
movb %bpl, 0x296(%rdi)
movb %bpl, 0x256(%rdi)
andq $0x0, 0x316(%rdi)
cmpb $0x1, 0x50(%rdi)
pushq $0x3
popq %rax
sbbl $0x0, %eax
cmpb %bpl, 0x51(%rdi)
cmovel %ebp, %eax
movl %eax, 0x1c(%rdi)
cmpl $0x0, 0x48(%rdi)
je 0xb8f6
movq %rdi, %rbx
leaq 0x2d6(%rdi), %rax
movq %rax, 0x8(%rsp)
leaq 0x296(%rdi), %rax
movq %rax, 0x10(%rsp)
leaq 0x256(%rdi), %rax
movq %rax, 0x18(%rsp)
pushq $0x1
popq %r14
leaq 0x1333d(%rip), %r12     # 0x1ea19
movq %rsp, %r13
movl %r14d, %edi
pushq $0x2b
popq %rsi
leaq 0x2464(%rip), %rdx      # 0xdb50
movq %rbx, %rcx
callq 0xd53c
movq %rax, %rdi
movq %r13, %rsi
movl $0x7530, %edx           # imm = 0x7530
movq %r12, %rcx
callq 0x9e8b
movl %eax, %ebp
movq (%rsp), %r15
testl %eax, %eax
jne 0xb7bc
testq %r15, %r15
je 0xb7bc
movzwl 0x10(%r15), %edi
callq 0xe73e
movq (%rsp), %r15
testw %ax, %ax
je 0xb7bc
movzwl 0x12(%r15), %edi
callq 0xe73e
movq (%rsp), %r15
cmpw $0x51, %ax
jne 0xb7bc
movq %r15, %rdi
callq 0x5040
movl %r14d, %edi
pushq $0x27
popq %rsi
leaq 0x2433(%rip), %rdx      # 0xdb91
movq %rbx, %rcx
callq 0xd53c
movq %rax, %rdi
movq %r13, %rsi
movl $0x7530, %edx           # imm = 0x7530
movq %r12, %rcx
callq 0x9e8b
movl %eax, %ebp
testl %eax, %eax
js 0xb7d3
movq (%rsp), %r15
testq %r15, %r15
je 0xb7d3
movzwl 0x10(%r15), %edi
callq 0xe73e
testw %ax, %ax
jne 0xb85d
movzwl 0x12(%r15), %edi
callq 0xe73e
testw %ax, %ax
jne 0xb85d
movq (%rsp), %rdi
callq 0x5040
jmp 0xb6df
testl %ebp, %ebp
sets %al
testq %r15, %r15
sete %cl
orb %al, %cl
cmpb $0x1, %cl
movq 0x18(%rsp), %r13
jne 0xb83b
movq 0x1d7de(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0x12f98(%rip), %rsi     # 0x1e781
leaq 0x13229(%rip), %rcx     # 0x1ea19
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1e4a1(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xb8f6
callq 0xe343
leaq 0x12f62(%rip), %rsi     # 0x1e781
leaq 0x131f3(%rip), %rcx     # 0x1ea19
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xb8f6
movzwl 0x10(%r15), %edi
callq 0xe73e
testw %ax, %ax
jne 0xb85d
movzwl 0x12(%r15), %edi
callq 0xe73e
testw %ax, %ax
je 0xb907
movzwl 0x12(%r15), %edi
callq 0xe73e
movl %eax, %ebx
movq 0x1d748(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movq %rax, %r12
movzwl 0x10(%r15), %edi
callq 0xe73e
movzwl %ax, %r8d
movzwl %bx, %ebp
leaq 0x12f00(%rip), %rsi     # 0x1e793
leaq 0x1317f(%rip), %rcx     # 0x1ea19
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1e3f7(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xb8ed
callq 0xe343
movq %rax, %r14
movzwl 0x10(%r15), %edi
callq 0xe73e
movzwl %ax, %r8d
leaq 0x12ebd(%rip), %rsi     # 0x1e793
leaq 0x1313c(%rip), %rcx     # 0x1ea19
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x52c0
movq (%rsp), %rdi
callq 0x5040
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rdi
addq $0x9, %rdi
pushq $0x14
popq %rsi
callq 0x9e14
movq %rax, %r15
movq (%rsp), %rdi
addq $0x9, %rdi
pushq $0x1b
popq %rsi
callq 0x9e14
movq %rax, %r14
movq (%rsp), %rdi
addq $0x9, %rdi
pushq $0x1c
popq %rsi
callq 0x9e14
movq %rax, 0x20(%rsp)
movq (%rsp), %rdi
addq $0x9, %rdi
pushq $0x1d
popq %rsi
callq 0x9e14
movq %rax, 0x30(%rsp)
movq (%rsp), %rdi
addq $0x9, %rdi
pushq $0x11
popq %rsi
callq 0x9e14
movq %rax, 0x28(%rsp)
pushq $0x3f
popq %rbp
testq %r15, %r15
je 0xb9a8
movzwl 0x1(%r15), %edi
callq 0xe73e
cmpw $0x3f, %ax
movl %ebp, %ecx
cmovbl %eax, %ecx
movzwl %cx, %r12d
testw %ax, %ax
je 0xb9a2
addq $0x3, %r15
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x52f0
movb $0x0, (%r13,%r12)
testq %r14, %r14
movq 0x20(%rsp), %r13
je 0xb9ea
movzwl 0x1(%r14), %edi
callq 0xe73e
cmpw $0x3f, %ax
movl %ebp, %ecx
cmovbl %eax, %ecx
movzwl %cx, %r15d
testw %ax, %ax
movq 0x10(%rsp), %r12
je 0xb9e5
addq $0x3, %r14
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x52f0
movb $0x0, (%r12,%r15)
testq %r13, %r13
je 0xba25
movzwl 0x1(%r13), %edi
callq 0xe73e
cmpw $0x3f, %ax
cmovbl %eax, %ebp
movzwl %bp, %r14d
testw %ax, %ax
movq 0x8(%rsp), %r15
je 0xba20
addq $0x3, %r13
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x52f0
movb $0x0, (%r15,%r14)
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0xba39
movzbl 0x3(%rax), %eax
movl %eax, 0x316(%rbx)
movq 0x28(%rsp), %rax
testq %rax, %rax
movq 0x8(%rsp), %r13
je 0xba52
movzbl 0x3(%rax), %eax
movl %eax, 0x31a(%rbx)
movq 0x1d55f(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movl 0x48(%rbx), %r8d
movl 0x316(%rbx), %r10d
movslq 0x31a(%rbx), %r11
leaq 0x1c8e6(%rip), %r12     # 0x28360
leaq 0x12f47(%rip), %rsi     # 0x1e9c8
leaq 0x12f91(%rip), %rcx     # 0x1ea19
xorl %ebp, %ebp
movq %r14, %rdi
movq %rax, %rdx
movq 0x18(%rsp), %r15
movq %r15, %r9
xorl %eax, %eax
pushq (%r12,%r11,8)
pushq %r10
pushq %r13
movq 0x28(%rsp), %r12
pushq %r12
callq 0x52c0
addq $0x20, %rsp
leaq 0x1e1ef(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0xb8ed
callq 0xe343
movl 0x48(%rbx), %r8d
movl 0x316(%rbx), %r10d
movslq 0x31a(%rbx), %r11
leaq 0x12ee5(%rip), %rsi     # 0x1e9c8
leaq 0x12f2f(%rip), %rcx     # 0x1ea19
movq %r14, %rdi
movq %rax, %rdx
movq %r15, %r9
xorl %eax, %eax
leaq 0x1c864(%rip), %rbx     # 0x28360
pushq (%rbx,%r11,8)
pushq %r10
pushq %r13
pushq %r12
callq 0x52c0
addq $0x20, %rsp
jmp 0xb8ed