LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game.cc
// Function: Game::create_system(std::vector<Pyramid, std::allocator<Pyramid>> const&, int)
int Game::create_system(const std::vector<Pyramid>& stars, int player) {
  for (const Pyramid& star : stars) {
    stash_[star]--;
  }
  if (player != 0) {
    homeworlds_built_++;
  }
  return add_system(System{0, player, stars});
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %r15
movq 0x8(%rsi), %r13
leaq 0x38(%rdi), %r12
cmpq %r13, %r15
je 0x3953
movq %r12, %rdi
movq %r15, %rsi
callq 0x3e88
decl (%rax)
addq $0x8, %r15
jmp 0x393b
testl %ebp, %ebp
je 0x395a
incl 0xc(%rbx)
leaq 0x8(%rsp), %r15
andl $0x0, -0x8(%r15)
movl %ebp, -0x4(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x3fe8
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r15)
andq $0x0, 0x28(%r15)
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x3de4
movl %eax, %ebx
movq %rsp, %rdi
callq 0x4036
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4036
movq %rbx, %rdi
callq 0x2300
nop
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game.cc
// Function: Game::destroy_system(int)
void Game::destroy_system(int system_id) {
  const auto& it = find_if(systems_.begin(), systems_.end(),
      [system_id](const System& s) {
        return s.id == system_id;
      });
  for (const Pyramid& star : it->stars) {
    stash_[star]++;
  }
  for (const Ship& ship : it->ships) {
    stash_[ship.pyramid]++;
  }
  systems_.erase(it);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq 0x20(%rdi), %rdi
movq 0x28(%r14), %r15
movq %r15, %rcx
subq %rdi, %rcx
pushq $0x38
popq %r8
movq %rcx, %rax
cqto
idivq %r8
sarq $0x2, %rax
testq %rax, %rax
jle 0x3a16
cmpl %esi, (%rdi)
je 0x3a5b
cmpl %esi, 0x38(%rdi)
je 0x3a48
cmpl %esi, 0x70(%rdi)
je 0x3a4e
cmpl %esi, 0xa8(%rdi)
je 0x3a54
addq $0xe0, %rdi
decq %rax
addq $-0xe0, %rcx
jmp 0x39e8
movq %rcx, %rax
cqto
idivq %r8
cmpq $0x1, %rax
je 0x3a40
cmpq $0x2, %rax
je 0x3a38
cmpq $0x3, %rax
jne 0x3a5e
cmpl %esi, (%rdi)
je 0x3a5b
addq $0x38, %rdi
cmpl %esi, (%rdi)
je 0x3a5b
addq $0x38, %rdi
cmpl %esi, (%rdi)
cmoveq %rdi, %r15
jmp 0x3a5e
addq $0x38, %rdi
jmp 0x3a5b
addq $0x70, %rdi
jmp 0x3a5b
addq $0xa8, %rdi
movq %rdi, %r15
movq 0x8(%r15), %r12
movq 0x10(%r15), %r13
addq $0x38, %r14
cmpq %r13, %r12
je 0x3a82
movq %r14, %rdi
movq %r12, %rsi
callq 0x3e88
incl (%rax)
addq $0x8, %r12
jmp 0x3a6a
movq 0x20(%r15), %r12
movq 0x28(%r15), %r13
cmpq %r13, %r12
je 0x3aa4
leaq 0x4(%r12), %rsi
movq %r14, %rdi
callq 0x3e88
incl (%rax)
addq $0xc, %r12
jmp 0x3a8a
movq %rbx, %rdi
movq %r15, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x407c
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/negamax.cc
// Function: Negamax::half_heuristic(Game const*, int)
int Negamax::half_heuristic(const Game *game, int player) {
  if (game->winner() == player) {
    return 1000000;
  } else if (game->winner() != 0) {
    return 0;
  }

  int total = 0;
  for (const System& system : game->systems()) {
    for (const Ship& ship : system.ships) {
      if (ship.player == player) {
        total += 100 * ship.pyramid.size * ship.pyramid.size;
      }
    }
  }

  return total;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rsi, %rdi
callq 0x2754
movl %eax, %ecx
movl $0xf4240, %eax          # imm = 0xF4240
cmpl %ebx, %ecx
je 0x5fca
movq %r14, %rdi
callq 0x2754
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x5fd2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x272e
movq (%rax), %rcx
movq 0x8(%rax), %rdx
xorl %esi, %esi
xorl %eax, %eax
cmpq %rdx, %rcx
je 0x5fca
movq 0x20(%rcx), %rdi
movq 0x28(%rcx), %r8
cmpq %r8, %rdi
je 0x6012
movl 0x4(%rdi), %r9d
imull %r9d, %r9d
imull $0x64, %r9d, %r9d
cmpl %ebx, (%rdi)
cmovnel %esi, %r9d
addl %r9d, %eax
addq $0xc, %rdi
jmp 0x5ff2
addq $0x38, %rcx
jmp 0x5fe5
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game_io.cc
// Function: operator<<(std::ostream&, System const&)
std::ostream& operator<<(std::ostream &os, const System& system) {
  os << "(";
  if (system.player != 0) {
    os << system.player << ", ";
  }
  for (const Pyramid& pyramid : system.stars) {
    os << pyramid;
  }
  os << ")";
  for (const Ship& ship : system.ships) {
    os << " " << ship;
  }
  return os;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x2163(%rip), %rsi      # 0xa1b5
callq 0x21d0
movl 0x4(%r14), %esi
testl %esi, %esi
je 0x8076
movq %rbx, %rdi
callq 0x22f0
leaq 0x2149(%rip), %rsi      # 0xa1b7
movq %rax, %rdi
callq 0x21d0
movq 0x8(%r14), %r15
movq 0x10(%r14), %r12
cmpq %r12, %r15
je 0x8094
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7fe0
addq $0x8, %r15
jmp 0x807e
leaq 0x20d2(%rip), %rsi      # 0xa16d
movq %rbx, %rdi
callq 0x21d0
movq 0x20(%r14), %r15
movq 0x28(%r14), %r12
leaq 0x2106(%rip), %r14      # 0xa1b8
cmpq %r12, %r15
je 0x80d3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x8012
addq $0xc, %r15
jmp 0x80b2
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game_io.cc
// Function: operator<<(std::ostream&, Action const&)
std::ostream& operator<<(std::ostream& os, const Action& action) {
  switch(action.type) {
    case PASS:
      os << "PASS";
      break;

    case ATTACK:
      os << "ATTACK " << action.ship << " " << action.system;
      break;

    case DISCOVER:
      os << "DISCOVER " << action.ship << " " << action.system;
      os << " " << action.target;
      break;

    case TRAVEL:
      os << "MOVE " << action.ship << " " << action.system << " ";
      os << action.system_target;
      break;

    case BUILD:
      os << "BUILD " << action.ship << " " << action.system;
      break;

    case TRADE:
      os << "TRADE " << action.ship << " " << action.target;
      os << " " << action.system;
      break;

    case SACRIFICE:
      os << "SACRIFICE " << action.ship << " " << action.system;
      break;

    case CATASTROPHE:
      os << "CATASTROPHE " << action.system;
      os << " " << "rygb"[action.ship.colour];
      break;
  }
  return os;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x4(%rsi), %eax
cmpq $0x7, %rax
ja 0x82a7
movq %rsi, %r14
leaq 0x206c(%rip), %rcx      # 0xa170
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x20a6(%rip), %rsi      # 0xa1ba
movq %rbx, %rdi
callq 0x21d0
jmp 0x82a7
leaq 0x20af(%rip), %rsi      # 0xa1d7
jmp 0x8275
leaq 0x2093(%rip), %rsi      # 0xa1c7
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r15
leaq 0xc(%r14), %rsi
movq %rax, %rdi
callq 0x7fe0
leaq 0x2066(%rip), %r12      # 0xa1b8
movq %r15, %rdi
movq %r12, %rsi
callq 0x21d0
movl 0x8(%r14), %esi
movq %rax, %rdi
callq 0x22f0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x21d0
addq $0x18, %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x7fe0
jmp 0x82a7
leaq 0x2042(%rip), %rsi      # 0xa1d1
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r15
leaq 0xc(%r14), %rsi
movq %rax, %rdi
callq 0x7fe0
leaq 0x200b(%rip), %r12      # 0xa1b8
movq %r15, %rdi
movq %r12, %rsi
callq 0x21d0
movl 0x8(%r14), %esi
movq %rax, %rdi
callq 0x22f0
movq %rax, %rdi
movq %r12, %rsi
callq 0x21d0
movl 0x14(%r14), %esi
movq %rbx, %rdi
jmp 0x82a2
leaq 0x200e(%rip), %rsi      # 0xa1f0
movq %rbx, %rdi
callq 0x21d0
movl 0x8(%r14), %esi
movq %rax, %rdi
callq 0x22f0
leaq 0x1fbb(%rip), %rsi      # 0xa1b8
movq %rbx, %rdi
callq 0x21d0
movl 0x10(%r14), %ecx
leaq 0x1fa0(%rip), %rdx      # 0xa1b0
movsbl (%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2220
jmp 0x82a7
leaq 0x1f97(%rip), %rsi      # 0xa1bf
jmp 0x8275
leaq 0x1fad(%rip), %rsi      # 0xa1de
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r15
leaq 0xc(%r14), %rsi
movq %rax, %rdi
callq 0x7fe0
leaq 0x1f69(%rip), %r12      # 0xa1b8
movq %r15, %rdi
movq %r12, %rsi
callq 0x21d0
leaq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x7fe0
movq %rbx, %rdi
movq %r12, %rsi
jmp 0x8296
leaq 0x1f70(%rip), %rsi      # 0xa1e5
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r15
leaq 0xc(%r14), %rsi
movq %rax, %rdi
callq 0x7fe0
leaq 0x1f25(%rip), %rsi      # 0xa1b8
movq %r15, %rdi
callq 0x21d0
movl 0x8(%r14), %esi
movq %rax, %rdi
callq 0x22f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game_io.cc
// Function: print_game(std::ostream&, Game const&, std::map<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<int>, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&)
void print_game(std::ostream& os, const Game& game,
                const std::map<int, std::string>& system_names) {
  os << game.num_players() << " ";
  os << game.homeworlds_built() << " ";
  os << game.cur_player() << std::endl;
  for (const System& system : game.systems()) {
    os << system_names.at(system.id) << " " << system << std::endl;
  }
  os << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2712
movq %r14, %rdi
movl %eax, %esi
callq 0x22f0
leaq 0x1c84(%rip), %r15      # 0xa1b8
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
movq %r12, %rdi
callq 0x271e
movq %r14, %rdi
movl %eax, %esi
callq 0x22f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
movq %r12, %rdi
callq 0x2716
movq %r14, %rdi
movl %eax, %esi
callq 0x22f0
movq %rax, %rdi
callq 0x20e0
movq %r12, %rdi
callq 0x272e
movq (%rax), %r12
movq 0x8(%rax), %rbp
cmpq %rbp, %r12
je 0x85c7
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8df4
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x803d
movq %r13, %rdi
callq 0x20e0
addq $0x38, %r12
jmp 0x8585
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20e0
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game_io.cc
// Function: operator>>(std::istream&, Pyramid&)
std::istream& operator>>(std::istream& is, Pyramid& pyramid) {
  is >> std::ws;
  char c;
  is.get(c);
  pyramid.colour =
    c == 'r' || c == 'R' ? RED :
    c == 'y' || c == 'Y' ? YELLOW :
    c == 'g' || c == 'G' ? GREEN : BLUE;
  int size;
  is >> size;
  pyramid.size = (Size)size;
  return is;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2190
leaq 0xb(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2270
movzbl (%r15), %ecx
andl $-0x21, %ecx
cmpl $0x52, %ecx
je 0x8617
cmpl $0x59, %ecx
jne 0x861b
pushq $0x1
popq %rax
jmp 0x8626
xorl %eax, %eax
jmp 0x8626
xorl %eax, %eax
cmpb $0x47, %cl
sete %al
xorl $0x3, %eax
movl %eax, 0x4(%r14)
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2130
movl (%r15), %eax
movl %eax, (%r14)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game_io.cc
// Function: operator>>(std::istream&, Ship&)
std::istream& operator>>(std::istream& is, Ship& ship) {
  is >> std::ws;
  char c;
  is.get(c);
  ship.player = (int)(c - '0');
  is >> ship.pyramid;
  return is;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2190
leaq 0xf(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2270
movsbl (%r15), %eax
addl $-0x30, %eax
movl %eax, (%rbx)
addq $0x4, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x85dd
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game_io.cc
// Function: operator>>(std::istream&, System&)
std::istream& operator>>(std::istream& is, System& system) {
  system.player = 0;
  system.id = 0;
  is >> std::ws;
  is.ignore(); // (
  if (std::isdigit(is.peek())) {
    is >> system.player;
    is.ignore(256, ' ');
  }
  while (is.peek() != ')') {
    Pyramid star;
    is >> star;
    system.stars.push_back(star);
  }
  is.ignore(); // )
  while (!is.eof()) {
    Ship ship;
    is >> ship;
    system.ships.push_back(ship);
  }
  return is;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
andq $0x0, (%rsi)
callq 0x2190
movq %rbx, %rdi
callq 0x2320
movq %rbx, %rdi
callq 0x2090
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x86e4
leaq 0x4(%r14), %rsi
movq %rbx, %rdi
callq 0x2130
pushq $0x20
popq %rdx
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
callq 0x2140
leaq 0x8(%r14), %r15
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
callq 0x2090
movq %rbx, %rdi
cmpl $0x29, %eax
je 0x8712
movq %r12, %rsi
callq 0x85dd
movq %r15, %rdi
movq %r12, %rsi
callq 0x8e2c
jmp 0x86ed
callq 0x2320
addq $0x20, %r14
leaq 0xc(%rsp), %r15
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%rbx,%rax)
jne 0x8746
movq %rbx, %rdi
movq %r15, %rsi
callq 0x864d
movq %r14, %rdi
movq %r15, %rsi
callq 0x4082
jmp 0x8720
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/czinn[P]homeworlds/game_io.cc
// Function: read_game(std::istream&, std::map<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<int>, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&)
Game* read_game(std::istream& is, std::map<int, std::string>& system_names) {
  int num_players, homeworlds_built, cur_player;
  std::string line;
  is >> num_players >> homeworlds_built >> cur_player;
  std::getline(is, line);
  Game *g = new Game(num_players);
  g->set_homeworlds_built(homeworlds_built);
  g->set_cur_player(cur_player);
  while (true) {
    std::getline(is, line);
    if (line.length() == 0) {
      break;
    }
    System system;
    std::istringstream sis = std::istringstream(line);
    std::string system_name;
    sis >> system_name;
    sis >> system;
    int system_id = g->add_system(system);
    system_names.emplace(system_id, system_name);
  }

  return g;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, 0x20(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x14(%rsp), %rsi
movq %rdi, 0x18(%rsp)
callq 0x2130
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2130
leaq 0xc(%rsp), %rsi
movq %rax, %rdi
callq 0x2130
leaq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rdi
callq 0x2050
pushq $0x68
popq %rdi
callq 0x21e0
movq %rax, %r15
movl 0x14(%rsp), %esi
movq %rax, %rdi
callq 0x2626
movl 0x10(%rsp), %esi
movq %r15, %rdi
callq 0x2748
movl 0xc(%rsp), %esi
movq %r15, %rdi
callq 0x273e
leaq 0xd8(%rsp), %r13
leaq 0x48(%rsp), %rbp
leaq 0x68(%rsp), %rbx
leaq 0xa0(%rsp), %r14
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x2050
cmpq $0x0, 0x30(%rsp)
je 0x88c1
leaq 0x70(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %r13, %rdi
leaq 0x28(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x22d0
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
movb $0x0, 0x58(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2230
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8696
movq %r14, %rdi
movq %rbx, %rsi
callq 0x507c
movq %r15, %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x3de4
movl %eax, %r15d
movq %r14, %rdi
callq 0x4036
movl %r15d, 0x8(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %rbp, %rdx
callq 0x9056
movq %r12, %r15
movq %rbp, %rdi
callq 0x20c0
movq %r13, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x4036
jmp 0x87fd
leaq 0x28(%rsp), %rdi
callq 0x20c0
movq %r15, %rax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x68
popq %rsi
movq %r15, %rdi
callq 0x21f0
jmp 0x8936
jmp 0x890b
jmp 0x890b
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x4036
jmp 0x8915
movq %rax, %rbx
jmp 0x892c
movq %rax, %rbx
jmp 0x8936
jmp 0x8912
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x20c0
leaq 0xd8(%rsp), %rdi
callq 0x20d0
leaq 0x68(%rsp), %rdi
callq 0x4036
leaq 0x28(%rsp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/main.cc
// Function: main
int main(int argc, char *argv[])
{
    char const *filename = nullptr;

    if (argc < 2) {
        printf("Some Sort Of Ascii Art Generator\n");
        printf("usage: %s <bitmap filename>\n", argv[0]);
        printf("using default image: %s\n", DEFAULT_IMAGE);

        filename = DEFAULT_IMAGE;
    } else {
        filename = argv[1];
    }

    ImageWriter    image_writer(filename);
    image_writer.WriteFile(MOSAIC_OUTPUT);

    AsciiArtWriter ascii_writer(filename);
    ascii_writer.WriteFile(ASCII_OUTPUT);
}

// Assembly:
pushq %rbx
subq $0xf0, %rsp
movq %rsi, %rbx
cmpl $0x1, %edi
jg 0x2413
leaq 0x1cae(%rip), %rdi      # 0x4091
callq 0x2200
movq (%rbx), %rsi
leaq 0x1c12(%rip), %rdi      # 0x4004
xorl %eax, %eax
callq 0x2060
leaq 0x1c21(%rip), %rdi      # 0x4021
leaq 0x1c33(%rip), %rbx      # 0x403a
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2060
jmp 0x2417
movq 0x8(%rbx), %rbx
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %rbx, %rsi
callq 0x2560
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x28c4
leaq 0x30(%rsp), %rdi
callq 0x2298
leaq 0x1c04(%rip), %rsi      # 0x4050
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x2560
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x26e8
leaq 0x30(%rsp), %rdi
callq 0x2298
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %rbx, %rsi
callq 0x2560
leaq 0x4cd8(%rip), %rdx      # 0x7168
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2b10
leaq 0x10(%rsp), %rdi
callq 0x2298
leaq 0x1bac(%rip), %rsi      # 0x405c
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2560
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x26e8
leaq 0x10(%rsp), %rdi
callq 0x2298
leaq 0x30(%rsp), %rdi
callq 0x259c
leaq 0xa0(%rsp), %rdi
callq 0x25c0
xorl %eax, %eax
addq $0xf0, %rsp
popq %rbx
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2298
jmp 0x250c
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x259c
jmp 0x2536
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x252c
jmp 0x2533
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2298
jmp 0x2536
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x25c0
movq %rbx, %rdi
callq 0x2230
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2298
jmp 0x2543
movq %rax, %rbx
jmp 0x2543
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/html_writer.cc
// Function: HTMLWriter::WriteFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool HTMLWriter::WriteFile(std::string const& filename)
{
    this->file_ = fopen(filename.c_str(), "w");
    if (this->file_) {
        this->WriteHTML();
        fclose(this->file_);
    }
    return (this->file_ != NULL);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rsi), %rdi
leaq 0x19d1(%rip), %rsi      # 0x40c7
callq 0x21b0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x271f
movq %rbx, %rdi
callq 0x2724
movq 0x8(%rbx), %rdi
callq 0x2150
cmpq $0x0, 0x8(%rbx)
setne %al
jmp 0x2721
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/html_writer.cc
// Function: HTMLWriter::WriteHTML()
void HTMLWriter::WriteHTML()
{
    fprintf(this->file_, "%s\n", "<!DOCTYPE html>");
    fprintf(this->file_, "%s\n", "<html>");
    
    this->WriteHead();
    this->WriteBody();
    
    fprintf(this->file_, "%s\n", "</html>");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
leaq 0x1900(%rip), %r14      # 0x4036
leaq 0x1993(%rip), %rdx      # 0x40d0
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
leaq 0x198e(%rip), %rdx      # 0x40e0
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq %rbx, %rdi
callq 0x2800
movq %rbx, %rdi
callq 0x287c
movq 0x8(%rbx), %rdi
leaq 0x1970(%rip), %rdx      # 0x40e7
movq %r14, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x21e0
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/html_writer.cc
// Function: HTMLWriter::Escape(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
std::string HTMLWriter::Escape(std::string const& input) const
{
    std::string result;
    for (char c : input) {
        switch (c) {
        case ' ':   result.append("&nbsp;");    break;
        default:    result.push_back(c);
        }
    }
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq (%rdx), %r15
movq 0x8(%rdx), %r12
xorl %r13d, %r13d
leaq 0x1914(%rip), %r14      # 0x40c9
cmpq %r13, %r12
je 0x27df
movb (%r15,%r13), %al
cmpb $0x20, %al
jne 0x27cf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2250
jmp 0x27da
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2130
incq %r13
jmp 0x27b5
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2298
movq %r14, %rdi
callq 0x2230
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/html_writer.cc
// Function: HTMLWriter::WriteHead()
void HTMLWriter::WriteHead()
{
    fprintf(this->file_, "%s\n", "<head>");
    
    fprintf(this->file_, "%s\n", "<meta charset=\"utf-8\" />");
    fprintf(this->file_, "<title>%s</title>", this->title_.c_str());
    this->WriteStyle();
    this->WriteScript();
    
    fprintf(this->file_, "%s\n", "</head>");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
leaq 0x1824(%rip), %r14      # 0x4036
leaq 0x18d6(%rip), %rdx      # 0x40ef
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
leaq 0x18c8(%rip), %rdx      # 0x40f6
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rdx
leaq 0x18c8(%rip), %rsi      # 0x410f
xorl %eax, %eax
callq 0x21e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movq 0x8(%rbx), %rdi
leaq 0x18b6(%rip), %rdx      # 0x4121
movq %r14, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x21e0
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/html_writer.cc
// Function: ImageWriter::WriteStyle()
void ImageWriter::WriteStyle()
{
    fprintf(this->file_, "%s\n", "<style type=\"text/css\">");
    fprintf(this->file_, "%s\n", "*{margin:0;padding:0;line-height:5px;}");
    fprintf(this->file_, "%s\n", ".pixel{width:5px;height:5px;float:left;}");
    fprintf(this->file_, "%s\n", "br{clear:left;}");
    fprintf(this->file_, "%s\n", "</style>");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
leaq 0x16d6(%rip), %r14      # 0x4036
leaq 0x17e1(%rip), %rdx      # 0x4148
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
leaq 0x17e4(%rip), %rdx      # 0x4160
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
leaq 0x17f6(%rip), %rdx      # 0x4187
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
leaq 0x180a(%rip), %rdx      # 0x41b0
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
leaq 0x1805(%rip), %rdx      # 0x41c0
movq %r14, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x21e0
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/html_writer.cc
// Function: ImageWriter::WriteContent()
void ImageWriter::WriteContent()
{
    Bitmap bitmap;

    fprintf(this->file_, "%s\n", "<div class=\"image\">");
    if (bitmap.Load(this->filename_)) {
        auto w = bitmap.GetWidth();
        auto h = bitmap.GetHeight();
        for (auto y = 0; y < h; y++) {
            for (auto x = 0; x < w; x++) {
                Color color = bitmap.GetColor(x, y);
                this->WritePixel(color);
            }
            fprintf(this->file_, "%s\n", "<br />");
        }
    } else {
        fprintf(this->file_, "<p>Failed open %s: %s</p>",
                             this->filename_.c_str(),
                             bitmap.GetError().c_str());
    }
    fprintf(this->file_, "%s\n", "</div>");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x2d58
movq 0x8(%rbx), %rdi
leaq 0x1643(%rip), %rsi      # 0x4036
leaq 0x17cf(%rip), %rdx      # 0x41c9
xorl %eax, %eax
callq 0x21e0
leaq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0x2e84
testb %al, %al
je 0x2a79
movl (%rsp), %r12d
xorl %eax, %eax
testl %r12d, %r12d
cmovlel %eax, %r12d
movl 0x4(%rsp), %ebp
testl %ebp, %ebp
cmovlel %eax, %ebp
xorl %r13d, %r13d
cmpl %ebp, %r13d
je 0x2a94
movslq %r13d, %r14
xorl %r15d, %r15d
cmpl %r15d, %r12d
je 0x2a5b
movq 0x8(%rsp), %rax
movslq (%rsp), %rcx
imulq %r14, %rcx
addq %r15, %rcx
movl (%rax,%rcx,4), %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
incq %r15
jmp 0x2a35
movq 0x8(%rbx), %rdi
leaq 0x15d0(%rip), %rsi      # 0x4036
leaq 0x1770(%rip), %rdx      # 0x41dd
xorl %eax, %eax
callq 0x21e0
incl %r13d
jmp 0x2a2a
movq 0x8(%rbx), %rdi
movq 0x30(%rbx), %rdx
movq 0x18(%rsp), %rcx
leaq 0x1757(%rip), %rsi      # 0x41e4
xorl %eax, %eax
callq 0x21e0
movq 0x8(%rbx), %rdi
leaq 0x1597(%rip), %rsi      # 0x4036
leaq 0x1758(%rip), %rdx      # 0x41fe
xorl %eax, %eax
callq 0x21e0
movq %rsp, %rdi
callq 0x2e40
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ac6
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2e40
movq %rbx, %rdi
callq 0x2230
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/bitmap.cc
// Function: Bitmap::operator=(Bitmap const&)
Bitmap& Bitmap::operator=(Bitmap const& rhs)
{
    if (this != &rhs) {
        this->Free();
        auto size = rhs.width_ * rhs.height_;
        this->width_  = rhs.width_;
        this->height_ = rhs.height_;
        this->pixels_ = new Color[size];
        memcpy(this->pixels_, rhs.pixels_, size);
    }
    return *this;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x2e0c
movq %rsi, %r14
movq %rbx, %rdi
callq 0x2e56
movl (%r14), %eax
movl 0x4(%r14), %ecx
movl %eax, (%rbx)
movl %ecx, 0x4(%rbx)
imull %eax, %ecx
movslq %ecx, %r15
leaq (,%r15,4), %rax
testl %r15d, %r15d
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
callq 0x2040
movq %rax, 0x8(%rbx)
movq 0x8(%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2120
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/bitmap.cc
// Function: Bitmap::Free()
void Bitmap::Free()
{
    this->width_  = 0;
    this->height_ = 0;

    if (this->pixels_) {
        delete[] this->pixels_;
        this->pixels_ = nullptr;
    }

    this->error_type_ = kSuccess;
    this->error_description_.clear();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
andq $0x0, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x2e71
callq 0x21c0
andq $0x0, 0x8(%rbx)
andl $0x0, 0x10(%rbx)
andq $0x0, 0x20(%rbx)
movq 0x18(%rbx), %rax
movb $0x0, (%rax)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/bitmap.cc
// Function: Bitmap::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool Bitmap::Load(std::string const& filename)
{
    this->Free();

    FILE *file = fopen(filename.c_str(), "rb");
    if (file == NULL) {
        this->error_type_ = kIOError;
        this->error_description_ = strerror(errno);
        return false;
    }

    fseek(file, 0, SEEK_END);
    auto length = ftell(file);
    fseek(file, 0, SEEK_SET);

    std::vector<char> buffer;

    buffer.resize(length);
    if (fread(buffer.data(), length, 1, file) != 1) {
        this->error_type_ = kIOError;
        this->error_description_ = "Failed reading data";
        return false;
    }

    fclose(file);

    return this->LoadData(buffer.data(), length);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2e56
movq (%r14), %rdi
leaq 0x1438(%rip), %rsi      # 0x42da
callq 0x21b0
testq %rax, %rax
je 0x2f1c
movq %rax, %r14
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x2190
movq %r14, %rdi
callq 0x2030
movq %rax, %r15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2190
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq %r15, %rsi
callq 0x34aa
movq (%rsp), %rdi
pushq $0x1
popq %rdx
movq %r15, %rsi
movq %r14, %rcx
callq 0x21f0
cmpq $0x1, %rax
jne 0x2f42
movq %r14, %rdi
callq 0x2150
movq (%rsp), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x2f86
movl %eax, %ebx
jmp 0x2f5e
movl $0x1, 0x10(%rbx)
callq 0x2050
movl (%rax), %edi
callq 0x2090
addq $0x18, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2260
xorl %ebx, %ebx
jmp 0x2f66
movl $0x1, 0x10(%rbx)
addq $0x18, %rbx
leaq 0x1389(%rip), %rsi      # 0x42dd
movq %rbx, %rdi
callq 0x2260
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x34d6
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x34d6
movq %rbx, %rdi
callq 0x2230
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/bitmap.cc
// Function: Bitmap::LoadData(char const*, unsigned long)
bool Bitmap::LoadData(char const *data, size_t size)
{
    if (!CheckFormat(data, size)) {
        this->error_type_ = kInvalidBitmap;
        return false;
    }

    auto *bf = reinterpret_cast<BITMAPFILEHEADER const *>(data);
    auto *bi = reinterpret_cast<BITMAPINFOHEADER const *>(bf + 1);

    int w = this->width_  = abs(bi->biWidth );
    int h = this->height_ = abs(bi->biHeight);

    this->pixels_ = new Color[w * h];

    if (bi->biSize < sizeof(BITMAPINFOHEADER)) {
        this->error_type_ = kUnsupportedBitmap;
        this->error_description_ = "DIB header type not supported";
        return false;   // mainly means no BITMAPCOREHEADER support
    }

    if (bi->biCompression != BI_RGB) {
        this->error_type_ = kUnsupportedBitmap;
        this->error_description_ = "Compressed format not supported";
        return false;   // unsupported
    }

    return this->LoadUncompressedPixelData(bf, bi);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x302a
testb %al, %al
je 0x2fdf
movl 0x12(%r14), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, (%rbx)
movl 0x16(%r14), %eax
movl %eax, %edi
negl %edi
cmovsl %eax, %edi
movl %edi, 0x4(%rbx)
imull %ecx, %edi
shlq $0x2, %rdi
callq 0x2040
movq %rax, 0x8(%rbx)
cmpl $0x27, 0xe(%r14)
ja 0x2fe8
movl $0x3, 0x10(%rbx)
addq $0x18, %rbx
leaq 0x13ca(%rip), %rsi      # 0x43a7
jmp 0x3001
movl $0x2, 0x10(%rbx)
jmp 0x3009
cmpl $0x0, 0x1e(%r14)
je 0x3013
movl $0x3, 0x10(%rbx)
addq $0x18, %rbx
leaq 0x13c4(%rip), %rsi      # 0x43c5
movq %rbx, %rdi
callq 0x2260
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xe(%r14), %rdx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x30e6
nop
// File: /workspace/github_cpp_makefile_star2_O2/timothyqiu[P]ssoaag/bitmap.cc
// Function: Bitmap::CheckFormat(char const*, unsigned long)
bool Bitmap::CheckFormat(char const *data, size_t size)
{
    // header field signatures
    if (!HasBitmapSignature(data, size)) {
        this->error_description_ = "No bitmap signature";
        return false;
    }

    // there must be a file header
    if (size < sizeof(BITMAPFILEHEADER)) {
        this->error_description_ = "File size too small";
        return false;
    }

    auto *bf = reinterpret_cast<BITMAPFILEHEADER const *>(data);

    // total file size
    if (bf->bfSize != size) {
        this->error_description_ = "File size and data length do not match";
        return false;
    }

    auto *bi = reinterpret_cast<BITMAPINFOHEADER const *>(bf + 1);
    auto *bc = reinterpret_cast<BITMAPCOREHEADER const *>(bf + 1);

    if (bc->bcSize == sizeof(BITMAPCOREHEADER)) {
        // number of planes must be one
        if (bc->bcPlanes != 1) {
            this->error_description_ = "Number of planes not 1";
            return false;
        }

    } else {

        // number of planes must be one
        if (bi->biPlanes != 1) {
            this->error_description_ = "Number of planes not 1";
            return false;
        }

        // some compression method requires bits per pixel to be a specific value
        if (bi->biCompression == BI_RLE8 && bi->biBitCount != 8) {
            this->error_description_ = "Wrong color depth for RLE 8 compression";
            return false;
        }
        if (bi->biCompression == BI_RLE4 && bi->biBitCount != 4) {
            this->error_description_ = "Wrong color depth for RLE 4 compression";
            return false;
        }
    }

    return true;
}

// Assembly:
leaq 0x12c0(%rip), %rax      # 0x42f1
cmpq $0x2, %rdx
jb 0x30c2
cmpw $0x4d42, (%rsi)         # imm = 0x4D42
je 0x3065
cmpw $0x4142, (%rsi)         # imm = 0x4142
je 0x3065
cmpw $0x4943, (%rsi)         # imm = 0x4943
je 0x3065
cmpw $0x5043, (%rsi)         # imm = 0x5043
je 0x3065
cmpw $0x4349, (%rsi)         # imm = 0x4349
je 0x3065
cmpw $0x5450, (%rsi)         # imm = 0x5450
jne 0x30c2
cmpq $0xe, %rdx
jae 0x3074
leaq 0x1293(%rip), %rax      # 0x4305
jmp 0x30c2
movl 0x2(%rsi), %eax
cmpq %rdx, %rax
jne 0x308c
cmpl $0xc, 0xe(%rsi)
jne 0x3095
movb $0x1, %al
cmpw $0x1, 0x16(%rsi)
jne 0x30bb
retq
leaq 0x1286(%rip), %rax      # 0x4319
jmp 0x30c2
cmpw $0x1, 0x1a(%rsi)
jne 0x30bb
movl 0x1e(%rsi), %ecx
movb $0x1, %al
cmpl $0x2, %ecx
je 0x30d6
cmpl $0x1, %ecx
jne 0x308b
cmpw $0x8, 0x1c(%rsi)
je 0x308b
leaq 0x129e(%rip), %rax      # 0x4357
jmp 0x30c2
leaq 0x127e(%rip), %rax      # 0x4340
pushq %rax
addq $0x18, %rdi
movq %rax, %rsi
callq 0x2260
xorl %eax, %eax
addq $0x8, %rsp
retq
cmpw $0x4, 0x1c(%rsi)
je 0x308b
leaq 0x129b(%rip), %rax      # 0x437f
jmp 0x30c2
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/realpath.c
// Function: main
int main(int argc, char **argv)
{
    int     i;
    char    path[argc][8192];

    if (argc > 1 && !strcmp(argv[1], "-q"))
        --argc, ++argv, fclose(stderr);

    if (argc < 2)
        return fputs("usage: realpath [-q] path [...]\n", stderr), 1;

    for (i = 1; i < argc; ++i)
        if (!realpath(argv[i], path[i]))
            return perror(argv[i]), 1;

    for (i = 1; i < argc; ++i)
        puts(path[i]);

    return  0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %eax
movq %rsp, %rbx
shlq $0xd, %rax
subq %rax, %rbx
movq %rbx, %rsp
cmpl $0x2, %edi
jl 0x1248
movq %rsi, %r14
movl %edi, %r15d
movq 0x8(%rsi), %rax
cmpb $0x2d, (%rax)
jne 0x11d9
cmpb $0x71, 0x1(%rax)
jne 0x11d9
cmpb $0x0, 0x2(%rax)
jne 0x11d9
movq 0x2e1c(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
callq 0x1050
cmpl $0x2, %r15d
je 0x1248
addq $0x8, %r14
decl %r15d
movl %r15d, %r12d
leaq 0x2000(%rbx), %r15
pushq $0x1
popq %r13
cmpq %r12, %r13
jae 0x1213
movq (%r14,%r13,8), %rdi
movq %r15, %rsi
callq 0x1030
incq %r13
addq $0x2000, %r15           # imm = 0x2000
testq %rax, %rax
jne 0x11e7
movq -0x8(%r14,%r13,8), %rdi
callq 0x1040
jmp 0x125e
addq $0x2000, %rbx           # imm = 0x2000
pushq $0x1
popq %r14
cmpq %r12, %r14
jae 0x1237
movq %rbx, %rdi
callq 0x1070
incq %r14
addq $0x2000, %rbx           # imm = 0x2000
jmp 0x121e
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d91(%rip), %rax      # 0x3fe0
movq (%rax), %rsi
leaq 0xdab(%rip), %rdi       # 0x2004
callq 0x1060
pushq $0x1
popq %rax
jmp 0x1239
// File: /workspace/github_cpp_makefile_star2_O2/brianquinlan[P]brainfuck-jit/bf_compile_and_go.cpp
// Function: BrainfuckCompileAndGo::emit_offset_table(std::map<signed char, unsigned char, std::less<signed char>, std::allocator<std::pair<signed char const, unsigned char>>>*, signed char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
void BrainfuckCompileAndGo::emit_offset_table(
    map<int8_t, uint8_t>* offset_to_change, int8_t* offset, string *code) {
  for (auto it = offset_to_change->begin();
       it != offset_to_change->end();
       ++it) {
    int8_t change_offset = it->first;
    uint8_t change_value = it->second;

    if (change_value == 0) {
      continue;
    }

    *code += "\x80\x43";                                  // addb [rbx+XX],YY
    *code += string(reinterpret_cast<char *>(&change_offset), 1);  // XX
    *code += string(reinterpret_cast<char *>(&change_value), 1);   // YY
  }

  if (*offset != 0) {
    *code += "\x48\x83\xc3";                                // add rbx ...
    *code += string(reinterpret_cast<char *>(offset), 1);   // ... offset
    *offset = 0;
  }
  offset_to_change->clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r15
movq %rdx, 0x28(%rsp)
movq 0x18(%rsi), %r13
movq %rsi, 0x20(%rsp)
leaq 0x8(%rsi), %rax
movq %rax, 0x30(%rsp)
leaq 0x10(%rsp), %r14
movq %rsp, %rbp
cmpq 0x30(%rsp), %r13
je 0x344c
movb 0x21(%r13), %r12b
testb %r12b, %r12b
je 0x343c
movb 0x20(%r13), %bl
movq %r15, %rdi
leaq 0x1f0e(%rip), %rsi      # 0x52f2
callq 0x22f0
movq %r14, (%rsp)
movb %bl, 0x10(%rsp)
movq $0x1, 0x8(%rsp)
movb $0x0, 0x11(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2300
movq %rbp, %rdi
callq 0x20f0
movq %r14, (%rsp)
movb %r12b, 0x10(%rsp)
movq $0x1, 0x8(%rsp)
movb $0x0, 0x11(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2300
movq %rbp, %rdi
callq 0x20f0
movq %r13, %rdi
callq 0x2140
movq %rax, %r13
jmp 0x33c6
movq 0x28(%rsp), %rbx
cmpb $0x0, (%rbx)
je 0x348d
leaq 0x1e98(%rip), %rsi      # 0x52f5
movq %r15, %rdi
callq 0x22f0
movq %rsp, %rdi
movq %r14, (%rdi)
leaq 0x1(%rbx), %rdx
movq %rbx, %rsi
callq 0x2afe
movq %rsp, %rsi
movq %r15, %rdi
callq 0x2300
movq %rsp, %rdi
callq 0x20f0
movb $0x0, (%rbx)
movq 0x20(%rsp), %rdi
callq 0x378c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x34af
movq %rax, %rbx
jmp 0x34ba
jmp 0x34af
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x22b0
// File: /workspace/github_cpp_makefile_star2_O2/brianquinlan[P]brainfuck-jit/bf_interpreter.cpp
// Function: BrainfuckInterpreter::init(__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>)
bool BrainfuckInterpreter::init(string::const_iterator start,
                                string::const_iterator end) {
  start_ = start;
  end_ = end;

  // Build the mapping from the position of the start of a block (i.e. "]") to
  // the character *after* the end of the block.
  stack<string::const_iterator> block_starts;
  for (string::const_iterator it = start; it != end; ++it) {
    if (*it == '[') {
      block_starts.push(it);
    } else if (*it == ']') {
      if (block_starts.size() != 0) {
        const string::const_iterator &loop_start = block_starts.top();
        loop_start_to_after_end_[loop_start] = it+1;
        block_starts.pop();
      }
    }
  }

  if (block_starts.size() != 0) {
    fprintf(
        stderr,
        "Unable to find loop end in block starting with: %s\n",
        string(block_starts.top(), end).c_str());
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x3d98
addq $0x18, %r14
movl $0x200, %ebp            # imm = 0x200
leaq 0x8(%rsp), %r12
movq %r13, 0x8(%rsp)
cmpq %rbx, %r13
je 0x3b7e
movzbl (%r13), %eax
cmpl $0x5d, %eax
je 0x3b30
cmpl $0x5b, %eax
jne 0x3b74
movq %r15, %rdi
movq %r12, %rsi
callq 0x4026
jmp 0x3b74
movq %r15, %rdi
callq 0x40c2
testq %rax, %rax
je 0x3b74
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
jne 0x3b55
movq 0x70(%rsp), %rax
movq -0x8(%rax), %rsi
addq %rbp, %rsi
addq $-0x8, %rsi
movq 0x8(%rsp), %r13
movq %r14, %rdi
callq 0x3db4
incq %r13
movq %r13, (%rax)
movq %r15, %rdi
callq 0x44ca
movq 0x8(%rsp), %r13
incq %r13
jmp 0x3b0a
leaq 0x28(%rsp), %rdi
callq 0x40c2
movq %rax, %r14
testq %rax, %rax
jne 0x3bb1
testq %r14, %r14
sete %bl
leaq 0x28(%rsp), %rdi
callq 0x3e04
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5428(%rip), %rax      # 0x8fe0
movq 0x58(%rsp), %rcx
cmpq 0x60(%rsp), %rcx
jne 0x3bd2
movq 0x70(%rsp), %rdx
movl $0x200, %ecx            # imm = 0x200
addq -0x8(%rdx), %rcx
movq (%rax), %r15
movq -0x8(%rcx), %rsi
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x3a2a
leaq 0x8(%rsp), %rbx
movq (%rbx), %rdx
leaq 0x16fb(%rip), %rsi      # 0x52f9
movq %r15, %rdi
xorl %eax, %eax
callq 0x2250
movq %rbx, %rdi
callq 0x20f0
jmp 0x3b90
jmp 0x3c19
jmp 0x3c19
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3e04
movq %rbx, %rdi
callq 0x22b0
// File: /workspace/github_cpp_makefile_star2_O2/brianquinlan[P]brainfuck-jit/bf_jit.cpp
// Function: BrainfuckJIT::init(__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>)
bool BrainfuckJIT::init(string::const_iterator start,
                        string::const_iterator end) {
  start_ = start;
  end_ = end;

  // Build the mapping from the position of the start of a block (i.e. "]") to
  // a Loop struct.
  stack<string::const_iterator> block_starts;
  for (string::const_iterator it = start; it != end; ++it) {
    if (*it == '[') {
      block_starts.push(it);
    } else if (*it == ']') {
      if (block_starts.size() != 0) {
        const string::const_iterator &loop_start = block_starts.top();
        loop_start_to_loop_[loop_start] = Loop(it+1);
        block_starts.pop();
      }
    }
  }

  if (block_starts.size() != 0) {
    fprintf(
        stderr,
        "Unable to find loop end in block starting with: %s\n",
        string(block_starts.top(), end).c_str());
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x3d98
leaq 0x10(%rsp), %r13
addq $0x18, %r14
movq %rsp, %rbp
movq %r12, (%rsp)
cmpq %rbx, %r12
je 0x4623
movzbl (%r12), %eax
cmpl $0x5d, %eax
je 0x45a9
cmpl $0x5b, %eax
jne 0x4617
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4026
jmp 0x4617
movq %r15, %rdi
callq 0x40c2
testq %rax, %rax
je 0x4617
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
jne 0x45d3
movq 0x70(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x8, %rsi
movq (%rsp), %rax
incq %rax
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
andq $0x0, 0x10(%r13)
movq %r14, %rdi
callq 0x49a8
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x49f8
leaq 0x20(%rsp), %rdi
callq 0x4a42
movq %r15, %rdi
callq 0x44ca
movq (%rsp), %r12
incq %r12
jmp 0x4580
leaq 0x28(%rsp), %rdi
callq 0x40c2
movq %rax, %r14
testq %rax, %rax
jne 0x4656
testq %r14, %r14
sete %bl
leaq 0x28(%rsp), %rdi
callq 0x3e04
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4983(%rip), %rax      # 0x8fe0
movq 0x58(%rsp), %rcx
cmpq 0x60(%rsp), %rcx
jne 0x4677
movq 0x70(%rsp), %rdx
movl $0x200, %ecx            # imm = 0x200
addq -0x8(%rdx), %rcx
movq (%rax), %r15
movq -0x8(%rcx), %rsi
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x3a2a
leaq 0x8(%rsp), %rbx
movq (%rbx), %rdx
leaq 0xc56(%rip), %rsi       # 0x52f9
movq %r15, %rdi
xorl %eax, %eax
callq 0x2250
movq %rbx, %rdi
callq 0x20f0
jmp 0x4635
jmp 0x46cb
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x4a42
jmp 0x46ce
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3e04
movq %rbx, %rdi
callq 0x22b0
// File: /workspace/github_cpp_makefile_star2_O2/Shenggan[P]SnowFlake/test/test_SnowFlake.cc
// Function: test(void*)
void *test(void *arg) {
    SnowFlake* sf;
    sf = (SnowFlake*)arg;
    for (int i = 0; i < (1<<12); i++) {
        LLOG(INFO) << sf->nextId();
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
movl $0x1000, %r14d          # imm = 0x1000
leaq 0x38(%rsp), %r15
leaq 0x18(%rsp), %rbp
leaq 0x58(%rsp), %r12
subl $0x1, %r14d
jb 0x24ef
callq 0x26e6
cmpl $0x0, (%rax)
jg 0x2455
movq %r15, %rdi
leaq 0x1b91(%rip), %rsi      # 0x4004
leaq 0xf(%rsp), %rdx
callq 0x2764
movq %rbp, %rdi
leaq 0x1b94(%rip), %rsi      # 0x401b
leaq 0xe(%rsp), %rdx
callq 0x2764
movq %r12, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbp, %rcx
pushq $0x8
popq %r8
callq 0x27a0
movq %rbx, %rdi
callq 0x29ce
movq %rax, 0x10(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x294a
movq %rax, %r13
callq 0x26e6
movq %rax, %rdi
movq %r13, %rsi
callq 0x2b42
movq %r12, %rdi
callq 0x2c2c
movq %rbp, %rdi
callq 0x2080
movq %r15, %rdi
callq 0x2080
jmp 0x2455
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x2524
movq %rax, %rbx
jmp 0x251a
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x2c2c
leaq 0x18(%rsp), %rdi
callq 0x2080
leaq 0x38(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22a0
// File: /workspace/github_cpp_makefile_star2_O2/Shenggan[P]SnowFlake/test/test_SnowFlake.cc
// Function: main
int main() {
    LLOG_FILE(); 
    SnowFlake sf(2, 3);
    pthread_t tid;
    pthread_create(&tid, NULL, test, &sf);
    for (int i = 0; i < (1<<12); i++) {
        LLOG(INFO) << sf.nextId();
    }
    pthread_join(tid, NULL);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
callq 0x26e6
movq %rax, %rbx
leaq 0x1aca(%rip), %rsi      # 0x4020
leaq 0x20(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x2764
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x2c4c
leaq 0x20(%rsp), %rdi
callq 0x2080
leaq 0xe0(%rsp), %rbx
pushq $0x2
popq %rsi
pushq $0x3
popq %rdx
movq %rbx, %rdi
callq 0x2c80
leaq -0x170(%rip), %rdx      # 0x242c
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x22c0
movl $0x1000, %r12d          # imm = 0x1000
leaq 0x60(%rsp), %r15
leaq 0x40(%rsp), %rbp
leaq 0x80(%rsp), %rbx
leaq 0x10(%rsp), %r13
subl $0x1, %r12d
jb 0x2665
callq 0x26e6
cmpl $0x0, (%rax)
jg 0x25c8
movq %r15, %rdi
leaq 0x1a1e(%rip), %rsi      # 0x4004
leaq 0xf(%rsp), %rdx
callq 0x2764
movq %rbp, %rdi
leaq 0x1a31(%rip), %rsi      # 0x402b
leaq 0xe(%rsp), %rdx
callq 0x2764
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbp, %rcx
pushq $0x13
popq %r8
callq 0x27a0
leaq 0xe0(%rsp), %rdi
callq 0x29ce
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x294a
movq %rax, %r14
callq 0x26e6
movq %rax, %rdi
movq %r14, %rsi
callq 0x2b42
movq %rbx, %rdi
callq 0x2c2c
movq %rbp, %rdi
callq 0x2080
movq %r15, %rdi
callq 0x2080
jmp 0x25c8
movq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x2150
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x26bf
jmp 0x2696
movq %rax, %rbx
jmp 0x26ba
movq %rax, %rbx
jmp 0x26c4
movq %rax, %rbx
jmp 0x26b0
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x2c2c
leaq 0x40(%rsp), %rdi
callq 0x2080
leaq 0x60(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22a0
// File: /workspace/github_cpp_makefile_star2_O2/Shenggan[P]SnowFlake/test/../utils/lightlog.h
// Function: llog::Message& llog::Message::operator<<<unsigned long>(unsigned long const&)
Message& operator<<(const T & t) {
        std::stringstream ss;
        ss << t;
        msg += ss.str();
        return *this;
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
callq 0x20c0
leaq 0x30(%rsp), %rdi
movq (%r14), %rsi
callq 0x20b0
leaq 0x38(%rsp), %rsi
movq %rsp, %rdi
callq 0x2260
leaq 0x40(%rbx), %rdi
movq %rsp, %rsi
callq 0x22d0
movq %rsp, %rdi
callq 0x2080
leaq 0x20(%rsp), %rdi
callq 0x20f0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2080
jmp 0x29bc
jmp 0x29b9
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x22a0