Function at 0x140050550
Capabilities:
Read file on windows

Disassembly:
mov qword [rsp + 0x18], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rsp - 0x360]
sub rsp, 0x460
mov rax, qword [0x140139980]
xor rax, rsp
mov qword [rbp + 0x350], rax
mov rdi, rdx
xor esi, esi
mov dword [rsp + 0x28], esi
xor r9d, r9d
xor r8d, r8d
mov dword [rsp + 0x20], 3
xor edx, edx
mov rbx, rcx
call fcn.140047384
lea rax, vtable.Fl_PNM_Image.0
mov rcx, rdi
lea rdx, [0x14011ddf0]
mov qword [rbx], rax
call fcn.140061530
mov r14, rax
test rax, rax
jne 0x1400505ce
mov dword [rbx + 0x14], 0xfffffffe
jmp 0x140050ad0
mov r12d, 0x400
lea rcx, [rsp + 0x50]
mov edx, r12d
mov r8, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgets]
test rax, rax
jne 0x140050605
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov rdx, rdi
lea rcx, str.Early_end_of_file_in_PNM_file___s__
call qword [case.0x140061e48.0]
jmp 0x1400505c2
lea rcx, [rax + 1]
mov qword [rsp + 0x38], rcx
call qword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_atoi]
mov r13d, eax
mov rax, qword [rsp + 0x38]
movsx ecx, byte [rax]
call qword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_isdigit]
mov r15d, 1
jmp 0x140050643
mov rax, qword [rsp + 0x38]
add rax, r15
mov qword [rsp + 0x38], rax
movsx ecx, byte [rax]
call qword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_isdigit]
test eax, eax
jne 0x14005062d
cmp r13d, 7
jne 0x14005065b
lea rax, [0x14011a8e4]
mov qword [rsp + 0x38], rax
jmp 0x140050660
mov rax, qword [rsp + 0x38]
test rax, rax
je 0x140050737
cmp dword [rbx + 8], esi
jne 0x140050732
cmp byte [rax], sil
je 0x1400506b6
cmp byte [rax], 0x23
je 0x1400506b6
movsx ecx, byte [rax]
call qword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_isdigit]
test eax, eax
je 0x1400506ac
mov rcx, qword [rsp + 0x38]
lea rdx, [rsp + 0x38]
mov r8d, 0xa
call qword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_strtol]
mov dword [rbx + 8], eax
mov dword [rbx + 0x1c], eax
mov rax, qword [rsp + 0x38]
jmp 0x1400506cc
mov rax, qword [rsp + 0x38]
add rax, r15
jmp 0x1400506c7
mov r8, r14
lea rcx, [rsp + 0x50]
mov edx, r12d
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgets]
mov qword [rsp + 0x38], rax
test rax, rax
jne 0x140050669
jmp 0x140050732
cmp dword [rbx + 0xc], esi
jne 0x140050737
cmp byte [rax], sil
je 0x14005071c
cmp byte [rax], 0x23
je 0x14005071c
movsx ecx, byte [rax]
call qword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_isdigit]
test eax, eax
je 0x140050712
mov rcx, qword [rsp + 0x38]
lea rdx, [rsp + 0x38]
mov r8d, 0xa
call qword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_strtol]
mov dword [rbx + 0xc], eax
mov dword [rbx + 0x20], eax
mov rax, qword [rsp + 0x38]
jmp 0x140050732
mov rax, qword [rsp + 0x38]
add rax, r15
jmp 0x14005072d
mov r8, r14
lea rcx, [rsp + 0x50]
mov edx, r12d
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgets]
mov qword [rsp + 0x38], rax
test rax, rax
jne 0x1400506d3
cmp r13d, r15d
je 0x1400507ab
cmp r13d, 4
je 0x1400507ab
mov r12d, esi
jmp 0x1400507a4
test r12d, r12d
jne 0x1400507b3
cmp byte [rax], sil
je 0x14005078c
cmp byte [rax], 0x23
je 0x14005078c
movsx ecx, byte [rax]
call qword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_isdigit]
test eax, eax
je 0x140050782
mov rcx, qword [rsp + 0x38]
lea r8d, [r12 + 0xa]
lea rdx, [rsp + 0x38]
call qword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_strtol]
mov r12d, eax
mov rax, qword [rsp + 0x38]
jmp 0x1400507a4
mov rax, qword [rsp + 0x38]
add rax, r15
jmp 0x14005079f
mov r8, r14
lea rcx, [rsp + 0x50]
mov edx, 0x400
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgets]
mov qword [rsp + 0x38], rax
test rax, rax
jne 0x140050747
jmp 0x1400507b3
mov r12d, r15d
cmp r13d, r15d
je 0x1400507cc
lea eax, [r13 - 2]
test eax, 0xfffffffc
jne 0x1400507c4
cmp r13d, 3
jne 0x1400507cc
mov r8d, 3
jmp 0x1400507cf
mov r8d, r15d
mov dword [rbx + 0x10], r8d
movsxd rax, dword [rbx + 8]
movsxd rdx, dword [rbx + 0xc]
mov rcx, rdx
imul rcx, rax
mov eax, r8d
imul rcx, rax
cmp rcx, qword [0x140137420]
jbe 0x140050822
mov rdx, rdi
lea rcx, str.PNM_file___s__is_too_large__n
call qword [0x140138758]
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov qword [rbx + 8], rsi
mov qword [rbx + 0x1c], rsi
mov dword [rbx + 0x10], esi
mov dword [rbx + 0x14], 0xfffffffd
jmp 0x140050ad0
imul edx, dword [rbx + 8]
imul edx, r8d
movsxd rcx, edx
call sub.api_ms_win_crt_heap_l1_1_0.dll_malloc
mov ecx, esi
mov qword [rbx + 0x30], rax
mov dword [rsp + 0x40], ecx
mov dword [rbx + 0x38], r15d
cmp dword [rbx + 0xc], esi
jle 0x140050ac7
movsxd rsi, dword [rbx + 8]
mov r15d, dword [rbx + 0x10]
imul r15d, esi
mov eax, r15d
imul eax, ecx
mov ecx, r13d
movsxd rdi, eax
add rdi, qword [rbx + 0x30]
sub ecx, 1
je 0x140050ab0
sub ecx, 1
je 0x140050a84
sub ecx, 1
je 0x140050a4e
sub ecx, 1
je 0x14005097a
sub ecx, 1
je 0x140050914
sub ecx, 1
je 0x140050914
cmp ecx, 1
jne 0x140050ab4
jmp 0x14005090b
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_getc]
movzx r8d, al
mov r9d, 0x92492493
mov eax, r8d
shr eax, 5
imul ecx, eax, 0xff
mov eax, r9d
imul ecx
add edx, ecx
sar edx, 2
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, r8d
shr eax, 2
and r8b, 3
and eax, 7
mov byte [rdi], dl
imul ecx, eax, 0xff
lea rdi, [rdi + 3]
mov eax, r9d
imul ecx
add edx, ecx
sar edx, 2
mov eax, edx
shr eax, 0x1f
add edx, eax
movzx eax, r8b
imul ecx, eax, 0x55
mov byte [rdi - 2], dl
dec esi
mov byte [rdi - 1], cl
test esi, esi
jg 0x1400508a2
jmp 0x140050ab4
cmp r12d, 0x100
jge 0x140050970
movsxd r8, dword [rbx + 0x10]
mov rdx, rsi
mov r9, r14
mov rcx, rdi
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
jmp 0x140050ab4
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_getc]
movzx ecx, al
mov dword [rsp + 0x30], ecx
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_getc]
movzx ecx, al
mov eax, dword [rsp + 0x30]
shl eax, 8
or eax, ecx
mov dword [rsp + 0x30], eax
imul eax, eax, 0xff
cdq
idiv r12d
mov byte [rdi], al
inc rdi
dec r15d
test r15d, r15d
jg 0x140050935
jmp 0x140050ab4
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_getc]
mov edx, eax
mov r15b, 0x80
jmp 0x1400509c5
lea rax, [rdi + 1]
mov qword [rsp + 0x48], rax
mov al, r15b
and al, dl
neg al
sbb cl, cl
not cl
mov byte [rdi], cl
cmp r15b, 1
jbe 0x1400509ab
shr r15b, 1
jmp 0x1400509be
mov r15b, 0x80
cmp esi, 1
jbe 0x1400509be
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_getc]
mov dl, al
mov rdi, qword [rsp + 0x48]
dec esi
test esi, esi
jg 0x14005098a
jmp 0x140050ab4
lea r8, [rsp + 0x30]
mov rcx, r14
lea rdx, [0x14011f0a8]
call fcn.140050b00
cmp eax, 1
jne 0x1400509f8
imul eax, dword [rsp + 0x30], 0xff
cdq
idiv r12d
mov byte [rdi], al
inc rdi
lea r8, [rsp + 0x30]
mov rcx, r14
lea rdx, [0x14011f0a8]
call fcn.140050b00
cmp eax, 1
jne 0x140050a22
imul eax, dword [rsp + 0x30], 0xff
cdq
idiv r12d
mov byte [rdi], al
inc rdi
lea r8, [rsp + 0x30]
mov rcx, r14
lea rdx, [0x14011f0a8]
call fcn.140050b00
cmp eax, 1
jne 0x140050a4c
imul eax, dword [rsp + 0x30], 0xff
cdq
idiv r12d
mov byte [rdi], al
inc rdi
dec esi
test esi, esi
jg 0x1400509ce
jmp 0x140050ab4
lea r8, [rsp + 0x30]
mov rcx, r14
lea rdx, [0x14011f0a8]
call fcn.140050b00
cmp eax, 1
jne 0x140050a82
imul eax, dword [rsp + 0x30], 0xff
cdq
idiv r12d
mov byte [rdi], al
inc rdi
dec esi
test esi, esi
jg 0x140050a58
jmp 0x140050ab4
lea r8, [rsp + 0x30]
mov rcx, r14
lea rdx, [0x14011f0a8]
call fcn.140050b00
cmp eax, 1
jne 0x140050aae
mov al, byte [rsp + 0x30]
dec al
mov byte [rdi], al
inc rdi
dec esi
test esi, esi
jg 0x140050a8a
mov ecx, dword [rsp + 0x40]
inc ecx
mov dword [rsp + 0x40], ecx
cmp ecx, dword [rbx + 0xc]
jl 0x140050849
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov rax, rbx
mov rcx, qword [rbp + 0x350]
xor rcx, rsp
call fcn.1400a6970
mov rbx, qword [rsp + 0x4b0]
add rsp, 0x460
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret