// File: /workspace/github_cpp_makefile_star2_O3/Kei18[P]pibt/./src/graph/simplegrid.cpp
// Function: SimpleGrid::createNodes()
void SimpleGrid::createNodes() {
  std::ifstream file(filename);
  if (!file) {
    std::cout << "error@SimpleGrid::createNodes, file "
              << filename
              << " does not exist" << "\n";
    std::exit(1);
  }

  std::string line;
  std::smatch results;
  std::regex r_map = std::regex(R"(map)");
  int w  = getW();
  int h = getH();
  int id;
  int j = 0;  // height
  bool mapStart = false;
  char s;

  while (getline(file, line)) {
    // for CRLF coding
    if (*(line.end()-1) == 0x0d) line.pop_back();

    if (mapStart) {
      // width check
      if (line.size() != w) {
        std::cout << "error@SimpleGrid::createNodes, "
                  << "width is invalid, should be " << w <<  "\n";
        std::exit(1);
      }
      for (int i = 0; i < w; ++i) {
        s = line[i];
        id = j * w + i;
        if (s == 'T' or s == '@') continue;
        Node* v = new Node(id);
        v->setPos(i, j);
        nodes.push_back(v);
      }
      ++j;
    }

    if (std::regex_match(line, results, r_map)) mapStart = true;
  }
  file.close();

  // height check
  if (j != h) {
    std::cout << "error@SimpleGrid::createNodes, "
              << "height is invalid, shoudl be " << h <<  "\n";
    std::exit(1);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %rbx
leaq 0xa0(%rdi), %rsi
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movl $0x8, %edx
callq 0x6590
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xb0(%rsp,%rax)
jne 0x1f0a1
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
leaq 0x29540(%rip), %rsi     # 0x48387
leaq 0x70(%rsp), %rdi
movl $0x10, %edx
callq 0xb2a8
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl %eax, %ebp
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movl %eax, 0x4(%rsp)
movslq %ebp, %rax
leaq 0x10(%rbx), %rcx
movq %rcx, 0x40(%rsp)
movq %rax, 0x30(%rsp)
movl %eax, %r14d
xorl %r12d, %r12d
xorl %r13d, %r13d
movl %ebp, 0x8(%rsp)
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x6350
movsbl %al, %edx
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
callq 0x6650
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1efd6
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rsi
cmpb $0xd, -0x1(%rax,%rsi)
jne 0x1eee6
leaq 0x10(%rsp), %rdi
callq 0x6450
movq 0x18(%rsp), %rsi
testb $0x1, %r13b
je 0x1efb4
movq 0x30(%rsp), %rax
cmpq %rax, %rsi
jne 0x1f04a
movq %rax, %rsi
testl %ebp, %ebp
jle 0x1efb1
movl %r12d, %r15d
imull %ebp, %r15d
movq %r12, 0x38(%rsp)
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
movss %xmm0, 0xc(%rsp)
xorl %r12d, %r12d
movq 0x10(%rsp), %rax
movzbl (%rax,%r12), %eax
cmpl $0x40, %eax
je 0x1ef93
cmpl $0x54, %eax
je 0x1ef93
movl $0x28, %edi
callq 0x6370
movq %rax, %rbp
leal (%r15,%r12), %esi
movq %rax, %rdi
callq 0x1d240
movq %rbp, 0x48(%rsp)
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
movss %xmm0, 0x20(%rbp)
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x24(%rbp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0x1ef84
movq %rbp, (%rsi)
addq $0x8, 0x18(%rbx)
jmp 0x1ef93
movq 0x40(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x1c5cc
incq %r12
cmpq %r12, %r14
jne 0x1ef26
movq 0x18(%rsp), %rsi
leaq 0x90(%rsp), %r15
movl 0x8(%rsp), %ebp
movq 0x38(%rsp), %r12
incl %r12d
movq 0x10(%rsp), %rdi
addq %rdi, %rsi
leaq 0x50(%rsp), %rdx
leaq 0x70(%rsp), %rcx
xorl %r8d, %r8d
callq 0x16c4f
orb %al, %r13b
jmp 0x1ee8b
leaq 0x90(%rsp), %rdi
callq 0x60c0
cmpl 0x4(%rsp), %r12d
jne 0x1f0fb
leaq 0x70(%rsp), %rdi
callq 0xb464
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1f00f
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1f02b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6380
leaq 0x90(%rsp), %rdi
callq 0x60f0
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x42f57(%rip), %rdi     # 0x61fa8
leaq 0x2b07e(%rip), %rsi     # 0x4a0d6
movl $0x1f, %edx
callq 0x63f0
movq 0x42f3f(%rip), %rdi     # 0x61fa8
leaq 0x2aee6(%rip), %rsi     # 0x49f56
movl $0x1c, %edx
callq 0x63f0
movq 0x42f27(%rip), %rdi     # 0x61fa8
movl %ebp, %esi
callq 0x6610
leaq 0x294d4(%rip), %rsi     # 0x48563
movq %rax, %rdi
callq 0x6360
movl $0x1, %edi
callq 0x6440
movq 0x42f00(%rip), %rdi     # 0x61fa8
leaq 0x2b002(%rip), %rsi     # 0x4a0b1
movl $0x24, %edx
callq 0x63f0
movq 0xa0(%rbx), %rsi
movq 0xa8(%rbx), %rdx
movq 0x42eda(%rip), %rdi     # 0x61fa8
callq 0x63f0
movq %rax, %rbx
leaq 0x291fb(%rip), %rsi     # 0x482d8
movl $0xf, %edx
movq %rax, %rdi
callq 0x63f0
leaq 0x29472(%rip), %rsi     # 0x48563
movq %rbx, %rdi
callq 0x6360
jmp 0x1f097
movq 0x42ea6(%rip), %rdi     # 0x61fa8
leaq 0x2afcd(%rip), %rsi     # 0x4a0d6
movl $0x1f, %edx
callq 0x63f0
movq 0x42e8e(%rip), %rdi     # 0x61fa8
leaq 0x2ae76(%rip), %rsi     # 0x49f97
movl $0x1d, %edx
callq 0x63f0
movq 0x42e76(%rip), %rdi     # 0x61fa8
movl 0x4(%rsp), %esi
callq 0x6610
leaq 0x29421(%rip), %rsi     # 0x48563
movq %rax, %rdi
callq 0x6360
jmp 0x1f097
movq %rax, %rbx
jmp 0x1f1b3
jmp 0x1f173
jmp 0x1f173
movq %rax, %rbx
jmp 0x1f180
jmp 0x1f173
jmp 0x1f173
movq %rax, %rbx
movl $0x28, %esi
movq %rbp, %rdi
callq 0x6380
jmp 0x1f176
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xb464
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1f197
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1f1b3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6380
leaq 0x90(%rsp), %rdi
callq 0x60f0
movq %rbx, %rdi
callq 0x6620