<commit_before># xo

xo is a superoptimizer, a tool for generating optimal assembly programs.

## Installation

xo requires that [BuDDy][1], a package for manipulating binary decision
diagrams, is installed on your system.

[1]: http://sourceforge.net/projects/buddy/

To install xo, do the following:

    ./bootstrap

This only applies if you've fetched the code from the development repository,
not if you've obtained it by downloading a release version.

    ./configure CPPFLAGS='-I/path/to/bdd/include -L/path/to/bdd/lib' LDFLAGS='-L/path/to/bdd/lib'

Passing CPPFLAGS and LDFLAGS is only required if you've installed BuDDy in a
non-standard location.

    make

Build the package.

    make check

Run the test suite. This is optional, but recommended.

    make install

Install the package on your system.

## Usage

xo has four forms:

    xo [-m M] [-qv] PROGRAM

In its standard form, xo generates programs and tests them for equivalence with
the given program.

By default, xo will generate programs up to 5 instructions in length, test them
by running them on test vectors (which may yield false positives), and by
modeling them as binary decision diagrams, (which should yield correct output,
barring any bugs in the implementation), and print those which pass both tests
on stdout.

The -m option sets the maximum length of the generated programs.

The -v option increases verbosity. Passing it once causes xo to also print
programs which pass the probabilistic test, as well as some diagnostic
information, on stderr. Passing it twice causes xo to also print every generated
program on stderr, which impacts performance considerably.

The -q option decreases verbosity, and is currently useless.

The syntax used for the assembly programs is detailed below.

    xo -L

In this form, xo prints a list of the supported instructions, along with their
arity, on stdout, and exits.

    xo -H

In this form, xo prints brief usage instructions on stdout and exits.

    xo -V

In this form, xo prints its version number on stdout and exits.

## Syntax

xo supports a small subset of the x86 instruction set. Intel syntax is used,
with some modifications:

* Registers are named r0--r7.
* Statements are terminated by semicolons.
* Immediate values are not supported.
* Effective addresses are not supported.

Example:

    add r0,r0; sbb r1,r1; sub r1,r0; adc r0,r1;

## Caveats

xo is a prototype, and has numerous shortcomings:

* Support for many important instructions, such as neg, mul and lea, as well as
  shift and rotate instructions, is missing.
* Immediate values are not supported.
* Multiple output registers are not supported. The output register is assumed to
  be the last register written to.
* Only 32-bit arithmetic is simulated.
* The equivalence test is unnecessarily slow, as values for the input program
  are not cached.
* The code for the generator is a mess.

## License

xo is free and unencumbered software released into the public domain. See
UNLICENSE for details.

## Author

xo was created by <NAME>, as part of a degree project at KTH.<commit_msg>Updated README.<commit_after># xo

xo is a superoptimizer, a tool for generating optimal assembly programs.

## Installation

xo requires that [BuDDy][1], a package for manipulating binary decision
diagrams, is installed on your system.

[1]: http://sourceforge.net/projects/buddy/

To install xo, do the following:

    ./bootstrap

This only applies if you've fetched the code from the development repository,
not if you've obtained it by downloading a release version.

    ./configure CPPFLAGS='-I/path/to/bdd/include -L/path/to/bdd/lib' LDFLAGS='-L/path/to/bdd/lib'

Passing CPPFLAGS and LDFLAGS is only required if you've installed BuDDy in a
non-standard location.

    make

Build the package.

    make check

Run the test suite. This is optional, but recommended.

    make install

Install the package on your system.

## Usage

xo has four forms:

    xo [-m M] [-qv] PROGRAM

In its standard form, xo generates programs and tests them for equivalence with
the given program.

By default, xo will generate programs up to 5 instructions in length, test them
by running them on test vectors (which may yield false positives), and by
modeling them as binary decision diagrams, (which should yield correct output,
barring any bugs in the implementation), and print those which pass both tests
on stdout.

The -m option sets the maximum length of the generated programs.

The -v option increases verbosity. Passing it once causes xo to also print
programs which pass the probabilistic test, as well as some diagnostic
information, on stderr. Passing it twice causes xo to also print every generated
program on stderr, which impacts performance considerably.

The -q option decreases verbosity, and is currently useless.

The syntax used for the assembly programs is detailed below.

    xo -L

In this form, xo prints a list of the supported instructions, along with their
arity, on stdout, and exits.

    xo -H

In this form, xo prints brief usage instructions on stdout and exits.

    xo -V

In this form, xo prints its version number on stdout and exits.

## Syntax

xo supports a small subset of the x86 instruction set. Intel syntax is used,
with some modifications:

* Registers are named r0--r7.
* Statements are terminated by semicolons.
* Immediate values are not supported.
* Effective addresses are not supported.

Example:

    add r0,r0; sbb r1,r1; sub r1,r0; adc r0,r1;

## Caveats

xo is a prototype, and has numerous shortcomings:

* Support for many important instructions, such as mul and lea, as well as shift
  and rotate instructions, is missing.
* Immediate values are not supported.
* Multiple output registers are not supported. The output register is assumed to
  be the last register written to.
* Only 32-bit arithmetic is simulated.
* The equivalence test is unnecessarily slow, as values for the input program
  are not cached.
* The code for the generator is a mess.

## License

xo is free and unencumbered software released into the public domain. See
UNLICENSE for details.

## Author

xo was created by <NAME>, as part of a degree project at KTH.
{'fraction_non_alphanumeric': 0.05436013590033975, 'fraction_numerical': 0.005500728037534379, 'mean_word_length': 3.860062893081761, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7070550', 'n_tokens_mistral': 1760, 'n_tokens_neox': 1663, 'n_words': 921}