// File: Linkerist[P]xs/src/io.cc
// Function: list_from_file()
bool
list_from_file(void)
{
 string desc;
 string path;
 int linecount = 0;

 default_list.clear();

 ifstream listfile(get_listfile().c_str());

 if (!listfile)
  return false;

 string cwd = get_cwd_as_string();

 while (!listfile.eof()) {
  string line;

  getline(listfile, line);

  if (line == "")
   continue;

  // comments ... are not saved later so we simply don't allow
  // them
  //       if (line[0] == '#') {
  //          continue;
  //       }
  // detect path and description at the leading slash of the
  // absolute path:

  desc = line.substr(0, line.find('/') - 1);
  path = line.substr(line.find('/'));

  if (cwd == path)
   CurrPosition = linecount;

  // counting the lines: if only one, no resolving should take place
  ++linecount;

  // if we got an exact match and not opt_no_resolve the first entry is the result!
  if (NeedleGiven && Needle && Needle == desc && !opt_no_resolve)
   finish(path, true);

  // filtered?
  if (dont_show(desc.c_str()) && dont_show(path.c_str()))
   continue;

  default_list.push_back(make_pair(desc, path));
 }

 listfile.close();

 switch(linecount) {
  case 0:
   listfile_empty = true;
   break;
  case 1:
   opt_no_resolve = true;
   break;
 }

 shorties_offset = 0;
 if (default_list.empty())
  return false;

 return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3b0, %rsp            # imm = 0x3B0
leaq -0x28(%rbp), %rdi
callq 0x4590
leaq -0x48(%rbp), %rdi
callq 0x4590
movl $0x0, -0x4c(%rbp)
leaq 0x108b5(%rip), %rdi     # 0x17540
callq 0x8a00
leaq -0x278(%rbp), %rdi
callq 0x4d60
jmp 0x6c9e
leaq -0x278(%rbp), %rdi
callq 0x41a0
movq %rax, %rsi
leaq -0x258(%rbp), %rdi
movl $0x8, %edx
callq 0x4780
jmp 0x6cc0
leaq -0x278(%rbp), %rdi
callq 0x4828
movq -0x258(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x258(%rbp,%rax), %rdi
callq 0x41e0
movb %al, -0x369(%rbp)
jmp 0x6cec
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x6cf8
jmp 0x6d5c
movb $0x0, -0x1(%rbp)
movl $0x1, -0x288(%rbp)
jmp 0x713e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x7176
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x4828
jmp 0x7176
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x716a
leaq -0x2a8(%rbp), %rdi
callq 0x51b0
jmp 0x6d6a
jmp 0x6d6c
movq -0x258(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x258(%rbp,%rax), %rdi
callq 0x4790
movb %al, -0x36a(%rbp)
jmp 0x6d8c
movb -0x36a(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x6d9d
jmp 0x70a5
leaq -0x2c8(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x4590
movq -0x378(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x40b0
jmp 0x6dc5
leaq 0x95ae(%rip), %rsi      # 0x1037a
leaq -0x2c8(%rbp), %rdi
callq 0x6210
movb %al, -0x379(%rbp)
jmp 0x6de0
movb -0x379(%rbp), %al
testb $0x1, %al
jne 0x6dec
jmp 0x6e29
movl $0x2, -0x288(%rbp)
jmp 0x7054
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x7130
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x7094
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x388(%rbp)
leaq -0x2c8(%rbp), %rdi
movq %rdi, -0x390(%rbp)
movl $0x2f, %esi
callq 0x4560
movq -0x390(%rbp), %rsi
movq -0x388(%rbp), %rdx
movq %rax, %rcx
decq %rcx
leaq -0x2e8(%rbp), %rdi
callq 0x4400
jmp 0x6e6e
leaq -0x28(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
movq %rsi, -0x3a0(%rbp)
callq 0x44f0
movq -0x3a0(%rbp), %rdi
callq 0x4828
xorl %eax, %eax
movl %eax, %edx
leaq -0x2c8(%rbp), %rdi
movq %rdi, -0x398(%rbp)
movl $0x2f, %esi
callq 0x4560
movq -0x398(%rbp), %rsi
movq %rax, %rdx
leaq -0x308(%rbp), %rdi
movq $-0x1, %rcx
callq 0x4400
jmp 0x6ecc
leaq -0x48(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x44f0
leaq -0x308(%rbp), %rdi
callq 0x4828
leaq -0x2a8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x8a20
testb $0x1, %al
jne 0x6efe
jmp 0x6f0a
movl -0x4c(%rbp), %ecx
leaq 0x1065c(%rip), %rax     # 0x17564
movl %ecx, (%rax)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
leaq 0x10646(%rip), %rax     # 0x17560
testb $0x1, (%rax)
je 0x6fbd
leaq 0x1062e(%rip), %rax     # 0x17558
cmpq $0x0, (%rax)
je 0x6fbd
leaq 0x1061d(%rip), %rax     # 0x17558
movq (%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x8ab0
movb %al, -0x3a1(%rbp)
jmp 0x6f4f
movb -0x3a1(%rbp), %al
testb $0x1, %al
jne 0x6f5b
jmp 0x6fbd
leaq 0x1063c(%rip), %rax     # 0x1759e
testb $0x1, (%rax)
jne 0x6fbd
leaq -0x328(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x41b0
jmp 0x6f79
leaq -0x328(%rbp), %rdi
movl $0x1, %esi
callq 0x53d0
jmp 0x6f8c
leaq -0x328(%rbp), %rdi
callq 0x4828
jmp 0x6fbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x4828
jmp 0x7094
leaq -0x28(%rbp), %rdi
callq 0x41a0
movq %rax, %rdi
callq 0x71a0
movb %al, -0x3a2(%rbp)
jmp 0x6fd6
movb -0x3a2(%rbp), %al
testb $0x1, %al
jne 0x6fe2
jmp 0x7013
leaq -0x48(%rbp), %rdi
callq 0x41a0
movq %rax, %rdi
callq 0x71a0
movb %al, -0x3a3(%rbp)
jmp 0x6ffb
movb -0x3a3(%rbp), %al
testb $0x1, %al
jne 0x7007
jmp 0x7013
movl $0x2, -0x288(%rbp)
jmp 0x7054
leaq -0x368(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x8b10
jmp 0x7029
leaq 0x10510(%rip), %rdi     # 0x17540
leaq -0x368(%rbp), %rsi
callq 0x8ae0
jmp 0x703e
leaq -0x368(%rbp), %rdi
callq 0x6850
movl $0x0, -0x288(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x4828
movl -0x288(%rbp), %eax
testl %eax, %eax
je 0x7071
jmp 0x706c
jmp 0x6d6c
jmp 0x6d6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x6850
leaq -0x2c8(%rbp), %rdi
callq 0x4828
jmp 0x7130
leaq -0x258(%rbp), %rdi
callq 0x40d0
jmp 0x70b3
movl -0x4c(%rbp), %eax
movl %eax, -0x3a8(%rbp)
testl %eax, %eax
je 0x70cf
jmp 0x70c2
movl -0x3a8(%rbp), %eax
subl $0x1, %eax
je 0x70db
jmp 0x70e5
leaq 0x104c9(%rip), %rax     # 0x1759f
movb $0x1, (%rax)
jmp 0x70e5
leaq 0x104bc(%rip), %rax     # 0x1759e
movb $0x1, (%rax)
leaq 0x10548(%rip), %rax     # 0x17634
movl $0x0, (%rax)
leaq 0x10447(%rip), %rdi     # 0x17540
callq 0x8b50
testb $0x1, %al
jne 0x7104
jmp 0x7114
movb $0x0, -0x1(%rbp)
movl $0x1, -0x288(%rbp)
jmp 0x7122
movb $0x1, -0x1(%rbp)
movl $0x1, -0x288(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x4828
jmp 0x713e
leaq -0x2a8(%rbp), %rdi
callq 0x4828
jmp 0x716a
leaq -0x258(%rbp), %rdi
callq 0x40f0
leaq -0x48(%rbp), %rdi
callq 0x4828
leaq -0x28(%rbp), %rdi
callq 0x4828
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x3b0, %rsp            # imm = 0x3B0
popq %rbp
retq
leaq -0x258(%rbp), %rdi
callq 0x40f0
leaq -0x48(%rbp), %rdi
callq 0x4828
leaq -0x28(%rbp), %rdi
callq 0x4828
movq -0x280(%rbp), %rdi
callq 0x4730
nopw %cs:(%rax,%rax)