Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

John Regehr regehr

🎯
Focusing
View GitHub Profile
View z3_pipe.cpp
#include <fcntl.h>
#include <iostream>
#include <string>
#include <unistd.h>
#include <sys/wait.h>
#include <cstring>
#include "z3_pipe.h"
#define ensure(b) ensure_helper(b, __FILE__, __FUNCTION__, __LINE__)
View gist:3df647666a9cb4781a2426e81d507f79
#include <iostream>
enum e { a, c, d };
class o {
uint32_t b = 0;
void p(int c) { b |= 1 << c; }
bool s(int c) { return b >> c & 1; }
public:
void t(int f, int col, e h) {
int g = 2 * (3 * f + col);
View nops.txt
; result 1:
%0:i8 = var ; 0
; result 2:
%0:i8 = var ; 0
%1:i8 = add 255:i8, %0
%2:i8 = add 1:i8, %1
; result 3:
%0:i8 = var ; 0
View gist:82c8e3661e710e4762a30035dc54f45b
; result 1:
%0:i8 = var ; 0
; result 2:
%0:i8 = var ; 0
%1:i8 = add 0:i8, %0
; result 3:
%0:i8 = var ; 0
%1:i8 = mul 1:i8, %0
View gist:19b2ef7206922df5d455c1280dc7e8b7
#include <stdio.h>
static unsigned f(unsigned i) { return i * 40; }
static unsigned setbit(unsigned i, unsigned b) { return i | (1U << b); }
static unsigned clearbit(unsigned i, unsigned b) { return i & ~(1U << b); }
static void testbit(unsigned b) {
printf("bit %d : ", b);
View gist:cd7a4ab7b45092c873ae50085f4ed7f6
static APInt XXXones(const KnownBits &x, const KnownBits &y) {
const int WIDTH = x.One.getBitWidth();
const APInt t0 = operator+(y.Zero, APInt(WIDTH, 1));
const APInt t1 = operator+(t0, x.One);
const APInt t2 = (APInt::getSignedMinValue(WIDTH).isOneValue()) ? (x.Zero) : (x.Zero);
const APInt t3 = operator+(x.One, t2);
const APInt t4 = ~x.One;
const APInt t5 = (t4.isNegative()) ? (x.Zero) : (x.Zero);
const APInt t6 = operator-(y.Zero, t5);
APInt t7 = APInt::getAllOnesValue(WIDTH);
View gist:24560ea4352e11bf6c74a0bc70b8f0e1
#include <iostream>
#include <random>
#include <functional>
#include <map>
namespace {
bool enumerate;
std::random_device rd;
View gist:b2b724ea337c71a2aa7e70315a18c5d1
----------------------------------------
define i64 @slice(i64 %0) {
%1:
%2 = shl i64 9223372036854775807, %0
ret i64 %2
}
=>
define i64 @slice(i64 %rdi) {
%0:
ret i64 -2246371524778917889
View gist:9ccc4fd236e59ea89a1d2503b1951fb5
{
"arch": "amd64",
"os": "linux",
"functions": [
{
"address": 0,
"name": "slice",
"parameters": [
{
"name": "rdi",
View gist:20b66a92d0533e7b7559bcffb1ba8a80
{
"arch": "amd64",
"os": "linux",
"functions": [
{
"address": 0,
"name": "slice",
"parameters": [
{
"name": "edi",