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

  std::string line;
  std::smatch results;
  int w  = 0;
  int h = 0;

  std::regex r_height = std::regex(R"(height\s(\d+))");
  std::regex r_width = std::regex(R"(width\s(\d+))");
  std::regex r_map = std::regex(R"(map)");

  // read fundamental graph params
  while (getline(file, line)) {

    // for CRLF coding
    if (*(line.end()-1) == 0x0d) line.pop_back();

    if (std::regex_match(line, results, r_height)) {
      h = std::stoi(results[1].str());
    }
    if (std::regex_match(line, results, r_width)) {
      w = std::stoi(results[1].str());
    }
    if (std::regex_match(line, results, r_map)) {
      break;
    }
  }
  setSize(w, h);
  file.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x328(%rbp)
addq $0xa0, %rsi
leaq -0x210(%rbp), %rdi
movl $0x8, %edx
callq 0x8780
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x8260
movb %al, -0x319(%rbp)
jmp 0x4ab12
movb -0x319(%rbp), %al
testb $0x1, %al
jne 0x4ab21
jmp 0x4abb2
movq 0xb6470(%rip), %rdi     # 0x100f98
leaq 0x6a80a(%rip), %rsi     # 0xb5339
callq 0x84d0
movq %rax, -0x330(%rbp)
jmp 0x4ab3d
movq -0x330(%rbp), %rdi
movq -0x328(%rbp), %rsi
addq $0xa0, %rsi
callq 0x8470
movq %rax, -0x338(%rbp)
jmp 0x4ab60
movq -0x338(%rbp), %rdi
leaq 0x687be(%rip), %rsi     # 0xb332c
callq 0x84d0
movq %rax, -0x340(%rbp)
jmp 0x4ab7c
movq -0x340(%rbp), %rdi
leaq 0x68a2d(%rip), %rsi     # 0xb35b7
callq 0x84d0
jmp 0x4ab91
movl $0x1, %edi
callq 0x85d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4afa1
leaq -0x240(%rbp), %rdi
callq 0x86b0
leaq -0x260(%rbp), %rdi
callq 0xd430
jmp 0x4abcc
movl $0x0, -0x264(%rbp)
movl $0x0, -0x268(%rbp)
leaq 0x6a77a(%rip), %rsi     # 0xb5361
leaq -0x288(%rbp), %rdi
movl $0x10, %edx
callq 0xd390
jmp 0x4abfa
leaq 0x6a76e(%rip), %rsi     # 0xb536f
leaq -0x2a8(%rbp), %rdi
movl $0x10, %edx
callq 0xd390
jmp 0x4ac14
leaq 0x687c0(%rip), %rsi     # 0xb33db
leaq -0x2c8(%rbp), %rdi
movl $0x10, %edx
callq 0xd390
jmp 0x4ac2e
jmp 0x4ac30
leaq -0x210(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x80f0
movq %rax, -0x348(%rbp)
jmp 0x4ac4c
movq -0x348(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x8620
movb %al, -0x349(%rbp)
jmp 0x4ac6a
movb -0x349(%rbp), %al
testb $0x1, %al
jne 0x4ac79
jmp 0x4aeec
leaq -0x240(%rbp), %rdi
callq 0x82f0
movq %rax, -0x2d8(%rbp)
leaq -0x2d8(%rbp), %rdi
movl $0x1, %esi
callq 0x4c150
movq %rax, -0x2d0(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x1b290
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x4ad3d
leaq -0x240(%rbp), %rdi
callq 0x85e0
jmp 0x4ad3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4af95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4af89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4af7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4af71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4af65
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rsi
leaq -0x288(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd470
movb %al, -0x34a(%rbp)
jmp 0x4ad61
movb -0x34a(%rbp), %al
testb $0x1, %al
jne 0x4ad70
jmp 0x4adf9
leaq -0x260(%rbp), %rdi
movl $0x1, %esi
callq 0xd4d0
movq %rax, -0x358(%rbp)
jmp 0x4ad8a
movq -0x358(%rbp), %rsi
leaq -0x2f8(%rbp), %rdi
callq 0xd540
jmp 0x4ad9f
xorl %eax, %eax
movl %eax, %esi
leaq -0x2f8(%rbp), %rdi
movl $0xa, %edx
callq 0xd630
movl %eax, -0x35c(%rbp)
jmp 0x4adbc
movl -0x35c(%rbp), %eax
movl %eax, -0x268(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x8330
jmp 0x4adf9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x8330
jmp 0x4af65
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rsi
leaq -0x2a8(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd470
movb %al, -0x35d(%rbp)
jmp 0x4ae1d
movb -0x35d(%rbp), %al
testb $0x1, %al
jne 0x4ae2c
jmp 0x4aeb5
leaq -0x260(%rbp), %rdi
movl $0x1, %esi
callq 0xd4d0
movq %rax, -0x368(%rbp)
jmp 0x4ae46
movq -0x368(%rbp), %rsi
leaq -0x318(%rbp), %rdi
callq 0xd540
jmp 0x4ae5b
xorl %eax, %eax
movl %eax, %esi
leaq -0x318(%rbp), %rdi
movl $0xa, %edx
callq 0xd630
movl %eax, -0x36c(%rbp)
jmp 0x4ae78
movl -0x36c(%rbp), %eax
movl %eax, -0x264(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x8330
jmp 0x4aeb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x8330
jmp 0x4af65
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rsi
leaq -0x2c8(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd470
movb %al, -0x36d(%rbp)
jmp 0x4aed9
movb -0x36d(%rbp), %al
testb $0x1, %al
jne 0x4aee5
jmp 0x4aee7
jmp 0x4aeec
jmp 0x4ac30
movq -0x328(%rbp), %rdi
movl -0x264(%rbp), %esi
movl -0x268(%rbp), %edx
callq 0x48280
jmp 0x4af06
leaq -0x210(%rbp), %rdi
callq 0x8120
jmp 0x4af14
leaq -0x2c8(%rbp), %rdi
callq 0xd6d0
leaq -0x2a8(%rbp), %rdi
callq 0xd6d0
leaq -0x288(%rbp), %rdi
callq 0xd6d0
leaq -0x260(%rbp), %rdi
callq 0xd6b0
leaq -0x240(%rbp), %rdi
callq 0x8330
leaq -0x210(%rbp), %rdi
callq 0x8170
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
leaq -0x2c8(%rbp), %rdi
callq 0xd6d0
leaq -0x2a8(%rbp), %rdi
callq 0xd6d0
leaq -0x288(%rbp), %rdi
callq 0xd6d0
leaq -0x260(%rbp), %rdi
callq 0xd6b0
leaq -0x240(%rbp), %rdi
callq 0x8330
leaq -0x210(%rbp), %rdi
callq 0x8170
movq -0x218(%rbp), %rdi
callq 0x8880
nopl (%rax)