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

Disassembly:
sub esp, 0x54
mov eax, dword [sym.alleg40.dll__drawing_mode]
push ebx
push ebp
mov ebp, dword [esp + 0x78]
push esi
push edi
mov edi, dword [sym.imp.MSVCRT.dll_malloc]
mov dword [esp + 0x18], eax
lea ebx, [ebp*4]
xor esi, esi
push ebx
call edi
push ebx
mov dword [esp + esi + 0x3c], eax
call edi
mov dword [esp + esi + 0x48], eax
add esi, 4
add esp, 8
cmp esi, 0xc
jl 0x100024d3
xor eax, eax
mov ecx, dword [esp + eax + 0x34]
test ecx, ecx
je 0x100027d4
mov ecx, dword [esp + eax + 0x40]
test ecx, ecx
je 0x100027d4
add eax, 4
cmp eax, 0xc
jl 0x100024ee
xor ecx, ecx
xor edx, edx
mov dword [esp + 0x4c], ecx
mov dword [esp + 0x50], ecx
mov dword [esp + 0x54], ecx
mov edi, dword [esp + edx + 0x34]
lea esi, [ebp*4]
mov ecx, esi
xor eax, eax
mov ebx, ecx
add edx, 4
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, ebx
and ecx, 3
rep stosb byte es:[edi], al
mov edi, dword [esp + edx + 0x3c]
mov ecx, esi
xor eax, eax
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, esi
and ecx, 3
cmp edx, 0xc
rep stosb byte es:[edi], al
jl 0x1000251e
mov edx, dword [esp + 0x6c]
push edx
call fcn.10001d00
mov edx, dword [esp + 0x88]
add esp, 4
test edx, edx
mov dword [esp + 0x14], eax
mov dword [sym.alleg40.dll__drawing_mode], 0
jle 0x100027ca
mov ecx, dword [esp + 0x7c]
mov eax, dword [esp + 0x74]
sub eax, ecx
mov dword [esp + 0x84], ecx
mov dword [esp + 0x74], eax
mov dword [esp + 0x7c], edx
jmp 0x100025a7
mov ebp, dword [esp + 0x80]
mov eax, dword [esp + 0x74]
xor edi, edi
test ebp, ebp
jle 0x10002766
mov ecx, dword [esp + 0x84]
add eax, ecx
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x70]
mov ebp, dword [esp + 0x68]
push eax
lea eax, [edi + ecx]
mov edx, dword [ebp + 0x1c]
push eax
push ebp
call dword [edx + 0x20]
mov ecx, dword [ebp + 0x1c]
mov esi, eax
push esi
mov eax, dword [ecx]
push eax
call sym.alleg40.dll_getr_depth
mov edx, dword [ebp + 0x1c]
mov dword [esp + 0x3c], eax
push esi
mov eax, dword [edx]
push eax
call sym.alleg40.dll_getg_depth
mov dword [esp + 0x48], eax
mov eax, dword [ebp + 0x1c]
push esi
mov eax, dword [eax]
push eax
call sym.alleg40.dll_getb_depth
add esp, 0x24
mov dword [esp + 0x30], eax
xor edx, edx
xor eax, eax
mov ecx, dword [esp + eax + 0x34]
mov ebx, dword [esp + eax + 0x28]
mov ecx, dword [ecx + edi*4]
add ecx, ebx
mov ebx, dword [esp + eax + 0x4c]
add ecx, ebx
cmp ecx, 0xff
mov dword [esp + eax + 0x1c], ecx
jle 0x10002636
mov dword [esp + eax + 0x1c], 0xff
cmp dword [esp + eax + 0x1c], edx
jge 0x10002640
mov dword [esp + eax + 0x1c], edx
add eax, 4
cmp eax, 0xc
jl 0x1000260f
mov edx, dword [esp + 0x24]
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x1c]
push edx
push eax
push ecx
call sym.alleg40.dll_makecol8
mov ebx, eax
mov eax, dword [sym.alleg40.dll__color_conv]
add esp, 0xc
test eax, 0x4000000
je 0x100026a8
mov edx, dword [ebp + 0x1c]
mov ecx, dword [esp + 0x6c]
mov eax, dword [edx + 4]
cmp esi, eax
mov eax, dword [ecx + 0x1c]
mov edx, dword [eax + 4]
jne 0x10002684
push edx
jmp 0x10002690
cmp ebx, edx
jne 0x1000268f
mov edx, dword [esp + 0x14]
push edx
jmp 0x10002690
push ebx
mov edx, dword [esp + 0x88]
push edx
mov edx, dword [esp + 0x80]
add edx, edi
push edx
push ecx
call dword [eax + 0x24]
jmp 0x100026c6
mov edx, dword [esp + 0x84]
mov eax, dword [esp + 0x6c]
push ebx
push edx
mov edx, dword [esp + 0x80]
mov ecx, dword [eax + 0x1c]
add edx, edi
push edx
push eax
call dword [ecx + 0x24]
xor eax, eax
xor edx, edx
mov al, byte [ebx*4 + sym.alleg40.dll__current_palette]
mov dl, byte [ebx*4 + 0x1009b601]
add esp, 0x10
mov ecx, dword [eax*4 + sym.alleg40.dll__rgb_scale_6]
mov eax, dword [edx*4 + sym.alleg40.dll__rgb_scale_6]
mov dword [esp + 0x28], ecx
xor ecx, ecx
mov cl, byte [ebx*4 + 0x1009b602]
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x80]
xor esi, esi
mov edx, dword [ecx*4 + sym.alleg40.dll__rgb_scale_6]
mov dword [esp + 0x30], edx
lea ebp, [eax - 1]
mov ecx, dword [esp + esi + 0x1c]
mov eax, dword [esp + esi + 0x28]
sub ecx, eax
mov ebx, dword [esp + esi + 0x40]
mov dword [esp + esi + 0x58], ecx
lea eax, [ecx + ecx*2]
cdq
and edx, 7
add eax, edx
mov edx, dword [ebx + edi*4]
sar eax, 3
add edx, eax
cmp edi, ebp
mov dword [esp + esi + 0x4c], eax
mov dword [ebx + edi*4], edx
je 0x1000274e
mov eax, ecx
cdq
and edx, 3
add eax, edx
sar eax, 2
mov dword [ebx + edi*4 + 4], eax
add esi, 4
cmp esi, 0xc
jl 0x10002711
mov eax, dword [esp + 0x80]
inc edi
cmp edi, eax
jl 0x100025be
xor edx, edx
mov ecx, dword [esp + 0x80]
mov ebx, dword [esp + edx + 0x40]
mov edi, dword [esp + edx + 0x34]
mov esi, ebx
lea eax, [ecx*4]
add edx, 4
mov ecx, eax
mov ebp, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebp
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, eax
xor eax, eax
mov esi, ecx
mov edi, ebx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, esi
and ecx, 3
cmp edx, 0xc
rep stosb byte es:[edi], al
jl 0x10002768
mov ecx, dword [esp + 0x84]
mov eax, dword [esp + 0x7c]
inc ecx
dec eax
mov dword [esp + 0x84], ecx
mov dword [esp + 0x7c], eax
jne 0x1000259c
mov edx, dword [esp + 0x18]
mov dword [sym.alleg40.dll__drawing_mode], edx
mov edi, dword [sym.imp.MSVCRT.dll_free]
xor esi, esi
mov eax, dword [esp + esi + 0x34]
test eax, eax
je 0x100027ea
push eax
call edi
add esp, 4
mov eax, dword [esp + esi + 0x40]
test eax, eax
je 0x100027f8
push eax
call edi
add esp, 4
add esi, 4
cmp esi, 0xc
jl 0x100027dc
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x54
ret