Function at 0x140021850
Capabilities:
Set environment variable

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0xf8
mov r14, rcx
mov rcx, qword [0x1400d2dd8]
mov qword [rsp + 0x38], r8
mov rsi, rdx
test rcx, rcx
je 0x140021b0e
lea rdx, str.environ
call qword [sym.imp.python312.dll_PyObject_GetAttrString]
mov rcx, rsi
mov qword [rsp + 0x28], rax
call qword [sym.imp.python312.dll_PyUnicode_FromString]
cmp qword [rsp + 0x38], 0
mov qword [rsp + 0x30], rax
je 0x1400219fe
movzx eax, byte [rsi]
xor r8d, r8d
mov word [rsp + 0x50], r8w
test al, al
je 0x140021b38
xor r13d, r13d
lea r15, [rsp + 0x50]
lea r12, [rsp + 0x44]
mov edi, 0x28
lea rbp, [rsp + 0x48]
nop dword [rax]
mov r14, rdi
mov r8d, 2
mov rdx, r12
mov rcx, rbp
sub r14, r13
mov byte [rsp + 0x44], al
lea rbx, [r15 + r13*2]
mov byte [rsp + 0x45], 0
call sub.msvcrt.dll_mbstowcs
cmp rax, 1
jne 0x1400ac1aa
cmp word [r15 + r13*2], 0
movzx eax, word [rsp + 0x48]
je 0x140021926
nop dword [rax + rax]
add rbx, 2
sub r14, 1
cmp word [rbx], 0
jne 0x140021918
test r14, r14
je 0x1400ac1aa
add r13, 1
mov word [rbx], ax
xor ecx, ecx
movzx eax, byte [rsi + r13]
mov word [rbx + 2], cx
test al, al
jne 0x1400218d8
mov rsi, qword [rsp + 0x38]
mov rcx, r15
mov rdx, rsi
call qword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
mov rdx, 0xffffffffffffffff
mov rcx, rsi
call qword [sym.imp.python312.dll_PyUnicode_FromWideChar]
mov rdx, qword [rsp + 0x30]
mov rcx, qword [rsp + 0x28]
mov rbx, rax
mov r8, rax
call qword [sym.imp.python312.dll_PyObject_SetItem]
test eax, eax
jne 0x140021b42
mov rax, qword [rbx]
test eax, eax
js 0x140021998
sub rax, 1
mov qword [rbx], rax
je 0x140021b00
mov rsi, qword [rsp + 0x30]
mov rax, qword [rsi]
test eax, eax
js 0x1400219ad
sub rax, 1
mov qword [rsi], rax
je 0x1400219f3
mov rdi, qword [rsp + 0x28]
mov rax, qword [rdi]
test eax, eax
js 0x1400219c2
sub rax, 1
mov qword [rdi], rax
je 0x1400219d6
add rsp, 0xf8
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov rcx, rdi
add rsp, 0xf8
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp qword [sym.imp.python312.dll__Py_Dealloc]
mov rcx, rsi
call qword [sym.imp.python312.dll__Py_Dealloc]
jmp 0x1400219ad
movzx eax, byte [rsi]
xor edx, edx
mov word [rsp + 0xa0], dx
test al, al
je 0x140021b58
lea rdx, [rsp + 0x4c]
xor r12d, r12d
lea r15, [rsp + 0x46]
mov ebp, 0x28
mov qword [rsp + 0x38], rdx
lea rdi, [rsp + 0xa0]
nop word [rax + rax]
mov rcx, qword [rsp + 0x38]
mov r13, rbp
mov rdx, r15
mov byte [rsp + 0x46], al
mov r8d, 2
sub r13, r12
mov byte [rsp + 0x47], 0
lea rbx, [rdi + r12*2]
call sub.msvcrt.dll_mbstowcs
cmp rax, 1
jne 0x1400ac1aa
cmp word [rdi + r12*2], 0
movzx eax, word [rsp + 0x4c]
je 0x140021a86
nop dword [rax]
add rbx, 2
sub r13, 1
cmp word [rbx], 0
jne 0x140021a78
test r13, r13
je 0x1400ac1aa
mov word [rbx], ax
add r12, 1
xor eax, eax
mov word [rbx + 2], ax
movzx eax, byte [rsi + r12]
test al, al
jne 0x140021a38
xor edx, edx
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
mov rdx, qword [rsp + 0x30]
mov rcx, qword [rsp + 0x28]
call qword [sym.imp.python312.dll_PyObject_DelItem]
test eax, eax
je 0x140021998
mov rcx, qword [r14 + 0x60]
mov qword [r14 + 0x60], 0
test rcx, rcx
je 0x140021998
mov rax, qword [rcx]
test eax, eax
js 0x140021998
sub rax, 1
mov qword [rcx], rax
jne 0x140021998
call qword [sym.imp.python312.dll__Py_Dealloc]
jmp 0x140021998
mov rcx, rbx
call qword [sym.imp.python312.dll__Py_Dealloc]
jmp 0x140021998
lea rcx, [0x1400b7a93]
call qword [sym.imp.python312.dll_PyImport_ImportModule]
mov qword [0x1400d2dd8], rax
mov rcx, rax
test rax, rax
jne 0x14002187e
jmp 0x1400ac1aa
lea r15, [rsp + 0x50]
jmp 0x140021945
mov ecx, 1
call qword [sym.imp.python312.dll_PyErr_PrintEx]
mov ecx, 1
call qword [sym.imp.python312.dll_Py_Exit]
lea rdi, [rsp + 0xa0]
jmp 0x140021aa5