Function at 0x40687b
Capabilities:
Get thread local storage value
Print debug messages
Set thread local storage value

Disassembly:
push ebp
lea ebp, [esp - 0x2004]
mov eax, 0x2004
call fcn.004128e0
push 0xfffffffffffffffe
push 0x42ac20
push 0x412779
mov eax, dword fs:[0]
push eax
sub esp, 0x48
mov eax, dword [0x4313f4]
xor dword [ebp - 8], eax
xor eax, ebp
mov dword [ebp + 0x2000], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0x10]
mov dword fs:[0], eax
mov dword [ebp - 0x18], esp
mov esi, ecx
mov dword [ebp - 0x38], esi
mov eax, dword [ebp + 0x2010]
mov dword [ebp - 0x2c], eax
mov eax, dword [ebp + 0x2014]
mov dword [ebp - 0x4c], eax
mov eax, dword [ebp + 0x2018]
mov dword [ebp - 0x58], eax
xor ebx, ebx
cmp dword [ebp + 0x201c], ebx
je 0x406928
push dword [0x431018]
mov edi, dword [sym.imp.KERNEL32.dll_TlsGetValue]
call edi
mov ebx, eax
push dword [0x43101c]
call edi
mov edi, eax
mov ecx, esi
call fcn.004067ac
push edi
push dword [0x43101c]
mov edi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
call edi
push ebx
push dword [0x431018]
call edi
xor ebx, ebx
cmp dword [esi + 0x28], ebx
jne 0x406936
cmp dword [esi + 0x2c], ebx
je 0x406d12
mov eax, dword [ebp + 0x200c]
cmp eax, dword [esi + 0x30]
jl 0x406d12
xor eax, eax
mov word [ebp], ax
push 0x1ffe
push ebx
lea eax, [ebp + 2]
push eax
call sub.MSVCR90.dll_memset
add esp, 0xc
xor eax, eax
mov word [ebp - 0x48], ax
lea edi, [ebp - 0x46]
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosw word es:[edi], ax
cmp dword [0x431f78], ebx
jne 0x40697e
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
mov dword [0x431f78], eax
lea eax, [ebp - 0x48]
push eax
call dword [sym.imp.KERNEL32.dll_GetLocalTime]
lea eax, [esi + 0xf0]
mov ecx, dword [eax]
lea edx, [ecx + 1]
mov dword [eax], edx
push dword [0x431f78]
movzx eax, word [ebp - 0x3a]
push eax
movzx eax, word [ebp - 0x3c]
push eax
movzx eax, word [ebp - 0x3e]
push eax
movzx eax, word [ebp - 0x40]
push eax
push ecx
push str._08d_t_02d:_02d:_02d._03d_t__d_
mov edi, 0x100
push edi
lea eax, [ebp]
push eax
mov esi, dword [sym.imp.MSVCR90.dll__snwprintf]
call esi
add esp, 0x24
lea ebx, [ebp + eax*2]
mov dword [ebp - 0x30], ebx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.__d_
push edi
push ebx
call esi
add esp, 0x10
lea ebx, [ebx + eax*2]
mov eax, dword [ebp + 0x200c]
sub eax, 0
je 0x406a56
dec eax
je 0x406a49
dec eax
je 0x406a3c
dec eax
je 0x406a2f
dec eax
je 0x406a22
dec eax
je 0x406a15
dec eax
jne 0x406d12
call fcn.00401ac2
push eax
push str.PROMPT___s_
jmp 0x406a61
call fcn.00401ac2
push eax
push str.FATAL____s_
jmp 0x406a61
call fcn.00401ac2
push eax
push str.ERROR____s_
jmp 0x406a61
call fcn.00401ac2
push eax
push str.WARN_____s_
jmp 0x406a61
call fcn.00401ac2
push eax
push str.INFO_____s_
jmp 0x406a61
call fcn.00401ac2
push eax
push str.DEBUG____s_
jmp 0x406a61
call fcn.00401ac2
push eax
push str.TRACE____s_
push edi
push ebx
call esi
add esp, 0x10
lea ebx, [ebx + eax*2]
mov dword [ebp - 0x24], ebx
xor eax, eax
mov dword [ebp - 0x20], eax
push 0x5b
pop ecx
mov word [ebx], cx
mov dword [ebp - 4], eax
cmp dword [ebp + 0x201c], eax
je 0x406a90
push dword [0x431018]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov dword [ebp - 0x1c], eax
xor eax, eax
cmp dword [ebp + 0x201c], eax
je 0x406aa9
push dword [0x43101c]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov dword [ebp - 0x20], eax
xor eax, eax
cmp dword [ebp - 0x1c], eax
jne 0x406ab8
mov dword [ebp - 0x28], eax
jmp 0x406ad9
push dword [ebp - 0x1c]
call dword [sym.imp.MSVCR90.dll_wcslen]
mov dword [ebp - 0x28], eax
add eax, eax
push eax
push dword [ebp - 0x1c]
lea eax, [ebx + 2]
push eax
call sub.MSVCR90.dll_memcpy
add esp, 0x10
mov eax, dword [ebp - 0x28]
mov dword [ebp - 4], 0xfffffffe
jmp 0x406b20
push 0x5d
pop ecx
mov word [ebx + eax*2 + 2], cx
push 0x20
pop ecx
mov word [ebx + eax*2 + 4], cx
lea ebx, [ebx + eax*2 + 6]
mov dword [ebp - 0x24], ebx
cmp dword [ebp - 0x20], 0
je 0x406bb8
and dword [ebp - 0x1c], 0
mov dword [ebp - 4], 1
push 4
lea eax, [ebp - 0x20]
push eax
lea eax, [ebp - 0x1c]
push eax
call sub.MSVCR90.dll_memcpy
add esp, 0xc
mov dword [ebp - 4], 0xfffffffe
jmp 0x406b83
push 0x5b
pop eax
mov word [ebx], ax
push dword [ebp - 0x1c]
push str.0x_08x
push edi
lea eax, [ebx + 2]
push eax
call esi
push ebx
call dword [sym.imp.MSVCR90.dll_wcslen]
add esp, 0x14
push 0x5d
pop ecx
mov word [ebx + eax*2], cx
push 0x20
pop ecx
mov word [ebx + eax*2 + 2], cx
lea ebx, [ebx + eax*2 + 4]
mov dword [ebp - 0x24], ebx
mov dword [ebp - 4], 2
mov eax, ebx
lea ecx, [ebp]
sub eax, ecx
sar eax, 1
mov ecx, 0xfbf
sub ecx, eax
cmp dword [ebp - 0x4c], 0
jne 0x406be3
push dword [ebp - 0x2c]
push 0x41fb6c
push ecx
push ebx
call esi
jmp 0x406bf1
push dword [ebp - 0x4c]
push dword [ebp - 0x2c]
push ecx
push ebx
call dword [sym.imp.MSVCR90.dll__vsnwprintf]
add esp, 0x10
jmp 0x406c32
mov dword [ebp - 0x34], eax
mov dword [ebp - 4], 0xfffffffe
cmp eax, 0xffffffff
jne 0x406c49
push ebx
call dword [sym.imp.MSVCR90.dll_wcslen]
pop ecx
lea edi, [ebx + eax*2 - 2]
movzx eax, word [edi]
push 9
pop ecx
cmp cx, ax
je 0x406c68
push 0xd
pop ecx
cmp cx, ax
je 0x406c68
push 0xa
pop ecx
cmp cx, ax
jne 0x406c71
xor eax, eax
mov word [edi], ax
dec edi
dec edi
jmp 0x406c4d
rdtsc
mov dword [ebp - 0x4c], edx
inc edi
inc edi
push 0x41facc
movzx ecx, ax
push ecx
shr eax, 0x10
push eax
push str._t_hu__hu_s
push 0x20
push edi
call esi
add esp, 0x18
lea esi, [edi + eax*2]
mov edi, dword [ebp - 0x38]
cmp dword [ebp + 0x200c], 6
je 0x406ce4
lea ecx, [edi + 0x34]
mov ebx, 0x41ed24
push ebx
call fcn.00402e4a
test eax, eax
jne 0x406cc2
push dword [ebp - 0x30]
lea ecx, [edi + 0x34]
call fcn.00402edd
test eax, eax
je 0x406d12
lea ecx, [edi + 0x88]
push ebx
call fcn.00402e4a
test eax, eax
jne 0x406d12
push dword [ebp - 0x30]
lea ecx, [edi + 0x88]
call fcn.00402edd
test eax, eax
jne 0x406d12
cmp dword [edi + 0x28], 0
je 0x406cf3
push dword [ebp - 0x30]
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
cmp dword [edi + 0x2c], 0
je 0x406d12
push dword [ebp - 0x58]
lea eax, [ebp]
sub esi, eax
sar esi, 1
push esi
push eax
push dword [ebp + 0x200c]
mov ecx, edi
call fcn.0040301d
mov ecx, dword [ebp - 0x10]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x2000]
xor ecx, ebp
call fcn.0041276a
add ebp, 0x2004
leave
ret 0x14