Function at 0x599f30
Capabilities:
Encode data using xor
Parse pe header

Disassembly:
sub esp, 0x9c
mov eax, dword [0x6a0160]
push ebx
push ebp
push esi
xor esi, esi
push edi
cmp eax, esi
mov dword [esp + 0x10], esi
jne 0x599f9b
push 0x380
mov dword [0x6a0160], 1
call fcn.00567760
mov edi, eax
mov ecx, 0xe0
xor eax, eax
mov dword [0x6b65bc], edi
rep stosd dword es:[edi], eax
push 0x460
call fcn.00567760
mov edi, eax
mov ecx, 0x118
xor eax, eax
mov dword [0x6b66f4], edi
rep stosd dword es:[edi], eax
push 0x8000
call fcn.00567760
add esp, 0xc
mov dword [0x6a0168], eax
call fcn.005998c0
mov ebp, eax
cmp ebp, 0xffffffff
je 0x59a273
mov ebx, dword [esp + 0xb4]
test ebx, 0x80000000
je 0x599fcf
and ebx, 0x7fffffff
mov dword [esp + 0x10], 1
mov dword [esp + 0xb4], ebx
mov eax, dword [esp + 0xb0]
push ebx
push eax
call fcn.005671d0
mov edi, eax
add esp, 8
cmp edi, 0xffffffff
jne 0x599ff4
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x9c
ret
lea ecx, [esp + 0x2c]
push 0x40
push ecx
push edi
xor esi, esi
call fcn.00567220
add esp, 0xc
cmp eax, 0x40
jne 0x59a055
cmp byte [esp + 0x2c], 0x4d
jne 0x59a055
cmp byte [esp + 0x2d], 0x5a
jne 0x59a055
mov edx, dword [esp + 0x68]
push esi
push edx
push edi
call fcn.00567370
lea eax, [esp + 0x38]
push 2
push eax
push edi
call fcn.00567220
add esp, 0x18
cmp eax, 2
jne 0x59a055
cmp byte [esp + 0x2c], 0x50
jne 0x59a055
cmp byte [esp + 0x2d], 0x45
jne 0x59a055
test ebx, ebx
mov esi, 1
jne 0x59a1f6
push esi
push edi
call fcn.00599740
mov esi, eax
add esp, 8
cmp esi, 0xffffffff
je 0x59a1f6
mov ecx, dword [0x6b66f0]
push 0
add ecx, esi
push ecx
push edi
call fcn.00567370
mov edx, dword [0x6b66f0]
add esp, 0xc
add edx, esi
cmp eax, edx
jne 0x59a1f6
lea eax, [esp + 0x14]
push 0x16
push eax
push edi
call fcn.00567220
add esp, 0xc
cmp eax, 0x16
jne 0x59a1f6
mov eax, dword [esp + 0x14]
xor ebx, ebx
cmp eax, 0x605444f
mov eax, dword [esp + 0x18]
jne 0x59a0fc
test ax, ax
je 0x59a0fc
mov edx, dword [0x6b65bc]
lea ecx, [ebp*8]
sub ecx, ebp
lea eax, [edx + ecx*8 + 8]
mov ecx, dword [edx + ecx*8 + 8]
or ecx, 1
mov dword [eax], ecx
mov ecx, 4
mov al, cl
mov dl, 3
imul dl
mov bl, byte [esp + ecx + 0x14]
sub al, 0x4d
xor bl, al
mov byte [esp + ecx + 0x14], bl
inc ecx
cmp ecx, 0x16
jb 0x59a0de
mov ebx, dword [esp + 0x18]
jmp 0x59a121
mov cx, word [esp + 0x1e]
cmp cx, word [esp + 0x1c]
jne 0x59a1f6
cmp word [esp + 0x1a], 0
jne 0x59a1f6
test ax, ax
jne 0x59a1f6
mov eax, dword [esp + 0x10]
test eax, eax
je 0x59a142
mov eax, dword [0x6b65bc]
lea edx, [ebp*8]
sub edx, ebp
test byte [eax + edx*8 + 8], 1
je 0x59a1f6
lea esi, [ebp*8]
sub esi, ebp
shl esi, 3
call fcn.0059c180
mov ecx, dword [0x6b65bc]
push ebx
mov dword [esi + ecx], eax
mov edx, dword [0x6b65bc]
mov dword [esi + edx + 4], edi
mov eax, dword [0x6b65bc]
mov byte [esi + eax + 0x20], 0
mov ecx, dword [esp + 0x28]
mov edx, dword [0x6b66f0]
mov eax, dword [0x6b65bc]
add edx, ecx
mov dword [esi + eax + 0xc], edx
mov ecx, dword [0x6b65bc]
mov edx, dword [esp + 0x24]
mov dword [esi + ecx + 0x10], edx
mov eax, dword [0x6b65bc]
mov ecx, dword [esi + eax + 0xc]
mov dword [esi + eax + 0x18], ecx
mov edx, dword [0x6b65bc]
mov eax, dword [esp + 0x20]
mov dword [esi + edx + 0x1c], eax
mov ecx, dword [0x6b65bc]
mov eax, dword [esp + 0x24]
mov edx, dword [esi + ecx]
mov ecx, dword [esp + 0x28]
push edx
mov edx, dword [0x6b66f0]
add edx, ecx
push eax
push edx
push edi
call fcn.00599930
add esp, 0x14
test eax, eax
jne 0x59a20c
mov eax, dword [0x6b65bc]
mov ecx, dword [esi + eax]
push ecx
call fcn.0059c220
mov edx, dword [0x6b65bc]
add esp, 4
mov dword [esi + edx], 0
push edi
call fcn.00567280
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x9c
ret
mov ecx, dword [esp + 0xb4]
cmp ecx, 1
je 0x59a23b
cmp ecx, 2
je 0x59a23b
mov ecx, dword [0x6b65bc]
cmp eax, 0xffffffff
mov dword [esi + ecx + 0x14], 0
je 0x59a257
push eax
call fcn.00567830
add esp, 4
jmp 0x59a257
mov edx, dword [0x6b65bc]
cmp eax, 0xffffffff
mov dword [esi + edx + 0x14], eax
jne 0x59a257
mov eax, dword [0x6b65bc]
mov dword [esi + eax + 0x14], 0xffffffff
mov ecx, dword [0x6b65bc]
push 0
mov edx, dword [esi + ecx]
push edx
call fcn.0059bd90
add esp, 8
or ebp, 0x4f440000
mov esi, ebp
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x9c
ret