Function at 0x40d990
Capabilities:
64-bit execution via heavens gate

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x84
push ebx
push esi
push edi
lea eax, [ebp + 4]
mov dword [ebp - 0x80], eax
mov dword [ebp - 0x84], 0
xor ecx, ecx
je 0x40da73
lea edx, [ebp + 4]
mov dword [ebp - 0x54], edx
mov eax, dword [ebp + 8]
mov ecx, dword [ebp - 0x54]
sub ecx, dword [eax + 0x28]
mov dword [ebp - 0x10], ecx
mov dword [ebp - 8], 0
mov dword [ebp - 0x14], 0
mov edx, dword [ebp - 0x10]
add edx, 4
mov dword [ebp - 8], edx
mov eax, dword [ebp - 8]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.004115a0
add esp, 8
movzx edx, al
test edx, edx
jne 0x40d9f6
jmp 0x40da67
mov eax, dword [ebp - 8]
cmp dword [eax], 0
jne 0x40da00
jmp 0x40da67
mov ecx, dword [ebp - 8]
mov edx, dword [ecx]
push edx
mov eax, dword [ebp + 8]
push eax
call fcn.00411410
add esp, 8
movzx ecx, al
test ecx, ecx
je 0x40da24
mov edx, dword [ebp - 0x14]
add edx, 1
mov dword [ebp - 0x14], edx
jmp 0x40da3b
mov eax, dword [ebp - 8]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.004114d0
add esp, 8
mov dword [ebp - 0x14], 0
mov edx, dword [ebp - 0x10]
mov eax, dword [edx]
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0
je 0x40da67
cmp dword [ebp - 0x14], 3
jge 0x40da67
mov ecx, dword [ebp + 8]
imul edx, dword [ecx + 0x28], 0x64
mov eax, dword [ebp - 8]
sub eax, edx
mov ecx, dword [ebp + 8]
cmp eax, dword [ecx + 0x10]
ja 0x40d9d4
mov edx, dword [ebp + 8]
push edx
call fcn.004116f0
add esp, 4
lea eax, [ebp + 0x14]
mov dword [ebp - 4], eax
cmp dword [ebp + 0x10], 0
jle 0x40daa2
mov ecx, dword [ebp + 0x10]
sub ecx, 1
mov dword [ebp + 0x10], ecx
mov edx, dword [ebp - 4]
add edx, 8
mov dword [ebp - 4], edx
mov eax, dword [ebp - 4]
mov ecx, dword [eax - 8]
mov dword [ebp - 0x20], ecx
mov edx, dword [eax - 4]
mov dword [ebp - 0x1c], edx
jmp 0x40dab0
mov dword [ebp - 0x20], 0
mov dword [ebp - 0x1c], 0
mov eax, dword [ebp - 0x20]
mov dword [ebp - 0x64], eax
mov ecx, dword [ebp - 0x1c]
mov dword [ebp - 0x60], ecx
cmp dword [ebp + 0x10], 0
jle 0x40dae5
mov edx, dword [ebp + 0x10]
sub edx, 1
mov dword [ebp + 0x10], edx
mov eax, dword [ebp - 4]
add eax, 8
mov dword [ebp - 4], eax
mov ecx, dword [ebp - 4]
mov edx, dword [ecx - 8]
mov dword [ebp - 0x28], edx
mov eax, dword [ecx - 4]
mov dword [ebp - 0x24], eax
jmp 0x40daf3
mov dword [ebp - 0x28], 0
mov dword [ebp - 0x24], 0
mov ecx, dword [ebp - 0x28]
mov dword [ebp - 0x6c], ecx
mov edx, dword [ebp - 0x24]
mov dword [ebp - 0x68], edx
cmp dword [ebp + 0x10], 0
jle 0x40db28
mov eax, dword [ebp + 0x10]
sub eax, 1
mov dword [ebp + 0x10], eax
mov ecx, dword [ebp - 4]
add ecx, 8
mov dword [ebp - 4], ecx
mov edx, dword [ebp - 4]
mov eax, dword [edx - 8]
mov dword [ebp - 0x30], eax
mov ecx, dword [edx - 4]
mov dword [ebp - 0x2c], ecx
jmp 0x40db36
mov dword [ebp - 0x30], 0
mov dword [ebp - 0x2c], 0
mov edx, dword [ebp - 0x30]
mov dword [ebp - 0x74], edx
mov eax, dword [ebp - 0x2c]
mov dword [ebp - 0x70], eax
cmp dword [ebp + 0x10], 0
jle 0x40db6b
mov ecx, dword [ebp + 0x10]
sub ecx, 1
mov dword [ebp + 0x10], ecx
mov edx, dword [ebp - 4]
add edx, 8
mov dword [ebp - 4], edx
mov eax, dword [ebp - 4]
mov ecx, dword [eax - 8]
mov dword [ebp - 0x38], ecx
mov edx, dword [eax - 4]
mov dword [ebp - 0x34], edx
jmp 0x40db79
mov dword [ebp - 0x38], 0
mov dword [ebp - 0x34], 0
mov eax, dword [ebp - 0x38]
mov dword [ebp - 0x7c], eax
mov ecx, dword [ebp - 0x34]
mov dword [ebp - 0x78], ecx
mov dword [ebp - 0x50], 0
invalid
inc ebp