Function at 0x522850
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x6039b8
mov eax, dword fs:[0]
push eax
sub esp, 0x20
push ebx
push esi
push edi
mov eax, dword [0x6687b8]
xor eax, esp
push eax
lea eax, [esp + 0x30]
mov dword fs:[0], eax
call fcn.0051bef0
mov ecx, dword [ebp + 8]
xor ebx, ebx
cmp eax, ebx
mov dword [ecx], eax
jne 0x5228a6
mov eax, 0x80004005
mov ecx, dword [esp + 0x30]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
push 0xffffffffffffffff
push eax
mov dword [esp + 0x2c], eax
mov byte [esp + 0x30], bl
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, ebx
je 0x5228c2
cmp eax, 0x80
jne 0x5228c7
mov byte [esp + 0x28], 1
lea edi, [esp + 0x14]
mov dword [esp + 0x38], ebx
call fcn.0047ac70
mov byte [esp + 0x38], 1
mov edi, dword [esp + 0x14]
mov eax, dword [edi - 0xc]
cmp eax, ebx
jle 0x522908
lea ecx, [eax - 1]
cmp ecx, ebx
jl 0x522964
cmp ecx, eax
jg 0x522964
movzx eax, word [edi + ecx*2]
cmp ax, 0x5c
je 0x522908
push 0x5c
lea edi, [esp + 0x18]
call fcn.0040af90
mov edi, dword [esp + 0x14]
mov edx, dword [0x677600]
mov eax, dword [edx + 0xc]
mov ecx, 0x677600
call eax
lea esi, [eax + 0x10]
mov dword [esp + 0x10], esi
mov byte [esp + 0x38], 2
mov eax, dword [esi - 8]
mov ecx, 1
sub ecx, dword [esi - 4]
sub eax, 0x402
or eax, ecx
jge 0x52294a
mov ecx, 0x402
lea eax, [esp + 0x10]
call fcn.00403540
mov esi, dword [esp + 0x10]
lea ecx, [esp + 0x20]
push ecx
push esi
push 0x400
push edi
call dword [sym.imp.KERNEL32.dll_GetFullPathNameW]
cmp esi, ebx
jne 0x52296e
xor eax, eax
jmp 0x522984
push 0x80070057
call fcn.00403650
mov eax, esi
lea edx, [eax + 2]
mov cx, word [eax]
add eax, 2
cmp cx, bx
jne 0x522973
sub eax, edx
sar eax, 1
js 0x522964
cmp eax, dword [esi - 8]
jg 0x522964
push 0x2e
push 0x5c
lea edx, [esp + 0x18]
mov dword [esi - 0xc], eax
push edx
mov word [esi + eax*2], bx
call fcn.004f5360
push 0x2e
push 0x2f
lea eax, [esp + 0x18]
push eax
call fcn.004f5360
push 7
push 0x638df8
lea ecx, [esp + 0x18]
push ecx
call fcn.0040aee0
push 0x454
push 0x638da4
lea edi, [esp + 0x18]
call fcn.0040e190
mov esi, dword [esp + 0x18]
mov edi, dword [esi - 0xc]
mov eax, dword [esi - 8]
mov ecx, 1
sub ecx, dword [esi - 4]
sub eax, edi
add esp, 8
or eax, ecx
jge 0x5229fa
mov ecx, edi
lea eax, [esp + 0x10]
call fcn.00403540
mov esi, dword [esp + 0x10]
lea edx, [edi + 1]
push edx
push esi
call fcn.005d45bb
add esp, 8
cmp edi, ebx
jl 0x522964
cmp edi, dword [esi - 8]
jg 0x522964
mov dword [esi - 0xc], edi
mov word [esi + edi*2], bx
mov dword [esp + 0x18], ebx
mov ebx, dword [ebp + 8]
lea eax, [esp + 0x18]
add ebx, 8
push eax
mov eax, 0x12d000
mov ecx, esi
mov edx, ebx
call fcn.0050de80
test eax, eax
mov dword [esp + 0x1c], eax
jge 0x522a6e
add esi, 0xfffffff0
mov byte [esp + 0x38], 1
lea ecx, [esi + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x522b2f
mov ecx, dword [esi]
mov eax, dword [ecx]
mov edx, dword [eax + 4]
push esi
call edx
jmp 0x522b2f
cmp dword [esp + 0x18], 0
mov edi, dword [ebx]
jne 0x522ae8
test edi, edi
je 0x522aae
lea eax, [edi + 0xa17c]
test eax, eax
mov dword [edi], 0x12d000
mov dword [edi + 4], 0x285b
je 0x522a94
sub eax, edi
push 0xa16c
lea ecx, [edi + 0x10]
push 0
push ecx
mov dword [edi + 8], eax
call fcn.005da970
add esp, 0xc
mov byte [edi + 0xc], 1
mov edi, dword [ebp + 8]
mov eax, edi
call fcn.00522b80
cmp dword [edi + 0x28], 0
jne 0x522b0e
mov eax, dword [ebx]
lea edx, [esp + 0x18]
push edx
push 0
push edi
push 0x522c10
push 0
mov byte [edi + 0x2c], 0
push 0
mov byte [eax + 0xc], 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
test eax, eax
mov dword [edi + 0x28], eax
jne 0x522b0e
jmp 0x522b08
cmp dword [ebp + 0xc], 0
je 0x522b0e
mov edi, dword [ebp + 8]
mov eax, edi
call fcn.00522b80
mov eax, dword [ebx]
mov byte [edi + 0x2c], 0
push edi
mov byte [eax + 0xc], 0
call fcn.00522c30
mov ebx, dword [ebx]
mov byte [ebx + 0xc], 1
add esi, 0xfffffff0
mov byte [esp + 0x38], 1
lea eax, [esi + 0xc]
or ecx, 0xffffffff
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x522b2f
mov ecx, dword [esi]
mov edx, dword [ecx]
mov eax, dword [edx + 4]
push esi
call eax
mov byte [esp + 0x38], 0
mov eax, dword [esp + 0x14]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x522b54
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
cmp byte [esp + 0x28], 0
je 0x522b66
mov ecx, dword [esp + 0x24]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x30]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8