Function at 0x547050
Capabilities:
Allocate thread local storage
Create thread
Terminate thread

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
lea edi, [ebp - 0x3c]
lea esi, [ebp - 0x6c]
push ebx
sub esp, 0x94
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1b1
mov dword [esp], 0xdeadbeef
call dword [sym.imp.kernel32.dll_lstrlenA]
sub esp, 4
test eax, eax
sete al
mov dword [esp + 4], str.lstrlenA:_unexpected_success_n
movzx eax, al
mov dword [esp], eax
call fcn.00543700
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x24]
mov dword [ebp - 0x88], eax
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1b6
call dword [sym.imp.kernel32.dll_TlsAlloc]
cmp eax, 0xffffffff
mov dword [0x8903e4], eax
setne al
mov dword [esp + 4], str.TlsAlloc_failed_n
xor ebx, ebx
movzx eax, al
mov dword [esp], eax
call fcn.00543700
mov dword [ebp + ebx*4 - 0x4c], 0
add edi, 0xc
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], 0
call dword [sym.imp.kernel32.dll_CreateEventA]
mov dword [edi - 0xc], ebx
mov dword [esi + ebx*4], eax
lea eax, [ebp - 0x4c]
add ebx, 1
sub esp, 0x10
mov dword [edi - 4], eax
mov dword [edi - 8], esi
cmp ebx, 4
jne 0x5470e3
xor esi, esi
lea eax, [ebp - 0x5c]
lea ecx, [ebp - 0x3c]
mov dword [esp + 0x10], 0
add eax, esi
mov dword [esp + 8], 0x544480
mov dword [esp + 0x14], eax
lea eax, [esi + esi*2]
add eax, ecx
mov dword [esp + 4], 0
mov dword [esp + 0xc], eax
mov dword [esp], 0
call dword [sym.imp.kernel32.dll_CreateThread]
sub esp, 0x18
mov dword [ebp + esi - 0x7c], eax
mov edi, eax
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1c7
xor eax, eax
test edi, edi
setne al
mov dword [esp + 4], str.Create_Thread_failed_n
add esi, 4
mov dword [esp], eax
call fcn.00543700
cmp esi, 0x10
jne 0x54712f
mov esi, dword [ebp + ebx*4 - 0x8c]
mov dword [esp + 4], 0x1388
mov dword [esp], esi
call dword [sym.imp.kernel32.dll_WaitForSingleObject]
sub esp, 8
mov edi, eax
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1cc
xor eax, eax
test edi, edi
sete al
mov dword [esp + 4], 0x5f8ff8
mov dword [esp], eax
call fcn.00543700
test edi, edi
jne 0x5475e0
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1d0
lea eax, [ebp - 0x84]
mov dword [esp + 4], eax
mov dword [esp], esi
call dword [sym.imp.kernel32.dll_GetExitCodeThread]
sub esp, 8
mov dword [esp], eax
mov dword [esp + 4], str.Could_not_retrieve_ext_code_n
call fcn.00543700
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1d1
xor eax, eax
mov dword [esp + 4], str.Thread_returned_an_incorrect_exit_code_n
cmp dword [ebp - 0x84], ebx
sete al
add ebx, 1
mov dword [esp], eax
call fcn.00543700
cmp ebx, 8
jne 0x5471a3
xor esi, esi
mov ebx, 1
add esi, 1
cmp esi, 4
je 0x5472fc
mov edx, dword [ebp + esi*4 - 0x50]
mov eax, esi
xor edi, edi
cmp edx, dword [ebp + eax*4 - 0x4c]
cmove edi, ebx
add eax, 1
cmp eax, 4
jne 0x54727d
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1e0
test edi, edi
je 0x54730e
mov dword [esp + 4], str.Thread_did_not_execute_successfully_n
mov dword [esp], 0
call fcn.00543700
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1e2
mov eax, dword [ebp + esi*4 - 0x80]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_CloseHandle]
sub esp, 4
test eax, eax
setne al
mov dword [esp + 4], str.CloseHandle_failed_n
add esi, 1
movzx eax, al
mov dword [esp], eax
call fcn.00543700
cmp esi, 4
jne 0x547275
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1e0
mov eax, dword [ebp + esi*4 - 0x50]
mov dword [esp + 4], str.Thread_did_not_execute_successfully_n
mov ecx, dword [ebp - 0x88]
cmp dword [ebp + esi*4 - 0x60], eax
sete dl
cmp eax, ecx
setne al
movzx eax, al
and eax, edx
mov dword [esp], eax
call fcn.00543700
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1e2
mov eax, dword [ebp + esi*4 - 0x80]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_CloseHandle]
sub esp, 4
test eax, eax
setne al
mov dword [esp + 4], str.CloseHandle_failed_n
movzx eax, al
mov dword [esp], eax
call fcn.00543700
cmp esi, 4
jne 0x547269
mov eax, dword [0x8903e4]
mov edi, dword [sym.imp.kernel32.dll_TlsFree]
mov esi, dword fs:[0x18]
mov dword [esi + 0x34], 0xcafef00d
mov dword [esp], eax
call edi
sub esp, 4
mov ebx, eax
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1e7
mov eax, dword [esi + 0x34]
mov dword [esp], ebx
mov dword [esp + 8], eax
mov dword [esp + 4], str.TlsFree_failed:__08lx_n
call fcn.00543700
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1e8
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str.GetLastError:_expected_0xCAFEF00D__got__08lx_n
mov dword [esp + 8], eax
xor eax, eax
cmp dword [esi + 0x34], 0xcafef00d
sete al
mov dword [esp], eax
call fcn.00543700
mov dword [esi + 0x34], 0xcafef00d
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1ed
mov eax, dword [0x8903e4]
mov dword [esp], eax
call edi
sub esp, 4
test eax, eax
sete al
mov dword [esp + 4], str.TlsFree_succeeded_n
movzx eax, al
mov dword [esp], eax
call fcn.00543700
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1ee
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str.GetLastError:_expected_ERROR_INVALID_PARAMETER__got__08lx_n
mov dword [esp + 8], eax
xor eax, eax
cmp dword [esi + 0x34], 0x57
sete al
mov dword [esp], eax
call fcn.00543700
lea eax, [ebp - 0x80]
mov dword [esi + 0x34], 0xfaceabad
mov dword [esp + 0x14], eax
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0x542a30
mov dword [esp + 4], 0
mov dword [esp], 0
call dword [sym.imp.kernel32.dll_CreateThread]
mov esi, dword [esi + 0x34]
sub esp, 0x18
mov ebx, eax
test eax, eax
je 0x5475f8
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1f6
xor eax, eax
cmp esi, 0xfaceabad
sete al
mov dword [esp + 8], esi
mov dword [esp + 4], str.CreateThread_set_last_error_to__ld__expected_4207848365_n
mov dword [esp], eax
call fcn.00543700
mov dword [esp], ebx
mov dword [esp + 4], 0x64
call dword [sym.imp.kernel32.dll_WaitForSingleObject]
sub esp, 8
mov esi, eax
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1f8
xor eax, eax
test esi, esi
sete al
mov dword [esp + 4], str.threadFunc2_did_not_exit_during_100_ms_n
mov dword [esp], eax
call fcn.00543700
lea eax, [ebp - 0x84]
mov dword [esp], ebx
mov dword [esp + 4], eax
call dword [sym.imp.kernel32.dll_GetExitCodeThread]
sub esp, 8
mov esi, eax
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1fa
xor eax, eax
test esi, esi
setne al
mov dword [esp + 8], esi
mov dword [esp], eax
mov dword [esp + 4], str.GetExitCodeThread_returned__ld__expected_nonzero__n
call fcn.00543700
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1fb
mov eax, dword [ebp - 0x84]
mov dword [esp + 4], str.threadFunc2_exited_with_code:__ld__expected_99__n
cmp eax, 0x63
mov dword [esp + 8], eax
sete al
movzx eax, al
mov dword [esp], eax
call fcn.00543700
call fcn.0057d110
mov dword [eax], 0x5f810b
mov dword [eax + 4], 0x1fc
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_CloseHandle]
sub esp, 4
test eax, eax
setne al
mov dword [esp + 4], str.Error_closing_thread_handle_n
movzx eax, al
mov dword [esp], eax
call fcn.00543700
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp + 4], ebx
mov dword [esp], esi
call dword [sym.imp.kernel32.dll_TerminateThread]
sub esp, 8
jmp 0x5471f1
mov eax, 0x1ff
call fcn.00542db0
xor eax, eax
cmp esi, 0x57
mov dword [esp + 8], esi
sete al
mov dword [esp + 4], str.CreateThread_set_last_error_to__ld__expected_87_n
mov dword [esp], eax
call fcn.00543700
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret