// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, -0x18(%rbp)
movq 0x27939(%rip), %rax     # 0x36480
movq %rax, -0x80(%rbp)
movq 0x27936(%rip), %rax     # 0x36488
movq %rax, -0x78(%rbp)
movq 0x27933(%rip), %rax     # 0x36490
movq %rax, -0x70(%rbp)
movq 0x27930(%rip), %rax     # 0x36498
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movb $0x0, 0x2d6(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x296(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x256(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x316(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x31a(%rax)
movq -0x18(%rbp), %rax
movzbl 0x50(%rax), %eax
cmpl $0x0, %eax
je 0xebd0
movq -0x18(%rbp), %rax
movzbl 0x51(%rax), %eax
cmpl $0x0, %eax
je 0xebd0
movq -0x18(%rbp), %rax
movl $0x3, 0x1c(%rax)
jmp 0xebf4
movq -0x18(%rbp), %rax
cmpb $0x0, 0x51(%rax)
je 0xebe7
movq -0x18(%rbp), %rax
movl $0x2, 0x1c(%rax)
jmp 0xebf2
movq -0x18(%rbp), %rax
movl $0x0, 0x1c(%rax)
jmp 0xebf4
movq -0x18(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jne 0xec0a
movl $0x0, -0xc(%rbp)
jmp 0xf354
jmp 0xec0c
movq -0x18(%rbp), %rcx
movl $0x1, %edi
movl $0x2b, %esi
leaq 0x33af(%rip), %rdx      # 0x11fd0
callq 0x11170
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0x7530, %edx           # imm = 0x7530
leaq 0x1efbb(%rip), %rcx     # 0x2dbf9
callq 0xc670
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xeea6
cmpq $0x0, -0x28(%rbp)
je 0xeea6
movq -0x28(%rbp), %rax
movzwl 0x10(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xeea6
movq -0x28(%rbp), %rax
movzwl 0x12(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x51, %eax
jne 0xeea6
movq -0x28(%rbp), %rdi
callq 0x5040
movq -0x18(%rbp), %rcx
movl $0x1, %edi
movl $0x27, %esi
leaq 0x3395(%rip), %rdx      # 0x12040
callq 0x11170
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0x7530, %edx           # imm = 0x7530
leaq 0x1ef31(%rip), %rcx     # 0x2dbf9
callq 0xc670
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0xece1
cmpq $0x0, -0x28(%rbp)
jne 0xed6f
jmp 0xece3
movq 0x282f6(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x90(%rbp)
callq 0x13930
movq -0x90(%rbp), %rdi
movq %rax, %rdx
movl -0x34(%rbp), %r8d
leaq 0x1ec53(%rip), %rsi     # 0x2d961
leaq 0x1eee4(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
leaq 0x29145(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xed62
leaq 0x29138(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x98(%rbp)
callq 0x13930
movq -0x98(%rbp), %rdi
movq %rax, %rdx
movl -0x34(%rbp), %r8d
leaq 0x1ec0d(%rip), %rsi     # 0x2d961
leaq 0x1ee9e(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
jmp 0xed64
movl -0x34(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xf354
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 0xeda9
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xee96
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movw %ax, -0x82(%rbp)
movq 0x2821c(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
callq 0x13930
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x82(%rbp), %r9d
leaq 0x1eb6b(%rip), %rsi     # 0x2d973
leaq 0x1edea(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
leaq 0x2904b(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xee7c
leaq 0x2903e(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
callq 0x13930
movq %rax, -0xb0(%rbp)
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x82(%rbp), %r9d
leaq 0x1eb05(%rip), %rsi     # 0x2d973
leaq 0x1ed84(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
jmp 0xee7e
movq -0x28(%rbp), %rdi
callq 0x5040
movzwl -0x82(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xf354
jmp 0xee98
movq -0x28(%rbp), %rdi
callq 0x5040
jmp 0xec0c
jmp 0xeea8
cmpl $0x0, -0x34(%rbp)
jl 0xeeb9
cmpq $0x0, -0x28(%rbp)
jne 0xef47
jmp 0xeebb
movq 0x2811e(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
callq 0x13930
movq -0xc0(%rbp), %rdi
movq %rax, %rdx
movl -0x34(%rbp), %r8d
leaq 0x1ea7b(%rip), %rsi     # 0x2d961
leaq 0x1ed0c(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
leaq 0x28f6d(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xef3a
leaq 0x28f60(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
callq 0x13930
movq -0xc8(%rbp), %rdi
movq %rax, %rdx
movl -0x34(%rbp), %r8d
leaq 0x1ea35(%rip), %rsi     # 0x2d961
leaq 0x1ecc6(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
jmp 0xef3c
movl -0x34(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xf354
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 0xef81
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xf06e
movq -0x30(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movw %ax, -0x84(%rbp)
movq 0x28044(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
callq 0x13930
movq %rax, -0xd0(%rbp)
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x84(%rbp), %r9d
leaq 0x1e993(%rip), %rsi     # 0x2d973
leaq 0x1ec12(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
leaq 0x28e73(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xf054
leaq 0x28e66(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
callq 0x13930
movq %rax, -0xe0(%rbp)
movq -0x30(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x84(%rbp), %r9d
leaq 0x1e92d(%rip), %rsi     # 0x2d973
leaq 0x1ebac(%rip), %rcx     # 0x2dbf9
movb $0x0, %al
callq 0x52c0
jmp 0xf056
movq -0x28(%rbp), %rdi
callq 0x5040
movzwl -0x84(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xf354
jmp 0xf070
movq -0x28(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x14, %esi
callq 0xc580
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x1b, %esi
callq 0xc580
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x1c, %esi
callq 0xc580
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x1d, %esi
callq 0xc580
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x11, %esi
callq 0xc580
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xf143
movq -0x18(%rbp), %rax
addq $0x256, %rax            # imm = 0x256
movq %rax, -0xf8(%rbp)
movq -0x40(%rbp), %rax
addq $0x3, %rax
movq %rax, -0xf0(%rbp)
movq -0x40(%rbp), %rax
movzwl 0x1(%rax), %edi
callq 0x13ed0
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rdx
movzwl %ax, %eax
movl %eax, %ecx
movl $0x40, %esi
callq 0x11380
cmpq $0x0, -0x48(%rbp)
je 0xf194
movq -0x18(%rbp), %rax
addq $0x296, %rax            # imm = 0x296
movq %rax, -0x108(%rbp)
movq -0x48(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x100(%rbp)
movq -0x48(%rbp), %rax
movzwl 0x1(%rax), %edi
callq 0x13ed0
movq -0x108(%rbp), %rdi
movq -0x100(%rbp), %rdx
movzwl %ax, %eax
movl %eax, %ecx
movl $0x40, %esi
callq 0x11380
cmpq $0x0, -0x50(%rbp)
je 0xf1e5
movq -0x18(%rbp), %rax
addq $0x2d6, %rax            # imm = 0x2D6
movq %rax, -0x118(%rbp)
movq -0x50(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x110(%rbp)
movq -0x50(%rbp), %rax
movzwl 0x1(%rax), %edi
callq 0x13ed0
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rdx
movzwl %ax, %eax
movl %eax, %ecx
movl $0x40, %esi
callq 0x11380
cmpq $0x0, -0x58(%rbp)
je 0xf1fe
movq -0x58(%rbp), %rax
movzbl 0x3(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x316(%rax)
cmpq $0x0, -0x60(%rbp)
je 0xf217
movq -0x60(%rbp), %rax
movzbl 0x3(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x31a(%rax)
jmp 0xf219
movq 0x27dc0(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x120(%rbp)
callq 0x13930
movq -0x120(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %rax
movl 0x48(%rax), %r8d
movq -0x18(%rbp), %r9
addq $0x256, %r9             # imm = 0x256
movq -0x18(%rbp), %rbx
addq $0x296, %rbx            # imm = 0x296
movq -0x18(%rbp), %r11
addq $0x2d6, %r11            # imm = 0x2D6
movq -0x18(%rbp), %rax
movl 0x316(%rax), %r10d
movq -0x18(%rbp), %rax
movslq 0x31a(%rax), %rax
movq -0x80(%rbp,%rax,8), %rax
leaq 0x1e924(%rip), %rsi     # 0x2dba8
leaq 0x1e96e(%rip), %rcx     # 0x2dbf9
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x52c0
leaq 0x28bbc(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0xf342
leaq 0x28bab(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x128(%rbp)
callq 0x13930
movq -0x128(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %rax
movl 0x48(%rax), %r8d
movq -0x18(%rbp), %r9
addq $0x256, %r9             # imm = 0x256
movq -0x18(%rbp), %rbx
addq $0x296, %rbx            # imm = 0x296
movq -0x18(%rbp), %r11
addq $0x2d6, %r11            # imm = 0x2D6
movq -0x18(%rbp), %rax
movl 0x316(%rax), %r10d
movq -0x18(%rbp), %rax
movslq 0x31a(%rax), %rax
movq -0x80(%rbp,%rax,8), %rax
leaq 0x1e887(%rip), %rsi     # 0x2dba8
leaq 0x1e8d1(%rip), %rcx     # 0x2dbf9
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x52c0
jmp 0xf344
movq -0x28(%rbp), %rdi
callq 0x5040
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)