Function at 0x509b4d
Capabilities:
Query environment variable

Disassembly:
push rbp
push rdi
sub rsp, 0xe8
lea rbp, [rsp + 0x80]
mov qword [rbp + 0x80], rcx
mov qword [rbp + 0x88], rdx
mov qword [rbp + 0x90], r8
mov dword [rbp + 0x98], r9d
mov qword [rbp + 0x58], 0
mov qword [rbp + 0x50], 0
mov qword [rbp + 0x48], 0
mov qword [rbp + 0x30], 0
mov qword [rbp + 0x18], 0
cmp qword [rbp + 0x80], 0
je 0x509bc0
cmp qword [rbp + 0x88], 0
je 0x509bc0
cmp qword [rbp + 0x90], 0
jne 0x509bca
mov eax, 0
jmp 0x50a1b3
mov rcx, qword [rbp + 0x80]
call fcn.00509684
cmp qword [rbp + 0x80], rax
jne 0x509e59
lea rcx, [0x0056a860]
call sub.msvcrt.dll_getenv
mov qword [rbp - 0x10], rax
cmp qword [rbp - 0x10], 0
je 0x509e59
mov rax, qword [rbp - 0x10]
mov rcx, rax
call sub.msvcrt.dll_strlen
add rax, 1
mov qword [rbp - 8], rax
cmp qword [rbp - 8], 1
ja 0x509c21
mov qword [rbp - 8], 2
mov rcx, qword [rbp + 0x80]
call sub.msvcrt.dll_strlen
mov rdx, rax
mov rax, qword [rbp - 8]
add rax, rdx
add rax, 1
mov qword [rbp - 0x18], rax
add qword [rbp - 0x18], 4
cmp qword [rbp - 0x18], 0xfbf
ja 0x509c81
mov rax, qword [rbp - 0x18]
add rax, 0xf
add rax, 0xf
shr rax, 4
shl rax, 4
call fcn.0050db60
sub rsp, rax
lea rax, [rsp + 0x20]
add rax, 0xf
shr rax, 4
shl rax, 4
mov qword [rbp], rax
jmp 0x509c99
mov rax, qword [rbp - 0x18]
mov rcx, rax
call sub.msvcrt.dll_malloc
mov qword [rbp], rax
mov rax, qword [rbp]
mov qword [rbp + 0x18], rax
mov rax, qword [rbp - 0x10]
mov qword [rbp + 8], rax
mov rax, qword [rbp + 8]
mov qword [rbp + 0x10], rax
mov rax, qword [rbp + 8]
movzx eax, byte [rax]
cmp al, 0x3b
je 0x509cc3
mov rax, qword [rbp + 8]
movzx eax, byte [rax]
test al, al
jne 0x509e4e
mov rax, qword [rbp + 8]
cmp rax, qword [rbp + 0x10]
jne 0x509cef
mov rax, qword [rbp]
mov byte [rax], 0x2e
mov rax, qword [rbp]
add rax, 1
mov byte [rax], 0x2f
mov rax, qword [rbp]
add rax, 2
mov byte [rax], 0
jmp 0x509d85
mov rdx, qword [rbp + 8]
mov rax, qword [rbp + 0x10]
sub rdx, rax
mov rax, rdx
mov rcx, rax
mov rdx, qword [rbp + 0x10]
mov rax, qword [rbp]
mov r8, rcx
mov rcx, rax
call sub.msvcrt.dll_memcpy
mov rax, qword [rbp + 8]
sub rax, 1
movzx eax, byte [rax]
cmp al, 0x2f
je 0x509d6a
mov rax, qword [rbp + 8]
sub rax, 1
movzx eax, byte [rax]
cmp al, 0x5c
je 0x509d6a
mov rdx, qword [rbp + 8]
mov rax, qword [rbp + 0x10]
sub rdx, rax
mov rax, rdx
mov rdx, rax
mov rax, qword [rbp]
add rax, rdx
mov byte [rax], 0x2f
mov rdx, qword [rbp + 8]
mov rax, qword [rbp + 0x10]
sub rdx, rax
mov rax, rdx
lea rdx, [rax + 1]
mov rax, qword [rbp]
add rax, rdx
mov byte [rax], 0
jmp 0x509d85
mov rdx, qword [rbp + 8]
mov rax, qword [rbp + 0x10]
sub rdx, rax
mov rax, rdx
mov rdx, rax
mov rax, qword [rbp]
add rax, rdx
mov byte [rax], 0
mov rax, qword [rbp]
mov rdx, qword [rbp + 0x80]
mov rcx, rax
call sub.msvcrt.dll_strcat
mov rax, qword [rbp]
mov edx, 1
mov rcx, rax
call fcn.00509740
test eax, eax
je 0x509df5
mov rax, qword [rbp]
mov rcx, 0xffffffffffffffff
mov rdx, rax
mov eax, 0
mov rdi, rdx
repne scasb al, byte [rdi]
mov rax, rcx
not rax
lea rdx, [rax - 1]
mov rax, qword [rbp]
add rax, rdx
mov dword [rax], 0x6578652e
mov byte [rax + 4], 0
mov rax, qword [rbp]
mov edx, 1
mov rcx, rax
call fcn.00509740
test eax, eax
jne 0x509e2d
lea rdx, [rbp - 0x60]
mov rax, qword [rbp]
mov rcx, rax
mov rax, qword [sym.imp.msvcrt.dll__stat64]
call rax
test eax, eax
js 0x509e2d
movzx eax, word [rbp - 0x5a]
movzx eax, ax
and eax, 0xf000
cmp eax, 0x8000
jne 0x509e2d
mov rax, qword [rbp]
mov qword [rbp + 0x80], rax
jmp 0x509e59
mov rax, qword [rbp + 8]
movzx eax, byte [rax]
test al, al
je 0x509e58
mov rax, qword [rbp + 8]
add rax, 1
mov qword [rbp + 0x10], rax
mov rax, qword [rbp + 0x10]
mov qword [rbp + 8], rax
jmp 0x509e53
add qword [rbp + 8], 1
jmp 0x509ca9
nop
cmp dword [rbp + 0x98], 0
je 0x509e74
mov rcx, qword [rbp + 0x80]
call fcn.005096a0
mov qword [rbp + 0x20], rax
jmp 0x509e84
mov rcx, qword [rbp + 0x80]
call sub.msvcrt.dll__strdup
mov qword [rbp + 0x20], rax
cmp qword [rbp + 0x20], 0
je 0x50a16c
lea rdx, [rbp - 0x20]
mov rax, qword [rbp + 0x20]
mov rcx, rax
call fcn.005097c0
mov qword [rbp + 0x58], rax
mov rax, qword [rbp + 0x20]
mov rcx, rax
call sub.msvcrt.dll_free
cmp qword [rbp + 0x58], 0
je 0x50a16f
lea rdx, [rbp - 0x24]
mov rax, qword [rbp + 0x88]
mov rcx, rax
call fcn.005097c0
mov qword [rbp + 0x50], rax
cmp qword [rbp + 0x50], 0
je 0x50a172
mov eax, dword [rbp - 0x20]
sub eax, 1
mov dword [rbp - 0x20], eax
mov edx, dword [rbp - 0x20]
mov eax, dword [rbp - 0x24]
cmp edx, eax
jne 0x509f58
mov dword [rbp + 0x44], 0
jmp 0x509f36
mov eax, dword [rbp + 0x44]
cdqe
lea rdx, [rax*8]
mov rax, qword [rbp + 0x50]
add rax, rdx
mov rdx, qword [rax]
mov eax, dword [rbp + 0x44]
cdqe
lea rcx, [rax*8]
mov rax, qword [rbp + 0x58]
add rax, rcx
mov rax, qword [rax]
mov rcx, rax
call sub.msvcrt.dll_strcmp
test eax, eax
jne 0x509f40
add dword [rbp + 0x44], 1
mov eax, dword [rbp - 0x24]
cmp dword [rbp + 0x44], eax
jl 0x509ef8
jmp 0x509f41
nop
mov eax, dword [rbp - 0x20]
test eax, eax
jle 0x50a175
mov eax, dword [rbp - 0x24]
cmp dword [rbp + 0x44], eax
je 0x50a175
lea rdx, [rbp - 0x28]
mov rax, qword [rbp + 0x90]
mov rcx, rax
call fcn.005097c0
mov qword [rbp + 0x48], rax
cmp qword [rbp + 0x48], 0
je 0x50a178
mov edx, dword [rbp - 0x24]
mov eax, dword [rbp - 0x28]
cmp edx, eax
cmovle eax, edx
mov dword [rbp - 0x1c], eax
mov dword [rbp + 0x40], 0
jmp 0x509fcf
mov eax, dword [rbp + 0x40]
cdqe
lea rdx, [rax*8]
mov rax, qword [rbp + 0x48]
add rax, rdx
mov rdx, qword [rax]
mov eax, dword [rbp + 0x40]
cdqe
lea rcx, [rax*8]
mov rax, qword [rbp + 0x50]
add rax, rcx
mov rax, qword [rax]
mov rcx, rax
call sub.msvcrt.dll_strcmp
test eax, eax
jne 0x509fd9
add dword [rbp + 0x40], 1
mov eax, dword [rbp + 0x40]
cmp eax, dword [rbp - 0x1c]
jl 0x509f91
jmp 0x509fda
nop
cmp dword [rbp + 0x40], 0
je 0x50a17b
mov dword [rbp + 0x3c], 0
mov dword [rbp + 0x44], 0
jmp 0x50a021
mov eax, dword [rbp + 0x44]
cdqe
lea rdx, [rax*8]
mov rax, qword [rbp + 0x58]
add rax, rdx
mov rax, qword [rax]
mov rcx, rax
call sub.msvcrt.dll_strlen
mov edx, eax
mov eax, dword [rbp + 0x3c]
add eax, edx
mov dword [rbp + 0x3c], eax
add dword [rbp + 0x44], 1
mov eax, dword [rbp - 0x20]
cmp dword [rbp + 0x44], eax
jl 0x509ff4
mov eax, dword [rbp - 0x24]
sub eax, dword [rbp + 0x40]
cdqe
mov edx, eax
mov eax, edx
add eax, eax
add edx, eax
mov eax, dword [rbp + 0x3c]
add eax, edx
mov dword [rbp + 0x3c], eax
mov eax, dword [rbp + 0x40]
mov dword [rbp + 0x44], eax
jmp 0x50a076
mov eax, dword [rbp + 0x44]
cdqe
lea rdx, [rax*8]
mov rax, qword [rbp + 0x48]
add rax, rdx
mov rax, qword [rax]
mov rcx, rax
call sub.msvcrt.dll_strlen
mov edx, eax
mov eax, dword [rbp + 0x3c]
add eax, edx
mov dword [rbp + 0x3c], eax
add dword [rbp + 0x44], 1
mov eax, dword [rbp - 0x28]
cmp dword [rbp + 0x44], eax
jl 0x50a049
add dword [rbp + 0x3c], 1
mov eax, dword [rbp + 0x3c]
cdqe
mov rcx, rax
call sub.msvcrt.dll_malloc
mov qword [rbp + 0x30], rax
cmp qword [rbp + 0x30], 0
je 0x50a17e
mov rax, qword [rbp + 0x30]
mov byte [rax], 0
mov dword [rbp + 0x44], 0
jmp 0x50a0d5
mov eax, dword [rbp + 0x44]
cdqe
lea rdx, [rax*8]
mov rax, qword [rbp + 0x58]
add rax, rdx
mov rdx, qword [rax]
mov rax, qword [rbp + 0x30]
mov rcx, rax
call sub.msvcrt.dll_strcat
add dword [rbp + 0x44], 1
mov eax, dword [rbp - 0x20]
cmp dword [rbp + 0x44], eax
jl 0x50a0ae
mov rax, qword [rbp + 0x30]
mov rcx, rax
call sub.msvcrt.dll_strlen
mov rdx, rax
mov rax, qword [rbp + 0x30]
add rax, rdx
mov qword [rbp + 0x28], rax
mov eax, dword [rbp + 0x40]
mov dword [rbp + 0x44], eax
jmp 0x50a124
mov rax, qword [rbp + 0x28]
mov word [rax], 0x2e2e
mov byte [rax + 2], 0
add qword [rbp + 0x28], 2
mov rax, qword [rbp + 0x28]
lea rdx, [rax + 1]
mov qword [rbp + 0x28], rdx
mov byte [rax], 0x2f
add dword [rbp + 0x44], 1
mov eax, dword [rbp - 0x24]
cmp dword [rbp + 0x44], eax
jl 0x50a0ff
mov rax, qword [rbp + 0x28]
mov byte [rax], 0
mov eax, dword [rbp + 0x40]
mov dword [rbp + 0x44], eax
jmp 0x50a162
mov eax, dword [rbp + 0x44]
cdqe
lea rdx, [rax*8]
mov rax, qword [rbp + 0x48]
add rax, rdx
mov rdx, qword [rax]
mov rax, qword [rbp + 0x30]
mov rcx, rax
call sub.msvcrt.dll_strcat
add dword [rbp + 0x44], 1
mov eax, dword [rbp - 0x28]
cmp dword [rbp + 0x44], eax
jl 0x50a13b
jmp 0x50a175
nop
jmp 0x50a17f
nop
jmp 0x50a17f
nop
jmp 0x50a17f
nop
jmp 0x50a17f
nop
jmp 0x50a17f
nop
jmp 0x50a17f
nop
mov rax, qword [rbp + 0x58]
mov rcx, rax
call fcn.00509ae0
mov rax, qword [rbp + 0x50]
mov rcx, rax
call fcn.00509ae0
mov rax, qword [rbp + 0x48]
mov rcx, rax
call fcn.00509ae0
mov rax, qword [rbp + 0x18]
mov rcx, rax
call sub.msvcrt.dll_free
mov rax, qword [rbp + 0x30]
lea rsp, [rbp + 0x68]
pop rdi
pop rbp
ret