Function at 0x100174f0
Capabilities:
Read file on windows

Disassembly:
push ebx
push ebp
push esi
mov esi, dword [esp + 0x10]
push edi
mov ecx, dword [esi + 4]
test cl, 8
jne 0x100176d2
mov eax, dword [esi + 0x10]
xor edi, edi
cmp eax, edi
jle 0x100176d2
mov edx, dword [esi + 0x14]
cmp edx, edi
je 0x10017575
test cl, 2
je 0x1001753d
cmp eax, 0x1000
jle 0x10017529
mov eax, 0x1000
lea ebx, [esi + 0x28]
push ebx
push eax
mov eax, dword [esi + 0x18]
push eax
push edx
call fcn.10017eb0
add esp, 0x10
jmp 0x10017557
cmp eax, 0x1000
jle 0x10017549
mov eax, 0x1000
lea ebx, [esi + 0x28]
push edx
push eax
push ebx
call sym.alleg40.dll_pack_fread
add esp, 0xc
mov dword [esi + 0xc], eax
mov eax, dword [esi + 0x14]
test byte [eax + 4], 8
je 0x10017566
mov dword [esi + 0x10], edi
test byte [eax + 4], 0x10
jne 0x100176b6
jmp 0x10017685
cmp eax, 0x1000
jle 0x10017581
mov eax, 0x1000
mov ecx, dword [esi]
push 1
push edi
push ecx
mov dword [esi + 0xc], eax
call dword [sym.imp.MSVCRT.dll__lseek]
mov dword [esp + 0x20], eax
call dword [sym.imp.MSVCRT.dll__errno]
mov dword [eax], edi
mov edx, dword [esi + 0xc]
mov eax, dword [esi]
lea ebx, [esi + 0x28]
push edx
push ebx
push eax
call dword [sym.imp.MSVCRT.dll__read]
mov ebp, eax
mov eax, dword [esi + 0xc]
add esp, 0x18
cmp ebp, eax
jge 0x1001761e
test ebp, ebp
jge 0x100175d9
call dword [sym.imp.MSVCRT.dll__errno]
cmp dword [eax], 4
je 0x100175d7
call dword [sym.imp.MSVCRT.dll__errno]
cmp dword [eax], 0xb
jne 0x100176b6
test ebp, ebp
jle 0x100175dd
add edi, ebp
mov ecx, dword [esp + 0x14]
mov eax, dword [esi]
push 0
lea edx, [edi + ecx]
push edx
push eax
call dword [sym.imp.MSVCRT.dll__lseek]
call dword [sym.imp.MSVCRT.dll__errno]
mov dword [eax], 0
mov ecx, dword [esi + 0xc]
mov eax, dword [esi]
sub ecx, edi
lea edx, [ebx + edi]
push ecx
push edx
push eax
call dword [sym.imp.MSVCRT.dll__read]
mov ebp, eax
mov eax, dword [esi + 0xc]
add esp, 0x18
lea ecx, [edi + ebp]
cmp ecx, eax
jl 0x100175b9
mov eax, dword [sym.alleg40.dll_allegro_errno]
mov edi, dword [sym.imp.MSVCRT.dll__errno]
mov dword [eax], 0
call edi
cmp dword [eax], 4
jne 0x1001763e
call edi
mov dword [eax], 0
mov eax, dword [esi + 0x24]
test eax, eax
je 0x10017685
test byte [esi + 4], 0x20
jne 0x10017685
mov eax, dword [esi + 0xc]
test eax, eax
jle 0x10017685
mov edi, 0xffffffd8
mov eax, ebx
sub edi, esi
mov ecx, dword [esi + 0x24]
mov dl, byte [ecx]
mov cl, byte [eax]
xor cl, dl
mov byte [eax], cl
mov ebp, dword [esi + 0x24]
inc ebp
mov ecx, ebp
mov dword [esi + 0x24], ebp
cmp byte [ecx], 0
jne 0x1001767a
mov ecx, dword [esi + 0x20]
mov dword [esi + 0x24], ecx
mov ecx, dword [esi + 0xc]
inc eax
lea edx, [edi + eax]
cmp edx, ecx
jl 0x1001765b
mov eax, dword [esi + 0xc]
mov edx, dword [esi + 0x10]
sub edx, eax
dec eax
test eax, eax
mov dword [esi + 0x10], edx
mov dword [esi + 8], ebx
mov dword [esi + 0xc], eax
jg 0x100176a9
mov eax, edx
test eax, eax
jg 0x100176a9
mov eax, dword [esi + 4]
or al, 8
mov dword [esi + 4], eax
xor eax, eax
pop edi
mov al, byte [ebx]
inc ebx
mov dword [esi + 8], ebx
pop esi
pop ebp
pop ebx
ret
mov edx, dword [sym.alleg40.dll_allegro_errno]
pop edi
mov dword [edx], 0xe
mov eax, dword [esi + 4]
or al, 0x10
mov dword [esi + 4], eax
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
ret
or ecx, 8
pop edi
mov dword [esi + 4], ecx
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
ret