// File: /workspace/github_c_makefile_star2_O3/Carton32[P]quectel-CM/QMIThread.c
// Function: requestSetProfile
static int requestSetProfile(PROFILE_T *profile) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    const char *new_apn = profile->apn ? profile->apn : "";
    const char *new_user = profile->user ? profile->user : "";
    const char *new_password = profile->password ? profile->password : "";
    const char *ipStr[] = {"IPV4", "NULL", "IPV6", "IPV4V6"};

    dbg_time("%s[%d] %s/%s/%s/%d/%s", __func__, profile->pdp, profile->apn, profile->user, profile->password, profile->auth,ipStr[profile->iptype]);
    if (!profile->pdp)
        return 0;

    if ( !strcmp(profile->old_apn, new_apn) && !strcmp(profile->old_user, new_user)
        && !strcmp(profile->old_password, new_password)
        && profile->old_iptype == profile->iptype
        && profile->old_auth == profile->auth)
    {
        dbg_time("no need to set skip the rest");
        return 0;
    }

    pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_MODIFY_PROFILE_SETTINGS_REQ, WdsModifyProfileSettingsReq, profile);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    qmi_rsp_check_and_return();

    free(pResponse);
#ifdef REBOOT_SIM_CARD_WHEN_APN_CHANGE //enable at only when customer asked 
    if (qmi_request_ops.requestRadioPower) {
        qmi_request_ops.requestRadioPower(0);
        qmi_request_ops.requestRadioPower(1);
    }
#endif
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq (%rdi), %r13
movq 0x8(%rdi), %r12
testq %r13, %r13
leaq 0x138a6(%rip), %rax     # 0x1eea1
cmoveq %rax, %r13
testq %r12, %r12
cmoveq %rax, %r12
movq 0x10(%rdi), %r15
testq %r15, %r15
cmoveq %rax, %r15
movq 0x1e9a8(%rip), %rax     # 0x29fc0
movq (%rax), %rbp
callq 0xea3b
movl 0x48(%r14), %r8d
movq (%r14), %r9
movups 0x8(%r14), %xmm0
movl 0x18(%r14), %ecx
movslq 0x1c(%r14), %rdx
leaq 0x1ddc5(%rip), %rbx     # 0x29400
movq (%rbx,%rdx,8), %rdx
movq %rdx, 0x18(%rsp)
movl %ecx, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x15375(%rip), %rsi     # 0x209c8
leaq 0x1538a(%rip), %rcx     # 0x209e4
movq %rbp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x1f63a(%rip), %rax     # 0x2aca8
movq (%rax), %rbp
testq %rbp, %rbp
je 0xb6bb
callq 0xea3b
movl 0x48(%r14), %r8d
movq (%r14), %r9
movups 0x8(%r14), %xmm0
movl 0x18(%r14), %ecx
movslq 0x1c(%r14), %rdx
movq (%rbx,%rdx,8), %rdx
movq %rdx, 0x18(%rsp)
movl %ecx, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x15321(%rip), %rsi     # 0x209c8
leaq 0x15336(%rip), %rcx     # 0x209e4
movq %rbp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
cmpl $0x0, 0x48(%r14)
je 0xb8fa
leaq 0x256(%r14), %rdi
movq %r13, %rsi
callq 0x52a0
testl %eax, %eax
jne 0xb779
leaq 0x296(%r14), %rdi
movq %r12, %rsi
callq 0x52a0
testl %eax, %eax
jne 0xb779
leaq 0x2d6(%r14), %rdi
movq %r15, %rsi
callq 0x52a0
testl %eax, %eax
jne 0xb779
movl 0x31a(%r14), %eax
cmpl 0x1c(%r14), %eax
jne 0xb779
movl 0x316(%r14), %eax
cmpl 0x18(%r14), %eax
jne 0xb779
movq 0x1e898(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x152bf(%rip), %rsi     # 0x209f6
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x1f55b(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xb8fc
callq 0xea3b
leaq 0x15291(%rip), %rsi     # 0x209f6
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0xb8fc
leaq 0x28c8(%rip), %rdx      # 0xe048
movl $0x1, %edi
movl $0x28, %esi
movq %r14, %rcx
callq 0xd9a2
leaq 0x1524b(%rip), %rcx     # 0x209e4
leaq 0x20(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa273
movl %eax, %ebx
testl %eax, %eax
sets %al
movq (%r14), %r12
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xb82d
movq 0x1e7f4(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
leaq 0x14fa6(%rip), %rsi     # 0x20781
leaq 0x15202(%rip), %rcx     # 0x209e4
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1f4af(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xb8fc
callq 0xea3b
leaq 0x14f70(%rip), %rsi     # 0x20781
leaq 0x151cc(%rip), %rcx     # 0x209e4
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xb8fc
movzwl 0x10(%r12), %edi
callq 0xee73
testw %ax, %ax
jne 0xb851
movzwl 0x12(%r12), %edi
callq 0xee73
testw %ax, %ax
je 0xb8f0
movzwl 0x12(%r12), %edi
callq 0xee73
movl %eax, %ebx
movq 0x1e75b(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xee73
movzwl %ax, %r8d
movzwl %bx, %ebx
leaq 0x14f0a(%rip), %rsi     # 0x20793
leaq 0x15154(%rip), %rcx     # 0x209e4
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1f401(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xb8e4
callq 0xea3b
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xee73
movzwl %ax, %r8d
leaq 0x14ec6(%rip), %rsi     # 0x20793
leaq 0x15110(%rip), %rcx     # 0x209e4
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
movq 0x20(%rsp), %rdi
callq 0x5040
jmp 0xb8fc
movq 0x20(%rsp), %rdi
callq 0x5040
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq