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

Disassembly:
mov ecx, dword [esp + 0xc]
mov eax, dword [ecx + 0x2c]
sub esp, 0x204
test eax, eax
push ebx
push ebp
push esi
push edi
je 0x5128be
mov edx, dword [esp + 0x21c]
mov eax, dword [edx]
cmp eax, 7
je 0x51219c
cmp eax, 8
jne 0x5121a6
cmp dword [edx + 0x34], 2
je 0x5128be
cmp eax, 9
je 0x5121b0
cmp eax, 0xa
jne 0x5121ba
cmp dword [edx + 0x18], 2
je 0x5128be
cmp eax, 6
mov edi, dword [ecx + 4]
mov ecx, dword [ecx + 0x28]
mov ecx, dword [ecx + 0x4c]
mov ebp, dword [esp + 0x218]
mov dword [esp + 0x24], edi
mov dword [esp + 0x20], ecx
jne 0x5121e9
mov ecx, dword [ebp + 0xbb8]
lea ecx, [ecx + ecx*2]
shl ecx, 5
cmp dword [ecx + ebp], 6
je 0x51222d
cmp eax, 2
jne 0x51220f
mov ebx, dword [edi + 0xd4]
xor eax, eax
test ebx, ebx
jle 0x51220f
mov esi, dword [edx + 0x34]
mov ecx, dword [edi + 0xd8]
cmp dword [ecx], esi
je 0x51227b
inc eax
add ecx, 4
cmp eax, ebx
jl 0x512203
mov ecx, dword [ebp + 0xbb8]
inc ecx
mov eax, ecx
cmp eax, 0x1e
mov dword [ebp + 0xbb8], ecx
jl 0x51222d
mov dword [ebp + 0xbb8], 0
mov eax, dword [ebp + 0xbb8]
lea ebx, [eax + eax*2]
shl ebx, 5
add ebx, ebp
mov esi, edx
mov ecx, 0x18
mov edi, ebx
rep movsd dword es:[edi], dword [esi]
mov edx, dword [ebx]
mov eax, dword [edx*4 + 0x5c69c4]
test al, 1
mov dword [esp + 0x44], ebx
mov dword [esp + 0x10], 0
je 0x5122d2
mov eax, dword [esp + 0x24]
push ebx
push eax
call fcn.00561370
add esp, 8
test eax, eax
mov dword [esp + 0x10], eax
jne 0x5122ed
mov dword [esp + 0x10], eax
jmp 0x5122ed
mov eax, dword [ebp + 0xbb8]
lea ecx, [eax + eax*2]
shl ecx, 5
lea edi, [ecx + ebp]
cmp dword [edi], 3
jne 0x51220f
cmp dword [edi + 0x34], esi
jne 0x51220f
test eax, eax
mov ecx, 0x1d
jle 0x5122a4
lea ecx, [eax - 1]
lea eax, [ecx + ecx*2]
shl eax, 5
mov ebx, dword [eax + ebp]
add eax, ebp
cmp ebx, 2
jne 0x51220f
cmp dword [eax + 0x34], esi
jne 0x51220f
mov dword [edi], 0xffffffff
mov dword [ebp + 0xbb8], ecx
jmp 0x51222d
test al, 2
je 0x5122df
mov ecx, dword [ebx + 0x34]
mov dword [esp + 0x10], ecx
jmp 0x5122ed
test eax, 0x20000
je 0x5122ed
mov edx, dword [ebx + 0x34]
mov dword [esp + 0x10], edx
mov eax, dword [ebp + 0xbb8]
mov ecx, dword [esp + 0x10]
mov dword [ebp + eax*4 + 0xb40], ecx
xor edx, edx
xor eax, eax
mov dword [esp + 0x38], edx
mov dword [esp + 0x3c], edx
mov dword [esp + 0x48], eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x40], edx
cmp dword [ebx], 0x23
je 0x512369
mov esi, dword [esp + 0x20]
lea edx, [esp + 0x38]
xor edi, edi
mov dword [esp + 0x38], edi
mov eax, dword [ebx]
push edx
push esi
mov dword [esp + 0x44], eax
mov dword [esp + 0x48], ecx
call dword [esi + 0x2c]
add esp, 8
cmp eax, edi
je 0x512346
mov eax, dword [eax + 0xc]
mov dword [esp + 0x48], eax
cmp dword [esp + 0x40], edi
je 0x51236d
lea ecx, [esp + 0x38]
push ecx
push esi
mov dword [esp + 0x48], edi
call dword [esi + 0x2c]
add esp, 8
cmp eax, edi
je 0x51236d
mov edx, dword [eax + 0xc]
mov dword [esp + 0x2c], edx
jmp 0x51236d
mov esi, dword [esp + 0x20]
mov ecx, dword [0x5debe0]
lea eax, [esp + 0x6c]
lea edi, [esp + 0x4c]
push eax
mov dword [esp + 0x18], edi
mov dword [esp + 0x38], 0
mov dword [esp + 0x20], 5
call dword [ecx + 0x1f0]
mov eax, dword [esp + 0x228]
add esp, 4
test eax, eax
jle 0x5125c3
mov dword [esp + 0x28], 0xc
mov dword [esp + 0x30], eax
mov edx, dword [esp + 0x228]
mov eax, dword [edx]
mov edx, dword [esp + 0x10]
mov dword [esp + 0x38], eax
mov ecx, dword [ebx]
lea eax, [esp + 0x38]
push eax
lea edi, [ebp + 0xbbc]
xor esi, esi
push edi
mov dword [esp + 0x20], esi
mov dword [esp + 0x44], ecx
mov dword [esp + 0x48], edx
call dword [ebp + 0xbe8]
add esp, 8
test eax, eax
je 0x512409
mov edx, dword [eax + 0xc]
mov eax, dword [esp + 0x24]
lea ecx, [esp + 0x18]
push ecx
push esi
push esi
push edx
push ebp
push eax
call fcn.00512900
add esp, 0x18
mov esi, eax
mov eax, dword [esp + 0x48]
test eax, eax
je 0x512430
mov edx, dword [esp + 0x228]
lea ecx, [esp + 0x18]
push ecx
mov ecx, dword [esp + 0x28]
push edx
push esi
push eax
push ebp
push ecx
call fcn.00512900
add esp, 0x18
mov esi, eax
mov eax, dword [esp + 0x10]
test eax, eax
je 0x512495
test esi, esi
jne 0x51249d
lea edx, [esp + 0x38]
push edx
push edi
mov dword [esp + 0x48], esi
call dword [ebp + 0xbe8]
add esp, 8
test eax, eax
je 0x51246e
mov edx, dword [eax + 0xc]
mov eax, dword [esp + 0x24]
lea ecx, [esp + 0x18]
push ecx
push esi
push esi
push edx
push ebp
push eax
call fcn.00512900
add esp, 0x18
mov esi, eax
mov eax, dword [esp + 0x2c]
test eax, eax
je 0x512495
mov edx, dword [esp + 0x228]
lea ecx, [esp + 0x18]
push ecx
push edx
push esi
push eax
mov eax, dword [esp + 0x34]
push ebp
push eax
call fcn.00512900
add esp, 0x18
mov esi, eax
test esi, esi
je 0x51259b
mov eax, dword [esp + 0x18]
mov ecx, dword [eax + 4]
test ecx, ecx
jne 0x5124bd
mov ecx, dword [0x5debe0]
push str.Tk_BindEvent:_missing_command
call dword [ecx + 0x10]
mov eax, dword [esp + 0x1c]
add esp, 4
cmp dword [eax + 4], 1
jne 0x5124ee
mov ecx, dword [esp + 0x10]
mov eax, dword [eax + 0xc]
lea edx, [esp + 0x6c]
push edx
mov edx, dword [esp + 0x220]
push ecx
mov ecx, dword [esp + 0x228]
push edx
push eax
push ecx
call fcn.00512ce0
add esp, 0x14
jmp 0x512580
mov edx, dword [esp + 0x34]
mov ecx, dword [esp + 0x1c]
cmp edx, ecx
jb 0x51255a
mov eax, ecx
mov ecx, dword [0x5debe0]
lea esi, [eax*4 + 0xc]
add eax, eax
mov dword [esp + 0x1c], eax
lea eax, [eax*4 + 0xc]
push eax
call dword [ecx + 0x14]
mov ecx, esi
mov esi, dword [esp + 0x18]
mov edx, ecx
shr ecx, 2
mov ebx, eax
mov edi, ebx
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x18]
lea eax, [esp + 0x50]
add esp, 4
cmp ecx, eax
je 0x51254e
mov edx, dword [0x5debe0]
push ecx
call dword [edx + 0x18]
add esp, 4
mov eax, dword [esp + 0x18]
mov dword [esp + 0x14], ebx
mov ebx, dword [esp + 0x44]
mov esi, dword [eax + 0x14]
mov edx, dword [esp + 0x14]
inc esi
mov dword [eax + 0x14], esi
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x18]
mov dword [eax + edx], ecx
mov edx, dword [esp + 0x34]
inc edx
add eax, 4
mov dword [esp + 0x34], edx
mov dword [esp + 0x28], eax
mov ecx, dword [0x5debe0]
push 1
lea eax, [esp + 0x70]
push 0x5debc4
push eax
call dword [ecx + 0x1dc]
add esp, 0xc
mov ecx, dword [esp + 0x228]
mov eax, dword [esp + 0x30]
add ecx, 4
dec eax
mov dword [esp + 0x228], ecx
mov dword [esp + 0x30], eax
jne 0x5123b4
mov esi, dword [esp + 0x20]
mov edi, dword [esp + 0x14]
mov eax, dword [esp + 0x70]
test eax, eax
je 0x5128be
mov eax, dword [0x5debe0]
mov ebx, dword [ebp + 0xc2c]
lea edx, [esp + 0x140]
push edx
call dword [eax + 0x1f0]
mov edx, dword [0x5debe0]
lea ecx, [esp + 0x144]
push ecx
push ebx
call dword [edx + 0x1ec]
mov ecx, dword [esi + 0x74]
mov eax, dword [esi + 0x70]
mov ebp, dword [esp + 0x22c]
mov dword [esp + 0x28], ecx
mov ecx, dword [esp + 0x30]
add esp, 0xc
cmp ecx, eax
mov dword [esp + 0x2c], eax
jne 0x512626
mov edx, dword [esp + 0x1c]
cmp dword [ebp + 8], edx
je 0x51263d
mov dword [esi + 0x70], ecx
mov eax, dword [ebp + 8]
push eax
mov dword [esi + 0x74], eax
mov eax, dword [ecx + 8]
push eax
push ebx
call fcn.005134c0
add esp, 0xc
mov eax, dword [esp + 0x34]
test eax, eax
jbe 0x512657
mov ecx, dword [esi + 0x7c]
mov dword [edi], ecx
mov dword [edi + 4], ebp
mov dword [edi + 8], 0
mov dword [esi + 0x7c], edi
mov eax, dword [ebp + 0x98]
mov edx, dword [esp + 0x70]
mov dword [esp + 0x44], eax
and eax, 0xfffff7ff
mov dword [ebp + 0x98], eax
mov ebp, dword [esp + 0x6c]
mov ecx, dword [0x5debe0]
lea eax, [edx + ebp]
push esi
mov dword [esp + 0x2c], eax
call dword [ecx + 0x32c]
mov eax, dword [esp + 0x2c]
add esp, 4
cmp ebp, eax
jae 0x5127a7
add edi, 0xc
mov dword [esp + 0x30], edi
mov eax, dword [esp + 0x20]
mov ecx, dword [eax + 0x80]
test ecx, ecx
jne 0x5126af
inc dword [eax + 0x78]
mov edx, dword [0x5debe0]
push ebx
call dword [edx + 0x118]
mov al, byte [ebp]
add esp, 4
test al, al
jne 0x512731
mov eax, dword [esp + 0x30]
mov esi, dword [eax]
add eax, 4
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x14]
mov ecx, dword [eax + 8]
xor edi, edi
test ecx, ecx
jne 0x512708
test byte [esi + 0x10], 2
jne 0x512708
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x220]
mov eax, dword [esp + 0x21c]
push ecx
mov ecx, dword [esi + 0xc]
push edx
push eax
push ebx
push ecx
call dword [esi + 4]
add esp, 0x14
mov edi, eax
dec dword [esi + 0x14]
jne 0x51275a
test byte [esi + 0x10], 2
je 0x51275a
mov eax, dword [esi + 8]
test eax, eax
je 0x512723
mov edx, dword [esi + 0xc]
push edx
call eax
add esp, 4
mov eax, dword [0x5debe0]
push esi
call dword [eax + 0x18]
add esp, 4
jmp 0x51275a
or ecx, 0xffffffff
xor eax, eax
mov edi, ebp
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov esi, ecx
mov ecx, dword [0x5debe0]
push 0x20000
push esi
push ebp
push ebx
call dword [ecx + 0x494]
add esp, 0x10
mov edi, eax
add ebp, esi
mov eax, dword [esp + 0x20]
mov ecx, dword [eax + 0x80]
inc ebp
test ecx, ecx
jne 0x51276c
dec dword [eax + 0x78]
test edi, edi
je 0x512775
cmp edi, 4
jne 0x512781
cmp ebp, dword [esp + 0x28]
jb 0x51269e
jmp 0x5127a7
cmp edi, 3
je 0x5127a7
mov edx, dword [0x5debe0]
push str._n_____command_bound_to_event_
push ebx
call dword [edx + 0x110]
mov eax, dword [0x5debe0]
push ebx
call dword [eax + 0x138]
add esp, 0xc
mov ebp, dword [esp + 0x34]
test ebp, ebp
mov edi, dword [esp + 0x14]
jbe 0x51280b
mov eax, dword [edi + 8]
test eax, eax
jne 0x51280b
mov edx, dword [esp + 0x220]
mov eax, dword [edx + 0x98]
mov esi, eax
xor esi, dword [esp + 0x44]
mov ecx, eax
and esi, 0x800
and ecx, 0x800
xor esi, eax
test ecx, ecx
mov dword [edx + 0x98], esi
je 0x51280b
mov eax, dword [edx + 0xc8]
test eax, eax
je 0x51280b
cmp dword [eax], 0xc
jbe 0x51280b
mov eax, dword [eax + 0xc]
test eax, eax
je 0x51280b
mov ecx, dword [esp + 0x21c]
push ecx
push edx
call eax
add esp, 8
mov esi, dword [esp + 0x20]
mov eax, dword [esi + 0x80]
test eax, eax
jne 0x51284e
mov eax, dword [esi + 0x78]
test eax, eax
je 0x51284e
mov edx, dword [esp + 0x2c]
cmp edx, dword [esi + 0x70]
jne 0x512832
mov eax, dword [esp + 0x1c]
cmp eax, dword [esi + 0x74]
je 0x51284e
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x1c]
push ecx
mov dword [esi + 0x70], eax
mov dword [esi + 0x74], ecx
mov ecx, dword [eax + 8]
push ecx
push ebx
call fcn.005134c0
add esp, 0xc
mov eax, dword [0x5debe0]
lea edx, [esp + 0x140]
push edx
push ebx
call dword [eax + 0x1f4]
mov edx, dword [0x5debe0]
lea ecx, [esp + 0x74]
push ecx
call dword [edx + 0x1e8]
add esp, 0xc
test ebp, ebp
jbe 0x5128af
mov eax, dword [esi + 0x80]
test eax, eax
jne 0x51289a
mov eax, dword [esi + 0x7c]
cmp eax, edi
lea ecx, [esi + 0x7c]
je 0x512896
mov ecx, eax
mov eax, dword [ecx]
cmp eax, edi
jne 0x51288e
mov eax, dword [edi]
mov dword [ecx], eax
lea ecx, [esp + 0x4c]
cmp edi, ecx
je 0x5128af
mov edx, dword [0x5debe0]
push edi
call dword [edx + 0x18]
add esp, 4
mov eax, dword [0x5debe0]
push esi
call dword [eax + 0x368]
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x204
ret