Function at 0x408580
Capabilities:
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5c786b
mov eax, dword fs:[0]
push eax
sub esp, 0x140
mov eax, dword [0x656770]
xor eax, ebp
mov dword [ebp - 0x14], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov byte [ebp - 0x135], dl
mov esi, ecx
mov dword [ebp - 0x14c], esi
mov dword [ebp - 0x144], 0
lea eax, [ebp + 8]
push eax
mov dword [ebp - 4], 1
call fcn.004068e0
push 0x103
lea eax, [ebp - 0x11b]
push 0
push eax
mov dword [ebp - 0x144], 1
mov byte [ebp - 0x11c], 0
call fcn.00527890
add esp, 0xc
lea eax, [ebp - 0x11c]
push 0x104
push eax
push dword [esi]
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsA]
lea eax, [ebp - 0x11c]
push eax
lea ecx, [ebp - 0x148]
call fcn.00405fe0
mov byte [ebp - 4], 2
mov ecx, dword [eax]
mov edi, dword [esi]
lea edx, [ecx - 0x10]
sub edi, 0x10
or ebx, 0xffffffff
cmp edx, edi
je 0x408681
cmp dword [edi + 0xc], 0
jl 0x408676
mov eax, dword [edx]
cmp eax, dword [edi]
jne 0x408676
push edx
call fcn.00406870
mov dword [ebp - 0x140], eax
add esp, 4
mov eax, ebx
lea ecx, [edi + 0xc]
lock xadd dword [ecx], eax
dec eax
test eax, eax
jg 0x408669
mov ecx, dword [edi]
push edi
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, dword [ebp - 0x140]
add eax, 0x10
mov dword [esi], eax
jmp 0x408681
push dword [ecx - 0xc]
push ecx
mov ecx, esi
call fcn.00405f00
mov byte [ebp - 4], 1
mov edx, dword [ebp - 0x148]
add edx, 0xfffffff0
mov ecx, ebx
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x4086a4
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, dword [esi]
mov edi, dword [eax - 0xc]
test edi, edi
jns 0x4086b7
push 0x80070057
call fcn.00406840
mov ecx, 1
sub ecx, dword [eax - 4]
mov eax, dword [eax - 8]
sub eax, edi
or eax, ecx
jge 0x4086d0
push edi
mov ecx, esi
call fcn.00405e30
lea eax, [edi + 1]
push eax
push dword [esi]
call fcn.00526abc
push eax
call fcn.0040a980
mov eax, dword [esi]
add esp, 0xc
cmp edi, dword [eax - 8]
jg 0x4086ad
mov dword [eax - 0xc], edi
mov eax, dword [esi]
lea ecx, [ebp - 0x134]
mov byte [edi + eax], 0
call fcn.0040d030
mov byte [ebp - 4], 3
cmp dword [eax + 0x14], 0x10
jb 0x40870b
mov eax, dword [eax]
push eax
lea ecx, [ebp - 0x13c]
call fcn.00405fe0
mov byte [ebp - 4], 5
cmp dword [ebp - 0x120], 0x10
jb 0x408732
push dword [ebp - 0x134]
call fcn.00411632
add esp, 4
push dword [ebp - 0x13c]
mov ecx, esi
push str._programfiles_
mov dword [ebp - 0x120], 0xf
mov dword [ebp - 0x124], 0
mov byte [ebp - 0x134], 0
call fcn.00409a80
mov eax, dword [esi]
mov edi, dword [eax - 0xc]
test edi, edi
jns 0x408772
push 0x80070057
call fcn.00406840
mov ecx, 1
sub ecx, dword [eax - 4]
mov eax, dword [eax - 8]
sub eax, edi
or eax, ecx
jge 0x40878b
push edi
mov ecx, esi
call fcn.00405e30
lea eax, [edi + 1]
push eax
push dword [esi]
call fcn.00526abc
push eax
call fcn.0040a980
mov eax, dword [esi]
add esp, 0xc
cmp edi, dword [eax - 8]
jg 0x4086ad
mov dword [eax - 0xc], edi
mov eax, dword [esi]
mov byte [edi + eax], 0
call fcn.00410420
cmp eax, 0x40
jne 0x4087de
cmp byte [ebp - 0x135], 1
jne 0x4087de
push str.program_files
push str.program_files__x86_
mov ecx, esi
call fcn.00409a80
mov ecx, esi
call fcn.00409d80
mov byte [ebp - 4], 1
mov edx, dword [ebp - 0x13c]
add edx, 0xfffffff0
mov ecx, ebx
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x408801
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 0
mov edi, dword [ebp + 8]
add edi, 0xfffffff0
lea eax, [edi + 0xc]
lock xadd dword [eax], ebx
dec ebx
test ebx, ebx
jg 0x40881f
mov ecx, dword [edi]
push edi
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, esi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.005259c3
mov esp, ebp
pop ebp
ret