// File: alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::LoadObjWithCallback(std::istream&, tinyobj::callback_t_ const&, void*, tinyobj::MaterialReader*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
bool LoadObjWithCallback(std::istream &inStream, const callback_t &callback,
                         void *user_data /*= NULL*/,
                         MaterialReader *readMatFn /*= NULL*/,
                         std::string *warn, /* = NULL*/
                         std::string *err /*= NULL*/) {
  std::stringstream errss;

  // material
  std::map<std::string, int> material_map;
  int material_id = -1;  // -1 = invalid

  std::vector<index_t> indices;
  std::vector<material_t> materials;
  std::vector<std::string> names;
  names.reserve(2);
  std::vector<const char *> names_out;

  std::string linebuf;
  while (inStream.peek() != -1) {
    safeGetline(inStream, linebuf);

    // Trim newline '\r\n' or '\n'
    if (linebuf.size() > 0) {
      if (linebuf[linebuf.size() - 1] == '\n')
        linebuf.erase(linebuf.size() - 1);
    }
    if (linebuf.size() > 0) {
      if (linebuf[linebuf.size() - 1] == '\r')
        linebuf.erase(linebuf.size() - 1);
    }

    // Skip if empty line.
    if (linebuf.empty()) {
      continue;
    }

    // Skip leading space.
    const char *token = linebuf.c_str();
    token += strspn(token, " \t");

    assert(token);
    if (token[0] == '\0') continue;  // empty line

    if (token[0] == '#') continue;  // comment line

    // vertex
    if (token[0] == 'v' && IS_SPACE((token[1]))) {
      token += 2;
      // TODO(syoyo): Support parsing vertex color extension.
      real_t x, y, z, w;  // w is optional. default = 1.0
      parseV(&x, &y, &z, &w, &token);
      if (callback.vertex_cb) {
        callback.vertex_cb(user_data, x, y, z, w);
      }
      continue;
    }

    // normal
    if (token[0] == 'v' && token[1] == 'n' && IS_SPACE((token[2]))) {
      token += 3;
      real_t x, y, z;
      parseReal3(&x, &y, &z, &token);
      if (callback.normal_cb) {
        callback.normal_cb(user_data, x, y, z);
      }
      continue;
    }

    // texcoord
    if (token[0] == 'v' && token[1] == 't' && IS_SPACE((token[2]))) {
      token += 3;
      real_t x, y, z;  // y and z are optional. default = 0.0
      parseReal3(&x, &y, &z, &token);
      if (callback.texcoord_cb) {
        callback.texcoord_cb(user_data, x, y, z);
      }
      continue;
    }

    // face
    if (token[0] == 'f' && IS_SPACE((token[1]))) {
      token += 2;
      token += strspn(token, " \t");

      indices.clear();
      while (!IS_NEW_LINE(token[0])) {
        vertex_index_t vi = parseRawTriple(&token);

        index_t idx;
        idx.vertex_index = vi.v_idx;
        idx.normal_index = vi.vn_idx;
        idx.texcoord_index = vi.vt_idx;

        indices.push_back(idx);
        size_t n = strspn(token, " \t\r");
        token += n;
      }

      if (callback.index_cb && indices.size() > 0) {
        callback.index_cb(user_data, &indices.at(0),
                          static_cast<int>(indices.size()));
      }

      continue;
    }

    // use mtl
    if ((0 == strncmp(token, "usemtl", 6)) && IS_SPACE((token[6]))) {
      token += 7;
      std::stringstream ss;
      ss << token;
      std::string namebuf = ss.str();

      int newMaterialId = -1;
      if (material_map.find(namebuf) != material_map.end()) {
        newMaterialId = material_map[namebuf];
      } else {
        // { error!! material not found }
      }

      if (newMaterialId != material_id) {
        material_id = newMaterialId;
      }

      if (callback.usemtl_cb) {
        callback.usemtl_cb(user_data, namebuf.c_str(), material_id);
      }

      continue;
    }

    // load mtl
    if ((0 == strncmp(token, "mtllib", 6)) && IS_SPACE((token[6]))) {
      if (readMatFn) {
        token += 7;

        std::vector<std::string> filenames;
        SplitString(std::string(token), ' ', filenames);

        if (filenames.empty()) {
          if (warn) {
            (*warn) +=
                "Looks like empty filename for mtllib. Use default "
                "material. \n";
          }
        } else {
          bool found = false;
          for (size_t s = 0; s < filenames.size(); s++) {
            std::string warn_mtl;
            std::string err_mtl;
            bool ok = (*readMatFn)(filenames[s].c_str(), &materials,
                                   &material_map, &warn_mtl, &err_mtl);

            if (warn && (!warn_mtl.empty())) {
              (*warn) += warn_mtl;  // This should be warn message.
            }

            if (err && (!err_mtl.empty())) {
              (*err) += err_mtl;
            }

            if (ok) {
              found = true;
              break;
            }
          }

          if (!found) {
            if (warn) {
              (*warn) +=
                  "Failed to load material file(s). Use default "
                  "material.\n";
            }
          } else {
            if (callback.mtllib_cb) {
              callback.mtllib_cb(user_data, &materials.at(0),
                                 static_cast<int>(materials.size()));
            }
          }
        }
      }

      continue;
    }

    // group name
    if (token[0] == 'g' && IS_SPACE((token[1]))) {
      names.clear();

      while (!IS_NEW_LINE(token[0])) {
        std::string str = parseString(&token);
        names.push_back(str);
        token += strspn(token, " \t\r");  // skip tag
      }

      assert(names.size() > 0);

      if (callback.group_cb) {
        if (names.size() > 1) {
          // create const char* array.
          names_out.resize(names.size() - 1);
          for (size_t j = 0; j < names_out.size(); j++) {
            names_out[j] = names[j + 1].c_str();
          }
          callback.group_cb(user_data, &names_out.at(0),
                            static_cast<int>(names_out.size()));

        } else {
          callback.group_cb(user_data, NULL, 0);
        }
      }

      continue;
    }

    // object name
    if (token[0] == 'o' && IS_SPACE((token[1]))) {
      // @todo { multiple object name? }
      token += 2;

      std::stringstream ss;
      ss << token;
      std::string object_name = ss.str();

      if (callback.object_cb) {
        callback.object_cb(user_data, object_name.c_str());
      }

      continue;
    }

#if 0  // @todo
    if (token[0] == 't' && IS_SPACE(token[1])) {
      tag_t tag;

      token += 2;
      std::stringstream ss;
      ss << token;
      tag.name = ss.str();

      token += tag.name.size() + 1;

      tag_sizes ts = parseTagTriple(&token);

      tag.intValues.resize(static_cast<size_t>(ts.num_ints));

      for (size_t i = 0; i < static_cast<size_t>(ts.num_ints); ++i) {
        tag.intValues[i] = atoi(token);
        token += strcspn(token, "/ \t\r") + 1;
      }

      tag.floatValues.resize(static_cast<size_t>(ts.num_reals));
      for (size_t i = 0; i < static_cast<size_t>(ts.num_reals); ++i) {
        tag.floatValues[i] = parseReal(&token);
        token += strcspn(token, "/ \t\r") + 1;
      }

      tag.stringValues.resize(static_cast<size_t>(ts.num_strings));
      for (size_t i = 0; i < static_cast<size_t>(ts.num_strings); ++i) {
        std::stringstream ss;
        ss << token;
        tag.stringValues[i] = ss.str();
        token += tag.stringValues[i].size() + 1;
      }

      tags.push_back(tag);
    }
#endif

    // Ignore unknown command.
  }

  if (err) {
    (*err) += errss.str();
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x870, %rsp            # imm = 0x870
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x7360
leaq -0x1e8(%rbp), %rdi
callq 0x2b830
movl $0xffffffff, -0x1ec(%rbp) # imm = 0xFFFFFFFF
leaq -0x208(%rbp), %rdi
callq 0x2c600
leaq -0x220(%rbp), %rdi
callq 0x2c620
leaq -0x238(%rbp), %rdi
movq %rdi, -0x758(%rbp)
callq 0x2be80
movq -0x758(%rbp), %rdi
movl $0x2, %esi
callq 0x2c640
jmp 0x22b73
leaq -0x260(%rbp), %rdi
callq 0x2c740
leaq -0x280(%rbp), %rdi
callq 0x7690
movq -0x8(%rbp), %rdi
callq 0x7170
movl %eax, -0x75c(%rbp)
jmp 0x22b9c
movl -0x75c(%rbp), %eax
cmpl $-0x1, %eax
je 0x23c01
movq -0x8(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x1df40
jmp 0x22bbd
leaq -0x280(%rbp), %rdi
callq 0x7350
cmpq $0x0, %rax
jbe 0x22c70
leaq -0x280(%rbp), %rdi
movq %rdi, -0x770(%rbp)
callq 0x7350
movq -0x770(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x7930
movq %rax, -0x768(%rbp)
jmp 0x22c01
movq -0x768(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x22c6e
leaq -0x280(%rbp), %rdi
movq %rdi, -0x778(%rbp)
callq 0x7350
movq -0x778(%rbp), %rdi
movq %rax, %rsi
decq %rsi
movq $-0x1, %rdx
callq 0x70c0
jmp 0x22c3e
jmp 0x22c6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x23ce0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x23cc8
jmp 0x22c70
leaq -0x280(%rbp), %rdi
callq 0x7350
cmpq $0x0, %rax
jbe 0x22cf1
leaq -0x280(%rbp), %rdi
movq %rdi, -0x788(%rbp)
callq 0x7350
movq -0x788(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x7930
movq %rax, -0x780(%rbp)
jmp 0x22cb0
movq -0x780(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x22cef
leaq -0x280(%rbp), %rdi
movq %rdi, -0x790(%rbp)
callq 0x7350
movq -0x790(%rbp), %rdi
movq %rax, %rsi
decq %rsi
movq $-0x1, %rdx
callq 0x70c0
jmp 0x22ced
jmp 0x22cef
jmp 0x22cf1
leaq -0x280(%rbp), %rdi
callq 0x77e0
testb $0x1, %al
jne 0x22d03
jmp 0x22d08
jmp 0x22b8b
leaq -0x280(%rbp), %rdi
callq 0x71c0
movq %rax, -0x288(%rbp)
movq -0x288(%rbp), %rdi
leaq 0x5b877(%rip), %rsi     # 0x7e5a0
callq 0x71d0
addq -0x288(%rbp), %rax
movq %rax, -0x288(%rbp)
cmpq $0x0, -0x288(%rbp)
je 0x22d48
jmp 0x22d67
leaq 0x5b89e(%rip), %rdi     # 0x7e5ed
leaq 0x5b89d(%rip), %rsi     # 0x7e5f3
movl $0xa55, %edx            # imm = 0xA55
leaq 0x5bcd4(%rip), %rcx     # 0x7ea36
callq 0x7310
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x22d7b
jmp 0x22b8b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x22d8f
jmp 0x22b8b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x76, %eax
jne 0x22e53
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x20, %eax
je 0x22dc6
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x9, %eax
jne 0x22e53
movq -0x288(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x288(%rbp)
leaq -0x28c(%rbp), %rdi
leaq -0x290(%rbp), %rsi
leaq -0x294(%rbp), %rdx
leaq -0x298(%rbp), %rcx
leaq -0x288(%rbp), %r8
xorps %xmm2, %xmm2
movsd 0x5b672(%rip), %xmm3    # 0x7e478
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x23d30
jmp 0x22e13
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x22e4e
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdi
movss -0x28c(%rbp), %xmm0
movss -0x290(%rbp), %xmm1
movss -0x294(%rbp), %xmm2
movss -0x298(%rbp), %xmm3
callq *%rax
jmp 0x22e4c
jmp 0x22e4e
jmp 0x22b8b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x76, %eax
jne 0x22f12
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x6e, %eax
jne 0x22f12
movq -0x288(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x20, %eax
je 0x22e9a
movq -0x288(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x9, %eax
jne 0x22f12
movq -0x288(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x288(%rbp)
leaq -0x29c(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
leaq -0x2a4(%rbp), %rdx
leaq -0x288(%rbp), %rcx
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x1bdf0
jmp 0x22ed8
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x22f0d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdi
movss -0x29c(%rbp), %xmm0
movss -0x2a0(%rbp), %xmm1
movss -0x2a4(%rbp), %xmm2
callq *%rax
jmp 0x22f0b
jmp 0x22f0d
jmp 0x22b8b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x76, %eax
jne 0x22fd1
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x74, %eax
jne 0x22fd1
movq -0x288(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x20, %eax
je 0x22f59
movq -0x288(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x9, %eax
jne 0x22fd1
movq -0x288(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x288(%rbp)
leaq -0x2a8(%rbp), %rdi
leaq -0x2ac(%rbp), %rsi
leaq -0x2b0(%rbp), %rdx
leaq -0x288(%rbp), %rcx
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x1bdf0
jmp 0x22f97
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x22fcc
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rdi
movss -0x2a8(%rbp), %xmm0
movss -0x2ac(%rbp), %xmm1
movss -0x2b0(%rbp), %xmm2
callq *%rax
jmp 0x22fca
jmp 0x22fcc
jmp 0x22b8b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x66, %eax
jne 0x231d9
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x20, %eax
je 0x23008
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x9, %eax
jne 0x231d9
movq -0x288(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x288(%rbp)
movq -0x288(%rbp), %rdi
leaq 0x5b578(%rip), %rsi     # 0x7e5a0
callq 0x71d0
addq -0x288(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x2c760
movq -0x288(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xd, %ecx
movb %al, -0x791(%rbp)
je 0x2308b
movq -0x288(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xa, %ecx
movb %al, -0x791(%rbp)
je 0x2308b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
sete %al
movb %al, -0x791(%rbp)
movb -0x791(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2309c
jmp 0x23158
leaq -0x288(%rbp), %rdi
callq 0x23dc0
movl %edx, -0x7a4(%rbp)
movq %rax, -0x7a0(%rbp)
jmp 0x230b7
movl -0x7a4(%rbp), %eax
movq -0x7a0(%rbp), %rcx
movq %rcx, -0x2d0(%rbp)
movl %eax, -0x2c8(%rbp)
movl -0x2c8(%rbp), %eax
movl %eax, -0x2b8(%rbp)
movq -0x2d0(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movl -0x2c0(%rbp), %eax
movl %eax, -0x2dc(%rbp)
movl -0x2b8(%rbp), %eax
movl %eax, -0x2d8(%rbp)
movl -0x2bc(%rbp), %eax
movl %eax, -0x2d4(%rbp)
leaq -0x208(%rbp), %rdi
leaq -0x2dc(%rbp), %rsi
callq 0x2c780
jmp 0x23124
movq -0x288(%rbp), %rdi
leaq 0x5ba7c(%rip), %rsi     # 0x7ebae
callq 0x71d0
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rax
addq -0x288(%rbp), %rax
movq %rax, -0x288(%rbp)
jmp 0x23047
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x231d4
leaq -0x208(%rbp), %rdi
callq 0x2bf80
cmpq $0x0, %rax
jbe 0x231d4
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x7c0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x7b8(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x208(%rbp), %rdi
callq 0x2c7f0
movq %rax, -0x7b0(%rbp)
jmp 0x231a8
leaq -0x208(%rbp), %rdi
callq 0x2bf80
movq -0x7b8(%rbp), %rdi
movq -0x7b0(%rbp), %rsi
movq %rax, %rcx
movq -0x7c0(%rbp), %rax
movl %ecx, %edx
callq *%rax
jmp 0x231d2
jmp 0x231d4
jmp 0x22b8b
movq -0x288(%rbp), %rdi
leaq 0x5b732(%rip), %rsi     # 0x7e919
movl $0x6, %edx
callq 0x7240
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x233ca
movq -0x288(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x20, %eax
je 0x23221
movq -0x288(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x9, %eax
jne 0x233ca
movq -0x288(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x288(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x7360
jmp 0x23241
leaq -0x460(%rbp), %rdi
movq -0x288(%rbp), %rsi
callq 0x74e0
jmp 0x23256
leaq -0x490(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x74d0
jmp 0x2326b
movl $0xffffffff, -0x494(%rbp) # imm = 0xFFFFFFFF
leaq -0x1e8(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0x2bd20
movq %rax, -0x7c8(%rbp)
jmp 0x23291
movq -0x7c8(%rbp), %rax
movq %rax, -0x4a0(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x2bd50
movq %rax, -0x4a8(%rbp)
leaq -0x4a0(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x2bcf0
testb $0x1, %al
jne 0x232cb
jmp 0x23332
leaq -0x1e8(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0x2bd80
movq %rax, -0x7d0(%rbp)
jmp 0x232e7
movq -0x7d0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x494(%rbp)
jmp 0x23334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x233b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x490(%rbp), %rdi
callq 0x72e0
jmp 0x233b9
jmp 0x23334
movl -0x494(%rbp), %eax
cmpl -0x1ec(%rbp), %eax
je 0x2334e
movl -0x494(%rbp), %eax
movl %eax, -0x1ec(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x2339c
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x7d8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x7e0(%rbp)
leaq -0x490(%rbp), %rdi
callq 0x71c0
movq -0x7e0(%rbp), %rdi
movq %rax, %rsi
movq -0x7d8(%rbp), %rax
movl -0x1ec(%rbp), %edx
callq *%rax
jmp 0x2339a
jmp 0x2339c
leaq -0x490(%rbp), %rdi
callq 0x72e0
leaq -0x470(%rbp), %rdi
callq 0x73b0
jmp 0x22b8b
leaq -0x470(%rbp), %rdi
callq 0x73b0
jmp 0x23cc8
movq -0x288(%rbp), %rdi
leaq 0x5b548(%rip), %rsi     # 0x7e920
movl $0x6, %edx
callq 0x7240
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x23834
movq -0x288(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x20, %eax
je 0x23412
movq -0x288(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x9, %eax
jne 0x23834
cmpq $0x0, -0x20(%rbp)
je 0x2382f
movq -0x288(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x288(%rbp)
leaq -0x4c0(%rbp), %rdi
callq 0x2be80
movq -0x288(%rbp), %rax
movq %rax, -0x7f0(%rbp)
leaq -0x4e1(%rbp), %rdi
movq %rdi, -0x7e8(%rbp)
callq 0x7870
movq -0x7f0(%rbp), %rsi
movq -0x7e8(%rbp), %rdx
leaq -0x4e0(%rbp), %rdi
callq 0x2b020
jmp 0x23478
leaq -0x4e0(%rbp), %rdi
movl $0x20, %esi
leaq -0x4c0(%rbp), %rdx
callq 0x228b0
jmp 0x23492
leaq -0x4e0(%rbp), %rdi
callq 0x72e0
leaq -0x4e1(%rbp), %rdi
callq 0x7560
leaq -0x4c0(%rbp), %rdi
callq 0x2bea0
testb $0x1, %al
jne 0x234bc
jmp 0x23536
cmpq $0x0, -0x28(%rbp)
je 0x23531
movq -0x28(%rbp), %rdi
leaq 0x5b5e6(%rip), %rsi     # 0x7eab4
callq 0x74c0
jmp 0x234d5
jmp 0x23531
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x23509
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x72e0
leaq -0x4e1(%rbp), %rdi
callq 0x7560
jmp 0x2381e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x2381e
jmp 0x23810
movb $0x0, -0x4e2(%rbp)
movq $0x0, -0x4f0(%rbp)
movq -0x4f0(%rbp), %rax
movq %rax, -0x7f8(%rbp)
leaq -0x4c0(%rbp), %rdi
callq 0x2bee0
movq %rax, %rcx
movq -0x7f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x2377c
leaq -0x510(%rbp), %rdi
callq 0x7690
leaq -0x530(%rbp), %rdi
callq 0x7690
movq -0x20(%rbp), %rax
movq %rax, -0x810(%rbp)
movq -0x4f0(%rbp), %rsi
leaq -0x4c0(%rbp), %rdi
callq 0x2bf00
movq %rax, %rdi
callq 0x71c0
movq %rax, -0x808(%rbp)
leaq -0x559(%rbp), %rdi
movq %rdi, -0x800(%rbp)
callq 0x7870
movq -0x808(%rbp), %rsi
movq -0x800(%rbp), %rdx
leaq -0x558(%rbp), %rdi
callq 0x2b020
jmp 0x235e9
movq -0x810(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0x558(%rbp), %rsi
leaq -0x220(%rbp), %rdx
leaq -0x1e8(%rbp), %rcx
leaq -0x510(%rbp), %r8
leaq -0x530(%rbp), %r9
callq *%rax
movb %al, -0x811(%rbp)
jmp 0x23624
leaq -0x558(%rbp), %rdi
callq 0x72e0
leaq -0x559(%rbp), %rdi
callq 0x7560
movb -0x811(%rbp), %al
andb $0x1, %al
movb %al, -0x531(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x236cf
leaq -0x510(%rbp), %rdi
callq 0x77e0
testb $0x1, %al
jne 0x236cf
movq -0x28(%rbp), %rdi
leaq -0x510(%rbp), %rsi
callq 0x7620
jmp 0x23673
jmp 0x236cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x236a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x558(%rbp), %rdi
callq 0x72e0
leaq -0x559(%rbp), %rdi
callq 0x7560
jmp 0x2375f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x2375f
cmpq $0x0, -0x30(%rbp)
je 0x236fa
leaq -0x530(%rbp), %rdi
callq 0x77e0
testb $0x1, %al
jne 0x236fa
movq -0x30(%rbp), %rdi
leaq -0x530(%rbp), %rsi
callq 0x7620
jmp 0x236f8
jmp 0x236fa
testb $0x1, -0x531(%rbp)
je 0x23716
movb $0x1, -0x4e2(%rbp)
movl $0x6, -0x560(%rbp)
jmp 0x23720
movl $0x0, -0x560(%rbp)
leaq -0x530(%rbp), %rdi
callq 0x72e0
leaq -0x510(%rbp), %rdi
callq 0x72e0
movl -0x560(%rbp), %eax
testl %eax, %eax
je 0x23746
jmp 0x23744
jmp 0x2377c
jmp 0x23748
movq -0x4f0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4f0(%rbp)
jmp 0x23548
leaq -0x530(%rbp), %rdi
callq 0x72e0
leaq -0x510(%rbp), %rdi
callq 0x72e0
jmp 0x2381e
testb $0x1, -0x4e2(%rbp)
jne 0x237a2
cmpq $0x0, -0x28(%rbp)
je 0x237a0
movq -0x28(%rbp), %rdi
leaq 0x5b1d2(%rip), %rsi     # 0x7e969
callq 0x74c0
jmp 0x2379e
jmp 0x237a0
jmp 0x2380e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x2380c
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x830(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x828(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x220(%rbp), %rdi
callq 0x2c830
movq %rax, -0x820(%rbp)
jmp 0x237e0
leaq -0x220(%rbp), %rdi
callq 0x2b2e0
movq -0x828(%rbp), %rdi
movq -0x820(%rbp), %rsi
movq %rax, %rcx
movq -0x830(%rbp), %rax
movl %ecx, %edx
callq *%rax
jmp 0x2380a
jmp 0x2380c
jmp 0x2380e
jmp 0x23810
leaq -0x4c0(%rbp), %rdi
callq 0x2bf20
jmp 0x2382f
leaq -0x4c0(%rbp), %rdi
callq 0x2bf20
jmp 0x23cc8
jmp 0x22b8b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x67, %eax
jne 0x23ac7
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x20, %eax
je 0x2386b
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x9, %eax
jne 0x23ac7
leaq -0x238(%rbp), %rdi
callq 0x2c870
movq -0x288(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xd, %ecx
movb %al, -0x831(%rbp)
je 0x238bb
movq -0x288(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xa, %ecx
movb %al, -0x831(%rbp)
je 0x238bb
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
sete %al
movb %al, -0x831(%rbp)
movb -0x831(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x238c9
jmp 0x23948
leaq -0x580(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x1c060
jmp 0x238de
leaq -0x238(%rbp), %rdi
leaq -0x580(%rbp), %rsi
callq 0x2c130
jmp 0x238f3
movq -0x288(%rbp), %rdi
leaq 0x5b2ad(%rip), %rsi     # 0x7ebae
callq 0x71d0
addq -0x288(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x580(%rbp), %rdi
callq 0x72e0
jmp 0x23877
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x580(%rbp), %rdi
callq 0x72e0
jmp 0x23cc8
leaq -0x238(%rbp), %rdi
callq 0x2bee0
cmpq $0x0, %rax
jbe 0x2395c
jmp 0x2397b
leaq 0x5b18f(%rip), %rdi     # 0x7eaf2
leaq 0x5ac89(%rip), %rsi     # 0x7e5f3
movl $0xaf0, %edx            # imm = 0xAF0
leaq 0x5b0c0(%rip), %rcx     # 0x7ea36
callq 0x7310
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x23ac2
leaq -0x238(%rbp), %rdi
callq 0x2bee0
cmpq $0x1, %rax
jbe 0x23aaa
leaq -0x238(%rbp), %rdi
callq 0x2bee0
movq %rax, %rsi
decq %rsi
leaq -0x260(%rbp), %rdi
callq 0x2c890
jmp 0x239c0
movq $0x0, -0x588(%rbp)
movq -0x588(%rbp), %rax
movq %rax, -0x840(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x2c920
movq %rax, %rcx
movq -0x840(%rbp), %rax
cmpq %rcx, %rax
jae 0x23a4b
movq -0x588(%rbp), %rsi
addq $0x1, %rsi
leaq -0x238(%rbp), %rdi
callq 0x2bf00
movq %rax, %rdi
callq 0x71c0
movq %rax, -0x848(%rbp)
movq -0x588(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0x2c940
movq -0x848(%rbp), %rcx
movq %rcx, (%rax)
movq -0x588(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x588(%rbp)
jmp 0x239cb
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x860(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x858(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x260(%rbp), %rdi
callq 0x2c960
movq %rax, -0x850(%rbp)
jmp 0x23a7e
leaq -0x260(%rbp), %rdi
callq 0x2c920
movq -0x858(%rbp), %rdi
movq -0x850(%rbp), %rsi
movq %rax, %rcx
movq -0x860(%rbp), %rax
movl %ecx, %edx
callq *%rax
jmp 0x23aa8
jmp 0x23ac0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x18(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq *%rax
jmp 0x23abe
jmp 0x23ac0
jmp 0x23ac2
jmp 0x22b8b
movq -0x288(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6f, %eax
jne 0x23bfc
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x20, %eax
je 0x23afe
movq -0x288(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x9, %eax
jne 0x23bfc
movq -0x288(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x288(%rbp)
leaq -0x710(%rbp), %rdi
callq 0x7360
jmp 0x23b1e
leaq -0x700(%rbp), %rdi
movq -0x288(%rbp), %rsi
callq 0x74e0
jmp 0x23b33
leaq -0x730(%rbp), %rdi
leaq -0x710(%rbp), %rsi
callq 0x74d0
jmp 0x23b48
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x23bc4
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x868(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x870(%rbp)
leaq -0x730(%rbp), %rdi
callq 0x71c0
movq -0x870(%rbp), %rdi
movq %rax, %rsi
movq -0x868(%rbp), %rax
callq *%rax
jmp 0x23b8e
jmp 0x23bc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x23beb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x730(%rbp), %rdi
callq 0x72e0
jmp 0x23beb
movl $0x2, -0x560(%rbp)
leaq -0x730(%rbp), %rdi
callq 0x72e0
leaq -0x710(%rbp), %rdi
callq 0x73b0
jmp 0x22b8b
leaq -0x710(%rbp), %rdi
callq 0x73b0
jmp 0x23cc8
jmp 0x22b8b
cmpq $0x0, -0x30(%rbp)
je 0x23c5d
leaq -0x750(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x74d0
jmp 0x23c1d
movq -0x30(%rbp), %rdi
leaq -0x750(%rbp), %rsi
callq 0x7620
jmp 0x23c2f
leaq -0x750(%rbp), %rdi
callq 0x72e0
jmp 0x23c5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x750(%rbp), %rdi
callq 0x72e0
jmp 0x23cc8
movl $0x1, -0x560(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x72e0
leaq -0x260(%rbp), %rdi
callq 0x2c9a0
leaq -0x238(%rbp), %rdi
callq 0x2bf20
leaq -0x220(%rbp), %rdi
callq 0x2ca00
leaq -0x208(%rbp), %rdi
callq 0x2ca60
leaq -0x1e8(%rbp), %rdi
callq 0x2c4e0
leaq -0x1b8(%rbp), %rdi
callq 0x73b0
movb $0x1, %al
andb $0x1, %al
addq $0x870, %rsp            # imm = 0x870
popq %rbp
retq
leaq -0x280(%rbp), %rdi
callq 0x72e0
leaq -0x260(%rbp), %rdi
callq 0x2c9a0
leaq -0x238(%rbp), %rdi
callq 0x2bf20
leaq -0x220(%rbp), %rdi
callq 0x2ca00
leaq -0x208(%rbp), %rdi
callq 0x2ca60
leaq -0x1e8(%rbp), %rdi
callq 0x2c4e0
leaq -0x1b8(%rbp), %rdi
callq 0x73b0
movq -0x240(%rbp), %rdi
callq 0x7860
nopl (%rax,%rax)