Function at 0x140052170
Capabilities:
Set environment variable

Disassembly:
mov qword [rsp + 8], rbx
mov qword [rsp + 0x10], rbp
mov qword [rsp + 0x18], rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x30
xor esi, esi
mov ebp, edx
mov r15, rcx
test rcx, rcx
jne 0x140051d98
call fcn.140042090
mov dword [rax], SafeArrayUnaccessData
or rax, 0xffffffffffffffff
jmp 0x14005204c
mov edx, 0x3d
mov rdi, r15
call fcn.140058d14
mov r13, rax
test rax, rax
je 0x14005202b
cmp rax, r15
je 0x14005202b
mov r14, qword [0x140082a28]
cmp r14, qword [0x140082a30]
movzx r12d, word [rax + 2]
jne 0x140051de1
mov rcx, r14
call fcn.140052080
mov r14, rax
mov qword [0x140082a28], rax
mov ebx, 1
test r14, r14
jne 0x140051e9e
mov rax, qword [0x140082a20]
test ebp, ebp
je 0x140051e31
test rax, rax
je 0x140051e31
call fcn.140047974
test rax, rax
je 0x14005202b
mov r14, qword [0x140082a28]
cmp r14, qword [0x140082a30]
jne 0x140051e99
mov rcx, r14
call fcn.140052080
mov r14, rax
mov qword [0x140082a28], rax
jmp 0x140051e99
test r12w, r12w
je 0x14005203a
test rax, rax
jne 0x140051e77
lea edx, [rax + 8]
mov rcx, rbx
call fcn.14004c10c
xor ecx, ecx
mov qword [0x140082a20], rax
call fcn.14004ace4
cmp qword [0x140082a20], rsi
jne 0x140051e6b
or rbp, 0xffffffffffffffff
jmp 0x14005203c
mov r14, qword [0x140082a28]
test r14, r14
jne 0x140051e9e
mov edx, 8
mov rcx, rbx
call fcn.14004c10c
xor ecx, ecx
mov qword [0x140082a28], rax
call fcn.14004ace4
mov r14, qword [0x140082a28]
test r14, r14
je 0x140051e62
mov rax, qword [r14]
sub r13, r15
sar r13, 1
mov rbx, r14
test rax, rax
je 0x140051ee9
mov r8, r13
mov rdx, rax
mov rcx, r15
call fcn.140057438
test eax, eax
jne 0x140051ed7
mov rax, qword [rbx]
mov ecx, 0x3d
cmp word [rax + r13*2], cx
je 0x140051ee0
cmp word [rax + r13*2], si
je 0x140051ee0
add rbx, 8
mov rax, qword [rbx]
jmp 0x140051eaa
sub rbx, r14
sar rbx, 3
jmp 0x140051ef3
sub rbx, r14
sar rbx, 3
neg rbx
test rbx, rbx
js 0x140051f50
cmp qword [r14], rsi
je 0x140051f50
mov rcx, qword [r14 + rbx*8]
call fcn.14004ace4
test r12w, r12w
je 0x140051f21
mov qword [r14 + rbx*8], r15
jmp 0x140051fab
mov rax, qword [r14 + rbx*8 + 8]
mov qword [r14 + rbx*8], rax
inc rbx
cmp qword [r14 + rbx*8], rsi
jne 0x140051f15
mov r8d, 8
mov rdx, rbx
mov rcx, r14
call fcn.140049a78
xor ecx, ecx
mov rbx, rax
call fcn.14004ace4
test rbx, rbx
je 0x140051fae
mov qword [0x140082a28], rbx
jmp 0x140051fae
test r12w, r12w
je 0x14005203e
neg rbx
lea rdx, [rbx + 2]
cmp rdx, rbx
jae 0x140051f6f
or rbp, 0xffffffffffffffff
jmp 0x140052040
movabs rax, 0x1fffffffffffffff
cmp rdx, rax
jae 0x140051f66
mov r8d, 8
mov rcx, r14
call fcn.140049a78
xor ecx, ecx
mov r14, rax
call fcn.14004ace4
test r14, r14
je 0x140051f66
mov qword [r14 + rbx*8], r15
mov qword [r14 + rbx*8 + 8], rsi
mov qword [0x140082a28], r14
mov rdi, rsi
test ebp, ebp
je 0x140052042
or rbp, 0xffffffffffffffff
mov r14, rbp
inc r14
cmp word [r15 + r14*2], si
jne 0x140051fbd
mov edx, 2
add r14, rdx
mov rcx, r14
call fcn.14004c10c
mov rbx, rax
test rax, rax
je 0x140052021
mov r8, r15
mov rdx, r14
mov rcx, rax
call fcn.1400508a4
test eax, eax
jne 0x140052069
neg r12w
lea rax, [r13 + 1]
lea rax, [rbx + rax*2]
mov rcx, rbx
sbb rdx, rdx
mov word [rax - 2], si
and rdx, rax
call qword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
test eax, eax
jne 0x140052021
call fcn.140042090
mov esi, ebp
mov dword [rax], 0x2a
mov rcx, rbx
call fcn.14004ace4
jmp 0x140052042
call fcn.140042090
or rsi, 0xffffffffffffffff
mov dword [rax], SafeArrayUnaccessData
mov ebp, esi
mov esi, ebp
mov ebp, esi
mov esi, ebp
mov rcx, rdi
call fcn.14004ace4
mov eax, esi
mov rbx, qword [rsp + 0x60]
mov rbp, qword [rsp + 0x68]
mov rsi, qword [rsp + 0x70]
add rsp, 0x30
pop r15
pop r14
pop r13
pop r12
pop rdi
ret
xor r9d, r9d
mov qword [rsp + 0x20], rsi
xor r8d, r8d
xor edx, edx
xor ecx, ecx
call fcn.14003d934
int3
jmp 0x140051d5c