Function at 0x412fd0
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x2c
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [ebp - 0x30], eax
mov eax, dword [0x4d9f68]
mov ebx, eax
test eax, eax
je 0x4130dd
xor esi, esi
jmp 0x412ffd
mov ebx, dword [ebx]
test ebx, ebx
je 0x41302d
mov eax, dword [ebx + 0x18]
mov dword [ebx + 0x10], 0
test eax, eax
je 0x412ff7
sub esp, 0xc
push ebx
call eax
mov eax, dword [ebx + 0x10]
add esp, 0x10
test eax, eax
je 0x412ff7
mov eax, ebx
mov esi, 1
call fcn.00412b70
mov ebx, dword [ebx]
test ebx, ebx
jne 0x412ffd
test esi, esi
je 0x413562
mov ebx, dword [0x4d9f68]
test ebx, ebx
jne 0x413047
jmp 0x413068
mov ebx, dword [ebx]
test ebx, ebx
je 0x413068
mov eax, dword [ebx + 0x28]
test eax, eax
je 0x413041
sub esp, 0xc
push ebx
call eax
add esp, 0x10
test eax, eax
je 0x413041
mov eax, ebx
call fcn.00412b70
mov ebx, dword [ebx]
test ebx, ebx
jne 0x413047
mov edx, dword [0x49b320]
cmp edx, 0x49b320
je 0x412fe4
lea esi, [esi]
mov eax, dword [edx]
and word [edx + 0x10], 0xfdff
mov dword [eax + 4], 0x49b320
mov dword [0x49b320], eax
mov dword [edx + 4], 0
mov ax, word [edx + 0x12]
mov dword [edx], 0
mov word [edx + 0x12], 0
push ebx
and eax, 0xffff
mov ecx, dword [edx + 0x18]
push ecx
push eax
mov eax, dword [edx + 8]
push eax
call dword [edx + 0x14]
mov edx, dword [0x49b320]
add esp, 0x10
cmp edx, 0x49b320
jne 0x413080
mov eax, dword [0x4d9f68]
mov ebx, eax
test eax, eax
jne 0x412ff3
mov dword [0x4da16c], 0
mov ebx, eax
test eax, eax
je 0x41357b
mov eax, dword [ebx + 0x1c]
test eax, eax
je 0x413109
sub esp, 0xc
push ebx
call eax
add esp, 0x10
test eax, eax
je 0x4136c3
mov ecx, dword [ebx + 8]
cmp ecx, 0xffffffff
je 0x413141
mov eax, dword [0x4da16c]
test eax, eax
jle 0x413134
xor edx, edx
cmp ecx, dword [0x4d9f6c]
jne 0x41312f
jmp 0x413141
cmp ecx, dword [edx*4 + 0x4d9f6c]
je 0x413141
inc edx
cmp edx, eax
jne 0x413126
mov dword [eax*4 + 0x4d9f6c], ecx
inc eax
mov dword [0x4da16c], eax
mov ebx, dword [ebx]
test ebx, ebx
jne 0x4130f1
mov ebx, dword [0x4da16c]
test ebx, ebx
je 0x41357b
mov eax, dword [0x4dcfc8]
test al, al
js 0x413468
mov esi, dword [0x4da16c]
cmp esi, 0x40
jle 0x4133c7
cmp byte [0x4dcfc8], 0
js 0x413637
mov eax, esi
mov edx, 0x82082083
imul edx
mov eax, esi
mov dword [ebp - 0x10], 0xffffffff
sar eax, 0x1f
lea edi, [edx + esi]
sar edi, 5
sub edi, eax
mov eax, esi
mov ebx, edi
shl ebx, 6
sub ebx, edi
sub eax, ebx
mov dword [ebp - 0x2c], eax
setne al
and eax, 0xff
sub esp, 0xc
add eax, edi
lea eax, [eax + eax*2]
shl eax, 3
push eax
call sub.msvcrt.dll_malloc
add esp, 0x10
mov dword [ebp - 0x24], eax
test eax, eax
je 0x4134db
push 0
push 0
push 1
push 0
call sub.KERNEL32.dll_CreateEventA
mov dword [ebp - 0x28], eax
test eax, eax
je 0x41373b
xor ecx, ecx
test edi, edi
jle 0x413221
mov edx, dword [ebp - 0x24]
xor ecx, ecx
add edx, 0x10
mov eax, dword [ebp - 0x28]
mov dword [edx], ecx
mov dword [edx - 0x10], eax
lea eax, [ebp - 0x10]
mov dword [edx - 0xc], eax
lea eax, [ecx*4 + 0x4d9f6c]
add ecx, 0x3f
mov dword [edx - 8], eax
mov dword [edx - 4], 0x3f
add edx, 0x18
cmp ecx, ebx
jne 0x4131f6
mov ecx, edi
mov eax, dword [ebp - 0x2c]
test eax, eax
je 0x413257
mov eax, dword [ebp - 0x24]
lea edx, [ecx + ecx*2]
inc edi
lea edx, [eax + edx*8]
mov eax, dword [ebp - 0x28]
mov dword [edx], eax
lea eax, [ebp - 0x10]
mov dword [edx + 4], eax
mov eax, ecx
shl eax, 6
sub eax, ecx
mov dword [edx + 0x10], eax
lea eax, [eax*4 + 0x4d9f6c]
mov dword [edx + 8], eax
mov eax, dword [ebp - 0x2c]
mov dword [edx + 0xc], eax
test edi, edi
jle 0x4138dc
mov esi, dword [ebp - 0x24]
mov dword [ebp - 0x20], 0
mov ebx, esi
jmp 0x413283
mov eax, dword [ebp - 0x20]
add ebx, 0x18
inc eax
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], edi
je 0x4136af
push eax
push eax
push 0
push 0
push ebx
push 0x412f20
push 0
push 0
call sub.msvcrt.dll__beginthreadex
add esp, 0x20
mov dword [ebx + 0x14], eax
test eax, eax
jne 0x413270
cmp byte [0x4dcfc8], 0
js 0x41377b
sub esp, 0xc
mov edx, dword [ebp - 0x28]
push edx
call sub.KERNEL32.dll_SetEvent
sub esp, 0xc
mov eax, dword [ebp - 0x28]
push 0xffffffffffffffff
push eax
call sub.KERNEL32.dll_WaitForSingleObject
mov eax, dword [ebp - 0x20]
add esp, 0x18
test eax, eax
jle 0x4132f8
xor ebx, ebx
push eax
push eax
push 0xffffffffffffffff
inc ebx
mov eax, dword [esi + 0x14]
push eax
call sub.KERNEL32.dll_WaitForSingleObject
push eax
mov edi, dword [esi + 0x14]
add esi, 0x18
push edi
call sub.KERNEL32.dll_CloseHandle
add esp, 0xc
cmp dword [ebp - 0x20], ebx
jg 0x4132d5
sub esp, 0xc
mov esi, dword [ebp - 0x28]
push esi
call sub.KERNEL32.dll_CloseHandle
mov ebx, dword [ebp - 0x24]
push ebx
call sub.msvcrt.dll_free
add esp, 0xc
lea eax, [ebp - 0x10]
push 0xffffffffffffffff
push 0xffffffffffffffff
push eax
call sub.KERNEL32.dll_InterlockedCompareExchange
pop ecx
mov edi, eax
test eax, eax
js 0x413769
mov eax, dword [0x4dcfc8]
cmp edi, 0xffffffff
je 0x4133e6
test al, al
js 0x4135ca
cmp edi, dword [0x4da16c]
jae 0x413155
mov esi, dword [0x4d9f68]
test esi, esi
jne 0x41336a
jmp 0x413155
mov esi, dword [esi]
test esi, esi
je 0x413155
mov eax, dword [edi*4 + 0x4d9f6c]
cmp eax, dword [esi + 8]
jne 0x413360
mov eax, dword [esi + 0x24]
test eax, eax
je 0x41338a
sub esp, 0xc
push esi
call eax
add esp, 0x10
test eax, eax
je 0x413360
cmp byte [0x4dcfc8], 0
js 0x4137f4
mov eax, esi
call fcn.00412b70
mov ebx, dword [0x4d9f68]
test ebx, ebx
je 0x413068
mov eax, dword [ebx + 0x20]
test eax, eax
je 0x4133bc
sub esp, 0xc
push ebx
call eax
add esp, 0x10
mov ebx, dword [ebx]
test ebx, ebx
jne 0x4133ac
jmp 0x413035
push 0xffffffffffffffff
push 0
push 0x4d9f6c
push esi
call sub.KERNEL32.dll_WaitForMultipleObjects
mov edi, eax
mov eax, dword [0x4dcfc8]
cmp edi, 0xffffffff
jne 0x413336
test al, al
jns 0x41315a
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov edx, dword [ebp - 0x30]
add esp, 0xc
push str.fdevent_process
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push edx
call fcn.00412fb0
call sub.msvcrt.dll__errno
mov dword [eax], ebx
call sub.KERNEL32.dll_GetLastError
add esp, 0xc
push eax
mov eax, dword [ebp - 0x30]
push str.adb_win32:_wait_failed__error__ld_n
push eax
call fcn.00412fb0
pop eax
mov eax, dword [ebp - 0x30]
push eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
mov eax, dword [0x4dcfc8]
test al, al
jns 0x413162
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov eax, dword [ebp - 0x30]
add esp, 0xc
push str.fdevent_process
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push eax
call fcn.00412fb0
call sub.msvcrt.dll__errno
add esp, 0xc
mov dword [eax], ebx
mov edi, dword [0x4da16c]
mov esi, dword [ebp - 0x30]
push edi
push str.adb_win32:_waiting_for__d_events_n
push esi
call fcn.00412fb0
pop ecx
mov edx, dword [ebp - 0x30]
push edx
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
jmp 0x413162
mov eax, dword [0x4dcfc8]
test al, al
jns 0x4133e6
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov eax, dword [ebp - 0x30]
add esp, 0xc
push str._wait_for_all
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push eax
call fcn.00412fb0
call sub.msvcrt.dll__errno
add esp, 0xc
mov dword [eax], ebx
push esi
mov edi, dword [ebp - 0x30]
push str.Unable_to_allocate_thread_array_for__d_handles.
push edi
call fcn.00412fb0
pop esi
mov ecx, dword [ebp - 0x30]
push ecx
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
mov eax, dword [0x4dcfc8]
test al, al
jns 0x41315a
jmp 0x4133ee
mov eax, dword [0x4d9f68]
mov dword [0x4da16c], 0
mov ebx, eax
test eax, eax
jne 0x4130f1
cmp byte [0x4dcfc8], 0
jns 0x413068
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov ecx, dword [ebp - 0x30]
add esp, 0xc
push str.fdevent_process
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push ecx
call fcn.00412fb0
call sub.msvcrt.dll__errno
mov dword [eax], ebx
pop eax
pop edx
push str.fdevent_process:_nothing_to_wait_for____n
jmp 0x41370d
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov eax, dword [ebp - 0x30]
add esp, 0xc
push str.fdevent_process
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push eax
call fcn.00412fb0
call sub.msvcrt.dll__errno
add esp, 0xc
mov dword [eax], ebx
push edi
mov eax, dword [ebp - 0x30]
push str.adb_win32:_got_one__index__d__n
push eax
call fcn.00412fb0
pop eax
mov esi, dword [ebp - 0x30]
push esi
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
jmp 0x41333e
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov eax, dword [ebp - 0x30]
add esp, 0xc
push str.fdevent_process
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push eax
call fcn.00412fb0
call sub.msvcrt.dll__errno
add esp, 0xc
mov dword [eax], ebx
mov eax, dword [0x4da16c]
push eax
mov eax, dword [ebp - 0x30]
push str.handle_count__d_exceeds_MAXIMUM_WAIT_OBJECTS._n
push eax
call fcn.00412fb0
pop eax
mov eax, dword [ebp - 0x30]
push eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
mov esi, dword [0x4da16c]
jmp 0x41317e
push eax
push eax
mov eax, dword [ebp - 0x28]
push 0xffffffffffffffff
push eax
call sub.KERNEL32.dll_WaitForSingleObject
pop edi
pop eax
jmp 0x4132d3
cmp byte [0x4dcfc8], 0
jns 0x413068
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov eax, dword [ebp - 0x30]
add esp, 0xc
push str.fdevent_process
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push eax
call fcn.00412fb0
call sub.msvcrt.dll__errno
mov dword [eax], ebx
pop esi
pop edi
push str.fdevent_process:_error_when_starting_a_hook_n
mov eax, dword [ebp - 0x30]
push eax
call fcn.00412fb0
pop eax
mov eax, dword [ebp - 0x30]
push eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
jmp 0x413068
cmp byte [0x4dcfc8], 0
js 0x41386a
sub esp, 0xc
mov eax, dword [ebp - 0x24]
push eax
call sub.msvcrt.dll_free
mov eax, dword [0x4dcfc8]
add esp, 0x10
test al, al
jns 0x41315a
jmp 0x4133ee
mov eax, dword [0x4dcfc8]
test al, al
jns 0x41315a
jmp 0x4133ee
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov ecx, dword [ebp - 0x30]
add esp, 0xc
push str._wait_for_all
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push ecx
call fcn.00412fb0
call sub.msvcrt.dll__errno
mov dword [eax], ebx
call sub.msvcrt.dll__errno
pop edx
mov eax, dword [eax]
push eax
mov eax, dword [ebp - 0x20]
push edi
mov edi, dword [ebp - 0x30]
push eax
push str.Unable_to_create_a_waiting_thread__d_of__d._errno_d
push edi
call fcn.00412fb0
add esp, 0x14
mov ecx, dword [ebp - 0x30]
push ecx
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
jmp 0x4132af
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov ecx, dword [ebp - 0x30]
add esp, 0xc
push str.fdevent_process
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push ecx
call fcn.00412fb0
call sub.msvcrt.dll__errno
mov dword [eax], ebx
mov eax, dword [esi + 4]
mov edx, dword [esi + 0x10]
add eax, 0x18
push edx
push eax
mov eax, dword [ebp - 0x30]
push str.adb_win32:_signaling__s_for__x_n
push eax
call fcn.00412fb0
add esp, 0x14
mov edi, dword [ebp - 0x30]
push edi
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
jmp 0x413397
call sub.msvcrt.dll__errno
sub esp, 0xc
mov ebx, dword [eax]
push 0x4dcfd8
call sub.KERNEL32.dll_EnterCriticalSection
mov edx, dword [ebp - 0x30]
add esp, 0xc
push str._wait_for_all
push str.system_core_adb_sysdeps_win32.c
push str._s::_s__:
push edx
call fcn.00412fb0
call sub.msvcrt.dll__errno
mov dword [eax], ebx
call sub.KERNEL32.dll_GetLastError
add esp, 0xc
push eax
mov eax, dword [ebp - 0x30]
push str.Unable_to_create_main_event._Error:__d
push eax
call fcn.00412fb0
pop eax
mov eax, dword [ebp - 0x30]
push eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4dcfd8
call sub.KERNEL32.dll_LeaveCriticalSection
add esp, 0xc
call sub.msvcrt.dll__errno
mov dword [eax], ebx
jmp 0x413748
mov ecx, dword [ebp - 0x28]
push ebx
push ebx
push 0xffffffffffffffff
push ecx
call sub.KERNEL32.dll_WaitForSingleObject
pop eax
pop edx
jmp 0x4132f8