Skip to content

Instantly share code, notes, and snippets.

/// Generic helper functions for handling permutations.
/// @a _n Specifies the size of the permutation.
/// @a _getTargetPosition A function that takes an offset as unsigned integer as argument and returns the desired target position
/// of the element at that offset as integer or -1, if the element is to be discarded.
/// @a _swap Takes a (zero-based) depth as unsigned integer as argument and swaps the currently last element with the
/// element at the given depth.
/// @a _pop Pops the last element.
template<typename GetTargetPosition, typename Swap, typename Pop>
void permute(unsigned _n, GetTargetPosition _getTargetPosition, Swap _swap, Pop _pop)
{
{
mstore(0x40, memoryguard(0x0580))
{
function fo_0() -> x_4, _
{ x_4 := mod(0x800, 0) }
let x_5117
function foo_m_3(x_27, _288, x_9, x_290, x_291, x_292, x_23, x_294, x_295, x6, _297, x_298, x_299, _300, x_301, x_302, x_303, _304, x30, x_306, x_307, x_30, x_309, x_310, x_311, x_312) -> x_327, x_28, x_29, x_330, __1, x_332, x_, x_334, x_3, _36, x_337, x_38, x39, x0, x_31, x_342
{
mstore(0x0560, x_27)
mstore(0x0540, _288)
@ekpyron
ekpyron / new.yul
Created April 13, 2021 09:24
Change in test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol
Optimized IR:
/*******************************************************
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "c_145" {
code {
Optimized IR:
/*******************************************************
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "Test_79" {
code {
======= /tmp/snark.yul (EVM) =======
Pretty printed source:
object "Test_1595" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("Test_1595_deployed")
@ekpyron
ekpyron / problem.smt2
Last active February 10, 2021 09:40
veriT example proof
(set-logic QF_LIA)
(declare-fun yul_x () Int)
(declare-fun expr_0 () Int)
(assert (and (<= 0 expr_0) (< expr_0 115792089237316195423570985008687907853269984665640564039457584007913129639936)))
(assert (= yul_x expr_0))
(declare-fun yul_t () Int)
(assert (= yul_t (ite (< yul_x 20) 1 0)))
(assert (not (= yul_t 0)))
diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol
index f2888369f..660726693 100644
--- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol
+++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol
@@ -27,4 +27,4 @@ contract C {
// gas ir: 199675
// gas irOptimized: 194189
// gas legacy: 196426
-// gas legacyOptimized: 193470
+// gas legacyOptimized: 193424
For ``for``:
{
let a := 1
let b := 0
mstore(key, a)
for {} mload(key) {} {
mstore(key, b)
#include <z3++.h>
#include <dlfcn.h>
#include <iostream>
void* z3handle = nullptr;
void* loadZ3Symbol(const char* name)
{
if (!z3handle)
#!/usr/bin/env python
import os
import sys
import re
# Patterns to match Z3 API entry point definitions.
def_pat = re.compile(" *def_API(.*)")
extradef_pat = re.compile(" *extra_API(.*)")
# Pattern to extract name and arguments from the above.