// File: kusumi[P]procstat/buffer.cc
// Function: Buffer::readline(int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, bool&)
int Buffer::readline(int &pos, std::string &s, bool &standout)
{
	std::getline(_ifs, s);
	if (_ifs.eof() && s.empty())
		return -1;

	size_t i = 0;
	while ((i = s.find("%", i)) != std::string::npos) {
		s.insert(i, "%");
		i += 2;
	}

	if (blinkline) {
		if (_curline >= static_cast<int>(_chunk.size()))
			_chunk.resize(_chunk.size() * 2 + 1);
		standout = (!_chunk[_curline].empty() && _chunk[_curline] != s);
		_chunk[_curline] = s;
	} else {
		standout = false;
	}

	pos = _curline++;
	if (showlnum) {
		std::stringstream ss;
		ss << _curline << ' ' << s;
		s = ss.str();
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x40b0
movq -0x1f0(%rbp), %rax
movq %rax, %rdi
addq $0x70, %rdi
movq 0x70(%rax), %rax
addq -0x18(%rax), %rdi
callq 0x4800
testb $0x1, %al
jne 0xb604
jmp 0xb61f
movq -0x20(%rbp), %rdi
callq 0x4750
testb $0x1, %al
jne 0xb613
jmp 0xb61f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb86b
movq $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x4002(%rip), %rsi      # 0xf638
callq 0x4850
movq %rax, -0x30(%rbp)
cmpq $-0x1, %rax
je 0xb667
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x3fe4(%rip), %rdx      # 0xf638
callq 0x40f0
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0xb627
leaq 0xbdda(%rip), %rax      # 0x17448
testb $0x1, (%rax)
je 0xb776
movq -0x1f0(%rbp), %rdi
movl 0x298(%rdi), %eax
movl %eax, -0x1f4(%rbp)
addq $0x58, %rdi
callq 0xba80
movq %rax, %rcx
movl -0x1f4(%rbp), %eax
cmpl %ecx, %eax
jl 0xb6d4
movq -0x1f0(%rbp), %rdi
movq %rdi, %rax
addq $0x58, %rax
movq %rax, -0x200(%rbp)
addq $0x58, %rdi
callq 0xba80
movq -0x200(%rbp), %rdi
movq %rax, %rsi
shlq %rsi
addq $0x1, %rsi
callq 0xbaa0
movq -0x1f0(%rbp), %rax
movq %rax, %rdi
addq $0x58, %rdi
movslq 0x298(%rax), %rsi
callq 0xbb30
movq %rax, %rdi
callq 0x4750
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x201(%rbp)
jne 0xb731
movq -0x1f0(%rbp), %rax
movq %rax, %rdi
addq $0x58, %rdi
movslq 0x298(%rax), %rsi
callq 0xbb30
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0xbb50
movb %al, -0x201(%rbp)
movq -0x1f0(%rbp), %rax
movb -0x201(%rbp), %dl
movq -0x28(%rbp), %rcx
andb $0x1, %dl
movb %dl, (%rcx)
movq -0x20(%rbp), %rcx
movq %rcx, -0x210(%rbp)
movq %rax, %rdi
addq $0x58, %rdi
movslq 0x298(%rax), %rsi
callq 0xbb30
movq -0x210(%rbp), %rsi
movq %rax, %rdi
callq 0x4040
jmp 0xb77d
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x1f0(%rbp), %rax
movl 0x298(%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x298(%rax)
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
leaq 0xbd06(%rip), %rax      # 0x174a8
testb $0x1, (%rax)
je 0xb864
leaq -0x1b8(%rbp), %rdi
callq 0x42f0
movq -0x1f0(%rbp), %rax
leaq -0x1a8(%rbp), %rdi
movl 0x298(%rax), %esi
callq 0x4790
movq %rax, -0x218(%rbp)
jmp 0xb7d9
movq -0x218(%rbp), %rdi
movl $0x20, %esi
callq 0x4520
movq %rax, -0x220(%rbp)
jmp 0xb7f3
movq -0x220(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43b0
jmp 0xb805
leaq -0x1e8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x43f0
jmp 0xb81a
movq -0x20(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x4580
leaq -0x1e8(%rbp), %rdi
callq 0x4878
leaq -0x1b8(%rbp), %rdi
callq 0x4310
jmp 0xb864
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x4310
jmp 0xb877
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x1c0(%rbp), %rdi
callq 0x47b0
nopw %cs:(%rax,%rax)