Function at 0x519a20
Capabilities:
Read file on windows

Disassembly:
push ebp
push ebx
sub esp, 0x494
lea edx, [esp + 0x490]
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x64], 0x607c20
mov dword [esp + 0x68], 0x60f0f0
mov dword [esp + 0x70], 0x51a3ce
mov dword [esp + 0x6c], edx
lea edx, [esp + 0x4c]
mov dword [esp + 0x74], esp
mov dword [esp], edx
call fcn.004cf190
mov ecx, dword [esp + 0x3c]
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 3
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], 0
mov dword [esp + 0x50], 0xffffffff
call fcn.0051b7a0
sub esp, 0x14
mov eax, dword [esp + 0x3c]
mov dword [eax], 0x742238
mov eax, dword [esp + 0x4a0]
mov dword [esp + 4], 0x65a65d
mov dword [esp + 0x50], 1
mov dword [esp], eax
call fcn.00608a20
test eax, eax
mov dword [esp + 0x2c], eax
je 0x51a381
mov dword [esp + 8], eax
lea eax, [esp + 0x90]
mov dword [esp + 4], 0x400
mov dword [esp + 0x50], 1
mov dword [esp], eax
call sub.msvcrt.dll_fgets
test eax, eax
mov dword [esp + 0x88], eax
je 0x51a35d
add eax, 1
mov dword [esp], eax
mov dword [esp + 0x88], eax
call sub.msvcrt.dll_atoi
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x88]
movsx edx, byte [eax]
sub edx, 0x30
cmp edx, 9
ja 0x519b47
lea edx, [eax + 1]
lea esi, [esi]
mov eax, edx
mov dword [esp + 0x88], edx
add edx, 1
movsx ecx, byte [eax]
sub ecx, 0x30
cmp ecx, 9
jbe 0x519b30
cmp dword [esp + 0x48], 7
je 0x51a3aa
mov ebx, dword [esp + 0x3c]
mov ebx, dword [ebx + 4]
test ebx, ebx
je 0x519bd0
mov ebx, dword [esp + 0x3c]
mov ecx, dword [ebx + 8]
test ecx, ecx
je 0x519cc3
mov edx, dword [esp + 0x48]
cmp edx, 1
je 0x519c10
cmp edx, 4
je 0x519c10
mov dword [esp + 0x38], 0
test eax, eax
je 0x519c18
mov edx, dword [esp + 0x38]
test edx, edx
jne 0x519c18
movsx edx, byte [eax]
test dl, dl
je 0x519db0
cmp dl, 0x23
je 0x519db0
sub edx, 0x30
cmp edx, 9
jbe 0x519de0
add eax, 1
mov dword [esp + 0x88], eax
mov dword [esp + 0x38], 0
jmp 0x519b8a
movsx edx, byte [eax]
test dl, dl
je 0x519d20
cmp dl, 0x23
je 0x519d20
sub edx, 0x30
cmp edx, 9
jbe 0x519d80
add eax, 1
mov dword [esp + 0x88], eax
test eax, eax
jne 0x519b52
mov edx, dword [esp + 0x48]
cmp edx, 1
jne 0x519b79
nop
mov dword [esp + 0x38], 1
mov ecx, dword [esp + 0x48]
mov eax, ecx
sub eax, 1
cmp eax, 1
jbe 0x51a3bf
mov eax, ecx
mov edx, 3
mov ecx, 3
sub eax, 4
cmp eax, 1
jbe 0x51a3bf
mov ebx, dword [esp + 0x3c]
mov eax, dword [ebx + 8]
mov dword [ebx + 0xc], ecx
imul eax, dword [ebx + 4]
imul edx, eax
cmp dword [0x61fe74], edx
jb 0x51a24f
imul eax, ecx
mov dword [esp + 0x50], 1
mov dword [esp], eax
call fcn.00606c50
mov ecx, dword [esp + 0x3c]
mov edx, dword [ecx + 8]
mov dword [ecx + 0x1c], eax
mov dword [ecx + 0x20], 1
test edx, edx
jle 0x51a391
mov dword [esp + 0x40], 0
mov ebp, ecx
mov ebx, dword [ebp + 4]
mov ecx, ebx
mov dword [esp + 0x34], ebx
mov ebx, dword [ebp + 0xc]
imul ecx, dword [esp + 0x40]
imul ecx, ebx
add eax, ecx
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x48]
cmp eax, 7
ja case.0x519cbc.0
jmp dword [eax*4 + 0x65a6a4]
movsx edx, byte [eax]
test dl, dl
je 0x519cf0
cmp dl, 0x23
je 0x519cf0
sub edx, 0x30
cmp edx, 9
jbe 0x519d50
add eax, 1
mov dword [esp + 0x88], eax
test eax, eax
jne 0x519b5d
jmp 0x519b6c
mov eax, dword [esp + 0x2c]
mov dword [esp + 4], 0x400
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
lea eax, [esp + 0x90]
mov dword [esp], eax
call sub.msvcrt.dll_fgets
jmp 0x519cda
mov eax, dword [esp + 0x2c]
mov dword [esp + 4], 0x400
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
lea eax, [esp + 0x90]
mov dword [esp], eax
call sub.msvcrt.dll_fgets
jmp 0x519bf3
lea ecx, [esp + 0x88]
mov dword [esp + 8], 0xa
mov dword [esp], eax
mov dword [esp + 4], ecx
call sub.msvcrt.dll_strtol
mov edx, dword [esp + 0x3c]
mov dword [edx + 8], eax
mov eax, dword [esp + 0x88]
jmp 0x519ce1
lea edx, [esp + 0x88]
mov dword [esp + 8], 0xa
mov dword [esp], eax
mov dword [esp + 4], edx
call sub.msvcrt.dll_strtol
mov edx, dword [esp + 0x3c]
mov dword [edx + 4], eax
mov eax, dword [esp + 0x88]
jmp 0x519bfa
mov eax, dword [esp + 0x2c]
mov dword [esp + 4], 0x400
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
lea eax, [esp + 0x90]
mov dword [esp], eax
call sub.msvcrt.dll_fgets
jmp 0x519bbd
lea ecx, [esp + 0x88]
mov dword [esp + 8], 0xa
mov dword [esp], eax
mov dword [esp + 4], ecx
call sub.msvcrt.dll_strtol
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x88]
jmp 0x519b8a
cmp dword [esp + 0x38], 0xff
jle 0x51a330
imul ebx, dword [esp + 0x34]
test ebx, ebx
jle case.0x519cbc.0
add ebx, dword [esp + 0x30]
mov dword [esp + 0x44], ebx
nop
mov eax, dword [esp + 0x2c]
mov dword [esp + 0x50], 1
mov dword [esp], eax
call sub.msvcrt.dll_getc
movzx eax, al
mov ebx, eax
mov dword [esp + 0x8c], eax
mov eax, dword [esp + 0x2c]
shl ebx, 8
mov dword [esp + 0x34], ebx
mov dword [esp], eax
call sub.msvcrt.dll_getc
movzx edx, al
or edx, dword [esp + 0x34]
add dword [esp + 0x30], 1
mov ecx, dword [esp + 0x30]
mov eax, edx
mov dword [esp + 0x8c], edx
shl eax, 8
sub eax, edx
cdq
idiv dword [esp + 0x38]
cmp ecx, dword [esp + 0x44]
mov byte [ecx - 1], al
jne 0x519e30
nop
mov eax, dword [esp + 0x3c]
mov edx, dword [eax + 8]
add dword [esp + 0x40], 1
mov eax, dword [esp + 0x40]
cmp eax, edx
jge 0x51a391
mov eax, dword [esp + 0x3c]
mov ebp, dword [esp + 0x3c]
mov eax, dword [eax + 0x1c]
jmp 0x519c95
mov edx, dword [esp + 0x3c]
add dword [esp + 0x40], 1
mov eax, dword [esp + 0x40]
mov edx, dword [edx + 8]
cmp eax, edx
jge 0x51a391
mov ebx, dword [esp + 0x3c]
mov eax, dword [ebx + 4]
mov dword [esp + 0x34], eax
imul eax, dword [esp + 0x40]
imul eax, dword [ebx + 0xc]
add eax, dword [ebx + 0x1c]
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x34]
test eax, eax
jg 0x519f6b
jmp case.0x519cbc.0
lea eax, [esp + 0x8c]
mov dword [esp + 4], 0x65a6a1
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
mov eax, dword [esp + 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_fscanf
cmp eax, 1
je 0x51a2e0
lea eax, [esp + 0x8c]
mov dword [esp + 4], 0x65a6a1
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
mov eax, dword [esp + 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_fscanf
cmp eax, 1
je 0x51a2b3
sub dword [esp + 0x34], 1
je 0x519ec0
lea eax, [esp + 0x8c]
mov dword [esp + 4], 0x65a6a1
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
mov eax, dword [esp + 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_fscanf
cmp eax, 1
jne 0x519f00
mov edx, dword [esp + 0x8c]
mov ecx, dword [esp + 0x30]
mov eax, edx
shl eax, 8
sub eax, edx
cdq
idiv dword [esp + 0x38]
mov byte [ecx], al
lea eax, [ecx + 1]
mov dword [esp + 0x30], eax
jmp 0x519f00
mov edx, dword [esp + 0x3c]
add dword [esp + 0x40], 1
mov eax, dword [esp + 0x40]
cmp eax, dword [edx + 8]
jge 0x51a391
mov eax, dword [edx + 4]
mov dword [esp + 0x34], eax
imul eax, dword [esp + 0x40]
imul eax, dword [edx + 0xc]
add eax, dword [edx + 0x1c]
mov dword [esp + 0x30], eax
lea esi, [esi]
mov eax, dword [esp + 0x2c]
mov dword [esp + 0x50], 1
mov dword [esp], eax
call sub.msvcrt.dll_getc
mov edx, dword [esp + 0x34]
test edx, edx
jle 0x519fc0
mov edx, dword [esp + 0x30]
add edx, 1
mov dword [esp + 0x30], edx
mov edx, 0xffffff80
lea esi, [esi]
test al, dl
mov ebx, dword [esp + 0x30]
sete cl
neg ecx
cmp dl, 1
mov byte [ebx - 1], cl
je 0x51a305
movzx edx, dl
shr edx, 1
add dword [esp + 0x30], 1
sub dword [esp + 0x34], 1
jne 0x51a020
jmp 0x519fc0
mov edx, dword [esp + 0x3c]
add dword [esp + 0x40], 1
mov eax, dword [esp + 0x40]
mov edx, dword [edx + 8]
cmp eax, edx
jge 0x51a391
mov ecx, dword [esp + 0x3c]
mov eax, dword [ecx + 4]
mov dword [esp + 0x34], eax
imul eax, dword [esp + 0x40]
imul eax, dword [ecx + 0xc]
add eax, dword [ecx + 0x1c]
mov dword [esp + 0x30], eax
mov ebx, dword [esp + 0x34]
test ebx, ebx
jg 0x51a097
jmp case.0x519cbc.0
sub dword [esp + 0x34], 1
je 0x51a050
lea eax, [esp + 0x8c]
mov dword [esp + 4], 0x65a6a1
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
mov eax, dword [esp + 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_fscanf
cmp eax, 1
jne 0x51a090
mov edx, dword [esp + 0x8c]
mov eax, edx
shl eax, 8
sub eax, edx
cdq
idiv dword [esp + 0x38]
mov edx, dword [esp + 0x30]
mov byte [edx], al
lea eax, [edx + 1]
mov dword [esp + 0x30], eax
jmp 0x51a090
mov edx, dword [esp + 0x3c]
add dword [esp + 0x40], 1
mov eax, dword [esp + 0x40]
mov edx, dword [edx + 8]
cmp edx, eax
jle 0x51a391
mov ecx, dword [esp + 0x3c]
mov eax, dword [ecx + 4]
mov ebx, eax
mov dword [esp + 0x34], eax
mov eax, dword [esp + 0x40]
imul eax, ebx
imul eax, dword [ecx + 0xc]
add eax, dword [ecx + 0x1c]
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x34]
test eax, eax
jle case.0x519cbc.0
mov eax, dword [esp + 0x34]
lea eax, [eax + eax*2]
add eax, dword [esp + 0x30]
mov dword [esp + 0x34], eax
mov esi, esi
lea edi, [edi]
mov eax, dword [esp + 0x2c]
mov dword [esp + 0x50], 1
mov dword [esp], eax
call sub.msvcrt.dll_getc
mov ecx, eax
shr al, 5
mov ebp, dword [esp + 0x30]
movzx eax, al
mov ebx, eax
shl ebx, 8
sub ebx, eax
mov eax, 0x92492493
imul ebx
mov eax, ecx
shr eax, 2
and eax, 7
add edx, ebx
sar ebx, 0x1f
sar edx, 2
sub edx, ebx
mov ebx, eax
shl ebx, 8
mov byte [ebp], dl
sub ebx, eax
mov eax, 0x92492493
imul ebx
mov eax, ebp
add eax, 3
mov dword [esp + 0x30], eax
add edx, ebx
sar ebx, 0x1f
sar edx, 2
sub edx, ebx
mov ebx, eax
mov eax, ecx
and eax, 3
mov ecx, 0x55
mov byte [ebp + 1], dl
imul eax, ecx
cmp ebx, dword [esp + 0x34]
mov byte [ebx - 1], al
jne 0x51a140
jmp 0x51a0e5
mov edx, dword [esp + 0x3c]
add dword [esp + 0x40], 1
mov eax, dword [esp + 0x40]
mov edx, dword [edx + 8]
cmp eax, edx
jge 0x51a391
mov ebx, dword [esp + 0x3c]
mov eax, dword [ebx + 4]
mov dword [esp + 0x34], eax
imul eax, dword [esp + 0x40]
imul eax, dword [ebx + 0xc]
add eax, dword [ebx + 0x1c]
mov dword [esp + 0x30], eax
mov ecx, dword [esp + 0x34]
test ecx, ecx
jg 0x51a20b
jmp case.0x519cbc.0
sub dword [esp + 0x34], 1
je 0x51a1c4
lea eax, [esp + 0x8c]
mov dword [esp + 4], 0x65a6a1
mov dword [esp + 0x50], 1
mov dword [esp + 8], eax
mov eax, dword [esp + 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_fscanf
cmp eax, 1
jne 0x51a204
sub eax, dword [esp + 0x8c]
mov ecx, dword [esp + 0x30]
neg eax
mov byte [ecx], al
lea eax, [ecx + 1]
mov dword [esp + 0x30], eax
jmp 0x51a204
mov edx, dword [esp + 0x4a0]
mov dword [esp], str.PNM_file___s__is_too_large__n
mov eax, dword [0x62117c]
mov dword [esp + 0x50], 1
mov dword [esp + 4], edx
call eax
mov edx, dword [esp + 0x2c]
mov dword [esp], edx
call sub.msvcrt.dll_fclose
mov eax, dword [esp + 0x3c]
mov dword [eax + 4], 0
mov dword [eax + 8], 0
mov dword [eax + 0xc], 0
mov dword [eax + 0x10], 0xfffffffd
lea eax, [esp + 0x4c]
mov dword [esp], eax
call fcn.004cf200
add esp, 0x494
pop ebx
pop ebp
ret 4
mov edx, dword [esp + 0x8c]
mov ebx, dword [esp + 0x30]
mov eax, edx
shl eax, 8
sub eax, edx
cdq
idiv dword [esp + 0x38]
mov byte [ebx], al
lea eax, [ebx + 1]
mov dword [esp + 0x30], eax
jmp 0x519f60
mov edx, dword [esp + 0x8c]
mov ecx, dword [esp + 0x30]
mov eax, edx
shl eax, 8
sub eax, edx
cdq
idiv dword [esp + 0x38]
mov byte [ecx], al
lea eax, [ecx + 1]
mov dword [esp + 0x30], eax
jmp 0x519f30
cmp dword [esp + 0x34], 1
je 0x519e90
mov eax, dword [esp + 0x2c]
mov dword [esp + 0x50], 1
mov dword [esp], eax
call sub.msvcrt.dll_getc
mov edx, 0xffffff80
jmp 0x51a03c
mov eax, dword [esp + 0x2c]
mov dword [esp + 8], ebx
mov dword [esp + 0x50], 1
mov dword [esp + 0xc], eax
mov eax, dword [esp + 0x34]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x30]
mov dword [esp], eax
call sub.msvcrt.dll_fread
jmp 0x519e90
mov eax, dword [esp + 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov eax, dword [esp + 0x4a0]
mov dword [esp], str.Early_end_of_file_in_PNM_file___s__
mov dword [esp + 4], eax
call dword [0x621150]
mov eax, dword [esp + 0x3c]
mov dword [eax + 0x10], 0xfffffffe
jmp 0x51a29c
mov eax, dword [esp + 0x2c]
mov dword [esp + 0x50], 1
mov dword [esp], eax
call sub.msvcrt.dll_fclose
jmp 0x51a29c
mov dword [esp + 0x88], 0x65a65c
mov eax, 0x65a65c
jmp 0x519b52
mov edx, 1
mov ecx, 1
jmp 0x519c42