Function at 0x401126
Capabilities:
Create thread
Read file on windows

Disassembly:
push ebp
mov ebp, esp
cmp dword [ebp + 8], 3
je 0x40114b
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push eax
push str.Usage:_asyncbuf_buf_size_bytes_initial_fill_bytes_n
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fputs]
add esp, 0xc
push 2
pop eax
pop ebp
ret
push ebx
mov ebx, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push esi
push edi
push 0x8000
push 0
call ebx
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
push eax
call esi
mov edi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__setmode]
pop ecx
pop ecx
push eax
call edi
pop ecx
pop ecx
test eax, eax
js 0x4013ad
push 0x8000
push 1
call ebx
push eax
call esi
pop ecx
pop ecx
push eax
call edi
pop ecx
pop ecx
test eax, eax
js 0x4013ad
mov edi, dword [ebp + 0xc]
xor ebx, ebx
mov esi, dword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_wcstoul]
push 0xa
push ebx
push dword [edi + 4]
call esi
push 0xa
push ebx
push dword [edi + 8]
mov dword [0x4043dc], eax
call esi
mov ecx, dword [0x4043dc]
mov edx, eax
mov eax, 0x20000
mov dword [0x4043c8], edx
add esp, 0x18
cmp ecx, eax
jb 0x4011d9
mov eax, 0x40000000
cmp ecx, eax
jbe 0x4011e1
mov ecx, eax
mov dword [0x4043dc], ecx
lea eax, [ecx - 0x20000]
cmp edx, eax
jbe 0x4011f0
mov dword [0x4043c8], eax
push ecx
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov dword [0x404400], eax
pop ecx
test eax, eax
je 0x4013ad
mov esi, dword [sym.imp.KERNEL32.dll_CreateEventW]
push ebx
push ebx
push ebx
push ebx
call esi
mov dword [0x4043e0], eax
test eax, eax
je 0x4013a0
push ebx
push ebx
push ebx
push ebx
call esi
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [0x4043cc], eax
test eax, eax
je 0x401398
mov edi, 0x4043e8
push edi
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
push ebx
push ebx
push ebx
push section..text
push ebx
push ebx
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__beginthreadex]
add esp, 0x18
mov dword [0x4043d0], eax
test eax, eax
je 0x401389
mov edi, dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov ebx, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov esi, 0x4043e8
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [0x4043e4]
xor edx, edx
sub eax, dword [0x4043d4]
dec eax
add eax, dword [0x4043dc]
div dword [0x4043dc]
push esi
cmp edx, 0x10000
jb 0x401329
call edi
mov eax, dword [0x4043dc]
mov ecx, 0x10000
sub eax, dword [0x4043d4]
mov esi, ecx
cmp eax, ecx
push 0
cmovb esi, eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push eax
mov eax, dword [0x4043d4]
add eax, dword [0x404400]
push esi
push 1
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
add esp, 0x14
mov esi, eax
push 0x4043e8
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
test esi, esi
jne 0x4012f7
mov dword [0x4043d8], 1
mov eax, dword [0x4043d4]
xor edx, edx
push dword [0x4043e0]
lea eax, [eax + esi]
div dword [0x4043dc]
mov dword [0x4043d4], edx
call dword [sym.imp.KERNEL32.dll_SetEvent]
push 0x4043e8
call edi
test esi, esi
je 0x401345
jmp 0x40126f
cmp dword [0x4043d8], 0
jne 0x401343
call edi
push 0xffffffffffffffff
push dword [0x4043cc]
call ebx
jmp 0x401274
call edi
push 0xffffffffffffffff
push dword [0x4043d0]
call ebx
push dword [0x4043d0]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push 0x4043e8
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
push dword [0x4043cc]
call esi
push dword [0x4043e0]
call esi
push dword [0x404400]
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
pop ecx
xor eax, eax
jmp 0x4013b0
push edi
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
push dword [0x4043cc]
call esi
push dword [0x4043e0]
call esi
push dword [0x404400]
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
pop ecx
xor eax, eax
inc eax
pop edi
pop esi
pop ebx
pop ebp
ret