Function at 0x515cd8
Capabilities:
Resolve function by parsing pe exports

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x84
cmp dword [edx], 0
mov ebx, ecx
je 0x515cf8
and dword [ebx + 4], 0
mov dword [ebx], 0xc01
jmp 0x515fa5
xor eax, eax
test byte [esp + 0xa0], 1
mov ecx, dword [esp + 0x98]
mov dword [esp + 0x4c], edx
mov edx, 0x89
lea esi, [esp + 0xc]
cmove edx, eax
lea edi, [ecx + 0xc]
mov dword [esp + 0x54], edx
lea edx, [ecx + 0x10]
mov ecx, esi
mov dword [esp + 0x58], edi
call fcn.00514b5b
cmp dword [esi], 0
jne 0x515fb2
mov ecx, dword [esp + 0x10]
mov al, byte [esp + 0x14]
mov dword [esp + 8], ebx
mov dword [esp], ecx
mov byte [esp + 4], al
lea eax, [ecx + 8]
mov edx, dword [ecx + 0x10]
test edx, edx
je 0x515d62
mov ecx, dword [ecx + 0xc]
mov ecx, dword [ecx + edx*4 - 4]
mov ecx, dword [ecx]
cmp ecx, 0x20
jbe 0x515d84
mov edx, dword [edi]
lea ebp, [esp + 0xc]
mov ecx, ebp
push eax
call 0x516083
pop eax
cmp byte [ebp], 4
je 0x515d84
mov ebx, dword [esp + 0xc]
cmp bl, 4
jne 0x515f74
mov eax, dword [esp]
mov ecx, dword [eax + 0x10]
test ecx, ecx
je 0x515fda
mov eax, dword [eax + 0xc]
mov esi, dword [eax + ecx*4 - 4]
lock inc dword [esi]
jle 0x515fb0
mov ecx, dword [esp]
mov edx, dword [esp + 4]
call fcn.004bd038
mov ebx, dword [esp + 0xa4]
lea ebp, [esp + 0x74]
mov dword [esp + 0x50], esi
mov dword [esp], esi
mov ecx, ebp
mov edx, ebx
push 0x48000022
call fcn.005161de
pop eax
cmp dword [ebp], 0
je 0x515e08
push 0xfffffffffffffff4
pop esi
lea ebp, [esp + 0x5c]
test esi, esi
je 0x515f63
mov ecx, ebp
mov edx, ebx
push dword [esi + 0x7649d4]
call fcn.005161de
pop eax
add esi, 4
cmp dword [esp + 0x5c], 0
jne 0x515ddc
mov edi, dword [esp + 0x60]
cmp edi, ebx
je 0x515ddc
jmp 0x515e0c
mov edi, dword [esp + 0x78]
lea ebp, [esp + 0xc]
mov esi, dword [ebp]
push 0x60
pop ecx
push 8
pop edx
call fcn.005086b2
mov ecx, dword [esp + 0x50]
mov ebx, eax
xor eax, eax
inc eax
lea edx, [ebx + 8]
mov dword [ebx], eax
mov dword [ebx + 4], eax
and dword [ebx + 8], 0
mov byte [ebx + 0xc], 0
and dword [ebx + 0x10], 0
mov dword [ebx + 0x14], esi
and dword [ebx + 0x18], 0
and dword [ebx + 0x20], 0
and dword [ebx + 0x1c], 0
and dword [ebx + 0x28], 0
and dword [ebx + 0x24], 0
and dword [ebx + 0x30], 0
and dword [ebx + 0x2c], 0
and dword [ebx + 0x38], 0
and dword [ebx + 0x34], 0
and dword [ebx + 0x40], 0
and dword [ebx + 0x3c], 0
and dword [ebx + 0x44], 0
mov dword [ebx + 0x48], ecx
mov dword [ebx + 0x4c], edi
and dword [ebx + 0x54], 0
and dword [ebx + 0x50], 0
and word [ebx + 0x58], 0
mov ecx, ebp
call fcn.0048dedc
xor eax, eax
cmp dword [ebp], eax
jne 0x51605a
mov al, byte [esp + 0xa0]
mov edi, dword [esp + 0x54]
mov ecx, dword [esp + 0x10]
mov esi, dword [esp + 0x9c]
mov edx, dword [esp + 0x14]
add al, al
and al, 4
movzx eax, al
or edi, eax
or edi, 0x110
mov dword [ecx + 0x48], edi
and dword [ecx + 0x3c], 0
mov dword [ecx + 0x38], esi
call fcn.004bd038
mov eax, dword [esp + 0x98]
lock inc dword [eax]
jle 0x515fb0
lock inc dword [ebx]
jle 0x515fb0
mov cl, byte [esp + 0xa0]
lea ebp, [eax + 8]
mov dword [esp + 0xc], eax
mov dword [esp + 0x14], esi
mov edx, ebx
mov byte [esp + 0x18], cl
mov ecx, ebp
mov dword [esp + 0x10], ebx
call fcn.00515c05
lea ebx, [esp + 0x5c]
mov edx, ebp
mov ecx, ebx
call fcn.00515c69
cmp byte [ebx], 4
je 0x515f22
mov ebx, dword [esp + 0x5c]
cmp bl, 4
jne 0x515f8f
mov esi, dword [esp + 0x10]
mov edi, dword [esp + 0x14]
mov ebp, dword [esp + 0x18]
push 0x10
pop ecx
push 4
pop edx
call fcn.005086b2
mov edx, dword [esp + 0x98]
mov ebx, eax
xor ecx, ecx
mov dword [ebx], edx
mov dword [ebx + 8], edi
mov dword [ebx + 4], esi
mov dword [ebx + 0xc], ebp
call fcn.0051624f
mov eax, dword [esp + 0x4c]
mov ecx, dword [esp + 8]
mov dword [eax], ebx
mov byte [ecx], 4
jmp 0x515fa5
mov esi, dword [esp + 0x78]
mov eax, esp
push eax
call fcn.0051419c
pop eax
xor ebx, ebx
jmp 0x515f9c
mov ecx, dword [esp]
mov edx, dword [esp + 4]
mov esi, dword [esp + 0x10]
call fcn.004bd038
cmp bl, 4
je 0x515dae
jmp 0x515f9c
mov esi, dword [esp + 0x60]
lea ecx, [esp + 0xc]
call fcn.00516229
mov eax, dword [esp + 8]
mov dword [eax], ebx
mov dword [eax + 4], esi
add esp, 0x84
pop esi
pop edi
pop ebx
pop ebp
ret
ud2
mov eax, dword [esp + 0x10]
mov cl, byte [esp + 0x14]
lea esi, [esp + 0x5c]
mov dword [esi], eax
mov byte [esi + 4], cl
push 0x2b
pop edx
mov ecx, str.called__Result::unwrap____on_an__Err__value
push 0x7647f0
push 0x764368
jmp 0x51607d
lea ecx, [esp + 0x58]
lea eax, [esp + 0x74]
mov dword [eax], ecx
mov ecx, esp
mov dword [eax + 4], 0x514c2e
mov dword [eax + 8], ecx
mov dword [eax + 0xc], 0x515349
push 2
pop edx
mov dword [esp + 0xc], edx
mov dword [esp + 0x14], edx
push 0x20
pop ecx
mov dword [esp + 0x1c], ecx
and dword [esp + 0x20], 0
push 4
pop edi
mov bl, 3
mov dword [esp + 0x24], edi
mov byte [esp + 0x28], bl
mov dword [esp + 0x2c], edx
mov dword [esp + 0x34], edx
mov dword [esp + 0x3c], ecx
lea ecx, [esp + 0x5c]
mov dword [esp + 0x40], 1
mov dword [esp + 0x44], edi
mov byte [esp + 0x48], bl
mov dword [ecx], 0x76484c
mov dword [ecx + 4], edx
mov dword [ecx + 0x10], esi
mov dword [ecx + 0x14], edx
mov dword [ecx + 8], eax
mov dword [ecx + 0xc], edx
mov edx, 0x76485c
call fcn.0062d360
mov eax, dword [esp + 0x10]
mov cl, byte [esp + 0x14]
lea esi, [esp + 0x5c]
mov dword [esi], eax
mov byte [esi + 4], cl
push 0x2b
pop edx
mov ecx, str.called__Result::unwrap____on_an__Err__value
push 0x764998
push 0x764348
push esi
call fcn.0062d770
push ebp
push ebx
push edi
push esi
sub esp, 0x48
mov esi, ecx
lea eax, [esp + 8]
lea ecx, [esp + 0xc]
mov edi, edx
and dword [ecx], 0
or dword [eax], 0xffffffff
and dword [ecx + 4], 0
push 0
push 0
push 0
push 1
push 3
push 0
push 0
push ecx
push 0x764740
push 0x100000
push eax
call dword [sym.imp.ntdll.dll_NtCreateFile]
test eax, eax
je 0x51612b
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
xor ecx, ecx
lea edx, [esp + 0x30]
lea edi, [esp + 0x14]
lea ebx, [esp + 0x24]
inc ecx
mov dword [edx], str.Failed_to_open_DeviceAfdMio:_XGv
mov byte [edi], 0
mov dword [edi + 4], eax
lea eax, [esp + 0x1c]
mov dword [edx + 4], ecx
and dword [edx + 0x10], 0
mov dword [edx + 8], eax
mov dword [edx + 0xc], ecx
mov ecx, ebx
mov dword [eax], edi
mov dword [eax + 4], fcn.005b02f0
call fcn.00453c50
mov ecx, edi
call fcn.00412758
mov ebp, esp
movzx edx, al
mov ecx, ebp
push ebx
call fcn.005147c0
pop eax
mov ecx, dword [edi]
mov edx, dword [edi + 4]
call fcn.00514289
mov al, byte [ebp]
jmp 0x516180
mov ebx, dword [esp + 8]
push 2
pop eax
lock xadd dword [0x7f4fd4], eax
add eax, 2
push 0
push eax
push dword [edi + 8]
push ebx
call dword [sym.imp.KERNEL32.dll_CreateIoCompletionPort]
test eax, eax
je 0x51616a
push 2
push dword [esp + 0xc]
call dword [sym.imp.KERNEL32.dll_SetFileCompletionNotificationModes]
test eax, eax
je 0x51616a
mov dword [esp + 4], ebx
mov byte [esp], 4
mov al, 4
jmp 0x516180
call sub.KERNEL32.dll_GetLastError
and dword [esp], 0
mov dword [esp + 4], eax
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
cmp al, 4
jne 0x51618a
mov ebp, dword [esp + 4]
jmp 0x516195
mov eax, dword [esp]
mov ebp, dword [esp + 4]
cmp al, 4
jne 0x5161d1
mov edi, dword [esp + 0x5c]
push 0xc
pop ecx
push 4
pop edx
call fcn.005086b2
mov ebx, eax
xor eax, eax
inc eax
mov dword [ebx], eax
mov dword [ebx + 4], eax
mov dword [ebx + 8], ebp
mov edx, dword [edi + 8]
cmp edx, dword [edi]
jne 0x5161c2
mov ecx, edi
call fcn.005d5dd6
mov edx, dword [edi + 8]
mov eax, dword [edi + 4]
mov dword [eax + edx*4], ebx
inc edx
mov byte [esi], 4
mov dword [edi + 8], edx
jmp 0x5161d6
mov dword [esi + 4], ebp
mov dword [esi], eax
add esp, 0x48
pop esi
pop edi
pop ebx
pop ebp
ret