// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x70(%rdi), %r13
movq 0x70(%rdi), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3350
movsbl %al, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x36c0
movq 0x70(%r14), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x90(%r14,%rax)
je 0x63a5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x0, 0x8(%rbx)
je 0x6544
leaq 0x224f(%rip), %rsi      # 0x85fb
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3670
cmpq $-0x1, %rax
je 0x6401
movq %rax, %r13
leaq 0x2230(%rip), %rbp      # 0x85fb
movl $0x1, %r8d
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
movq %rbp, %rcx
callq 0x33d0
addq $0x2, %r13
movl $0x1, %ecx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x3670
movq %rax, %r13
cmpq $-0x1, %rax
jne 0x63cb
leaq 0x5f88(%rip), %rax      # 0xc390
cmpb $0x1, (%rax)
jne 0x6476
movl 0x298(%r14), %ecx
movq 0x58(%r14), %rax
movq 0x60(%r14), %rsi
subq %rax, %rsi
movq %rsi, %rdx
shrq $0x5, %rdx
cmpl %edx, %ecx
jl 0x6446
leaq 0x58(%r14), %rdi
sarq $0x4, %rsi
orq $0x1, %rsi
callq 0x65c0
movl 0x298(%r14), %ecx
movq 0x58(%r14), %rax
movslq %ecx, %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %r13
movq 0x8(%rax,%rcx), %rdx
testq %rdx, %rdx
je 0x647d
movb $0x1, %al
cmpq 0x8(%rbx), %rdx
jne 0x647f
movq (%rbx), %rsi
movq (%r13), %rdi
callq 0x3390
testl %eax, %eax
setne %al
jmp 0x647f
movb $0x0, (%r12)
jmp 0x648e
xorl %eax, %eax
movb %al, (%r12)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x31f0
movl 0x298(%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x298(%r14)
movl %eax, (%r15)
leaq 0x5f47(%rip), %rax      # 0xc3f0
xorl %ebp, %ebp
cmpb $0x1, (%rax)
jne 0x6544
leaq 0x20(%rsp), %rdi
callq 0x3280
leaq 0x30(%rsp), %rdi
movl 0x298(%r14), %esi
callq 0x3650
movq %rsp, %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x3400
leaq 0x38(%rsp), %rsi
movq %rsp, %rdi
callq 0x35e0
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x34a0
movq (%r14), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6526
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3380
movq 0x5a4b(%rip), %rsi      # 0xbf78
leaq 0x20(%rsp), %rdi
callq 0x32a0
leaq 0xa0(%rsp), %rdi
callq 0x3120
movl %ebp, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x655a
movq %rax, %rbx
movq 0x5a14(%rip), %rsi      # 0xbf78
leaq 0x20(%rsp), %rdi
callq 0x32a0
leaq 0xa0(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3680
nop