Function at 0x4ed850
Capabilities:
Allocate thread local storage
Get thread local storage value
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x664
push ebx
mov ebx, ecx
mov dword [esp + 4], 0
push esi
push edi
mov dword [esp + 0x18], ebx
mov edi, 1
cmp byte [ebx + 0x24], 0
mov dword [ebx], 0x5acfe0
je 0x4ed8be
mov ecx, 0x5c1b60
mov dword [esp + 0x34], 0xffffffff
call fcn.004f28d0
mov esi, eax
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp byte [0x5c1b7c], 0
mov eax, 4
cmovne eax, edi
sub dword [0x5c1b98], edi
jne 0x4ed8b7
push eax
call dword [sym.imp.WINMM.dll_timeEndPeriod]
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
xor esi, esi
mov ecx, ebx
call fcn.004eede0
cmp dword [ebx + 0x1c], 0
jne 0x4ed8df
mov ecx, dword [ebx + 0xcc]
lea eax, [ebx + 0xc]
push eax
call fcn.00506030
add dword [ebx + 0x20], eax
mov ecx, ebx
call fcn.004eede0
test al, al
je 0x4ed8f0
inc esi
cmp esi, 0x64
jl 0x4ed8c0
mov eax, dword [ebx + 0x5c]
or ecx, 0xffffffff
sub eax, dword [ebx + 0x58]
test eax, 0xfffffffc
je 0x4edc5f
mov eax, dword [ebx + 0x54]
lea esi, [ebx + 0x54]
test eax, eax
je 0x4ed915
mov eax, dword [eax]
cmp eax, 1
jne 0x4ed954
push 8
call fcn.00539d85
add esp, 4
mov ecx, edi
mov dword [eax], 0
mov byte [eax + 5], 1
lock xadd dword [eax], ecx
mov ecx, dword [esi]
mov dword [esi], eax
test ecx, ecx
je 0x4ed951
or eax, 0xffffffff
lock xadd dword [ecx], eax
sub eax, 1
setne al
test al, al
jne 0x4ed951
push ecx
call fcn.00539d80
add esp, 4
or ecx, 0xffffffff
mov edi, dword [esi]
mov dword [esp + 0x1c], edi
mov dword [esp + 0x38], edi
test edi, edi
je 0x4ed96b
mov eax, 1
lock xadd dword [edi], eax
mov dword [esp + 0x24], edi
test edi, edi
je 0x4ed97c
mov eax, 1
lock xadd dword [edi], eax
mov dword [esp + 0x28], esi
test edi, edi
je 0x4ed99d
mov eax, ecx
lock xadd dword [edi], eax
sub eax, 1
setne al
test al, al
jne 0x4ed99d
push edi
call fcn.00539d80
add esp, 4
xor esi, esi
lea eax, [ebx + 0x54]
mov dword [esp + 0x2c], esi
cmp dword [eax + 0x14], esi
jne 0x4ed9b0
or ecx, 0xffffffff
jmp 0x4ed9b9
mov ecx, dword [eax + 8]
sub ecx, dword [eax + 4]
sar ecx, 2
mov dword [esp + 0x30], ecx
mov dword [esp + 0x10], ecx
test edi, edi
je 0x4ed9cb
cmp byte [edi + 5], 0
jne 0x4ed9cd
xor eax, eax
inc dword [eax + 0x10]
test edi, edi
je 0x4edc5f
mov ecx, dword [esp + 0xc]
test cl, 0x40
je 0x4ed9f5
and ecx, 0xffffffbf
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0x40]
call fcn.004ebe90
mov ecx, dword [esp + 0xc]
cmp byte [edi + 5], 0
je 0x4eda86
test cl, cl
jns 0x4eda1d
and ecx, 0xffffff7f
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0xf0]
call fcn.004ebe90
mov ecx, dword [esp + 0xc]
test ecx, 0x200
je 0x4eda3f
and ecx, 0xfffffdff
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0x1a0]
call fcn.004ebe90
mov ecx, dword [esp + 0xc]
xor eax, eax
lea edx, [ebx + 0x54]
cmp byte [edi + 5], al
cmovne eax, edx
mov edx, dword [eax + 4]
mov eax, dword [eax + 8]
sub eax, edx
mov dword [esp + 0x14], edx
mov edx, dword [esp + 0x10]
sar eax, 2
cmp eax, edx
mov dword [esp + 0x3c], eax
cmovb edx, eax
cmp esi, edx
jae 0x4eda86
mov eax, dword [esp + 0x14]
lea eax, [eax + esi*4]
cmp dword [eax], 0
jne 0x4edb81
inc esi
add eax, 4
mov dword [esp + 0x2c], esi
cmp esi, edx
jb 0x4eda71
test edi, edi
je 0x4edc5f
test ecx, 0x400
je 0x4edab0
and ecx, 0xfffffbff
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0x250]
call fcn.004ebe90
mov ecx, dword [esp + 0xc]
cmp byte [edi + 5], 0
je 0x4edc45
test ecx, 0x800
je 0x4edadc
and ecx, 0xfffff7ff
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0x300]
call fcn.004ebe90
mov ecx, dword [esp + 0xc]
test ecx, 0x2000
je 0x4edafe
and ecx, 0xffffdfff
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0x3b0]
call fcn.004ebe90
mov ecx, dword [esp + 0xc]
xor eax, eax
lea esi, [ebx + 0x54]
cmp byte [edi + 5], al
cmovne eax, esi
add dword [eax + 0x10], 0xffffffff
jne 0x4edc45
test ecx, 0x4000
je 0x4edb35
and ecx, 0xffffbfff
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0x460]
call fcn.004ebe90
mov ecx, dword [esp + 0xc]
test ecx, 0x10000
je 0x4edb53
and ecx, 0xfffeffff
mov dword [esp + 0xc], ecx
lea ecx, [esp + 0x510]
call fcn.004ebe90
xor ecx, ecx
cmp byte [edi + 5], cl
cmovne ecx, esi
mov dword [esp + 0x14], ecx
mov eax, dword [ecx + 8]
mov esi, dword [ecx + 4]
cmp esi, eax
je 0x4edc04
nop dword [eax]
cmp dword [esi], 0
je 0x4edbbd
add esi, 4
cmp esi, eax
jne 0x4edb70
jmp 0x4edc04
cmp esi, edx
jae 0x4eda86
mov edx, dword [esp + 0x14]
mov eax, esi
inc esi
mov dword [esp + 0x2c], esi
mov eax, dword [edx + eax*4]
test eax, eax
je 0x4eda86
mov ecx, dword [eax]
mov edx, dword [ecx]
mov ecx, eax
cmp edx, 0x4f88e0
jne 0x4ee033
mov eax, dword [eax]
push 1
call dword [eax + 4]
jmp 0x4ed9d0
cmp esi, eax
je 0x4edc04
lea ecx, [esi + 4]
mov ebx, eax
sub ebx, ecx
xor edx, edx
add ebx, 3
shr ebx, 2
cmp ecx, eax
cmova ebx, edx
mov dword [esp + 0x10], ebx
test ebx, ebx
mov ebx, dword [esp + 0x18]
je 0x4edc00
mov edi, dword [esp + 0x10]
mov ebx, dword [ecx]
test ebx, ebx
je 0x4edbf0
mov dword [esi], ebx
add esi, 4
inc edx
add ecx, 4
cmp edx, edi
jne 0x4edbe5
mov edi, dword [esp + 0x1c]
mov ebx, dword [esp + 0x18]
mov ecx, dword [esp + 0x14]
mov edx, dword [ecx + 4]
mov dword [esp + 0x20], esi
cmp esi, edx
jne 0x4edc19
cmp eax, dword [ecx + 8]
jne 0x4edc19
mov dword [ecx + 8], edx
jmp 0x4edc45
cmp esi, eax
je 0x4edc45
mov ecx, dword [ecx + 8]
sub ecx, eax
sar ecx, 2
lea ebx, [ecx*4]
push ebx
push eax
push esi
call fcn.0053af50
mov ecx, dword [esp + 0x20]
lea eax, [esi + ebx]
mov ebx, dword [esp + 0x24]
add esp, 0xc
mov dword [ecx + 8], eax
or eax, 0xffffffff
lock xadd dword [edi], eax
sub eax, 1
setne al
test al, al
jne 0x4edc5f
push edi
call fcn.00539d80
add esp, 4
mov esi, dword [ebx + 0xd8]
mov dword [ebx + 0xd8], 0
test esi, esi
je 0x4edc83
mov ecx, esi
call fcn.005093a0
push esi
call fcn.00539d80
add esp, 4
mov edi, dword [ebx + 0xcc]
lea esi, [edi + 0xc]
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push esi
mov dword [edi + 0x38], 0
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov ecx, dword [ebx + 0xcc]
or edi, 0xffffffff
mov dword [ebx + 0xcc], 0
test ecx, ecx
je 0x4edcda
add ecx, 4
mov eax, edi
lock xadd dword [ecx], eax
sub eax, 1
setne al
test al, al
jne 0x4edcda
test ecx, ecx
je 0x4edcda
add ecx, 0xfffffffc
je 0x4edcda
mov eax, dword [ecx]
push 1
call dword [eax]
mov ecx, dword [ebx + 0xd0]
mov dword [ebx + 0xd0], 0
test ecx, ecx
je 0x4edd21
add ecx, 4
mov eax, edi
lock xadd dword [ecx], eax
sub eax, 1
setne al
test al, al
jne 0x4edd21
test ecx, ecx
je 0x4edd0a
add ecx, 0xfffffffc
jmp 0x4edd0c
xor ecx, ecx
mov eax, dword [ecx]
mov edx, dword [eax + 0xc]
cmp eax, 0x5ad9ec
jne 0x4ee03a
push 1
call dword [eax + 8]
mov ecx, dword [ebx + 0xd4]
mov dword [ebx + 0xd4], 0
test ecx, ecx
je 0x4edd68
add ecx, 4
mov eax, edi
lock xadd dword [ecx], eax
sub eax, 1
setne al
test al, al
jne 0x4edd68
test ecx, ecx
je 0x4edd51
add ecx, 0xfffffffc
jmp 0x4edd53
xor ecx, ecx
mov eax, dword [ecx]
mov edx, dword [eax + 0xc]
cmp eax, 0x5ad9ec
jne 0x4ee041
push 1
call dword [eax + 8]
mov eax, dword [0x5c1b50]
test eax, 0xfffffffe
jne 0x4eddf8
mov edx, 0x5c1b50
xor eax, eax
mov ecx, 1
lock cmpxchg dword [edx], ecx
test eax, eax
je 0x4eddb0
mov eax, dword [0x5c1b50]
cmp eax, 1
jne 0x4eddf8
mov esi, dword [sym.imp.KERNEL32.dll_Sleep]
nop dword [eax]
push 0
call esi
mov eax, dword [0x5c1b50]
cmp eax, 1
je 0x4edda0
jmp 0x4eddf8
mov dword [0x5c1b54], 0
call dword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [0x5c1b54], eax
cmp eax, 0xffffffff
jne 0x4eddd8
cmp byte [0x5c2bfc], 0
jne 0x4ee048
int3
test dword [esp + 0xc], 0x20000
je 0x4eddee
lea ecx, [esp + 0x5c0]
call fcn.004ebe90
mov dword [0x5c1b50], 0x5c1b54
mov eax, dword [0x5c1b50]
push dword [eax]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
cmp eax, ebx
jne 0x4ede1b
push 0
push ecx
call fcn.004efa70
add esp, 4
mov ecx, eax
call fcn.004efae0
mov esi, dword [ebx + 0xd8]
mov dword [ebx + 0xd8], 0
test esi, esi
je 0x4ede3f
mov ecx, esi
call fcn.005093a0
push esi
call fcn.00539d80
add esp, 4
mov ecx, dword [ebx + 0xd4]
test ecx, ecx
je 0x4ede7c
add ecx, 4
mov eax, edi
lock xadd dword [ecx], eax
sub eax, 1
setne al
test al, al
jne 0x4ede7c
test ecx, ecx
je 0x4ede65
add ecx, 0xfffffffc
jmp 0x4ede67
xor ecx, ecx
mov eax, dword [ecx]
mov edx, dword [eax + 0xc]
cmp eax, 0x5ad9ec
jne 0x4ee04f
push 1
call dword [eax + 8]
mov ecx, dword [ebx + 0xd0]
test ecx, ecx
je 0x4edeb9
add ecx, 4
mov eax, edi
lock xadd dword [ecx], eax
sub eax, 1
setne al
test al, al
jne 0x4edeb9
test ecx, ecx
je 0x4edea2
add ecx, 0xfffffffc
jmp 0x4edea4
xor ecx, ecx
mov eax, dword [ecx]
mov edx, dword [eax + 0xc]
cmp eax, 0x5ad9ec
jne 0x4ee056
push 1
call dword [eax + 8]
mov ecx, dword [ebx + 0xcc]
test ecx, ecx
je 0x4edee5
add ecx, 4
mov eax, edi
lock xadd dword [ecx], eax
sub eax, 1
setne al
test al, al
jne 0x4edee5
test ecx, ecx
je 0x4edee5
add ecx, 0xfffffffc
je 0x4edee5
mov eax, dword [ecx]
push 1
call dword [eax]
mov ecx, dword [ebx + 0xb4]
lea esi, [ebx + 0xb0]
test ecx, ecx
je 0x4edf19
mov eax, dword [esi + 0xc]
sub eax, ecx
sar eax, 2
push eax
push ecx
call fcn.004e9690
mov dword [esi + 4], 0
mov dword [esi + 8], 0
mov dword [esi + 0xc], 0
mov ecx, esi
call fcn.004ffd10
mov eax, dword [ebx + 0xa4]
lea esi, [ebx + 0x90]
cmp eax, 0x10
jb 0x4edf3c
inc eax
mov ecx, esi
push eax
push dword [esi]
call fcn.004e2910
mov dword [esi + 0x14], 0xf
mov dword [esi + 0x10], 0
mov byte [esi], 0
mov eax, dword [ebx + 0x8c]
cmp eax, 0x10
jb 0x4edf65
inc eax
lea ecx, [ebx + 0x78]
push eax
push dword [ebx + 0x78]
call fcn.004e2910
mov dword [ebx + 0x8c], 0xf
mov dword [ebx + 0x88], 0
mov byte [ebx + 0x78], 0
mov ecx, dword [ebx + 0x70]
test ecx, ecx
je 0x4edf9b
lock xadd dword [ecx], edi
sub edi, 1
setne al
test al, al
jne 0x4edf9b
mov eax, dword [ecx + 4]
push ecx
call eax
add esp, 4
mov ecx, dword [ebx + 0x58]
test ecx, ecx
je 0x4edfc6
mov eax, dword [ebx + 0x60]
sub eax, ecx
sar eax, 2
push eax
push ecx
call fcn.004e9690
mov dword [ebx + 0x58], 0
mov dword [ebx + 0x5c], 0
mov dword [ebx + 0x60], 0
lea ecx, [ebx + 0x54]
call fcn.004ffd10
lea ecx, [ebx + 0x40]
call fcn.004efcb0
push 8
push 1
push dword [ebx + 0x40]
call fcn.004dd7a0
add esp, 0xc
mov dword [ebx + 0x40], 0
lea ecx, [ebx + 0x28]
call fcn.004ee060
lea ecx, [ebx + 0xc]
call fcn.004efcb0
push 8
push 1
push dword [ebx + 0xc]
call fcn.004dd7a0
mov dword [ebx + 0xc], 0
add esp, 0xc
mov ecx, dword [ebx + 4]
mov dword [ebx + 4], 0
test ecx, ecx
je 0x4ee026
mov eax, dword [ecx]
push 1
call dword [eax]
pop edi
pop esi
mov dword [ebx], 0x5acfc8
pop ebx
mov esp, ebp
pop ebp
ret
call edx
jmp 0x4ed9d0
call edx
jmp 0x4edd21
call edx
jmp 0x4edd68
push 1
call fcn.00549dc3
call edx
jmp 0x4ede7c
call edx
jmp 0x4edeb9