// File: Luthaf[P]zeopp/networkstorage.cc
// Function: parse_atom(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>*, int, ATOM_NETWORK*, int*, int*, char*, _IO_FILE*)
void parse_atom(vector<string> *token, int first_index, ATOM_NETWORK *cell, int *atom_index, int *line_num, char *line, FILE *cgd) {
  bool verbose = false;
  VERTEX v(convertToDouble(token->at(first_index+2)), convertToDouble(token->at(first_index+3)), convertToDouble(token->at(first_index+4)));
  if(verbose) printf("parsed atom labelled %d at %.3f %.3f %.3f\n", convertToInt(token->at(first_index+0)), v.abc.x, v.abc.y, v.abc.z);
  v.expected_edges = convertToInt(token->at(first_index+1)); //now parse the edges
  for(int i=0; i<v.expected_edges; i++) {
    if(fgets(line, maxline, cgd)!=NULL) {
      (*line_num)++;
      vector<string> local_token = split(string(line)," ()\r\t");
      if(local_token.at(0)=="edge" || local_token.at(0)=="EDGE") {
        XYZ e(convertToDouble(local_token.at(2)), convertToDouble(local_token.at(3)), convertToDouble(local_token.at(4)));
        v.edges.push_back(e);
        if(verbose) printf("parsed edge labelled %d at %.3f %.3f %.3f\n", convertToInt(local_token.at(1)), e.x, e.y, e.z);
      }
      else {
        printf("NET ERROR: atom with %d edges was declared but the string \"%s\" was read instead of the data for edge ID %d\n", v.expected_edges, local_token.at(0).c_str(), i);
        exit(EXIT_FAILURE);
      }
    } else {
      printf("NET WARNING: %d edges were expected but file ended after reading %d edges\n", v.expected_edges, i+1);
      //exit(EXIT_FAILURE);
    }
  }
  //here we can now explicitly read in dummy edges, if we read a 2c vertex
  if(v.expected_edges==2) { //i.e., if 2c
    if(fgets(line, maxline, cgd)!=NULL) {
      (*line_num)++;
      vector<string> local_token = split(string(line)," ()\r\t");
      if(local_token.at(0)=="dummy_edge" || local_token.at(0)=="DUMMY_EDGE") {
        XYZ e(convertToDouble(local_token.at(2)), convertToDouble(local_token.at(3)), convertToDouble(local_token.at(4)));
        v.dummy_edges.push_back(e);
        if(verbose) printf("parsed dummy edge labelled %d at %.3f %.3f %.3f\n", convertToInt(local_token.at(1)), e.x, e.y, e.z);
      }
      else {
        printf("NET ERROR: dummy edge for 2c atom with index %d was declared but the string \"%s\" was read instead of the data for the dummy edge\n", (*atom_index), local_token.at(0).c_str());
        exit(EXIT_FAILURE);
      }
    } else {
      printf("NET WARNING: dummy edge was expected for 2c atom with index %d, but file ended instead\n", (*atom_index));
      //exit(EXIT_FAILURE);
    }    
  }
  cell->vertices.push_back(v);
  cell->vertex_symmetry_operators.push_back(0); //the vertices read from file are the basic ones, before any symmetry operator (or you could say after operator 0, which does nothing)
  cell->vertex_basic_indices.push_back((*atom_index));
  (*atom_index)++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movb $0x0, -0x31(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0xaf450
movq %rax, %rdi
callq 0x8a8a0
movsd %xmm0, -0x1c8(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rsi
callq 0xaf450
movq %rax, %rdi
callq 0x8a8a0
movsd %xmm0, -0x1d0(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
addl $0x4, %eax
movslq %eax, %rsi
callq 0xaf450
movq %rax, %rdi
callq 0x8a8a0
movsd -0x1d0(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x1c8(%rbp), %xmm0
leaq -0xa8(%rbp), %rdi
callq 0x110910
testb $0x1, -0x31(%rbp)
je 0xa7a6e
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0xaf450
movq %rax, -0x1d8(%rbp)
jmp 0xa7a13
movq -0x1d8(%rbp), %rdi
callq 0x8a9b0
movl %eax, -0x1dc(%rbp)
jmp 0xa7a27
movl -0x1dc(%rbp), %esi
movsd -0xa8(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm1
movsd -0x98(%rbp), %xmm2
leaq 0x151d6d(%rip), %rdi    # 0x1f97b9
movb $0x3, %al
callq 0x5070
jmp 0xa7a55
jmp 0xa7a6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0xa82ca
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
incl %eax
movslq %eax, %rsi
callq 0xaf450
movq %rax, -0x1e8(%rbp)
jmp 0xa7a88
movq -0x1e8(%rbp), %rdi
callq 0x8a9b0
movl %eax, -0x1ec(%rbp)
jmp 0xa7a9c
movl -0x1ec(%rbp), %eax
movl %eax, -0x90(%rbp)
movl $0x0, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
cmpl -0x90(%rbp), %eax
jge 0xa7e9a
movq -0x30(%rbp), %rdi
movq 0x10(%rbp), %rdx
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x57e0
movq %rax, -0x1f8(%rbp)
jmp 0xa7adf
movq -0x1f8(%rbp), %rax
cmpq $0x0, %rax
je 0xa7e64
movq -0x28(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x5900
movq -0x208(%rbp), %rsi
movq -0x200(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x47530
jmp 0xa7b34
leaq -0x119(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x5900
movq -0x210(%rbp), %rdx
leaq 0x14b299(%rip), %rsi    # 0x1f2dee
leaq -0x118(%rbp), %rdi
callq 0x47530
jmp 0xa7b63
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x8a620
jmp 0xa7b7f
leaq -0x118(%rbp), %rdi
callq 0x5300
leaq -0x119(%rbp), %rdi
callq 0x55d0
leaq -0xf0(%rbp), %rdi
callq 0x5300
leaq -0xf1(%rbp), %rdi
callq 0x55d0
xorl %eax, %eax
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0xaf450
movq %rax, -0x218(%rbp)
jmp 0xa7bc8
movq -0x218(%rbp), %rdi
leaq 0x162872(%rip), %rsi    # 0x20a448
callq 0x845d0
movb %al, -0x219(%rbp)
jmp 0xa7be3
movb -0x219(%rbp), %al
testb $0x1, %al
jne 0xa7c32
jmp 0xa7bef
xorl %eax, %eax
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0xaf450
movq %rax, -0x228(%rbp)
jmp 0xa7c08
movq -0x228(%rbp), %rdi
leaq 0x151cc1(%rip), %rsi    # 0x1f98d7
callq 0x845d0
movb %al, -0x229(%rbp)
jmp 0xa7c23
movb -0x229(%rbp), %al
testb $0x1, %al
jne 0xa7c32
jmp 0xa7dfc
leaq -0xd0(%rbp), %rdi
movl $0x2, %esi
callq 0xaf450
movq %rax, -0x238(%rbp)
jmp 0xa7c4c
movq -0x238(%rbp), %rdi
callq 0x8a8a0
movsd %xmm0, -0x240(%rbp)
jmp 0xa7c62
leaq -0xd0(%rbp), %rdi
movl $0x3, %esi
callq 0xaf450
movq %rax, -0x248(%rbp)
jmp 0xa7c7c
movq -0x248(%rbp), %rdi
callq 0x8a8a0
movsd %xmm0, -0x250(%rbp)
jmp 0xa7c92
leaq -0xd0(%rbp), %rdi
movl $0x4, %esi
callq 0xaf450
movq %rax, -0x258(%rbp)
jmp 0xa7cac
movq -0x258(%rbp), %rdi
callq 0x8a8a0
movsd %xmm0, -0x260(%rbp)
jmp 0xa7cc2
movsd -0x260(%rbp), %xmm2
movsd -0x250(%rbp), %xmm1
movsd -0x240(%rbp), %xmm0
leaq -0x138(%rbp), %rdi
callq 0xea8e0
jmp 0xa7ce8
leaq -0x88(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xafc20
jmp 0xa7cfd
testb $0x1, -0x31(%rbp)
je 0xa7dfa
leaq -0xd0(%rbp), %rdi
movl $0x1, %esi
callq 0xaf450
movq %rax, -0x268(%rbp)
jmp 0xa7d21
movq -0x268(%rbp), %rdi
callq 0x8a9b0
movl %eax, -0x26c(%rbp)
jmp 0xa7d35
movl -0x26c(%rbp), %esi
movsd -0x138(%rbp), %xmm0
movsd -0x130(%rbp), %xmm1
movsd -0x128(%rbp), %xmm2
leaq 0x151a8a(%rip), %rdi    # 0x1f97e4
movb $0x3, %al
callq 0x5070
jmp 0xa7d63
jmp 0xa7dfa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0xa7dc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0xa7dae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x5300
leaq -0x119(%rbp), %rdi
callq 0x55d0
leaq -0xf0(%rbp), %rdi
callq 0x5300
leaq -0xf1(%rbp), %rdi
callq 0x55d0
jmp 0xa82ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x59290
jmp 0xa82ca
jmp 0xa7e56
movl -0x90(%rbp), %eax
movl %eax, -0x27c(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0xaf450
movq %rax, -0x278(%rbp)
jmp 0xa7e21
movq -0x278(%rbp), %rdi
callq 0x5200
movl -0x27c(%rbp), %esi
movq %rax, %rdx
movl -0xb8(%rbp), %ecx
leaq 0x1519cc(%rip), %rdi    # 0x1f980f
xorl %eax, %eax
callq 0x5070
jmp 0xa7e4c
movl $0x1, %edi
callq 0x67c0
leaq -0xd0(%rbp), %rdi
callq 0x59290
jmp 0xa7e84
movl -0x90(%rbp), %esi
movl -0xb8(%rbp), %edx
incl %edx
leaq 0x151a02(%rip), %rdi    # 0x1f987b
xorl %eax, %eax
callq 0x5070
jmp 0xa7e82
jmp 0xa7e84
jmp 0xa7e86
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0xa7ab2
cmpl $0x2, -0x90(%rbp)
jne 0xa8258
movq -0x30(%rbp), %rdi
movq 0x10(%rbp), %rdx
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x57e0
movq %rax, -0x288(%rbp)
jmp 0xa7ec2
movq -0x288(%rbp), %rax
cmpq $0x0, %rax
je 0xa823e
movq -0x28(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x298(%rbp)
leaq -0x171(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x5900
movq -0x298(%rbp), %rsi
movq -0x290(%rbp), %rdx
leaq -0x170(%rbp), %rdi
callq 0x47530
jmp 0xa7f17
leaq -0x199(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x5900
movq -0x2a0(%rbp), %rdx
leaq 0x14aeb6(%rip), %rsi    # 0x1f2dee
leaq -0x198(%rbp), %rdi
callq 0x47530
jmp 0xa7f46
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
leaq -0x198(%rbp), %rdx
callq 0x8a620
jmp 0xa7f62
leaq -0x198(%rbp), %rdi
callq 0x5300
leaq -0x199(%rbp), %rdi
callq 0x55d0
leaq -0x170(%rbp), %rdi
callq 0x5300
leaq -0x171(%rbp), %rdi
callq 0x55d0
xorl %eax, %eax
movl %eax, %esi
leaq -0x150(%rbp), %rdi
callq 0xaf450
movq %rax, -0x2a8(%rbp)
jmp 0xa7fab
movq -0x2a8(%rbp), %rdi
leaq 0x15190d(%rip), %rsi    # 0x1f98c6
callq 0x845d0
movb %al, -0x2a9(%rbp)
jmp 0xa7fc6
movb -0x2a9(%rbp), %al
testb $0x1, %al
jne 0xa8015
jmp 0xa7fd2
xorl %eax, %eax
movl %eax, %esi
leaq -0x150(%rbp), %rdi
callq 0xaf450
movq %rax, -0x2b8(%rbp)
jmp 0xa7feb
movq -0x2b8(%rbp), %rdi
leaq 0x1518d8(%rip), %rsi    # 0x1f98d1
callq 0x845d0
movb %al, -0x2b9(%rbp)
jmp 0xa8006
movb -0x2b9(%rbp), %al
testb $0x1, %al
jne 0xa8015
jmp 0xa81dc
leaq -0x150(%rbp), %rdi
movl $0x2, %esi
callq 0xaf450
movq %rax, -0x2c8(%rbp)
jmp 0xa802f
movq -0x2c8(%rbp), %rdi
callq 0x8a8a0
movsd %xmm0, -0x2d0(%rbp)
jmp 0xa8045
leaq -0x150(%rbp), %rdi
movl $0x3, %esi
callq 0xaf450
movq %rax, -0x2d8(%rbp)
jmp 0xa805f
movq -0x2d8(%rbp), %rdi
callq 0x8a8a0
movsd %xmm0, -0x2e0(%rbp)
jmp 0xa8075
leaq -0x150(%rbp), %rdi
movl $0x4, %esi
callq 0xaf450
movq %rax, -0x2e8(%rbp)
jmp 0xa808f
movq -0x2e8(%rbp), %rdi
callq 0x8a8a0
movsd %xmm0, -0x2f0(%rbp)
jmp 0xa80a5
movsd -0x2f0(%rbp), %xmm2
movsd -0x2e0(%rbp), %xmm1
movsd -0x2d0(%rbp), %xmm0
leaq -0x1b8(%rbp), %rdi
callq 0xea8e0
jmp 0xa80cb
leaq -0x70(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0xafc20
jmp 0xa80dd
testb $0x1, -0x31(%rbp)
je 0xa81da
leaq -0x150(%rbp), %rdi
movl $0x1, %esi
callq 0xaf450
movq %rax, -0x2f8(%rbp)
jmp 0xa8101
movq -0x2f8(%rbp), %rdi
callq 0x8a9b0
movl %eax, -0x2fc(%rbp)
jmp 0xa8115
movl -0x2fc(%rbp), %esi
movsd -0x1b8(%rbp), %xmm0
movsd -0x1b0(%rbp), %xmm1
movsd -0x1a8(%rbp), %xmm2
leaq 0x1517a2(%rip), %rdi    # 0x1f98dc
movb $0x3, %al
callq 0x5070
jmp 0xa8143
jmp 0xa81da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0xa81a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0xa818e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x5300
leaq -0x199(%rbp), %rdi
callq 0x55d0
leaq -0x170(%rbp), %rdi
callq 0x5300
leaq -0x171(%rbp), %rdi
callq 0x55d0
jmp 0xa82ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x59290
jmp 0xa82ca
jmp 0xa8230
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x30c(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x150(%rbp), %rdi
callq 0xaf450
movq %rax, -0x308(%rbp)
jmp 0xa8201
movq -0x308(%rbp), %rdi
callq 0x5200
movl -0x30c(%rbp), %esi
movq %rax, %rdx
leaq 0x1516f0(%rip), %rdi    # 0x1f990d
xorl %eax, %eax
callq 0x5070
jmp 0xa8226
movl $0x1, %edi
callq 0x67c0
leaq -0x150(%rbp), %rdi
callq 0x59290
jmp 0xa8256
movq -0x20(%rbp), %rax
movl (%rax), %esi
leaq 0x151744(%rip), %rdi    # 0x1f998f
xorl %eax, %eax
callq 0x5070
jmp 0xa8254
jmp 0xa8256
jmp 0xa8258
movq -0x18(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
leaq -0xa8(%rbp), %rsi
callq 0xafc90
jmp 0xa8271
movq -0x18(%rbp), %rdi
addq $0x420, %rdi            # imm = 0x420
movl $0x0, -0x1bc(%rbp)
leaq -0x1bc(%rbp), %rsi
callq 0xffc0
jmp 0xa8294
movq -0x18(%rbp), %rdi
addq $0x408, %rdi            # imm = 0x408
movq -0x20(%rbp), %rsi
callq 0xd1b0
jmp 0xa82aa
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
leaq -0xa8(%rbp), %rdi
callq 0x12650
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
leaq -0xa8(%rbp), %rdi
callq 0x12650
movq -0xb0(%rbp), %rdi
callq 0x58f0
nopw %cs:(%rax,%rax)