// File: /workspace/github_cpp_makefile_star2_O2/ahupp[P]mural/tags.cpp
// Function: read_etags_file(std::basic_ifstream<char, std::char_traits<char>>&, std::vector<TagInfo, std::allocator<TagInfo>>&)
void read_etags_file(ifstream& tag_stream, vector<TagInfo>& tags) {

  bool expecting_filename = false;
  string current_filename;
  while (!tag_stream.eof()) {
    string line;
    getline(tag_stream, line);

    if (expecting_filename) {
      expecting_filename = false;

      size_t comma = line.find(',');
      if (comma != string::npos) {
        current_filename = line.substr(0, comma);
        tags.push_back(TagInfo(current_filename, current_filename, 0));
      }
    } else if (line[0] == 0x0C) {
      expecting_filename = true;
      continue;
    } else {

      size_t tag_start = line.find(0x7F);
      if (tag_start == string::npos) {
        continue;
      }
      size_t tag_end = line.find(0x01, tag_start);
      if (tag_end == string::npos) {
        continue;
      }
      size_t row_end = line.find(',', tag_end);
      if (row_end == string::npos) {
        continue;
      }

      string symbol = line.substr(tag_start + 1, tag_end-tag_start-1);
      string row = line.substr(tag_end+1, row_end);

      tags.push_back(TagInfo(symbol, current_filename, atoi(row.c_str())));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbp
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %r14
movb $0x0, (%rax)
leaq 0x20(%rsp), %rbx
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
leaq 0x90(%rsp), %r12
movq %rsi, 0x8(%rsp)
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r14,%rax)
jne 0x3afa
movq %rbx, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2060
testb $0x1, %r13b
je 0x39f8
xorl %r13d, %r13d
movq %r15, %rdi
pushq $0x2c
popq %rsi
xorl %edx, %edx
callq 0x2260
cmpq $-0x1, %rax
je 0x3aed
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x2200
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x2230
movq %r12, %rdi
callq 0x20e0
movq %r12, %rdi
movq %r13, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x3cb8
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4218
movq %r12, %rdi
callq 0x2a08
xorl %r13d, %r13d
jmp 0x3aed
movq 0x10(%rsp), %rax
movb $0x1, %r13b
cmpb $0xc, (%rax)
je 0x3aed
xorl %r13d, %r13d
movq %r15, %rdi
pushq $0x7f
popq %rsi
xorl %edx, %edx
callq 0x2260
cmpq $-0x1, %rax
je 0x3ae8
movq %rax, %rbx
movq %r15, %rdi
pushq $0x1
popq %rsi
movq %rax, %rdx
callq 0x2260
cmpq $-0x1, %rax
je 0x3ae0
movq %rax, %rbp
movq %r15, %rdi
pushq $0x2c
popq %rsi
movq %rax, %rdx
callq 0x2260
cmpq $-0x1, %rax
je 0x3ae0
movq %rax, %r13
leaq 0x1(%rbx), %rdx
notq %rbx
addq %rbp, %rbx
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0x2200
incq %rbp
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x2200
movq 0x50(%rsp), %rdi
callq 0x22d0
movq %r12, %rdi
leaq 0x70(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movl %eax, %ecx
callq 0x3cb8
movq 0x8(%rsp), %rbp
leaq 0x20(%rsp), %rbx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4218
movq %r12, %rdi
callq 0x2a08
leaq 0x50(%rsp), %rdi
callq 0x20e0
leaq 0x70(%rsp), %rdi
callq 0x20e0
jmp 0x39f0
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
leaq 0x20(%rsp), %rbx
movq %r15, %rdi
callq 0x20e0
jmp 0x3957
leaq 0x30(%rsp), %rdi
callq 0x20e0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2a08
jmp 0x3b2b
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x20e0
jmp 0x3b3a
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x20e0
jmp 0x3b61
jmp 0x3b5e
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2a08
jmp 0x3b61
jmp 0x3b5e
jmp 0x3b5e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x20e0
leaq 0x30(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2310