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

Disassembly:
push ebx
push esi
push edi
push ebp
add esp, 0xffffff50
mov edi, ecx
mov dword [esp], edx
mov ebp, eax
mov esi, dword [edi + 0xc]
sub esi, dword [edi + 4]
mov ebx, dword [edi + 8]
sub ebx, dword [edi]
test esi, esi
jle case.0x40ce85.0
test ebx, ebx
jle case.0x40ce85.0
mov eax, dword [ebp]
call fcn.00408440
mov dword [esp + 0xac], eax
mov eax, dword [esp + 0xac]
mov dword [esp + 0x10], eax
mov eax, dword [ebp + 4]
call fcn.00408440
mov dword [esp + 0xac], eax
mov eax, dword [esp + 0xac]
mov dword [esp + 0x14], eax
xor eax, eax
mov al, byte [esp + 0x12]
mov dword [esp + 0x18], eax
xor eax, eax
mov al, byte [esp + 0x16]
mov dword [esp + 0x1c], eax
xor eax, eax
mov al, byte [esp + 0x11]
mov dword [esp + 0x28], eax
xor eax, eax
mov al, byte [esp + 0x15]
mov dword [esp + 0x2c], eax
xor eax, eax
mov al, byte [esp + 0x10]
mov dword [esp + 0x20], eax
xor eax, eax
mov al, byte [esp + 0x14]
mov dword [esp + 0x24], eax
xor eax, eax
mov dword [esp + 0x6c], eax
xor eax, eax
mov dword [esp + 0x70], eax
mov ax, word [esp + 0x20]
shl eax, 8
mov word [esp + 0x74], ax
mov ax, word [esp + 0x28]
shl eax, 8
mov word [esp + 0x76], ax
mov ax, word [esp + 0x18]
shl eax, 8
mov word [esp + 0x78], ax
mov word [esp + 0x7a], 0
mov ax, word [esp + 0x24]
shl eax, 8
mov word [esp + 0x84], ax
mov ax, word [esp + 0x2c]
shl eax, 8
mov word [esp + 0x86], ax
mov ax, word [esp + 0x1c]
shl eax, 8
mov word [esp + 0x88], ax
mov word [esp + 0x8a], 0
push esi
push edi
lea esi, [esp + 0x74]
lea edi, [esp + 0x94]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
pop edi
pop esi
mov dword [esp + 0x8c], ebx
xor eax, eax
mov dword [esp + 0x90], eax
xor eax, eax
mov dword [esp + 4], eax
mov dword [esp + 8], 1
mov eax, dword [esp + 0x18]
sub dword [esp + 0x1c], eax
mov eax, dword [esp + 0x28]
sub dword [esp + 0x2c], eax
mov eax, dword [esp + 0x20]
sub dword [esp + 0x24], eax
xor eax, eax
mov dword [esp + 0x38], eax
xor eax, eax
mov dword [esp + 0x3c], eax
mov al, byte [ebp + 0x24]
xor edx, edx
mov dl, al
cmp edx, 6
ja case.0x40ce85.0
jmp dword [edx*4 + 0x40ce8c]
mov dword [esp + 0x30], ebx
mov dword [esp + 0x34], 0x20
mov edx, dword [esp + 0x30]
mov dword [esp + 0x40], edx
jmp 0x40cf69
mov dword [esp + 0x30], 0x20
mov dword [esp + 0x34], esi
mov edx, dword [esp + 0x34]
mov dword [esp + 0x40], edx
jmp 0x40cf69
mov dword [esp + 0x38], ebx
mov edx, dword [esp + 0x38]
shr edx, 1
mov dword [esp + 0x30], edx
mov dword [esp + 0x34], 0x20
mov edx, dword [esp + 0x34]
mov dword [esp + 0x3c], edx
mov edx, dword [esp + 0x30]
mov dword [esp + 0x40], edx
jmp 0x40cf69
mov dword [esp + 0x30], 0x20
mov dword [esp + 0x3c], esi
mov edx, dword [esp + 0x3c]
shr edx, 1
mov dword [esp + 0x34], edx
mov edx, dword [esp + 0x30]
mov dword [esp + 0x38], edx
mov edx, dword [esp + 0x34]
mov dword [esp + 0x40], edx
xor edx, edx
mov dword [esp + 0x8c], edx
mov dword [esp + 0x90], esi
jmp 0x40cf69
lea edx, [ebx + esi]
mov dword [esp + 0x30], edx
mov edx, esi
test edx, edx
jns 0x40cf4a
add edx, 0x1f
sar edx, 5
inc edx
mov dword [esp + 0x34], edx
cmp dword [esp + 0x34], 6
jle 0x40cf61
mov dword [esp + 0x34], 6
mov edx, dword [esp + 0x30]
mov dword [esp + 0x40], edx
add al, 0xfd
sub al, 2
jb 0x40cf7f
mov eax, dword [esp + 0x30]
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x34]
mov dword [esp + 0x3c], eax
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x38]
call fcn.0040a94c
mov dword [esp + 0x44], eax
mov eax, dword [esp + 0x30]
mov dword [esp + 0x7c], eax
mov eax, dword [esp + 0x34]
mov dword [esp + 0x80], eax
mov al, byte [ebp + 0x24]
mov edx, eax
sub dl, 1
je 0x40cfb2
sub dl, 2
jne 0x40cfbc
mov dword [esp + 0xc], 1
jmp 0x40cfc2
xor edx, edx
mov dword [esp + 0xc], edx
cmp byte [0x417e25], 0
je 0x40d020
mov eax, dword [esp + 0x44]
call fcn.0040ad80
call fcn.00408af4
mov ebx, eax
mov al, byte [ebp + 0x24]
add al, 0xfd
sub al, 2
jae 0x40d001
mov eax, dword [esp + 0xc]
push eax
push 1
lea eax, [esp + 0xc]
push eax
push 2
lea eax, [esp + 0x8c]
push eax
push ebx
call dword [0x417e28]
mov eax, dword [esp + 0xc]
push eax
push 1
lea eax, [esp + 0xc]
push eax
push 2
lea eax, [esp + 0x7c]
push eax
push ebx
call dword [0x417e28]
jmp 0x40d190
dec al
je 0x40d033
dec al
je 0x40d058
dec al
je 0x40d033
dec eax
sub al, 3
jb 0x40d058
jmp 0x40d07b
push 1
mov eax, dword [esp + 0x3c]
push eax
push 0
push 0
lea eax, [esp + 0x5c]
push eax
call fcn.00408134
xor eax, eax
mov dword [esp + 0x38], eax
mov dword [esp + 0x3c], 1
jmp 0x40d07b
mov eax, dword [esp + 0x3c]
push eax
push 1
push 0
push 0
lea eax, [esp + 0x5c]
push eax
call fcn.00408134
mov dword [esp + 0x38], 1
xor eax, eax
mov dword [esp + 0x3c], eax
cmp byte [ebp + 0x24], 3
jne 0x40d092
push esi
push 0x20
dec esi
push esi
push 0
lea eax, [esp + 0x6c]
push eax
call fcn.00408134
cmp byte [ebp + 0x24], 4
jne 0x40d0a9
push 0x20
push ebx
push 0
dec ebx
push ebx
lea eax, [esp + 0x6c]
push eax
call fcn.00408134
mov esi, dword [esp + 0x40]
test esi, esi
jl 0x40d190
inc esi
xor ebx, ebx
mov eax, dword [esp + 0x1c]
imul ebx
cdq
idiv dword [esp + 0x40]
mov ecx, eax
add ecx, dword [esp + 0x18]
and ecx, 0xff
shl ecx, 0x10
mov eax, dword [esp + 0x2c]
imul ebx
cdq
idiv dword [esp + 0x40]
add eax, dword [esp + 0x28]
and eax, 0xff
shl eax, 8
or ecx, eax
mov eax, dword [esp + 0x24]
imul ebx
cdq
idiv dword [esp + 0x40]
add eax, dword [esp + 0x20]
and eax, 0xff
or ecx, eax
mov eax, ecx
push eax
call sub.gdi32.dll_CreateSolidBrush
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x48]
push eax
lea eax, [esp + 0x50]
push eax
mov eax, dword [esp + 0x4c]
call fcn.0040ad80
call fcn.00408af4
push eax
call sub.user32.dll_FillRect
mov al, byte [ebp + 0x24]
add al, 0xfd
sub al, 2
jae 0x40d152
mov eax, dword [esp + 0x48]
push eax
lea eax, [esp + 0x60]
push eax
mov eax, dword [esp + 0x4c]
call fcn.0040ad80
call fcn.00408af4
push eax
call sub.user32.dll_FillRect
mov eax, dword [esp + 0x3c]
neg eax
push eax
mov eax, dword [esp + 0x3c]
neg eax
push eax
lea eax, [esp + 0x64]
push eax
call sub.user32.dll_OffsetRect
mov eax, dword [esp + 0x3c]
push eax
mov eax, dword [esp + 0x3c]
push eax
lea eax, [esp + 0x54]
push eax
call sub.user32.dll_OffsetRect
mov eax, dword [esp + 0x48]
push eax
call sub.gdi32.dll_DeleteObject
inc ebx
dec esi
jne 0x40d0b8
xor eax, eax
mov al, byte [ebp + 0x24]
cmp eax, 6
ja case.0x40d19e.0
jmp dword [eax*4 + 0x40d1a5]
mov esi, dword [edi + 0xc]
test esi, esi
jns 0x40d1cb
add esi, 0x1f
sar esi, 5
test esi, esi
jl case.0x40d19e.0
inc esi
xor ebx, ebx
mov eax, dword [edi + 4]
mov edx, ebx
shl edx, 5
add eax, edx
push eax
mov ecx, dword [edi]
mov eax, dword [esp + 0x48]
mov edx, dword [esp + 4]
call fcn.0040aa74
inc ebx
dec esi
jne 0x40d1d9
jmp case.0x40d19e.0
mov esi, dword [edi + 8]
test esi, esi
jns 0x40d206
add esi, 0x1f
sar esi, 5
test esi, esi
jl case.0x40d19e.0
inc esi
xor ebx, ebx
mov eax, dword [edi + 4]
push eax
mov ecx, dword [edi]
mov eax, ebx
shl eax, 5
add ecx, eax
mov eax, dword [esp + 0x48]
mov edx, dword [esp + 4]
call fcn.0040aa74
inc ebx
dec esi
jne 0x40d214
jmp case.0x40d19e.0
mov eax, dword [edi + 0xc]
add eax, dword [esp + 0x34]
dec eax
cdq
idiv dword [esp + 0x34]
mov esi, eax
dec esi
test esi, esi
jl case.0x40d19e.0
inc esi
xor ebx, ebx
mov eax, dword [edi + 4]
mov edx, ebx
imul edx, dword [esp + 0x34]
add eax, edx
push eax
mov ecx, dword [edi]
mov eax, ebx
neg eax
imul dword [esp + 0x38]
add ecx, eax
mov eax, dword [esp + 0x48]
mov edx, dword [esp + 4]
call fcn.0040aa74
inc ebx
dec esi
jne 0x40d24b
jmp case.0x40d19e.0
mov eax, dword [edi + 0xc]
add eax, dword [esp + 0x34]
dec eax
cdq
idiv dword [esp + 0x34]
mov esi, eax
dec esi
test esi, esi
jl case.0x40d19e.0
inc esi
xor ebx, ebx
mov edx, dword [edi + 4]
mov eax, ebx
imul eax, dword [esp + 0x34]
add edx, eax
push edx
mov ecx, dword [edi]
sub ecx, dword [edi + 0xc]
add ecx, eax
mov eax, dword [esp + 0x48]
mov edx, dword [esp + 4]
call fcn.0040aa74
inc ebx
dec esi
jne 0x40d28e
mov eax, dword [esp + 0x44]
call fcn.004081c0
add esp, 0xb0
pop ebp
pop edi
pop esi
pop ebx
ret