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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x4ce848
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x60
push ebx
push esi
mov esi, ecx
mov eax, dword [esi + 0xa8]
test eax, eax
push edi
je 0x40a6cf
push 0x4d7404
lea ecx, [eax + 0x10]
call fcn.00403460
test al, al
je 0x40a6cf
mov ecx, dword [ebp + 0xc]
mov eax, dword [ebp + 8]
push ecx
push eax
mov dword [esi + 0x494], eax
lea eax, [esp + 0x50]
push str.Level__d__d
push eax
mov dword [esi + 0x498], ecx
call fcn.004887ad
add esp, 0x10
push str.Level
lea ecx, [esp + 0x24]
call fcn.00431b00
mov ecx, dword [esi + 0xa8]
lea edx, [esp + 0x20]
push edx
mov dword [esp + 0x78], 0
call fcn.00409e50
or ebx, 0xffffffff
lea ecx, [esp + 0x20]
mov edi, eax
mov dword [esp + 0x74], ebx
call fcn.00431a00
test edi, edi
je 0x40a017
lea eax, [esp + 0x48]
push eax
lea ecx, [esp + 0x24]
call fcn.00431b00
lea ecx, [esp + 0x20]
push ecx
mov ecx, edi
mov dword [esp + 0x78], 1
call fcn.00464d80
lea ecx, [esp + 0x20]
mov dword [esp + 0x74], ebx
call fcn.00431a00
mov al, byte [ebp + 0x10]
test al, al
je 0x40a4a8
push str.MapStageCompleteSound
lea ecx, [esp + 0x24]
call fcn.00431b00
mov ecx, dword [esi + 0x9c]
lea edx, [esp + 0x20]
push edx
push 0xb
mov dword [esp + 0x7c], 2
call fcn.00458290
lea ecx, [esp + 0x20]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_S
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_S
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 3
call fcn.00431b00
lea eax, [esp + 0x18]
push eax
lea ecx, [esp + 0x24]
push ecx
mov ecx, esi
mov byte [esp + 0x7c], 4
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 3
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_T
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_T
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 5
call fcn.00431b00
lea edx, [esp + 0x18]
push edx
lea eax, [esp + 0x24]
push eax
mov ecx, esi
mov byte [esp + 0x7c], 6
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 5
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_A
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_A
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 7
call fcn.00431b00
lea ecx, [esp + 0x18]
push ecx
lea edx, [esp + 0x24]
push edx
mov ecx, esi
mov byte [esp + 0x7c], 8
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 7
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_G
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_G
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 9
call fcn.00431b00
lea eax, [esp + 0x18]
push eax
lea ecx, [esp + 0x24]
push ecx
mov ecx, esi
mov byte [esp + 0x7c], 0xa
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 9
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_E
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_E
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0xb
call fcn.00431b00
lea edx, [esp + 0x18]
push edx
lea eax, [esp + 0x24]
push eax
mov ecx, esi
mov byte [esp + 0x7c], 0xc
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0xb
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_C
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_C
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0xd
call fcn.00431b00
lea ecx, [esp + 0x18]
push ecx
lea edx, [esp + 0x24]
push edx
mov ecx, esi
mov byte [esp + 0x7c], 0xe
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0xd
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_O
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_O
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0xf
call fcn.00431b00
lea eax, [esp + 0x18]
push eax
lea ecx, [esp + 0x24]
push ecx
mov ecx, esi
mov byte [esp + 0x7c], 0x10
call fcn.0045f410
mov byte [esp + 0x74], 0xf
lea ecx, [esp + 0x20]
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_M
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_M
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0x11
call fcn.00431b00
lea edx, [esp + 0x18]
push edx
lea eax, [esp + 0x24]
push eax
mov ecx, esi
mov byte [esp + 0x7c], 0x12
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0x11
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_P
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_P
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0x13
call fcn.00431b00
lea ecx, [esp + 0x18]
push ecx
lea edx, [esp + 0x24]
push edx
mov ecx, esi
mov byte [esp + 0x7c], 0x14
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0x13
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_L
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_L
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0x15
call fcn.00431b00
lea eax, [esp + 0x18]
push eax
lea ecx, [esp + 0x24]
push ecx
mov ecx, esi
mov byte [esp + 0x7c], 0x16
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0x15
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_E2
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_E2
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0x17
call fcn.00431b00
mov byte [esp + 0x74], 0x18
lea edx, [esp + 0x18]
push edx
lea eax, [esp + 0x24]
push eax
mov ecx, esi
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0x17
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_T2
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_T2
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0x19
call fcn.00431b00
lea ecx, [esp + 0x18]
push ecx
lea edx, [esp + 0x24]
push edx
mov ecx, esi
mov byte [esp + 0x7c], 0x1a
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0x19
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
push str.MapStageComplete_E3
lea ecx, [esp + 0x1c]
call fcn.00431b00
push str.StageComplete_E3
lea ecx, [esp + 0x24]
mov dword [esp + 0x78], 0x1b
call fcn.00431b00
lea eax, [esp + 0x18]
push eax
lea ecx, [esp + 0x24]
push ecx
mov ecx, esi
mov byte [esp + 0x7c], 0x1c
call fcn.0045f410
lea ecx, [esp + 0x20]
mov byte [esp + 0x74], 0x1b
call fcn.00431a00
lea ecx, [esp + 0x18]
mov dword [esp + 0x74], ebx
call fcn.00431a00
mov edi, 1
mov dword [esp + 0x10], edi
jmp 0x40a4c0
mov edi, dword [esp + 0x10]
jmp 0x40a4c0
push edi
lea edx, [esp + 0x4c]
push str.Stage_d
push edx
call fcn.004887ad
add esp, 0xc
lea eax, [esp + 0x48]
push eax
lea ecx, [esp + 0x2c]
call fcn.00431b00
mov eax, dword [esi + 0xa8]
lea ecx, [eax + 0xa0]
cmp dword [ecx], 0
mov dword [esp + 0x74], 0x1d
je 0x40a512
lea edx, [esp + 0x28]
push edx
call fcn.0043f920
test eax, eax
je 0x40a512
mov eax, dword [eax]
mov dword [esp + 0x18], eax
mov al, 1
jmp 0x40a514
xor al, al
mov ecx, dword [esp + 0x18]
neg al
mov dword [esp + 0x74], ebx
sbb eax, eax
and eax, ecx
lea ecx, [esp + 0x28]
mov dword [esp + 0x14], eax
call fcn.00431a00
mov ecx, dword [esp + 0x14]
test ecx, ecx
je 0x40a56b
mov al, byte [esi + 0x49c]
test al, al
jne 0x40a54b
mov al, byte [esi + 0x49d]
test al, al
je 0x40a557
cmp edi, dword [esi + 0x394]
jg 0x40a557
xor al, al
jmp 0x40a55b
xor eax, eax
mov al, 1
cmp edi, dword [esi + 0x394]
setg dl
push edx
push eax
call fcn.00465000
mov dword [esp + 0x14], 1
jmp 0x40a580
mov edi, dword [esp + 0x10]
lea esp, [esp]
mov eax, dword [esp + 0x14]
push eax
push edi
lea ecx, [esp + 0x50]
push str.Level_d__d
push ecx
call fcn.004887ad
add esp, 0x10
lea edx, [esp + 0x48]
push edx
lea ecx, [esp + 0x34]
call fcn.00431b00
mov eax, dword [esi + 0xa8]
lea ecx, [eax + 0xa0]
cmp dword [ecx], 0
mov dword [esp + 0x74], 0x1e
je 0x40a5d7
lea eax, [esp + 0x30]
push eax
call fcn.0043f920
test eax, eax
je 0x40a5d7
mov ecx, dword [eax]
mov dword [esp + 0x20], ecx
mov al, 1
jmp 0x40a5d9
xor al, al
mov ecx, dword [esp + 0x20]
neg al
mov dword [esp + 0x74], ebx
sbb eax, eax
and eax, ecx
lea ecx, [esp + 0x30]
mov edi, eax
call fcn.00431a00
test edi, edi
je 0x40a622
mov eax, dword [esi + 0x494]
mov ecx, dword [esp + 0x10]
cmp ecx, eax
jl 0x40a616
jne 0x40a612
mov edx, dword [esp + 0x14]
cmp edx, dword [esi + 0x498]
jle 0x40a616
xor al, al
jmp 0x40a61a
xor eax, eax
mov al, 1
push eax
mov ecx, edi
call fcn.004656e0
mov eax, dword [esp + 0x10]
cmp eax, dword [esi + 0x494]
jne 0x40a6ab
mov ecx, dword [esp + 0x14]
cmp ecx, dword [esi + 0x498]
jne 0x40a6ab
mov eax, dword [esi + 0x4a0]
test eax, eax
je 0x40a650
mov ecx, dword [esi + 0x9c]
push eax
call fcn.004582f0
push str.MapCurrentLevel
lea ecx, [esp + 0x44]
call fcn.00431b00
lea edx, [esp + 0x48]
push edx
lea ecx, [esp + 0x3c]
mov dword [esp + 0x78], 0x1f
call fcn.00431b00
lea eax, [esp + 0x40]
push eax
lea ecx, [esp + 0x3c]
push ecx
mov ecx, esi
mov byte [esp + 0x7c], 0x20
call fcn.0045f410
lea ecx, [esp + 0x38]
mov dword [esi + 0x4a0], eax
mov byte [esp + 0x74], 0x1f
call fcn.00431a00
lea ecx, [esp + 0x40]
mov dword [esp + 0x74], ebx
call fcn.00431a00
mov eax, dword [esp + 0x14]
inc eax
cmp eax, 0xa
mov dword [esp + 0x14], eax
jle 0x40a575
mov eax, dword [esp + 0x10]
inc eax
cmp eax, 0xf
mov dword [esp + 0x10], eax
jle 0x40a4b3
mov ecx, dword [esp + 0x6c]
pop edi
pop esi
mov dword fs:[0], ecx
pop ebx
mov esp, ebp
pop ebp
ret 0xc