// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, %r15
leaq 0xa0(%rdi), %rbx
leaq 0xd0(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x65a0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xf0(%rsp,%rax)
jne 0x1a0e7
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
leaq 0x22240(%rip), %rsi     # 0x3c13e
leaq 0x90(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x9162
leaq 0x22237(%rip), %rsi     # 0x3c14c
leaq 0x70(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x9162
movq %r15, 0x28(%rsp)
leaq 0x20459(%rip), %rsi     # 0x3a387
leaq 0x50(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x9162
xorl %r14d, %r14d
leaq 0x30(%rsp), %r15
movq %rsp, %r12
leaq 0xb0(%rsp), %rbp
leaq 0x50(%rsp), %rbx
xorl %r13d, %r13d
leaq 0xd0(%rsp), %rdi
movq %r15, %rsi
callq 0x60b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1a078
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpb $0xd, -0x1(%rax,%rcx)
jne 0x19f91
movq %r15, %rdi
callq 0x6460
movq %r15, %rdi
movq %r12, %rsi
leaq 0x90(%rsp), %rdx
xorl %ecx, %ecx
callq 0x91c8
testb %al, %al
je 0x19ffa
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0x19fd3
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0x19fd3
addq $0x18, %rsi
jmp 0x19fda
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0x91e4
movq %rbp, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x922b
movl %eax, %r13d
movq %rbp, %rdi
callq 0x61d0
movq %r15, %rdi
movq %r12, %rsi
leaq 0x70(%rsp), %rdx
xorl %ecx, %ecx
callq 0x91c8
testb %al, %al
je 0x1a060
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0x1a039
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0x1a039
addq $0x18, %rsi
jmp 0x1a040
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0x91e4
movq %rbp, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x922b
movl %eax, %r14d
movq %rbp, %rdi
callq 0x61d0
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x91c8
testb %al, %al
je 0x19f56
movq 0x28(%rsp), %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x18d3a
leaq 0xd0(%rsp), %rdi
callq 0x60d0
leaq 0x50(%rsp), %rdi
callq 0x9260
leaq 0x70(%rsp), %rdi
callq 0x9260
leaq 0x90(%rsp), %rdi
callq 0x9260
movq %rsp, %rdi
callq 0x9690
leaq 0x30(%rsp), %rdi
callq 0x61d0
leaq 0xd0(%rsp), %rdi
callq 0x6120
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3feaa(%rip), %rdi     # 0x59f98
leaq 0x22021(%rip), %rsi     # 0x3c116
callq 0x63a0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x6360
leaq 0x201cc(%rip), %rsi     # 0x3a2d8
movq %rax, %rdi
callq 0x63a0
leaq 0x20448(%rip), %rsi     # 0x3a563
movq %rax, %rdi
callq 0x63a0
pushq $0x1
popq %rdi
callq 0x6450
movq %rax, %rbx
jmp 0x1a18f
movq %rax, %rbx
jmp 0x1a166
movq %rax, %rbx
jmp 0x1a170
movq %rax, %rbx
jmp 0x1a17d
jmp 0x1a159
jmp 0x1a145
jmp 0x1a159
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x61d0
jmp 0x1a15c
jmp 0x1a159
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x9260
leaq 0x70(%rsp), %rdi
callq 0x9260
leaq 0x90(%rsp), %rdi
callq 0x9260
movq %rsp, %rdi
callq 0x9690
leaq 0x30(%rsp), %rdi
callq 0x61d0
leaq 0xd0(%rsp), %rdi
callq 0x6120
movq %rbx, %rdi
callq 0x6650