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

Disassembly:
sub esp, 0x40
push ebx
push ebp
push esi
or ebx, 0xffffffff
xor ebp, ebp
push edi
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x20], ebp
call sym.alleg40.dll_scare_mouse
mov eax, dword [esp + 0x74]
mov ecx, dword [esp + 0x70]
mov edx, dword [esp + 0x64]
push eax
mov eax, dword [esp + 0x64]
push ecx
mov ecx, dword [esp + 0x64]
push edx
mov edx, dword [esp + 0x64]
push eax
mov eax, dword [esp + 0x64]
push ecx
push edx
lea ecx, [esp + 0x3c]
push eax
push ecx
call fcn.10022560
mov eax, dword [esp + 0x88]
mov esi, dword [esp + 0x64]
mov edi, dword [esp + 0x60]
add esp, 0x20
cmp eax, ebp
je 0x10021752
mov ecx, dword [sym.alleg40.dll_gfx_driver]
cmp ecx, ebp
je 0x100216af
mov eax, dword [ecx + 0x68]
jmp 0x100216b1
xor eax, eax
mov edx, dword [esp + 0x38]
sub eax, edi
dec eax
cmp edx, eax
jge 0x100216c0
mov eax, edx
jmp 0x100216ce
cmp ecx, ebp
je 0x100216c9
mov eax, dword [ecx + 0x68]
jmp 0x100216cb
xor eax, eax
sub eax, edi
dec eax
cmp eax, ebp
jge 0x100216d8
mov dword [esp + 0x38], ebp
jmp 0x100216fc
cmp ecx, ebp
je 0x100216e1
mov eax, dword [ecx + 0x68]
jmp 0x100216e3
xor eax, eax
sub eax, edi
dec eax
cmp edx, eax
jl 0x100216fc
cmp ecx, ebp
je 0x100216f3
mov eax, dword [ecx + 0x68]
jmp 0x100216f5
xor eax, eax
sub eax, edi
dec eax
mov dword [esp + 0x38], eax
cmp ecx, ebp
je 0x10021705
mov eax, dword [ecx + 0x6c]
jmp 0x10021707
xor eax, eax
mov edx, dword [esp + 0x3c]
sub eax, esi
dec eax
cmp edx, eax
jge 0x10021716
mov eax, edx
jmp 0x10021724
cmp ecx, ebp
je 0x1002171f
mov eax, dword [ecx + 0x6c]
jmp 0x10021721
xor eax, eax
sub eax, esi
dec eax
cmp eax, ebp
jge 0x1002172e
mov dword [esp + 0x3c], ebp
jmp 0x10021752
cmp ecx, ebp
je 0x10021737
mov eax, dword [ecx + 0x6c]
jmp 0x10021739
xor eax, eax
sub eax, esi
dec eax
cmp edx, eax
jl 0x10021752
cmp ecx, ebp
je 0x10021749
mov eax, dword [ecx + 0x6c]
jmp 0x1002174b
xor eax, eax
sub eax, esi
dec eax
mov dword [esp + 0x3c], eax
inc esi
inc edi
push esi
push edi
call sym.alleg40.dll_create_bitmap
add esp, 8
cmp eax, ebp
mov dword [esp + 0x4c], eax
je 0x10021790
mov edx, dword [esp + 0x44]
mov ecx, dword [esp + 0x40]
inc edx
inc ecx
push edx
mov edx, dword [esp + 0x40]
push ecx
mov ecx, dword [esp + 0x40]
push ebp
push ebp
push edx
mov edx, dword [sym.alleg40.dll_screen]
push ecx
push eax
push edx
call sym.alleg40.dll_blit
add esp, 0x20
jmp 0x1002179b
mov eax, dword [sym.alleg40.dll_allegro_errno]
mov dword [eax], 0xc
lea ecx, [esp + 0x24]
push ecx
call fcn.10022480
mov esi, eax
add esp, 4
mov dword [esp + 0x70], esi
mov dword [esp + 0x34], esi
call dword [sym.alleg40.dll_gui_mouse_b]
mov edi, eax
mov dword [0x1007f2e4], ebp
mov dword [esp + 0x74], edi
call sym.alleg40.dll_unscare_mouse
mov edx, dword [sym.alleg40.dll_system_driver]
mov eax, dword [edx + 0x74]
cmp eax, ebp
je 0x100217d8
call eax
mov eax, dword [esp + 0x34]
lea ecx, [esp + 0x24]
push ecx
mov dword [esp + 0x68], eax
call fcn.10022480
add esp, 4
mov dword [esp + 0x10], eax
call dword [sym.alleg40.dll_gui_mouse_b]
test eax, eax
mov eax, dword [esp + 0x10]
jne 0x10021803
cmp eax, esi
je 0x10021815
mov dword [esp + 0x70], eax
mov dword [esp + 0x34], eax
mov dword [0x10077db8], 0xffffffff
call dword [sym.alleg40.dll_gui_mouse_b]
test eax, eax
je 0x100218a9
call dword [sym.alleg40.dll_gui_mouse_x]
cmp eax, dword [esp + 0x38]
jl 0x10021863
call dword [sym.alleg40.dll_gui_mouse_x]
mov edx, dword [esp + 0x38]
mov ecx, dword [esp + 0x40]
add ecx, edx
cmp eax, ecx
jge 0x10021863
call dword [sym.alleg40.dll_gui_mouse_y]
cmp eax, dword [esp + 0x3c]
jl 0x10021863
call dword [sym.alleg40.dll_gui_mouse_y]
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x44]
add ecx, edx
cmp eax, ecx
jl 0x10021880
mov edx, dword [esp + 0x28]
push edx
call fcn.10022530
add esp, 4
test eax, eax
jne 0x10021df1
cmp edi, ebp
je 0x10021df1
mov eax, dword [esp + 0x34]
cmp eax, ebp
jl 0x10021897
mov edx, dword [esp + 0x24]
lea ecx, [eax + eax*4]
cmp dword [edx + ecx*4 + 8], ebp
je 0x10021897
mov ebx, eax
mov dword [esp + 0x74], 0xffffffff
call sym.alleg40.dll_clear_keybuf
jmp 0x10021ad4
cmp edi, ebp
je 0x100218b5
mov ebx, dword [esp + 0x34]
mov dword [esp + 0x74], ebp
call sym.alleg40.dll_keypressed
test eax, eax
je 0x10021ad4
mov dword [0x1007f2e4], ebp
mov dword [0x10077db8], ebp
call sym.alleg40.dll_readkey
mov ecx, eax
mov dword [esp + 0x10], eax
and ecx, 0xff
cmp ecx, 0x1b
je 0x10021dbf
mov edx, eax
sar edx, 8
lea esi, [edx - 0x43]
cmp esi, 0x12
ja case.0x10021905.72
mov edi, dword [esp + 0x34]
xor edx, edx
mov dl, byte [esi + 0x10021ea8]
jmp dword [edx*4 + 0x10021e90]
mov ecx, dword [esp + 0x28]
cmp ecx, ebp
jne 0x10021dc4
mov ecx, dword [esp + 0x2c]
and al, 0
cmp eax, 0x5200
jne 0x10021929
cmp ecx, ebp
jne 0x1002193c
cmp eax, 0x5400
jne 0x10021ad4
cmp ecx, ebp
jne 0x10021ad4
mov eax, dword [esp + 0x34]
dec eax
mov dword [esp + 0x10], eax
jns 0x10021950
mov eax, dword [esp + 0x30]
dec eax
mov dword [esp + 0x10], eax
mov edx, dword [esp + 0x24]
lea ecx, [eax + eax*4]
mov eax, dword [edx + ecx*4]
push eax
call dword [sym.alleg40.dll_ugetc]
add esp, 4
test eax, eax
mov eax, dword [esp + 0x10]
jne 0x10021972
cmp eax, dword [esp + 0x34]
jne 0x10021940
mov dword [esp + 0x34], eax
jmp 0x10021ad4
cmp edi, ebp
jl 0x1002198c
mov edx, dword [esp + 0x24]
lea ecx, [edi + edi*4]
cmp dword [edx + ecx*4 + 8], ebp
jne case.0x10021905.71
mov ecx, dword [esp + 0x28]
cmp ecx, ebp
je case.0x10021905.71
cmp dword [ecx + 8], ebp
jne 0x10021dd0
mov edx, dword [esp + 0x2c]
cmp edi, ebp
jl 0x100219d6
mov esi, dword [esp + 0x24]
lea ecx, [edi + edi*4]
cmp dword [esi + ecx*4 + 8], ebp
je 0x100219d6
mov ecx, eax
and cl, 0
cmp ecx, 0x5300
jne 0x100219c3
cmp edx, ebp
je 0x100219cf
cmp ecx, 0x5500
jne 0x100219d6
cmp edx, ebp
je 0x100219d6
mov ebx, edi
jmp 0x10021ad4
and al, 0
cmp eax, 0x5300
jne 0x100219e3
cmp edx, ebp
jne 0x100219f6
cmp eax, 0x5500
jne 0x10021ad4
cmp edx, ebp
jne 0x10021ad4
mov eax, edi
mov ecx, dword [esp + 0x30]
inc eax
cmp eax, ecx
mov dword [esp + 0x10], eax
jl 0x10021a0b
xor eax, eax
mov dword [esp + 0x10], eax
lea edx, [eax + eax*4]
mov eax, dword [esp + 0x24]
mov ecx, dword [eax + edx*4]
push ecx
call dword [sym.alleg40.dll_ugetc]
add esp, 4
test eax, eax
mov eax, dword [esp + 0x10]
jne 0x10021a2d
cmp eax, dword [esp + 0x34]
jne 0x100219f8
mov dword [esp + 0x34], eax
jmp 0x10021ad4
mov eax, dword [esp + 0x34]
cmp eax, ebp
jl 0x10021ad4
mov ebx, eax
jmp 0x10021ad4
cmp dword [esp + 0x28], ebp
jne 0x10021a65
cmp ecx, ebp
jne 0x10021a65
mov edx, dword [esp + 0x24]
push edx
push eax
call fcn.10021540
add esp, 8
mov dword [esp + 0x10], eax
mov ecx, dword [esp + 0x24]
xor edi, edi
cmp dword [ecx], ebp
je 0x10021aa1
xor esi, esi
mov ecx, dword [esi + ecx]
push ecx
push eax
call fcn.10022740
add esp, 8
test eax, eax
jne 0x10021a97
mov ecx, dword [esp + 0x24]
add esi, 0x14
inc edi
mov eax, dword [esi + ecx]
cmp eax, ebp
mov eax, dword [esp + 0x10]
jne 0x10021a71
jmp 0x10021aa1
mov eax, dword [esp + 0x10]
mov dword [esp + 0x34], edi
mov ebx, edi
mov edx, dword [esp + 0x28]
cmp edx, ebp
je 0x10021ad4
mov ecx, dword [edx + 4]
xor esi, esi
cmp ecx, ebp
je 0x10021abc
mov edx, ecx
inc esi
mov ecx, dword [edx + 4]
cmp ecx, ebp
jne 0x10021ab2
mov edx, dword [edx]
push edx
push eax
call fcn.10021540
add esp, 8
cmp eax, ebp
mov dword [esp + 0x10], eax
jne 0x10021d9d
mov edi, dword [esp + 0x1c]
mov esi, dword [esp + 0x64]
cmp edi, ebp
jne 0x10021ae6
cmp dword [esp + 0x34], esi
je 0x10021b61
mov dword [0x1007f2e4], ebp
call sym.alleg40.dll_scare_mouse
mov ecx, dword [sym.alleg40.dll_screen]
mov eax, dword [ecx + 0x1c]
mov eax, dword [eax + 0x10]
cmp eax, ebp
je 0x10021b07
push ecx
call eax
add esp, 4
cmp edi, ebp
je 0x10021b1e
lea ecx, [esp + 0x24]
push ecx
call fcn.100223b0
add esp, 4
mov dword [esp + 0x1c], ebp
jmp 0x10021b46
cmp esi, ebp
jl 0x10021b30
lea edx, [esp + 0x24]
push esi
push edx
call fcn.10021f70
add esp, 8
mov eax, dword [esp + 0x34]
cmp eax, ebp
jl 0x10021b46
push eax
lea eax, [esp + 0x28]
push eax
call fcn.10021f70
add esp, 8
mov ecx, dword [sym.alleg40.dll_screen]
mov edx, dword [ecx + 0x1c]
mov eax, dword [edx + 0x14]
cmp eax, ebp
je 0x10021b5c
push ecx
call eax
add esp, 4
call sym.alleg40.dll_unscare_mouse
cmp dword [0x10077db8], ebp
je 0x10021c15
cmp dword [0x1007f2e8], ebp
jl 0x10021c15
call dword [sym.alleg40.dll_gui_mouse_x]
cmp eax, dword [esp + 0x38]
jl 0x10021bb9
call dword [sym.alleg40.dll_gui_mouse_x]
mov ecx, dword [esp + 0x38]
mov edx, dword [esp + 0x40]
add edx, ecx
cmp eax, edx
jge 0x10021bb9
call dword [sym.alleg40.dll_gui_mouse_y]
cmp eax, dword [esp + 0x3c]
jl 0x10021bb9
call dword [sym.alleg40.dll_gui_mouse_y]
mov ecx, dword [esp + 0x3c]
mov edx, dword [esp + 0x44]
add edx, ecx
cmp eax, edx
jl 0x10021bce
mov eax, dword [esp + 0x28]
push eax
call fcn.10022530
add esp, 4
test eax, eax
jne 0x10021dec
mov eax, dword [esp + 0x70]
mov ecx, dword [esp + 0x24]
cmp eax, ebp
jl 0x10021c0f
lea edx, [eax + eax*4]
cmp dword [ecx + edx*4 + 8], ebp
je 0x10021c0f
cmp dword [esp + 0x2c], ebp
je 0x10021bfd
cmp dword [esp + 0x20], ebp
je 0x10021c0f
mov dword [0x1007f2e4], ebp
mov ebx, eax
mov dword [esp + 0x20], ebp
jmp 0x10021c19
mov edx, dword [0x1007f2e4]
mov esi, dword [0x1007f2e8]
cmp edx, esi
jle 0x10021c0f
mov ebx, eax
mov dword [esp + 0x20], ebp
jmp 0x10021c19
mov ecx, dword [esp + 0x24]
cmp ebx, ebp
jl 0x10021d2b
lea esi, [ebx + ebx*4]
shl esi, 2
test byte [esi + ecx + 0xc], 0x20
je 0x10021c36
or ebx, 0xffffffff
jmp 0x10021d2b
cmp dword [esi + ecx + 8], ebp
je 0x10021d2b
cmp dword [esp + 0x2c], ebp
je 0x10021c84
lea eax, [esp + 0x10]
lea ecx, [esp + 0x18]
push eax
lea edx, [esp + 0x18]
push ecx
push edx
lea eax, [esp + 0x30]
push ebx
push eax
call fcn.10021ec0
mov edi, dword [esp + 0x28]
mov ecx, dword [sym.alleg40.dll_font]
add edi, 6
push ecx
mov dword [esp + 0x2c], edi
call sym.alleg40.dll_text_height
mov edx, dword [esp + 0x30]
add esp, 0x18
lea eax, [edx + eax + 7]
jmp 0x10021cc9
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x40]
lea edx, [ecx + eax - 3]
mov eax, dword [sym.alleg40.dll_font]
push eax
mov dword [esp + 0x18], edx
call sym.alleg40.dll_text_height
mov ecx, dword [sym.alleg40.dll_font]
mov edi, eax
add edi, 4
push ecx
imul edi, ebx
call sym.alleg40.dll_text_height
cdq
and edx, 3
add esp, 8
add eax, edx
mov edx, dword [esp + 0x3c]
sar eax, 2
add edx, edi
lea eax, [eax + edx + 1]
mov edx, dword [esp + 0x24]
push ebp
push ebp
or edi, 0xffffffff
push ebp
push edi
mov dword [esp + 0x28], eax
push eax
mov eax, dword [esp + 0x28]
lea ecx, [esp + 0x38]
push eax
mov eax, dword [esi + edx + 8]
push ebp
push ecx
push eax
call fcn.10021640
add esp, 0x24
cmp eax, ebp
mov dword [esp + 0x10], eax
jge 0x10021d2b
lea ecx, [esp + 0x24]
mov ebx, edi
push ecx
mov dword [esp + 0x78], ebp
call fcn.10022480
mov ecx, dword [esp + 0x14]
add esp, 4
cmp ecx, 0xfffffffe
mov dword [esp + 0x70], eax
jne 0x10021d2b
mov dword [esp + 0x34], eax
mov dword [esp + 0x1c], edi
mov dword [0x1007f2e4], ebp
mov dword [esp + 0x20], edi
cmp dword [esp + 0x2c], ebp
je 0x10021d8c
call dword [sym.alleg40.dll_gui_mouse_b]
test eax, eax
jne 0x10021d8c
call sym.alleg40.dll_keypressed
test eax, eax
jne 0x10021d8c
call dword [sym.alleg40.dll_gui_mouse_x]
cmp eax, dword [esp + 0x38]
jl 0x10021df1
call dword [sym.alleg40.dll_gui_mouse_x]
mov edx, dword [esp + 0x38]
mov ecx, dword [esp + 0x40]
add ecx, edx
cmp eax, ecx
jge 0x10021df1
call dword [sym.alleg40.dll_gui_mouse_y]
cmp eax, dword [esp + 0x3c]
jl 0x10021df1
call dword [sym.alleg40.dll_gui_mouse_y]
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x44]
add ecx, edx
cmp eax, ecx
jge 0x10021df1
cmp ebx, ebp
jge 0x10021df1
mov edi, dword [esp + 0x74]
mov esi, dword [esp + 0x70]
jmp 0x100217c9
mov edx, esi
dec esi
test edx, edx
jle 0x10021db6
inc esi
push 0x1b
call sym.alleg40.dll_simulate_keypress
add esp, 4
dec esi
jne 0x10021da5
mov eax, dword [esp + 0x10]
push eax
call sym.alleg40.dll_simulate_keypress
add esp, 4
or ebx, 0xffffffff
jmp 0x10021df1
cmp dword [ecx + 8], ebp
je 0x10021de7
push 0x5200
jmp 0x10021dd5
push 0x5300
call sym.alleg40.dll_simulate_keypress
push 0x5500
call sym.alleg40.dll_simulate_keypress
add esp, 8
or ebx, 0xffffffff
jmp 0x10021df1
mov ebx, 0xfffffffe
mov esi, dword [esp + 0x6c]
cmp esi, ebp
je 0x10021dfb
mov dword [esi], ebp
mov eax, dword [esp + 0x48]
cmp eax, ebp
jne 0x10021e1d
cmp ebx, ebp
jl 0x10021e3e
mov ecx, dword [esp + 0x24]
lea eax, [ebx + ebx*4]
lea eax, [ecx + eax*4]
mov dword [sym.alleg40.dll_active_menu], eax
mov eax, dword [eax + 4]
mov dword [esp + 0x48], eax
cmp ebx, ebp
jl 0x10021e3e
mov ecx, dword [esp + 0x58]
cmp ecx, ebp
je 0x10021e2e
mov dword [ecx + 0x24], eax
jmp 0x10021e3e
cmp eax, ebp
je 0x10021e3e
call eax
cmp esi, ebp
mov dword [esp + 0x10], eax
je 0x10021e3e
mov dword [esi], eax
cmp dword [esp + 0x4c], ebp
je 0x10021e83
call sym.alleg40.dll_scare_mouse
mov edx, dword [esp + 0x44]
mov eax, dword [esp + 0x40]
mov ecx, dword [esp + 0x3c]
inc edx
inc eax
push edx
mov edx, dword [esp + 0x3c]
push eax
mov eax, dword [sym.alleg40.dll_screen]
push ecx
mov ecx, dword [esp + 0x58]
push edx
push ebp
push ebp
push eax
push ecx
call sym.alleg40.dll_blit
call sym.alleg40.dll_unscare_mouse
mov edx, dword [esp + 0x6c]
push edx
call sym.alleg40.dll_destroy_bitmap
add esp, 0x24
pop edi
pop esi
mov eax, ebx
pop ebp
pop ebx
add esp, 0x40
ret