Function at 0x69d8cbf0
Capabilities:
Allocate thread local storage

Disassembly:
push rdi
push rsi
push rbx
sub rsp, 0x20
mov rbx, qword [rcx + 8]
mov rdi, qword [rcx]
cmp rbx, 8
mov rsi, rcx
ja 0x69d8cba0
lea rcx, [rdi + 8]
call sub.msvcrt.dll_malloc
test rax, rax
je 0x69d8cbe2
mov rdx, qword [rsi + 0x18]
mov qword [rax], rax
lea r9, [rax + 8]
mov r8, rdi
test rdx, rdx
je 0x69d8cbca
mov rcx, r9
call sub.msvcrt.dll_memcpy
mov r9, rax
mov rax, r9
add rsp, 0x20
pop rbx
pop rsi
pop rdi
ret
lea rcx, [rbx + rdi + 7]
call sub.msvcrt.dll_malloc
test rax, rax
je 0x69d8cbe2
lea r9, [rax + rbx + 7]
neg rbx
mov r8, rdi
and r9, rbx
mov qword [r9 - 8], rax
mov rdx, qword [rsi + 0x18]
test rdx, rdx
jne 0x69d8cb88
mov rcx, r9
xor edx, edx
call sub.msvcrt.dll_memset
mov r9, rax
mov rax, r9
add rsp, 0x20
pop rbx
pop rsi
pop rdi
ret
call sub.msvcrt.dll_abort
nop
nop dword [rax + rax]
sub rsp, 0x28
xor r9d, r9d
xor edx, edx
xor ecx, ecx
mov dword [0x69e48920], 0xffffffff
mov r8d, 0xffff
call qword [sym.imp.KERNEL32.dll_CreateSemaphoreW]
mov qword [0x69e48928], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
cmp eax, 0xffffffff
je 0x69d8cc40
lea rdx, [0x69d8cb10]
mov ecx, eax
mov dword [0x69e48918], eax
call fcn.69d97060
test eax, eax
jne 0x69d8cc4a
add rsp, 0x28
ret
call qword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x69d8cc3b
call sub.msvcrt.dll_abort
nop
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x28
mov rbx, qword [0x69e243e0]
mov r11d, dword [rbx]
mov rdi, rcx
test r11d, r11d
jne 0x69d8cc84
mov rax, qword [rcx + 0x10]
test rax, rax
je 0x69d8cce0
add rsp, 0x28
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
ret
mov rsi, qword [rcx + 0x10]
test rsi, rsi
je 0x69d8ccf0
mov ebx, dword [0x69e48918]
mov r12, qword [sym.imp.KERNEL32.dll_GetLastError]
call r12
mov ebp, eax
mov ecx, ebx
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov ecx, ebp
mov rbx, rax
call qword [sym.imp.KERNEL32.dll_SetLastError]
test rbx, rbx
je 0x69d8cd61
mov rbp, qword [rbx]
cmp rbp, rsi
jb 0x69d8cda1
lea rbx, [rbx + rsi*8]
mov rax, qword [rbx]
test rax, rax
jne 0x69d8cc77
mov rcx, rdi
call fcn.69d8cb50
mov qword [rbx], rax
jmp 0x69d8cc77
call fcn.69d8cb50
mov qword [rdi + 0x10], rax
jmp 0x69d8cc77
mov r10d, dword [rbx]
test r10d, r10d
je 0x69d8ce02
mov r9d, dword [0x69e1e030]
test r9d, r9d
je 0x69d8ce30
lock add dword [0x69e48920], 1
jne 0x69d8ce60
mov rsi, qword [rdi + 0x10]
test rsi, rsi
je 0x69d8ce0f
mov eax, dword [rbx]
test eax, eax
je 0x69d8cc8d
mov eax, 0xffffffff
lock xadd dword [0x69e48920], eax
sub eax, 1
js 0x69d8cc8d
xor r8d, r8d
mov edx, 1
mov rcx, qword [0x69e48928]
call qword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
jmp 0x69d8cc8d
lea rcx, [rsi + 0x21]
mov edx, 8
call sub.msvcrt.dll_calloc
lea rbp, [rsi + 0x20]
test rax, rax
mov rbx, rax
je 0x69d8ce87
mov qword [rax], rbp
mov rdx, rbx
mov ecx, dword [0x69e48918]
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
jne 0x69d8ccc7
call r12
jmp 0x69d8ccc7
lea r13, [rbp + rbp]
mov rcx, rbx
lea rax, [rsi + 0x20]
cmp rsi, r13
cmova r13, rax
lea rdx, [r13*8 + 8]
call sub.msvcrt.dll_realloc
test rax, rax
mov rbx, rax
je 0x69d8ce87
mov qword [rax], r13
lea rcx, [rax + rbp*8 + 8]
sub r13, rbp
xor edx, edx
lea r8, [r13*8]
call sub.msvcrt.dll_memset
jmp 0x69d8cd82
call 0x69d8cbf0
mov dword [0x69e1e030], 1
mov edx, dword [rbx]
test edx, edx
jne 0x69d8cd0c
mov rsi, qword [rdi + 0x10]
test rsi, rsi
jne 0x69d8cc8d
mov rax, qword [0x69e48910]
lea rsi, [rax + 1]
mov qword [0x69e48910], rsi
mov qword [rdi + 0x10], rsi
jmp 0x69d8cd27
lock add dword [0x69e1e034], 1
je 0x69d8cde9
mov r8d, dword [0x69e1e030]
lea rsi, [0x69e1e030]
mov rbp, qword [sym.imp.KERNEL32.dll_Sleep]
test r8d, r8d
jne 0x69d8cdf8
xor ecx, ecx
call rbp
mov ecx, dword [rsi]
test ecx, ecx
je 0x69d8ce54
jmp 0x69d8cdf8
mov edx, 0xffffffff
mov rcx, qword [0x69e48928]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
je 0x69d8cd1a
lock sub dword [0x69e48920], 1
jmp 0x69d8cd1a
call sub.msvcrt.dll_abort
nop
nop dword [rax]
cmp qword [rcx], rdx
jae 0x69d8cea0
mov qword [rcx], rdx
mov qword [rcx + 0x18], 0
cmp qword [rcx + 8], r8
jae 0x69d8ceaa
mov qword [rcx + 8], r8
test r9, r9
je 0x69d8ceb4
cmp qword [rcx], rdx
je 0x69d8ceb5
ret
mov qword [rcx + 0x18], r9
ret