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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x88
push ebx
mov ebx, ecx
push ebp
push esi
mov eax, dword [ebx + 0x84]
mov ecx, dword [ebx + 0x80]
push edi
push eax
push ecx
mov dword [ebx + 0x104], 0
call dword [sym.imp.OPENGL32.dll_wglMakeCurrent]
lea eax, [ebx + 0x58]
push 0x405
mov dword [esp + 0x54], eax
mov edx, dword [eax]
mov dword [esp + 0x30], edx
mov ecx, dword [eax + 4]
mov dword [esp + 0x34], ecx
mov edx, dword [eax + 8]
mov dword [esp + 0x38], edx
call dword [sym.imp.OPENGL32.dll_glDrawBuffer]
push 0x405
call dword [sym.imp.OPENGL32.dll_glReadBuffer]
mov eax, dword [ebx + 0x38]
test eax, eax
jne 0x405a19
push 0xb50
call dword [sym.imp.OPENGL32.dll_glPushAttrib]
push 0xb50
call dword [sym.imp.OPENGL32.dll_glDisable]
push 0x207
call dword [sym.imp.OPENGL32.dll_glDepthFunc]
lea eax, [esp + 0x38]
mov ecx, ebx
push eax
call fcn.004064c0
test eax, eax
je 0x405dad
fld dword [esp + 0x38]
fsub dword [esp + 0x2c]
mov eax, dword [ebx + 0x38]
test eax, eax
fstp dword [esp + 0x44]
fld dword [esp + 0x3c]
fsub dword [esp + 0x30]
fstp dword [esp + 0x48]
fld dword [esp + 0x40]
fsub dword [esp + 0x34]
fstp dword [esp + 0x4c]
jne 0x405ab6
mov eax, dword [ebx + 0xf0]
test eax, eax
jne 0x405a6d
push 0
push 0xc8
push 0
jmp 0x405a8e
mov eax, dword [ebx + 0x30]
test eax, eax
je 0x405a82
mov cl, byte [eax + 0x6e]
mov dl, byte [eax + 0x6d]
mov al, byte [eax + 0x6c]
push ecx
push edx
push eax
jmp 0x405a8e
push 0
push 0xff
push 0xff
call dword [sym.imp.OPENGL32.dll_glColor3ub]
push 1
call dword [sym.imp.OPENGL32.dll_glBegin]
mov esi, dword [sym.imp.OPENGL32.dll_glVertex3fv]
lea ecx, [esp + 0x2c]
push ecx
call esi
lea edx, [esp + 0x38]
push edx
call esi
call dword [sym.imp.OPENGL32.dll_glEnd]
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x3c]
mov edx, dword [esp + 0x40]
mov dword [esp + 0x2c], eax
lea eax, [esp + 0x44]
mov dword [esp + 0x30], ecx
mov ecx, dword [ebx + 0x30]
push eax
mov dword [esp + 0x38], edx
call fcn.004071f0
mov eax, dword [ebx + 0x38]
test eax, eax
je 0x405d99
mov ecx, dword [ebx + 0x20]
lea edx, [esp + 0x54]
push ecx
mov ecx, dword [ebx + 0x30]
lea eax, [ebx + 0x88]
push edx
push eax
push 1
call fcn.004072b0
lea ecx, [esp + 0x10]
lea edx, [esp + 0x54]
push ecx
push edx
mov ecx, ebx
call fcn.00405430
test eax, eax
je 0x405d99
lea eax, [ebx + 0xc8]
lea ecx, [esp + 0x10]
push eax
push ecx
call fcn.00405950
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x20]
mov esi, dword [esp + 0x24]
mov edx, 1
sub edx, eax
mov edi, 1
add ecx, edx
mov edx, dword [esp + 0x1c]
sub edi, edx
add esp, 8
add esi, edi
mov dword [esp + 0x18], ecx
push esi
push ecx
push edx
push eax
mov dword [esp + 0x2c], esi
call dword [sym.imp.OPENGL32.dll_glScissor]
mov edi, dword [sym.imp.OPENGL32.dll_glDepthFunc]
push 0x204
call edi
push 0
push 0
call dword [sym.imp.OPENGL32.dll_glClearDepth]
push 0x4100
call dword [sym.imp.OPENGL32.dll_glClear]
mov ecx, dword [ebx + 0x30]
mov eax, dword [ecx]
call dword [eax + 0xc]
mov ecx, dword [ebx + 0xdc]
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x18]
mov esi, dword [sym.imp.OPENGL32.dll_glReadPixels]
push ecx
mov ecx, dword [esp + 0x18]
push 0x1406
push 0x1902
push edx
mov edx, dword [esp + 0x20]
push eax
push ecx
push edx
call esi
mov eax, dword [ebx + 0xe4]
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x18]
push eax
mov eax, dword [esp + 0x18]
push 0x1401
push 0x1908
push ecx
mov ecx, dword [esp + 0x20]
push edx
push eax
push ecx
call esi
push 0x201
call edi
mov ecx, dword [ebx + 0x30]
mov edx, dword [ecx]
call dword [edx + 0xc]
mov eax, dword [ebx + 0xe0]
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x18]
push eax
mov eax, dword [esp + 0x18]
push 0x1406
push 0x1902
push ecx
mov ecx, dword [esp + 0x20]
push edx
push eax
push ecx
call esi
mov ecx, dword [esp + 0x14]
mov edi, ecx
mov edx, dword [esp + 0x1c]
lea eax, [ecx + edx]
cmp ecx, eax
jge 0x405d99
lea ebp, [ecx*4]
mov edx, dword [esp + 0x10]
mov eax, dword [esp + 0x18]
add eax, edx
mov esi, edx
cmp edx, eax
jge 0x405d86
mov eax, edi
sub eax, ecx
mov ecx, dword [ebx + 0xd8]
imul eax, dword [esp + 0x18]
add ecx, ebp
sub eax, edx
add eax, esi
mov edx, dword [ecx]
cmp dword [edx + esi*4], 0
jne 0x405c94
mov eax, dword [ebx + 0x78]
mov ecx, dword [ebx + 0xe8]
imul eax, edi
mov dl, byte [ebx]
add eax, esi
mov byte [ecx + eax*4], dl
mov ecx, dword [ebx + 0xe8]
mov dl, byte [ebx + 1]
mov byte [ecx + eax*4 + 1], dl
mov ecx, dword [ebx + 0xe8]
mov dl, byte [ebx + 2]
mov byte [ecx + eax*4 + 2], dl
jmp 0x405d6e
mov ecx, dword [ecx]
lea edx, [ecx + esi*4]
lea ecx, [eax*4]
mov eax, dword [ebx + 0xdc]
mov dword [esp + 0x20], edx
lea edx, [ecx + eax]
mov eax, dword [esp + 0x20]
mov eax, dword [eax]
fld dword [eax + 4]
fcomp dword [edx]
fnstsw ax
test ah, 1
je 0x405d6e
mov eax, dword [esp + 0x20]
fld dword [edx]
mov eax, dword [eax]
fcomp dword [eax + 4]
fnstsw ax
test ah, 1
jne 0x405d6e
mov eax, dword [ebx + 0xe0]
mov edx, dword [edx]
mov dword [esp + 0x24], edx
fld dword [ecx + eax]
fst dword [esp + 0x28]
fcomp dword [esp + 0x24]
fnstsw ax
test ah, 1
je 0x405d6e
mov eax, edx
mov edx, dword [esp + 0x28]
push eax
mov eax, dword [esp + 0x24]
push edx
mov edx, dword [ebx + 0xe4]
add ecx, edx
push ecx
push eax
mov ecx, ebx
call fcn.00406350
cmp eax, 1
jne 0x405d6e
mov ecx, dword [ebx + 0xd8]
mov edx, dword [ecx + ebp]
mov ecx, dword [edx + esi*4]
test ecx, ecx
je 0x405d6e
mov eax, dword [ebx + 0x78]
mov edx, dword [ebx + 0xe8]
imul eax, edi
mov cl, byte [ecx]
add eax, esi
mov byte [edx + eax*4], cl
mov edx, dword [ebx + 0xd8]
mov ecx, dword [edx + ebp]
mov edx, dword [ecx + esi*4]
mov ecx, dword [ebx + 0xe8]
mov dl, byte [edx + 1]
mov byte [ecx + eax*4 + 1], dl
mov ecx, dword [ebx + 0xd8]
mov edx, dword [ecx + ebp]
mov ecx, dword [edx + esi*4]
mov edx, dword [ebx + 0xe8]
mov cl, byte [ecx + 2]
mov byte [edx + eax*4 + 2], cl
mov edx, dword [esp + 0x10]
mov eax, dword [esp + 0x18]
inc esi
lea ecx, [edx + eax]
cmp esi, ecx
mov ecx, dword [esp + 0x14]
jl 0x405c45
mov edx, dword [esp + 0x1c]
inc edi
add ebp, 4
lea eax, [ecx + edx]
cmp edi, eax
jl 0x405c31
lea ecx, [esp + 0x38]
push ecx
mov ecx, ebx
call fcn.004064c0
test eax, eax
jne 0x405a2d
mov ecx, dword [ebx + 0x30]
test ecx, ecx
je 0x405fe5
mov eax, dword [ebx + 0x38]
test eax, eax
je 0x405fe5
lea edx, [esp + 0x44]
mov dword [esp + 0x4c], 0
push edx
mov dword [esp + 0x4c], 0
mov dword [esp + 0x48], 0
call fcn.004071f0
lea eax, [esp + 0x54]
push 0
lea ecx, [ebx + 0x88]
push eax
push ecx
mov ecx, dword [ebx + 0x30]
push 0
call fcn.004072b0
lea edx, [esp + 0x10]
lea eax, [esp + 0x54]
push edx
push eax
mov ecx, ebx
call fcn.00405430
test eax, eax
je 0x405fe5
lea ecx, [ebx + 0xc8]
lea edx, [esp + 0x10]
push ecx
push edx
call fcn.00405950
mov eax, dword [ebx + 0x34]
add esp, 8
test eax, eax
je 0x406003
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x18]
mov esi, dword [esp + 0x1c]
mov edx, 1
sub edx, eax
mov edi, 1
add ecx, edx
mov edx, dword [esp + 0x14]
sub edi, edx
mov dword [esp + 0x18], ecx
add esi, edi
push esi
push ecx
push edx
push eax
mov dword [esp + 0x2c], esi
call dword [sym.imp.OPENGL32.dll_glScissor]
push 0x201
call dword [sym.imp.OPENGL32.dll_glDepthFunc]
push 0x3ff00000
push 0
call dword [sym.imp.OPENGL32.dll_glClearDepth]
push 0x4100
call dword [sym.imp.OPENGL32.dll_glClear]
mov ecx, dword [ebx + 0x30]
mov eax, dword [ecx]
call dword [eax + 8]
mov ecx, dword [ebx + 0xdc]
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x18]
mov esi, dword [sym.imp.OPENGL32.dll_glReadPixels]
push ecx
mov ecx, dword [esp + 0x18]
push 0x1406
push 0x1902
push edx
mov edx, dword [esp + 0x20]
push eax
push ecx
push edx
call esi
mov eax, dword [ebx + 0xe4]
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x18]
push eax
mov eax, dword [esp + 0x18]
push 0x1401
push 0x1908
push ecx
mov ecx, dword [esp + 0x20]
push edx
push eax
push ecx
call esi
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x1c]
or esi, 0xffffffff
mov dword [esp + 0x20], edx
lea ecx, [edx + eax]
cmp edx, ecx
jge 0x406007
mov ebp, dword [esp + 0x10]
lea eax, [edx*4]
mov dword [esp + 0x24], eax
mov ecx, dword [esp + 0x18]
mov edi, ebp
lea eax, [ecx + ebp]
cmp ebp, eax
jge 0x405fc1
mov ecx, dword [esp + 0x20]
mov eax, dword [ebx + 0xd8]
imul ecx, dword [ebx + 0x78]
mov ebp, dword [esp + 0x24]
inc esi
add eax, ebp
add ecx, edi
mov ebp, dword [eax]
cmp dword [ebp + edi*4], 0
je 0x405f5b
mov eax, ebp
mov ebp, dword [ebx + 0xdc]
mov eax, dword [eax + edi*4]
fld dword [eax + 4]
fcomp dword [ebp + esi*4]
fnstsw ax
test ah, 0x41
jne 0x405fad
mov edx, dword [ebx + 0xe4]
mov eax, dword [ebx + 0xe8]
mov dl, byte [edx + esi*4]
mov byte [eax + ecx*4], dl
mov eax, dword [ebx + 0xe4]
mov edx, dword [ebx + 0xe8]
mov al, byte [eax + esi*4 + 1]
mov byte [edx + ecx*4 + 1], al
mov edx, dword [ebx + 0xe4]
mov eax, dword [ebx + 0xe8]
mov dl, byte [edx + esi*4 + 2]
mov byte [eax + ecx*4 + 2], dl
mov eax, dword [ebx + 0xe4]
mov edx, dword [ebx + 0xe8]
mov al, byte [eax + esi*4 + 3]
mov byte [edx + ecx*4 + 3], al
mov edx, dword [esp + 0x14]
mov ebp, dword [esp + 0x10]
mov ecx, dword [esp + 0x18]
inc edi
lea eax, [ecx + ebp]
cmp edi, eax
jl 0x405f22
mov ecx, dword [esp + 0x24]
mov eax, dword [esp + 0x20]
add ecx, 4
inc eax
mov dword [esp + 0x24], ecx
mov ecx, dword [esp + 0x1c]
add ecx, edx
mov dword [esp + 0x20], eax
cmp eax, ecx
jl 0x405f11
jmp 0x40600b
mov edx, 0x2710
mov eax, 0xffffd8f0
mov ebp, edx
mov dword [esp + 0x14], edx
mov dword [esp + 0x10], ebp
mov dword [esp + 0x1c], eax
mov dword [esp + 0x18], eax
jmp 0x40600b
mov edx, dword [esp + 0x14]
mov ebp, dword [esp + 0x10]
mov ecx, dword [ebx + 0xd0]
mov edi, dword [ebx + 0xc8]
cmp ecx, edi
jle 0x40607e
mov eax, dword [ebx + 0xd4]
mov esi, dword [ebx + 0xcc]
cmp eax, esi
jle 0x40607e
cmp dword [ebx + 0x38], 1
jne 0x40607e
sub eax, esi
sub ecx, edi
inc eax
inc ecx
push eax
push ecx
push esi
push edi
call dword [sym.imp.OPENGL32.dll_glScissor]
push 0x405
call dword [sym.imp.OPENGL32.dll_glDrawBuffer]
push 0x207
call dword [sym.imp.OPENGL32.dll_glDepthFunc]
mov edx, dword [ebx + 0xe8]
mov eax, dword [ebx + 0x7c]
mov ecx, dword [ebx + 0x78]
push edx
push 0x1401
push 0x1908
push eax
push ecx
call dword [sym.imp.OPENGL32.dll_glDrawPixels]
mov edx, dword [esp + 0x14]
mov ebp, dword [esp + 0x10]
mov eax, dword [ebx + 0x34]
test eax, eax
je 0x406169
mov ecx, dword [esp + 0x1c]
mov dword [esp + 0x20], edx
lea eax, [edx + ecx]
cmp edx, eax
jge 0x40616d
lea edi, [edx*4]
mov ecx, dword [esp + 0x18]
mov esi, ebp
lea eax, [ecx + ebp]
cmp ebp, eax
jge 0x40614c
mov eax, dword [esp + 0x20]
mov ecx, dword [ebx + 0xd8]
imul eax, dword [ebx + 0x78]
mov edx, dword [ecx + edi]
add ecx, edi
add eax, esi
cmp dword [edx + esi*4], 0
je 0x40610f
mov ecx, edx
mov edx, dword [ecx + esi*4]
mov ecx, dword [ebx + 0xe8]
mov dl, byte [edx]
mov byte [ecx + eax*4], dl
mov ecx, dword [ebx + 0xd8]
mov edx, dword [ecx + edi]
mov ecx, dword [edx + esi*4]
mov edx, dword [ebx + 0xe8]
mov cl, byte [ecx + 1]
mov byte [edx + eax*4 + 1], cl
mov edx, dword [ebx + 0xd8]
mov ecx, dword [edx + edi]
mov edx, dword [ecx + esi*4]
mov ecx, dword [ebx + 0xe8]
mov dl, byte [edx + 2]
jmp 0x406130
mov ecx, dword [ebx + 0xe8]
mov dl, byte [ebx]
mov byte [ecx + eax*4], dl
mov ecx, dword [ebx + 0xe8]
mov dl, byte [ebx + 1]
mov byte [ecx + eax*4 + 1], dl
mov ecx, dword [ebx + 0xe8]
mov dl, byte [ebx + 2]
mov byte [ecx + eax*4 + 2], dl
mov ebp, dword [esp + 0x10]
mov eax, dword [esp + 0x18]
inc esi
lea ecx, [eax + ebp]
cmp esi, ecx
jl 0x4060b4
mov edx, dword [esp + 0x14]
mov ecx, dword [esp + 0x1c]
mov eax, dword [esp + 0x20]
inc eax
add edi, 4
lea esi, [edx + ecx]
mov dword [esp + 0x20], eax
cmp eax, esi
jl 0x4060a3
jmp 0x40616d
mov ecx, dword [esp + 0x1c]
mov eax, dword [esp + 0x18]
test eax, eax
jle 0x40619b
test ecx, ecx
jle 0x40619b
lea eax, [eax + ebp - 1]
lea ecx, [edx + ecx - 1]
mov dword [ebx + 0xc8], ebp
mov dword [ebx + 0xcc], edx
mov dword [ebx + 0xd0], eax
mov dword [ebx + 0xd4], ecx
jmp 0x4061bd
mov eax, 0x2710
mov dword [ebx + 0xcc], eax
mov dword [ebx + 0xc8], eax
mov eax, 0xffffd8f0
mov dword [ebx + 0xd4], eax
mov dword [ebx + 0xd0], eax
mov edx, dword [ebx + 0x80]
push edx
call dword [sym.imp.GDI32.dll_SwapBuffers]
mov eax, dword [ebx + 0x34]
test eax, eax
jne 0x4061e8
push 0x404
call dword [sym.imp.OPENGL32.dll_glDrawBuffer]
mov ecx, dword [ebx + 0x30]
test ecx, ecx
je 0x4061e8
mov eax, dword [ecx]
call dword [eax + 0x10]
mov eax, dword [ebx + 0x38]
test eax, eax
jne 0x40620b
push 0x405
call dword [sym.imp.OPENGL32.dll_glDrawBuffer]
call dword [sym.imp.OPENGL32.dll_glPopAttrib]
push 0x201
call dword [sym.imp.OPENGL32.dll_glDepthFunc]
push 0
push 0
call dword [sym.imp.OPENGL32.dll_wglMakeCurrent]
call fcn.00411f20
mov ebp, eax
test ebp, ebp
je 0x406287
mov cl, byte [0x41c3f8]
xor eax, eax
mov byte [esp + 0x64], cl
mov ecx, 0xc
lea edi, [esp + 0x65]
xor edx, edx
rep stosd dword es:[edi], eax
stosb byte es:[edi], al
mov eax, dword [ebx + 0x30]
test eax, eax
je 0x40626b
lea edi, [eax + 0x10]
or ecx, 0xffffffff
xor eax, eax
lea esi, [esp + 0x64]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov dword [esp + 0x28], esi
mov eax, ecx
mov esi, edi
mov edi, dword [esp + 0x28]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ebx, dword [ebx + 0x4c]
test ebx, ebx
je 0x406275
mov edx, dword [ebx + 0x20]
mov ecx, dword [esp + 0x50]
push ecx
push edx
lea edx, [esp + 0x6c]
mov ecx, ebp
push edx
call fcn.00412d00
pop edi
pop esi
pop ebp
pop ebx
mov esp, ebp
pop ebp
ret