Function at 0x409840
Capabilities:
Access peb ldr_data
Get ntdll base address

Disassembly:
push 0xffffffffffffffff
push 0x4a39c8
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x34
push ebx
mov eax, 0x7fff
push ebp
push esi
mov word [esp + 0x34], ax
mov word [esp + 0x36], ax
mov esi, ecx
mov eax, 0xffff8001
push edi
mov dword [esp + 0x10], esi
mov word [esp + 0x3c], ax
mov word [esp + 0x3e], ax
mov eax, dword [esp + 0x60]
lea ecx, [esp + 0x30]
push ecx
mov ecx, esi
mov ebx, dword [eax + 8]
mov eax, dword [eax + 0xc]
mov dword [esp + 0x50], 0
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x18], eax
call fcn.00409270
mov edi, dword [eax]
mov eax, dword [eax + 4]
mov ebp, eax
mov dword [esp + 0x38], edi
cmp di, bp
mov dword [esp + 0x3c], eax
mov dword [esp + 0x2c], ebp
jg 0x4098cf
mov eax, dword [esp + 0x3e]
cmp ax, word [esp + 0x3a]
jl 0x4098cf
sub eax, dword [esp + 0x3a]
jmp 0x4098d1
xor eax, eax
movsx ecx, word [esp + 0x14]
movsx edx, ax
mov dword [esp + 0x30], ecx
sub ecx, edx
mov dword [esp + 0x1c], ecx
sub esp, 8
fild dword [esp + 0x24]
fadd qword [0x4a8220]
fmul qword [0x4a8220]
fstp qword [esp]
call dword [sym.imp.MSVCRT.dll_floor]
add esp, 8
call sub.MSVCRT.dll__ftol
mov dx, word [esp + 0x3a]
mov cx, dx
sub cx, word [esi + 4]
sub ecx, eax
cmp word [esp + 0x38], bp
mov dword [esp + 0x24], ecx
jg 0x40992d
cmp word [esp + 0x3e], dx
jl 0x40992d
mov eax, ebp
sub eax, edi
jmp 0x40992f
xor eax, eax
movsx ecx, bx
movsx eax, ax
sub ecx, eax
sub esp, 8
mov dword [esp + 0x24], ecx
fild dword [esp + 0x24]
fadd qword [0x4a8220]
fmul qword [0x4a8220]
fstp qword [esp]
call dword [sym.imp.MSVCRT.dll_floor]
add esp, 8
call sub.MSVCRT.dll__ftol
sub edi, eax
xor eax, eax
cmp word [esi + 6], ax
mov ebx, edi
mov dword [esp + 0x20], ebx
mov dword [esp + 0x1c], eax
jle 0x409a4e
jmp 0x40997d
mov ebx, dword [esp + 0x20]
mov ecx, dword [esp + 0x24]
mov edx, dword [esi + 8]
mov ebp, eax
sub ebp, ecx
movsx ecx, ax
mov ax, word [edx + ecx*2]
mov edx, dword [esi + 0xc]
mov dx, word [edx + ecx*2]
cmp ax, dx
jg 0x409a37
test bp, bp
jl 0x409a37
cmp bp, word [esp + 0x14]
jge 0x409a37
mov edi, eax
sub edi, ebx
test di, di
jge 0x4099c0
sub eax, edi
xor edi, edi
mov esi, edx
sub esi, ebx
movsx ebx, word [esp + 0x18]
mov dword [esp + 0x28], esi
dec ebx
movsx esi, si
cmp esi, ebx
jle 0x4099e3
mov esi, dword [esp + 0x18]
mov ebx, dword [esp + 0x28]
sub esi, ebx
lea edx, [edx + esi - 1]
sub edx, eax
inc edx
test dx, dx
jle 0x409a33
mov esi, dword [esp + 0x54]
push 0
shl ecx, 4
add esi, ecx
mov ecx, dword [esp + 0x5c]
push esi
sub ax, word [ecx]
mov ecx, dword [esi]
movsx eax, ax
add ecx, eax
mov dword [esi], ecx
movsx ecx, dx
movsx edx, bp
movsx eax, di
push ecx
mov ecx, dword [esp + 0x6c]
push edx
push eax
call fcn.0046b850
mov eax, dword [esi + 8]
test eax, eax
jne 0x409a2d
push eax
mov ecx, esi
call fcn.00409af0
jmp 0x409a33
mov dword [esi], eax
mov byte [esi + 4], 8
mov esi, dword [esp + 0x10]
mov eax, dword [esp + 0x1c]
inc eax
cmp ax, word [esi + 6]
mov dword [esp + 0x1c], eax
jl 0x409979
mov ebp, dword [esp + 0x2c]
mov ecx, dword [esp + 0x5c]
test ecx, ecx
jne 0x409a62
mov ecx, dword [esp + 0x64]
mov dword [ecx], 0
jmp 0x409acc
mov ax, word [esp + 0x38]
movsx edx, bp
movsx esi, ax
add edx, esi
cmp ax, bp
mov dword [esp + 0x60], edx
fild dword [esp + 0x60]
fmul qword [0x4a8220]
jg 0x409a93
mov esi, dword [esp + 0x3e]
cmp si, word [esp + 0x3a]
jl 0x409a93
sub esi, dword [esp + 0x3a]
jmp 0x409a95
xor esi, esi
sub esp, 8
add ecx, 0x24
fstp qword [esp]
call fcn.00437ae0
movsx eax, word [esp + 0x3a]
movsx ecx, si
mov dword [esp + 0x60], eax
mov eax, dword [esp + 0x30]
fisub dword [esp + 0x60]
sub eax, ecx
cdq
sub eax, edx
mov edx, dword [esp + 0x64]
sar eax, 1
mov dword [esp + 0x60], eax
fiadd dword [esp + 0x60]
fstp dword [edx]
mov ecx, dword [esp + 0x44]
pop edi
pop esi
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0x40
ret 0x14