Function at 0x508413
Capabilities:
Packed with generic packer

Disassembly:
pushfd
pushal
call 0x50841a
pop ebp
sub ebp, 7
lea ecx, [ebp - 0x34f]
cmp byte [ecx], 1
je 0x50866f
mov byte [ecx], 1
mov eax, ebp
sub eax, dword [ebp - 0x3bb]
mov dword [ebp - 0x3bb], eax
add dword [ebp - 0x38b], eax
lea esi, [ebp - 0x347]
add dword [esi], eax
push ebp
push esi
push 0x40
push 0x1000
push 0x1000
push 0
call dword [ebp - 0x313]
test eax, eax
je fcn.005087d3
mov dword [ebp - 0x393], eax
call 0x508475
pop ebx
mov ecx, 0x367
add ebx, ecx
push eax
push ebx
call fcn.00508734
pop esi
pop ebp
mov esi, dword [esi]
mov edi, ebp
add edi, dword [ebp - 0x3cb]
mov ebx, edi
cmp dword [edi], 0
jne 0x5084a1
add edi, 4
mov ecx, 0
jmp 0x5084b7
mov ecx, 1
add edi, dword [ebx]
add ebx, 4
cmp dword [ebx], 0
je 0x5084e4
add dword [ebx], edx
mov esi, dword [ebx]
add edi, dword [ebx + 4]
push edi
push ecx
push ebx
push dword [ebp - 0x30f]
push dword [ebp - 0x313]
mov edx, esi
mov ecx, edi
mov eax, dword [ebp - 0x393]
add eax, 0x5aa
call eax
pop ebx
pop ecx
pop edi
cmp ecx, 0
je 0x5084e4
add ebx, 8
jmp 0x5084ab
push 0x8000
push 0
push dword [ebp - 0x393]
call dword [ebp - 0x30f]
lea esi, [ebp - 0x38b]
mov ecx, dword [esi + 8]
lea edx, [esi + 0x10]
mov esi, dword [esi]
mov edi, esi
cmp ecx, 0
je 0x50854b
mov al, byte [edi]
inc edi
sub al, 0xe8
cmp al, 1
ja 0x50850c
mov eax, dword [edi]
cmp byte [edx + 1], 0
je 0x508531
mov bl, byte [edx]
cmp byte [edi], bl
jne 0x50850c
mov bl, byte [edi + 4]
shr ax, 8
rol eax, 0x10
xchg ah, al
jmp 0x50853b
mov bl, byte [edi + 4]
xchg ah, al
rol eax, 0x10
xchg ah, al
sub eax, edi
add eax, esi
mov dword [edi], eax
add edi, 5
sub bl, 0xe8
mov eax, ebx
loop 0x508511
call fcn.0050868a
lea ecx, [ebp - 0x377]
mov eax, dword [ecx + 8]
cmp eax, 0
je 0x5085e3
mov esi, edx
sub esi, dword [ecx + 0x10]
je 0x5085e3
mov dword [ecx + 0x10], esi
lea esi, [ebp - 0x347]
mov esi, dword [esi]
lea ebx, [esi - 4]
mov eax, dword [ecx]
cmp eax, 1
je 0x508588
mov edi, edx
add edi, dword [ecx + 8]
mov ecx, dword [ecx + 0x10]
jmp 0x508590
mov edi, esi
add edi, dword [ecx + 8]
mov ecx, dword [ecx + 0x10]
xor eax, eax
mov al, byte [edi]
inc edi
or eax, eax
je 0x5085b9
cmp al, 0xef
ja 0x5085a3
add ebx, eax
add dword [ebx], ecx
jmp 0x508590
and al, 0xf
shl eax, 0x10
mov ax, word [edi]
add edi, 2
or eax, eax
jne 0x50859d
mov eax, dword [edi]
add edi, 4
jmp 0x50859d
xor ebx, ebx
xchg esi, edi
mov eax, dword [esi]
cmp eax, 0
je 0x5085e3
lodsd eax, dword [esi]
or eax, eax
je 0x5085d1
add ebx, eax
add word [edi + ebx], cx
jmp 0x5085c4
xor ebx, ebx
shr ecx, 0x10
lodsd eax, dword [esi]
or eax, eax
je 0x5085e3
add ebx, eax
add word [edi + ebx], cx
jmp 0x5085d6
lea esi, [ebp - 0x3bb]
mov edx, dword [esi]
lea esi, [ebp - 0x35f]
mov al, byte [esi]
cmp al, 1
jne 0x508636
add edx, dword [esi + 4]
push esi
push edx
push esi
push 4
push pe_nt_image_headers32
push edx
call dword [ebp - 0x317]
pop edi
pop esi
cmp eax, 1
jne fcn.005087d3
add esi, 8
mov ecx, 8
rep movsb byte es:[edi], byte [esi]
sub esi, 0xc
sub edi, 8
push esi
push dword [esi - 4]
push pe_nt_image_headers32
push edi
call dword [ebp - 0x317]
push ebp
pop ebx
sub ebx, 0x21
xor ecx, ecx
mov cl, byte [ebx]
cmp cl, 0
je 0x50866f
inc ebx
lea esi, [ebp - 0x3bb]
mov edx, dword [esi]
push esi
push ecx
push ebx
push edx
push esi
push dword [ebx]
push dword [ebx + 4]
mov eax, dword [ebx + 8]
add eax, edx
push eax
call dword [ebp - 0x317]
pop edx
pop ebx
pop ecx
pop esi
add ebx, 0xc
loop 0x508650
mov eax, 0
cmp eax, 0
je 0x508683
popal
popfd
mov eax, 1
ret 0xc
popal
popfd
jmp 0x46333d