<commit_before>
#include <sstream>
#include <cstdlib>
#include <time.h>

#include "src/ext/x64asm/include/x64asm.h"
#include "src/stategen/stategen.h"
#include "src/cfg/cfg.h"

TEST(StateGenTest, Issue44) {

  time_t seed;
  time(&seed);
  srand((unsigned int)seed);
  std::cout << "seed = " << seed << std::endl;
  // Build example
  std::stringstream ss;
  ss << "movq $0x4eb4b0, (%rdi)" << std::endl;
  ss << "movq $0x0, 0x10(%rdi) " << std::endl;
  ss << "movq $0x0, 0x18(%rdi) " << std::endl;
  ss << "movl $0x0, 0x8(%rdi)  " << std::endl;

  x64asm::Code c;
  ss >> c;

  // Run stategen
  stoke::Cfg cfg_t(c, x64asm::RegSet::universe(), x64asm::RegSet::empty());
  stoke::StateGen sg;
  sg.set_max_attempts(10)
    .set_max_memory(1000)
    .set_max_jumps(2);

  stoke::CpuState tc;
  ASSERT_TRUE(sg.get(tc, cfg_t)) << "Failed with seed = " << seed;

}<commit_msg>Updated testcase to reflect that stategen shouldn't succeed without 'retq'.<commit_after>
#include <sstream>
#include <cstdlib>
#include <time.h>

#include "src/ext/x64asm/include/x64asm.h"
#include "src/stategen/stategen.h"
#include "src/cfg/cfg.h"

TEST(StateGenTest, Issue44) {

  time_t seed;
  time(&seed);
  srand((unsigned int)seed);

  // Build example
  std::stringstream ss;
  ss << "movq $0x4eb4b0, (%rdi)" << std::endl;
  ss << "movq $0x0, 0x10(%rdi) " << std::endl;
  ss << "movq $0x0, 0x18(%rdi) " << std::endl;
  ss << "movl $0x0, 0x8(%rdi)  " << std::endl;

  x64asm::Code c;
  ss >> c;

  // Run stategen
  stoke::Cfg cfg_t(c, x64asm::RegSet::universe(), x64asm::RegSet::empty());
  stoke::StateGen sg;
  sg.set_max_attempts(10)
    .set_max_memory(1000)
    .set_max_jumps(2);

  stoke::CpuState tc;
  ASSERT_FALSE(sg.get(tc, cfg_t)) << "Failed with seed = " << seed;

}
{'fraction_non_alphanumeric': 0.19897669130187606, 'fraction_numerical': 0.04206935758953951, 'mean_word_length': 4.253731343283582, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1175107', 'n_tokens_mistral': 809, 'n_tokens_neox': 764, 'n_words': 147}