Function at 0x10039536
Capabilities:
Parse pe header

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
push ebx
push esi
mov esi, dword [ebp + 8]
mov ebx, dword [esi + 8]
test bl, 3
jne 0x10039564
mov eax, dword fs:[0x18]
mov dword [ebp + 8], eax
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 8]
cmp ebx, ecx
mov dword [ebp - 4], ecx
jb 0x1003956b
cmp ebx, dword [eax + 4]
jae 0x1003956b
xor eax, eax
jmp 0x1003975b
push edi
mov edi, dword [esi + 0xc]
cmp edi, 0xffffffff
jne 0x1003957c
xor eax, eax
inc eax
jmp 0x1003975a
xor edx, edx
mov dword [ebp + 8], edx
mov eax, ebx
mov ecx, dword [eax]
cmp ecx, 0xffffffff
je 0x10039592
cmp ecx, edx
jae 0x100396d7
cmp dword [eax + 4], 0
je 0x1003959b
inc dword [ebp + 8]
inc edx
add eax, 0xc
cmp edx, edi
jbe 0x10039583
cmp dword [ebp + 8], 0
je 0x100395bd
mov eax, dword [esi - 8]
cmp eax, dword [ebp - 4]
jb 0x100396d7
cmp eax, esi
jae 0x100396d7
mov eax, dword [0x10055820]
mov edi, ebx
and edi, 0xfffff000
xor esi, esi
test eax, eax
jle 0x100395e2
cmp dword [esi*4 + 0x10055828], edi
je 0x100396db
inc esi
cmp esi, eax
jl 0x100395d0
push 0x1c
lea eax, [ebp - 0x20]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualQuery]
test eax, eax
je 0x10039757
cmp dword [ebp - 8], 0x1000000
jne 0x10039757
test byte [ebp - 0xc], 0xcc
je 0x10039660
mov ecx, dword [ebp - 0x1c]
cmp word [ecx], 0x5a4d
jne 0x10039757
mov eax, dword [ecx + 0x3c]
add eax, ecx
cmp dword [eax], 0x4550
jne 0x10039757
cmp word [eax + 0x18], 0x10b
jne 0x10039757
sub ebx, ecx
cmp word [eax + 6], 0
movzx ecx, word [eax + 0x14]
lea ecx, [ecx + eax + 0x18]
jbe 0x10039757
mov eax, dword [ecx + 0xc]
cmp ebx, eax
jb 0x10039660
mov edx, dword [ecx + 8]
add edx, eax
cmp ebx, edx
jae 0x10039660
test byte [ecx + 0x27], 0x80
jne 0x100396d7
push 1
push 0x10055868
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
test eax, eax
jne 0x10039574
mov ecx, dword [0x10055820]
test ecx, ecx
mov edx, ecx
jle 0x10039694
lea eax, [ecx*4 + 0x10055824]
cmp dword [eax], edi
je 0x10039694
dec edx
sub eax, 4
test edx, edx
jg 0x10039688
test edx, edx
jne 0x100396c5
push 0xf
pop ebx
cmp ecx, ebx
jg 0x100396a1
mov ebx, ecx
xor edx, edx
test ebx, ebx
jl 0x100396b9
lea eax, [edx*4 + 0x10055828]
mov esi, dword [eax]
inc edx
cmp edx, ebx
mov dword [eax], edi
mov edi, esi
jle 0x100396a7
cmp ecx, 0x10
jge 0x100396c5
inc ecx
mov dword [0x10055820], ecx
push 0
push 0x10055868
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
jmp 0x10039574
xor eax, eax
jmp 0x1003975a
test esi, esi
jle 0x10039574
mov ebx, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
push 1
push 0x10055868
call ebx
test eax, eax
jne 0x10039574
cmp dword [esi*4 + 0x10055828], edi
je 0x10039731
mov eax, dword [0x10055820]
lea esi, [eax - 1]
test esi, esi
jl 0x1003971f
cmp dword [esi*4 + 0x10055828], edi
je 0x1003971b
dec esi
jns 0x1003970f
test esi, esi
jge 0x1003972f
cmp eax, 0x10
jge 0x1003972a
inc eax
mov dword [0x10055820], eax
lea esi, [eax - 1]
jmp 0x10039731
je 0x10039749
xor ecx, ecx
test esi, esi
jl 0x10039749
lea eax, [ecx*4 + 0x10055828]
mov edx, dword [eax]
inc ecx
cmp ecx, esi
mov dword [eax], edi
mov edi, edx
jle 0x10039737
push 0
push 0x10055868
call ebx
jmp 0x10039574
or eax, 0xffffffff
pop edi
pop esi
pop ebx
leave
ret