Function at 0x51d481
Capabilities:
Resume thread

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2d4
mov eax, dword [ebp + 8]
push ebx
xor ebx, ebx
cmp eax, ebx
je 0x51d49c
mov ecx, dword [0x59ff14]
mov dword [eax], ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp dword [0x59ff0c], eax
je 0x51d4b4
mov eax, 0x10dd
jmp 0x51d6d2
cmp dword [0x59ff10], ebx
je 0x51d4c6
call fcn.0051d38a
jmp 0x51d6cd
push esi
mov esi, dword [0x59ff1c]
push edi
cmp esi, ebx
je 0x51d575
cmp dword [esi + 4], ebx
mov eax, dword [esi + 0x10]
je 0x51d533
xor edi, edi
cmp byte [eax + 0x17], 0
jbe 0x51d50e
lea ecx, [ebp - 4]
mov dword [ebp - 4], ebx
push ecx
push ebx
push eax
mov eax, dword [esi + 0xc]
add eax, edi
push eax
call fcn.0051dd77
cmp dword [ebp - 4], ebx
jne 0x51d50e
mov ecx, dword [esi + 0x10]
mov edi, eax
sub edi, ecx
movzx ecx, byte [ecx + 0x17]
cmp edi, ecx
jl 0x51d4e6
mov eax, dword [esi + 0x10]
movzx eax, byte [eax + 0x17]
cmp edi, eax
je 0x51d52b
mov dword [0x59ff10], 0xd
mov eax, dword [esi + 8]
mov dword [0x59ff14], eax
mov eax, dword [esi + 8]
mov ecx, dword [esi + 0xc]
jmp 0x51d56c
mov ecx, dword [eax + 0x1c]
mov eax, dword [esi + 0xc]
lea edx, [eax + 5]
mov byte [eax], 0xe9
inc eax
sub ecx, edx
mov dword [eax], ecx
mov ecx, dword [esi + 0x10]
lea edi, [eax + 4]
mov ecx, dword [ecx + 0x18]
cmp edi, ecx
jae 0x51d566
sub ecx, edi
mov eax, 0xcccccccc
mov edx, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [esi + 8]
mov ecx, dword [esi + 0x10]
mov dword [eax], ecx
mov esi, dword [esi]
jmp 0x51d4ce
mov edi, dword [0x59ff18]
cmp edi, ebx
je 0x51d61f
mov ebx, dword [sym.imp.KERNEL32.dll_SetThreadContext]
lea eax, [ebp - 0x2d4]
mov dword [ebp - 0x2d4], 0x10001
push eax
push dword [edi + 4]
call dword [sym.imp.KERNEL32.dll_GetThreadContext]
test eax, eax
je 0x51d613
mov esi, dword [0x59ff1c]
test esi, esi
je 0x51d613
cmp dword [esi + 4], 0
je 0x51d5d8
mov eax, dword [esi + 0x10]
cmp dword [ebp - 0x21c], eax
jb 0x51d60f
lea ecx, [eax + 4]
cmp dword [ebp - 0x21c], ecx
jae 0x51d60f
sub dword [ebp - 0x21c], eax
mov eax, dword [esi + 0xc]
jmp 0x51d5fd
mov eax, dword [esi + 0xc]
cmp dword [ebp - 0x21c], eax
jb 0x51d60f
mov ecx, dword [esi + 0x10]
movzx ecx, byte [ecx + 0x17]
add ecx, eax
cmp dword [ebp - 0x21c], ecx
jae 0x51d60f
sub dword [ebp - 0x21c], eax
mov eax, dword [esi + 0x10]
add dword [ebp - 0x21c], eax
lea eax, [ebp - 0x2d4]
push eax
push dword [edi + 4]
call ebx
mov esi, dword [esi]
jmp 0x51d5ad
mov edi, dword [edi]
test edi, edi
jne 0x51d589
xor ebx, ebx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
mov esi, dword [0x59ff1c]
mov dword [ebp - 4], eax
cmp esi, ebx
je 0x51d683
lea eax, [ebp - 8]
push eax
mov eax, dword [esi + 0x10]
push dword [esi + 0x14]
movzx eax, byte [eax + 0x17]
push eax
push dword [esi + 0xc]
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov eax, dword [esi + 0x10]
movzx eax, byte [eax + 0x17]
push eax
push dword [esi + 0xc]
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_FlushInstructionCache]
cmp dword [esi + 4], ebx
je 0x51d674
mov eax, dword [esi + 0x10]
cmp eax, ebx
je 0x51d674
push eax
call fcn.0051d454
pop ecx
mov dword [esi + 0x10], ebx
mov edi, dword [esi]
push esi
call fcn.0051e1fa
cmp edi, ebx
pop ecx
mov esi, edi
jne 0x51d632
mov dword [0x59ff1c], ebx
call fcn.0051d42d
mov esi, dword [0x59ff18]
cmp esi, ebx
je 0x51d6b0
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_ResumeThread]
mov edi, dword [esi]
push esi
call fcn.0051e1fa
cmp edi, ebx
pop ecx
mov esi, edi
jne 0x51d698
mov eax, dword [ebp + 8]
pop edi
cmp eax, ebx
mov dword [0x59ff18], ebx
mov dword [0x59ff0c], ebx
pop esi
je 0x51d6cd
mov ecx, dword [0x59ff14]
mov dword [eax], ecx
mov eax, dword [0x59ff10]
pop ebx
leave
ret 4