Function at 0x5d794c
Capabilities:
Get thread local storage value
Set thread local storage value

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x2c
mov esi, dword [esp + 0x40]
mov ecx, dword [0x68cb3c]
test ecx, ecx
jne 0x5d7974
mov eax, dword [esi + 8]
test eax, eax
je 0x5d7a84
add esp, 0x2c
pop ebx
pop esi
pop edi
pop ebp
ret
mov ebp, dword [esi + 8]
test ebp, ebp
je 0x5d7a04
mov ebx, dword [0x68cb84]
call sub.KERNEL32.dll_GetLastError
mov edi, eax
mov dword [esp], ebx
call sub.KERNEL32.dll_TlsGetValue
push ecx
mov ebx, eax
mov dword [esp], edi
call sub.KERNEL32.dll_SetLastError
push edi
test ebx, ebx
je 0x5d79c4
mov edi, dword [ebx]
cmp ebp, edi
ja 0x5d7a93
dec ebp
mov eax, dword [ebx + ebp*4 + 4]
test eax, eax
jne 0x5d796c
mov eax, esi
call fcn.005df800
mov dword [ebx + ebp*4 + 4], eax
jmp 0x5d796c
lea edi, [ebp + 0x20]
mov dword [esp + 4], 4
lea eax, [ebp + 0x21]
mov dword [esp], eax
call sub.msvcrt.dll_calloc
mov ebx, eax
test eax, eax
je 0x5d7b59
mov dword [eax], edi
mov dword [esp + 4], ebx
mov eax, dword [0x68cb84]
mov dword [esp], eax
call sub.KERNEL32.dll_TlsSetValue
push edx
push edx
test eax, eax
jne 0x5d79ae
call sub.KERNEL32.dll_GetLastError
jmp 0x5d79ae
cmp dword [0x5f2d34], 0
je 0x5d7adc
mov dword [esp], 0x68cb78
call sub.KERNEL32.dll_InterlockedIncrement
push edx
test eax, eax
jne 0x5d7b28
mov ebp, dword [esi + 8]
test ebp, ebp
jne 0x5d7a3d
mov ebp, dword [0x68cb80]
inc ebp
mov dword [0x68cb80], ebp
mov dword [esi + 8], ebp
cmp dword [0x68cb3c], 0
je 0x5d797f
mov dword [esp], 0x68cb78
call sub.KERNEL32.dll_InterlockedDecrement
push edx
test eax, eax
js 0x5d797f
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov eax, dword [0x68cb7c]
mov dword [esp], eax
call sub.KERNEL32.dll_ReleaseSemaphore
sub esp, 0xc
jmp 0x5d797f
mov eax, esi
call fcn.005df800
mov dword [esi + 8], eax
jmp 0x5d796c
lea edx, [edi + edi]
cmp ebp, edx
jbe 0x5d7a9d
lea edx, [ebp + 0x20]
lea eax, [edx*4 + 4]
mov dword [esp + 4], eax
mov dword [esp], ebx
mov dword [esp + 0x1c], edx
call sub.msvcrt.dll_realloc
mov ebx, eax
test eax, eax
mov edx, dword [esp + 0x1c]
je 0x5d7b59
mov dword [eax], edx
sub edx, edi
lea ecx, [edx*4]
lea edx, [eax + edi*4 + 4]
xor eax, eax
mov edi, edx
rep stosb byte es:[edi], al
jmp 0x5d79e6
mov dword [esp], 0x5f2d38
call sub.KERNEL32.dll_InterlockedIncrement
push ebp
test eax, eax
jne 0x5d7afc
jmp 0x5d7b17
mov dword [esp], 0
call sub.KERNEL32.dll_Sleep
push edi
cmp dword [0x5f2d34], 0
je 0x5d7aef
cmp dword [0x68cb3c], 0
je 0x5d7a26
jmp 0x5d7a11
call fcn.005d78e0
mov dword [0x5f2d34], 1
jmp 0x5d7b05
mov dword [esp + 4], 0xffffffff
mov eax, dword [0x68cb7c]
mov dword [esp], eax
call sub.KERNEL32.dll_WaitForSingleObject
push ebx
push ebx
test eax, eax
je 0x5d7a26
mov dword [esp], 0x68cb78
call sub.KERNEL32.dll_InterlockedDecrement
push ecx
jmp 0x5d7a26
call sub.msvcrt.dll_abort
nop
push esi
push ebx
mov eax, dword [esp + 0xc]
mov edx, dword [esp + 0x10]
mov ebx, dword [esp + 0x14]
mov esi, dword [esp + 0x18]
mov ecx, dword [eax]
cmp ecx, edx
jae 0x5d7b83
mov dword [eax], edx
mov dword [eax + 0xc], 0
mov ecx, edx
cmp dword [eax + 4], ebx
jae 0x5d7b8b
mov dword [eax + 4], ebx
test esi, esi
je 0x5d7b96
cmp edx, ecx
jne 0x5d7b96
mov dword [eax + 0xc], esi
pop ebx
pop esi
ret