Function at 0x401580
Capabilities:
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x38
mov edx, dword [0x402010]
cmp edx, 0xffffffff
je 0x401640
sub edx, 1
js 0x401602
mov eax, dword [0x405088]
xor ebx, ebx
mov ecx, edx
mov edi, ebx
mov dword [ebp - 0x14], eax
mov eax, dword [sym.imp.ucrtbase.dll_strcmp]
mov dword [ebp - 0x18], eax
mov eax, dword [ebp + 8]
add eax, 1
mov dword [ebp - 0x1c], eax
jmp 0x4015c7
lea edi, [esi + 1]
cmp edi, ecx
jg 0x401602
lea eax, [edi + ecx]
mov dword [ebp - 0x10], ecx
mov esi, eax
shr esi, 0x1f
add esi, eax
mov eax, dword [ebp - 0x14]
sar esi, 1
mov ebx, esi
shl ebx, 4
add ebx, eax
lea eax, [ebx + 1]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
mov eax, dword [ebp - 0x18]
call eax
mov ecx, dword [ebp - 0x10]
test eax, eax
je 0x401630
jns 0x4015c0
lea ecx, [esi - 1]
cmp edi, ecx
jle 0x4015c7
mov edx, dword [ebp + 8]
movzx eax, byte [0x402014]
cmp byte [edx], 0
js 0x401620
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov edx, dword [ebp + 8]
mov byte [edx], al
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
movzx eax, byte [ebx]
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], 0x403040
call dword [sym.imp.ucrtbase.dll_getenv]
mov dword [0x402010], 0
test eax, eax
je 0x401602
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll__strdup]
test eax, eax
je 0x40178e
mov dword [ebp - 0x2c], eax
mov ebx, eax
lea esi, [esi]
mov dword [esp + 4], 0x2c
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strchr]
mov dword [ebp - 0x10], 0
test eax, eax
je 0x40169d
lea edx, [eax + 1]
mov byte [eax], 0
mov dword [ebp - 0x10], edx
mov dword [esp + 4], 0x40304a
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strcspn]
lea edx, [ebx + eax]
mov esi, eax
movzx eax, byte [edx]
test al, al
je 0x401730
cmp ebx, edx
jae 0x401850
mov ecx, 5
mov dword [ebp - 0x14], edx
xor edi, edi
mov byte [ebp - 0x18], al
cmp esi, ecx
jne 0x4016f2
mov eax, dword [edi*4 + 0x4030e8]
mov dword [esp + 8], esi
mov dword [esp], ebx
mov dword [esp + 4], eax
call sym._memcmp
test eax, eax
je 0x401902
add edi, 1
cmp edi, 4
je 0x401720
mov eax, dword [edi*4 + 0x4030e8]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_strlen]
mov ecx, eax
cmp esi, ecx
je 0x4016d3
add edi, 1
cmp edi, 4
jne 0x4016fa
lea esi, cs:[esi]
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x401782
mov ebx, dword [ebp - 0x10]
jmp 0x401678
movzx eax, byte [ebx]
cmp al, 0x2d
je 0x4017a0
lea edx, [eax - 0x2b]
and edx, 0xfd
mov esi, edx
je 0x401840
mov byte [ebp - 0x18], 0xff
xor esi, esi
test al, al
je 0x401720
mov dword [esp + 4], 0x40304d
mov edi, dword [sym.imp.ucrtbase.dll_strcmp]
mov dword [esp], ebx
call edi
test eax, eax
jne 0x4017b8
mov eax, esi
not eax
and al, byte [0x402014]
or al, byte [ebp - 0x18]
mov byte [0x402014], al
mov eax, dword [ebp - 0x10]
test eax, eax
jne 0x401727
mov esi, dword [ebp - 0x2c]
mov dword [esp], esi
call dword [sym.imp.ucrtbase.dll_free]
mov edx, dword [0x402010]
jmp 0x401598
mov byte [ebp - 0x18], 0
mov esi, 0xffffffff
mov edx, ebx
movzx eax, byte [edx + 1]
lea ebx, [edx + 1]
jmp 0x40174e
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strlen]
mov ecx, eax
cmp eax, 0xe
ja 0x401720
mov eax, dword [0x402010]
mov edx, dword [0x405088]
mov dword [ebp - 0x28], eax
sub eax, 1
mov dword [ebp - 0x1c], edx
mov dword [ebp - 0x14], eax
js 0x401a09
xor edx, edx
mov eax, esi
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0x24], edi
mov ebx, edx
mov edi, dword [ebp - 0x14]
mov byte [ebp - 0x2d], al
mov dword [ebp - 0x34], ecx
jmp 0x401807
lea ebx, [ecx + 1]
cmp edi, ebx
jl 0x401869
lea eax, [ebx + edi]
mov ecx, eax
shr ecx, 0x1f
add ecx, eax
mov eax, dword [ebp - 0x1c]
sar ecx, 1
mov esi, ecx
mov dword [ebp - 0x14], ecx
shl esi, 4
add esi, eax
lea eax, [esi + 1]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
mov eax, dword [ebp - 0x24]
call eax
mov ecx, dword [ebp - 0x14]
test eax, eax
je 0x401857
jns 0x401800
lea edi, [ecx - 1]
jmp 0x401803
mov byte [ebp - 0x18], 0xff
mov edx, ebx
jmp 0x4017ab
mov ebx, edx
jmp 0x401733
movzx edx, byte [ebp - 0x2d]
not edx
and dl, byte [esi]
or dl, byte [ebp - 0x18]
mov byte [esi], dl
jmp 0x401720
mov edx, ebx
movzx esi, byte [ebp - 0x2d]
mov ebx, dword [ebp - 0x20]
mov edi, edx
mov ecx, dword [ebp - 0x34]
mov eax, dword [0x40508c]
mov dword [ebp - 0x20], edx
shl edi, 4
mov dword [ebp - 0x14], edi
cmp dword [ebp - 0x28], eax
jge 0x401991
mov eax, dword [ebp - 0x1c]
mov edi, dword [ebp - 0x14]
add edi, eax
mov eax, dword [ebp - 0x28]
cmp edx, eax
jge 0x4018c7
sub eax, edx
mov dword [ebp - 0x14], ecx
shl eax, 4
mov dword [esp + 4], edi
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x20]
mov edx, dword [ebp - 0x1c]
add eax, 1
shl eax, 4
add edx, eax
mov dword [esp], edx
call dword [sym.imp.ucrtbase.dll_memmove]
mov ecx, dword [ebp - 0x14]
lea eax, [ecx + 1]
lea edx, [edi + 1]
cmp eax, 4
jae 0x40193a
test eax, eax
je 0x4018e3
movzx ecx, byte [ebx]
mov byte [edx], cl
test al, 2
jne 0x401a48
mov eax, esi
not eax
and al, byte [0x402014]
or al, byte [ebp - 0x18]
mov byte [edi], al
mov eax, dword [ebp - 0x28]
add eax, 1
mov dword [0x402010], eax
jmp 0x401720
mov ecx, edi
mov ebx, 1
movzx eax, byte [ebp - 0x18]
mov edx, dword [ebp - 0x14]
shl ebx, cl
mov ecx, ebx
mov esi, ebx
cmp al, 0x2b
je 0x4019fd
sub eax, 0x2b
and eax, 0xfd
mov byte [ebp - 0x18], al
je 0x4017ab
mov byte [ebp - 0x18], 0
mov ebx, edx
jmp 0x401752
mov ecx, dword [ebx]
mov dword [edi + 1], ecx
mov ecx, dword [ebx + eax - 4]
mov dword [edx + eax - 4], ecx
lea ecx, [edi + 5]
and ecx, 0xfffffffc
sub edx, ecx
add eax, edx
sub ebx, edx
and eax, 0xfffffffc
cmp eax, 4
jb 0x4018e3
and eax, 0xfffffffc
xor edx, edx
mov dword [ebp - 0x14], eax
mov eax, esi
mov byte [ebp - 0x1c], al
mov eax, dword [ebp - 0x14]
mov esi, dword [ebx + edx]
mov dword [ecx + edx], esi
add edx, 4
cmp edx, eax
jb 0x40196b
movzx esi, byte [ebp - 0x1c]
jmp 0x4018e3
mov dword [ebp - 0x14], 0
xor edx, edx
mov dword [ebp - 0x20], 0
add eax, eax
mov edi, 0x10
mov dword [ebp - 0x28], ecx
cmp eax, 0x10
mov dword [ebp - 0x24], edx
cmovl eax, edi
mov dword [0x40508c], eax
shl eax, 4
mov edi, eax
mov eax, dword fs:[0x18]
cmp dword [ebp - 0x1c], 0
je 0x401a1f
mov dword [esp + 0xc], edi
mov edx, dword [ebp - 0x1c]
mov dword [esp + 4], 0
mov dword [esp + 8], edx
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapReAlloc]
mov ecx, dword [ebp - 0x28]
mov edx, dword [ebp - 0x24]
mov dword [ebp - 0x1c], eax
sub esp, 0x10
mov eax, dword [ebp - 0x1c]
mov dword [0x405088], eax
mov eax, dword [0x402010]
mov dword [ebp - 0x28], eax
jmp 0x40188e
mov byte [ebp - 0x18], cl
mov ebx, edx
xor esi, esi
jmp 0x4017a9
mov eax, dword [0x40508c]
cmp dword [ebp - 0x28], eax
jge 0x401981
mov edi, dword [ebp - 0x1c]
jmp 0x4018c7
mov dword [esp + 8], edi
mov dword [esp + 4], 0
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapAlloc]
mov edx, dword [ebp - 0x24]
mov ecx, dword [ebp - 0x28]
mov dword [ebp - 0x1c], eax
sub esp, 0xc
jmp 0x4019e8
movzx ecx, word [ebx + eax - 2]
mov word [edx + eax - 2], cx
jmp 0x4018e3