Decompile
36/37 passed
Avg opcode similarity
97.4%
Recompile succeeded
37/37
Sort by

Anonymous

92.9% opcode match
Original
import haxe.Int32;

class Anonymous {
    static function main() {
        var a = { first: 3, second: 4 };
        log(a.first, a.second, 5);
    }

    static function log(argument_name_cannot_be_confused_at_all: Dynamic, other_arg_name: Int32, third_arg: Dynamic) {
        trace(argument_name_cannot_be_confused_at_all);
    }
}
Decompiled
class Anonymous {
    public static function log(argument_name_cannot_be_confused_at_all: Dynamic, other_arg_name: Int, third_arg: Dynamic): Void {
        trace(argument_name_cannot_be_confused_at_all); // { fileName: 'Anonymous.hx', lineNumber: 10, className: 'Anonymous', methodName: 'log' }
    }

    public static function main(): Void {
        Anonymous.log(3, 4, 5);
    }
}

Arithmetic

92.7% opcode match
Original
class Arithmetic {
    static function main() {
        var first_var = 3;
        var second_var = 4;
        var third_var = first_var;
        var test = "test!!!";
        var res = first_var + second_var;
        var res2 = first_var - second_var;
        var res3 = first_var * second_var;
        var res4 = first_var / second_var;
        var res5 = first_var % second_var;
        var res6 = first_var << second_var;
        var bool_res = first_var < second_var; // true
        if (bool_res) {
            var final_res = first_var + second_var;
        } else {
            var final_res = first_var - second_var;
        }
        if (first_var < second_var) {
            var final_res = first_var + second_var;
        } else {
            var final_res = first_var - second_var;
        }
    }
}
Decompiled
class Arithmetic {
    public static function main(): Void {
        var bool_res: Bool = false;
        var third_var: Int = 3;
        var second_var: Int = 4;
        var test: String = "test!!!";
        var res: Int = third_var + second_var;
        var res2: Int = third_var - second_var;
        var res3: Int = third_var * second_var;
        var res4: Float = third_var / second_var;
        var res5: Int = third_var % second_var;
        var res6: Int = third_var << second_var;
        if (third_var >= second_var) {
            bool_res = false;
        } else {
            bool_res = true;
        }
        if (third_var >= second_var) {
        }
    }
}

Array Accezz

100.0% opcode match
Original
class ArrayAccezz {
    static function main() {
        var a = array();
        var b = a[0];
    }

    static function array() {
        return [1, 2, 3];
    }
}
Decompiled
class ArrayAccezz {
    public static function array(): Array<Int> {
        return [1, 2, 3];
    }

    public static function main(): Void {
        var a: Array<Int> = ArrayAccezz.array();
        var b: Int = a[0];
    }
}

Arrays

100.0% opcode match
Original
class Arrays {
    static function main() {
        var a = [1, 2, 3];
        trace(a);
        var b = [];
        trace(b);
        var arr = [1, 2, 3];
        arr.push(4);
        arr.pop();
        var first = arr[0];
        trace(arr);
        trace(first);
    }
}
Decompiled
extern class StdFuncs {
    static function __std_49_pop(arg0: Dynamic): Dynamic;
    static function __std_50_push(arg0: Dynamic, arg1: Dynamic): Dynamic;
}

class Arrays {
    public static function main(): Void {
        var a: Array<Int> = [1, 2, 3];
        trace(a); // { fileName: 'Arrays.hx', lineNumber: 4, className: 'Arrays', methodName: 'main' }
        var b: Array<Dynamic> = [];
        trace(b); // { fileName: 'Arrays.hx', lineNumber: 6, className: 'Arrays', methodName: 'main' }
        var arr: Array<Int> = [1, 2, 3];
        var var2: Int = arr.push(4);
        arr.pop();
        var first: Int = arr[0];
        trace(arr); // { fileName: 'Arrays.hx', lineNumber: 11, className: 'Arrays', methodName: 'main' }
        trace(first); // { fileName: 'Arrays.hx', lineNumber: 12, className: 'Arrays', methodName: 'main' }
    }
}

Big Control Flow

98.8% opcode match
Original
class BigControlFlow {
    public static function main() {
        var x = 10;
        var result = 0.0;
        if (x > 5) {
            result = x * 2;
        } else {
            result = x + 2;
        }

        var y = 2.0;
        switch (y) {
            case 0:
                result = y + 10;
            case 1:
                result = y * 10;
            case 2:
                result = y - 10;
            default:
                result = y / 10;
        }

        for (i in 0...5) {
            result += i * 2;
        }

        var z = 0;
        while (z < 5) {
            result += z + 3;
            z++;
        }

        var w = 0;
        do {
            result += w - 3;
            w++;
        } while (w < 5);

        try {
            var a = 10 / 0;
        } catch (e:Dynamic) {
            result = -1;
        }

        result += factorial(5);

        for (i in 0...3) {
            if (i % 2 == 0) {
                result += i * 5;
            } else {
                result -= i * 5;
            }
        }
    }

    static function factorial(n:Int):Int {
        if (n <= 1) return 1;
        return n * factorial(n - 1);
    }
}
Decompiled
class BigControlFlow {
    public static function factorial(n: Int): Int {
        if (n <= 1) {
            return 1;
        }
        var var1: Int = n * BigControlFlow.factorial(n - 1);
        return var1;
    }

    public static function main(): Void {
        var var3: Int = 0;
        var a: Float = 0.0;
        var x: Int = 10;
        var result: Float = 0.0;
        if (x > 5) {
            var3 = x * 2;
        } else {
            var3 = x + 2;
        }
        result = var3;
        var y: Float = 2.0;
        result = switch (var3) {
            case 0: y + 10.0;
            case 1: y * 10.0;
            case 2: y - 10.0;
            default: y / 10.0;
        }
        result += 0.0;
        result += 2.0;
        result += 4.0;
        result += 6.0;
        result += 8.0;
        var z: Int = 0;
        while (z < 5) {
            result += z + 3;
            z++;
        }
        var w: Int = 0;
        do {
            result += w - 3;
            w++;
        } while (w < 5);
        try {
            result = 10.0;
            a = result / 0.0;
        } catch (e:Dynamic) {
            a = -1.0;
            result = a;
        }
        var var8: Int = BigControlFlow.factorial(5);
        result += var8;
        if (0 % 2 == 0) {
            result += 0.0;
        } else {
            result -= 0.0;
        }
        if (1 % 2 == 0) {
            result += 5.0;
        } else {
            result -= 5.0;
        }
        if (2 % 2 == 0) {
            result += 10.0;
        } else {
            result -= 10.0;
        }
    }
}

Branch

100.0% opcode match
Original
class Branch {
    static function main() {
        var a = 0;
        if (a > 1) {
            a = 1;
        } else {
            a = 2;
            return;
        }
        a = 3;
    }
}
Decompiled
class Branch {
    public static function main(): Void {
        var a: Int = 0;
        if (a > 1) {
            a = 1;
        } else {
            a = 2;
            return;
        }
        a = 3;
    }
}

Branch Expr

92.3% opcode match
Original
class BranchExpr {
    static function main() {
        var a = true;
        var b = if (a) {
            3;
        } else {
            2;
        };
    }
}
Decompiled
class BranchExpr {
    public static function main(): Void {
        var b: Int = 0;
        var a: Bool = true;
        if (a) {
            b = 3;
        } else {
            b = 2;
        }
    }
}

Branch Nested

94.1% opcode match
Original
class BranchNested {
    static function main() {
        var a = 0;
        if (a > 1) {
            a = 1;
            if (a == 10) {
                a = 42;
                return;
            } else {
                a = 41;
            }
            a = 4;
            var cond = a != 3;
            if (cond) {
                a = 16;
            }
        } else if (a <= 2) {
            a = 2;
            return;
        }
        a = 3;
    }
}
Decompiled
class BranchNested {
    public static function main(): Void {
        var cond: Bool = false;
        var a: Int = 0;
        if (a > 1) {
            a = 1;
            if (a == 10) {
                a = 42;
                return;
            }
            a = 41;
            a = 4;
            if (a == 3) {
                cond = false;
            } else {
                cond = true;
            }
            if (cond) {
                a = 16;
            }
        } else {
            if (a <= 2) {
                a = 2;
            } else {
                a = 3;
            }
            return;
        }
        a = 3;
    }
}

Clazz

100.0% opcode match
Original
class Clazz extends Parent {
    var b: Int;

    public function new() {
        this.b = 10;
    }

    static function main() {
        var c = new Clazz();
        c.b = 15;
        var a = c.b;
        c.method();
    }

    function method(): Int {
        this.b = 18;
        return 42;
    }
}

class Parent {
    var a: Int;
}
Decompiled
class Clazz extends Parent {
    public var b: Int;

    public function new() {
        this.b = 10;
    }

    public static function main(): Void {
        var c: Clazz = new Clazz();
        c.b = 15;
        var a: Int = c.b;
        c.method();
    }

    public function method(): Int {
        this.b = 18;
        return 42;
    }
}

class Parent {
    public var a: Int;
}

Closure

94.7% opcode match
Original
class Closure {
    static function main() {
        var fun = () -> "hello";
        trace(fun());
        trace(fun);
        // This will get inlined
        (() -> { trace(" there"); })();
    }
}
Decompiled
class Closure {
    public static function main(): Void {
        var fun: Dynamic = __anon_23;
        var var4: String = fun();
        trace(var4); // { fileName: 'Closure.hx', lineNumber: 4, className: 'Closure', methodName: 'main' }
        trace(fun); // { fileName: 'Closure.hx', lineNumber: 5, className: 'Closure', methodName: 'main' }
        trace(" there"); // { fileName: 'Closure.hx', lineNumber: 7, className: 'Closure', methodName: 'main' }
    }

    public static function __anon_23(): String {
        return "hello";
    }
}

Constructor

100.0% opcode match
Original
class Constructor {

    function new(a: Int, b: String) {}

    static function main() {
        var a = 45;
        var instance = new Constructor(a, "1.4142135623");
        var b = other();
    }

    static function other() {
        return 42;
    }
}
Decompiled
class Constructor {
    public function new(b: Int, arg1: String) {
    }

    public static function other(): Int {
        return 42;
    }

    public static function main(): Void {
        var a: Int = 45;
        var instance: Constructor = new Constructor(a, "1.4142135623");
        var b: Int = Constructor.other();
    }
}

Empty

100.0% opcode match
Original
class Empty {
    static function main() {}
}
Decompiled
class Empty {
    public static function main(): Void {
    }
}

Enums

96.3% opcode match
Original
class Enums {
    static function main() {
        var a = Red;
        var b = Green;
        var c = Rgb(255, 255, 0);
        switch (c) {
            case Red:
                trace("red");
            case Green:
                trace("Color was green");
            case Blue:
                trace("Color was blue");
            case Rgb(r, g, b):
                trace("Color had a red value of " + r);
        }
    }
}

enum Color {
  Red;
  Green;
  Blue;
  Rgb(r:Int, g:Int, b:Int);
}
Decompiled
extern class StdFuncs {
    static function __std_20___add__(arg0: Dynamic, arg1: Dynamic): Dynamic;
}

enum Color {
    Red;
    Green;
    Blue;
    Rgb(arg0: Int, arg1: Int, arg2: Int);
}

class Enums {
    public static function main(): Void {
        var a: Color = Red;
        var b: Color = Green;
        var c: Color = Rgb(255, 255, 0);
        switch (c) {
            case Red:
                trace("red"); // { fileName: 'Enums.hx', lineNumber: 8, className: 'Enums', methodName: 'main' }
            case Green:
                trace("Color was green"); // { fileName: 'Enums.hx', lineNumber: 10, className: 'Enums', methodName: 'main' }
            case Blue:
                trace("Color was blue"); // { fileName: 'Enums.hx', lineNumber: 12, className: 'Enums', methodName: 'main' }
            case Rgb(r, g, b1):
                var var9: String = ("Color had a red value of " + r);
                trace(var9); // { fileName: 'Enums.hx', lineNumber: 14, className: 'Enums', methodName: 'main' }
        }
    }
}

If

98.4% opcode match
Original
class If {
    public static function other() {
        trace('hi mom');
    }

    public static function other2() {
        trace('hi dad');
    }

    public static function spacer() {
        trace('spacer');
    }

    static function main() {
        var a = 500;
        var b = 10;
        spacer();
        if (a > b) {
            other();
        } else {
            other2();
        }
        spacer();
        if (a > 400 && a > b) {
            other();
        } else {
            other2();
        }
    }
}
Decompiled
class If {
    public static function main(): Void {
        var a: Int = 500;
        var b: Int = 10;
        If.spacer();
        if (b < a) {
            If.other();
        } else {
            If.other2();
        }
        If.spacer();
        if (a > 400) {
            if (b < a) {
                If.other();
            } else {
                If.other2();
            }
            return;
        }
        If.other2();
    }

    public static function spacer(): Void {
        trace("spacer"); // { fileName: 'If.hx', lineNumber: 11, className: 'If', methodName: 'spacer' }
    }

    public static function other2(): Void {
        trace("hi dad"); // { fileName: 'If.hx', lineNumber: 7, className: 'If', methodName: 'other2' }
    }

    public static function other(): Void {
        trace("hi mom"); // { fileName: 'If.hx', lineNumber: 3, className: 'If', methodName: 'other' }
    }
}

Loop Continue

100.0% opcode match
Original
class LoopContinue {
    static function main() {
        var b = 69;
        while (b < 1024) {
            if (b - 2 == 0) {
                continue;
            }
            b += 4;
        }
    }
}
Decompiled
class LoopContinue {
    public static function main(): Void {
        var b: Int = 69;
        while (b < 1024) {
            if (b - 2 == 0) {
                continue;
            }
            b += 4;
        }
    }
}

Loop For Each

100.0% opcode match
Original
class LoopForEach {
    static function main() {
        var sum = 0;
        for (i in items()) sum += i;
    }

    static function items() {
        return [1, 2, 3];
    }
}
Decompiled
class LoopForEach {
    public static function items(): Array<Int> {
        return [1, 2, 3];
    }

    public static function main(): Void {
        var sum: Int = 0;
        for (i in LoopForEach.items()) {
            sum += i;
        }
    }
}

Loop Infinite

100.0% opcode match
Original
class LoopInfinite {
    static function main() {
        var b = 69;
        while (true) {
            b *= 2;
            if (b > 1000) {
                break;
            }
        }
    }
}
Decompiled
class LoopInfinite {
    public static function main(): Void {
        var b: Int = 69;
        do {
            b *= 2;
        } while (b <= 1000);
    }
}

Loop Nested

90.9% opcode match
Original
class LoopNested {
    static function main() {
        var b = 69;
        while (true) {
            b *= 2;
            if (b > 1000) {
                break;
            }
            var a = 0;
            if (a > 1) {
                a = 1;
            } else {
                a = 2;
                return;
            }
            while (true) {
                b *= 2;
                if (b > 1000) {
                    break;
                }
            }
        }
    }
}
Decompiled
class LoopNested {
    public static function main(): Void {
        var a: Int = 0;
        var b: Int = 69;
        while (true) {
            b *= 2;
            if (b * 2 > 1000) {
                return;
            }
            a = 0;
            if (a > 1) {
                a = 1;
            } else {
                a = 2;
                return;
            }
            do {
                a = b * 2;
                b = a;
            } while (a <= 1000);
        }
    }
}

Loop While

100.0% opcode match
Original
class LoopWhile {
    static function main() {
        var b = 69;
        while (b > 5) {
            b -= 2;
        }
        b = 999;
    }
}
Decompiled
class LoopWhile {
    public static function main(): Void {
        var b: Int = 69;
        while (b > 5) {
            b -= 2;
        }
        b = 999;
    }
}

Method

100.0% opcode match
Original
class Method {

    function new() {}

    function a() {
        return 42;
    }

    static function main() {
        var instance = new Method();
        var a = instance.a();
    }
}
Decompiled
class Method {
    public function new() {
    }

    public static function main(): Void {
        var instance: Method = new Method();
        var a: Int = instance.a();
    }

    public function a(): Int {
        return 42;
    }
}

Nested

100.0% opcode match
Original
class Nested {
    static function main() {
        var b = 512.0;
        while (b > 5) {
            b /= 2;
            if (b < 10) {
                while (b < 100) {
                    b *= 2;
                    if (b > 50) {
                        break;
                    }
                }
            }
        }
    }
}
Decompiled
class Nested {
    public static function main(): Void {
        var b: Float = 512.0;
        while (b > 5.0) {
            b /= 2.0;
            if (b < 10.0) {
                while (b < 100.0) {
                    b *= 2.0;
                    if (b > 50.0) {
                        break;
                    }
                }
            }
        }
    }
}

Patch Me

99.4% opcode match
Original
// If you're confused - that's okay! I am too!
// This test file exists as a test for both pyhl and hlmod. It was backported here for convenience.

import haxe.io.Bytes;

class SuperTestClass {
    public static var STATIC_VAL: Int = 8;

    public function do_a_thing() {
        trace("Hello world! superclass");
    }
}

class TestClass extends SuperTestClass {
    public var test: Int = 5;

    public function new() {}

    public override function do_a_thing() {
        trace("Hello world! subclass");
    }
}

class PatchMe {
    static function main() {
        var val = get_value();
        var val2 = 2.0;
        thing(val, val2, "Unpatched message!", new TestClass());
        array_test();
        trace(SuperTestClass.STATIC_VAL);
    }

    static function array_test() {
        arraybytes_consumer([1, 2, 3]);
        arrayobj_consumer([new TestClass(), new TestClass(), new TestClass()]);
    }

    static function arraybytes_consumer(test: Array<Int>) {
        trace(test);
    }

    static function arrayobj_consumer(test: Array<TestClass>) {
        trace(test);
    }

    static function get_value(): Float {
        return 1.0;
    }

    static function thing(val: Float, val2: Null<Float>, msg: String, val3: Null<TestClass>) {
        if (val == 2.0) {
            trace(msg);
            trace(val3.test);
        } else {
            trace("Patch failed!");
        }
    }
}
Decompiled
class PatchMe {
    public static function thing(val: Float, val2: Dynamic, msg: String, val3: TestClass): Void {
        if (val == 2.0) {
            trace(msg); // { fileName: 'PatchMe.hx', lineNumber: 52, className: 'PatchMe', methodName: 'thing' }
            trace(val3.test); // { fileName: 'PatchMe.hx', lineNumber: 53, className: 'PatchMe', methodName: 'thing' }
        } else {
            trace("Patch failed!"); // { fileName: 'PatchMe.hx', lineNumber: 55, className: 'PatchMe', methodName: 'thing' }
        }
    }

    public static function get_value(): Float {
        return 1.0;
    }

    public static function arrayobj_consumer(test: Array<Dynamic>): Void {
        trace(test); // { fileName: 'PatchMe.hx', lineNumber: 43, className: 'PatchMe', methodName: 'arrayobj_consumer' }
    }

    public static function arraybytes_consumer(test: Array<Int>): Void {
        trace(test); // { fileName: 'PatchMe.hx', lineNumber: 39, className: 'PatchMe', methodName: 'arraybytes_consumer' }
    }

    public static function array_test(): Void {
        PatchMe.arraybytes_consumer([1, 2, 3]);
        PatchMe.arrayobj_consumer([new TestClass(), new TestClass(), new TestClass()]);
    }

    public static function main(): Void {
        var val: Float = PatchMe.get_value();
        var val2: Float = 2.0;
        PatchMe.thing(val, val2, "Unpatched message!", new TestClass());
        PatchMe.array_test();
        trace(SuperTestClass.STATIC_VAL); // { fileName: 'PatchMe.hx', lineNumber: 30, className: 'PatchMe', methodName: 'main' }
    }
}

class SuperTestClass {
    public static var STATIC_VAL: Int;

    public function do_a_thing(): Void {
        trace("Hello world! superclass"); // { fileName: 'PatchMe.hx', lineNumber: 10, className: 'SuperTestClass', methodName: 'do_a_thing' }
    }
}

class TestClass extends SuperTestClass {
    public var test: Int;

    public function new() {
        this.test = 5;
    }

    public override function do_a_thing(): Void {
        trace("Hello world! subclass"); // { fileName: 'PatchMe.hx', lineNumber: 20, className: 'TestClass', methodName: 'do_a_thing' }
    }
}

Println

100.0% opcode match
Original
class Println {
    static function main() {
        Sys.println("Hello, println!");
    }
}
Decompiled
extern class StdFuncs {
    static function __std_28_println(arg0: Dynamic): Dynamic;
}

class Println {
    public static function main(): Void {
        Sys.println("Hello, println!");
    }
}

Random

92.9% opcode match
Original
class Random {
    static function main() {
        var randomNumber = Std.random(10);
        trace("A random number between 0 and 9: " + randomNumber);

        var min = 1;
        var max = 100;
        var rangedRandomNumber = min + Std.random(max - min + 1);
        trace("A random number between " + min + " and " + max + ": " + rangedRandomNumber);

        var randomFloat = Math.random();
        trace("A random float between 0 and 1: " + randomFloat);
    }
}
Decompiled
extern class StdFuncs {
    static function __std_20___add__(arg0: Dynamic, arg1: Dynamic): Dynamic;
    static function __std_27_random(): Dynamic;
    static function __std_29_random(arg0: Dynamic): Dynamic;
}

class Random {
    public static function main(): Void {
        var randomNumber: Int = Std.random(10);
        var var4: String = ("A random number between 0 and 9: " + randomNumber);
        trace(var4); // { fileName: 'Random.hx', lineNumber: 4, className: 'Random', methodName: 'main' }
        var min: Int = 1;
        var max: Int = 100;
        var rangedRandomNumber: Int = min + Std.random(max - min + 1);
        trace(((((("A random number between " + min) + " and ") + max) + ": ") + rangedRandomNumber)); // { fileName: 'Random.hx', lineNumber: 9, className: 'Random', methodName: 'main' }
        var randomFloat: Float = Math.random();
        var4 = ("A random float between 0 and 1: " + randomFloat);
        trace(var4); // { fileName: 'Random.hx', lineNumber: 12, className: 'Random', methodName: 'main' }
    }
}

Simple If

95.0% opcode match
Original
class SimpleIf {
    public static function call() {}
    
    static function main() {
        var a = 500;
        if (a > 400) {
            call();
            call();
            call();
        } else {
            call();
        }
        a = 300;
        var b = 999;
    }
}
Decompiled
class SimpleIf {
    public static function main(): Void {
        var a: Int = 500;
        if (a > 400) {
            SimpleIf.call();
            SimpleIf.call();
        }
        SimpleIf.call();
        a = 300;
        var b: Int = 999;
    }

    public static function call(): Void {
    }
}

String Concat

100.0% opcode match
Original
class StringConcat {
    static function main() {
        var a = "hello" + "world";
        var c = 3;
        var b = "number : " + c;
    }
}
Decompiled
extern class StdFuncs {
    static function __std_20___add__(arg0: Dynamic, arg1: Dynamic): Dynamic;
}

class StringConcat {
    public static function main(): Void {
        var a: String = ("hello" + "world");
        var c: Int = 3;
        var b: String = ("number : " + c);
    }
}

String Interp

100.0% opcode match
Original
class StringInterp {
    static function main() {
        var a = 42;
        var b = a + 1;
        var b = 'the number is $a, a + 1 = $b !';
    }
}
Decompiled
extern class StdFuncs {
    static function __std_20___add__(arg0: Dynamic, arg1: Dynamic): Dynamic;
}

class StringInterp {
    public static function main(): Void {
        var a: Int = 42;
        var b: Int = a + 1;
        var b1: String = (((("the number is " + a) + ", a + 1 = ") + b) + " !");
    }
}

Switch

100.0% opcode match
Original
class Switch {
    static function main() {
        var a = 3;
        var b = switch (a) {
            case 0: a * 2;
            case 3: a - 1;
            default: a << 2;
        }
    }
}
Decompiled
class Switch {
    public static function main(): Void {
        var a: Int = 3;
        var b: Int = switch (a) {
            case 0: a * 2;
            case 3: a - 1;
            default: a << 2;
        }
    }
}

Switch Big

100.0% opcode match
Original
class SwitchBig {
    static function main() {
        var a = 3;
        var b = switch (a) {
            case 0: a * 2;
            case 3: a - 1;
            default: a << 2;
        }
        switch (b) {
            case 0: b += 1;
            case 1: b += 1;
            case 2: b += 1;
            //case 4: b += 1;
        }
        switch (a) {
            case -1: b += 1;
            case -5: b += 1;
        }
        var c = "hello";
        switch (c) {
            case "hello": a += 1;
            case "world": a += 1;
        }
    }
}
Decompiled
class SwitchBig {
    public static function main(): Void {
        var a: Int = 3;
        var b: Int = switch (a) {
            case 0: a * 2;
            case 3: a - 1;
            default: a << 2;
        }
        switch (b) {
            case 0:
                b++;
            case 1:
                b++;
            case 2:
                b++;
        }
        switch (a) {
            case -5:
                b++;
            case -1:
                b++;
        }
        var c: String = "hello";
        switch (c) {
            case "hello":
                a++;
            case "world":
                a++;
        }
    }
}

Tiny

100.0% opcode match
Original
class Tiny {
    static function main() {
        var b = 10;
        while (b > 3) {
            b -= 1;
        }
    }
}
Decompiled
class Tiny {
    public static function main(): Void {
        var b: Int = 10;
        while (b > 3) {
            b--;
        }
    }
}

Trace

100.0% opcode match
Original
class Trace {
    static function main() {
        trace("Hello");
        trace("World");
    }
}
Decompiled
class Trace {
    public static function main(): Void {
        trace("Hello"); // { fileName: 'Trace.hx', lineNumber: 3, className: 'Trace', methodName: 'main' }
        trace("World"); // { fileName: 'Trace.hx', lineNumber: 4, className: 'Trace', methodName: 'main' }
    }
}

Try Catch

92.3% opcode match
Original
class TryCatch {
    static function main() {
        try {
            var a = 0;
        } catch (e) {
            var b = 3;
        }
    }
}
Decompiled
class TryCatch {
    public static function main(): Void {
        try {
            var a: Int = 0;
        } catch (e:Dynamic) {
            var b: Int = 3;
        }
    }
}

Virtual Closure

92.3% opcode match
Original
class Base {
    public function new() {}

    public function sayHello() {
        trace("Hello from Base");
    }
}

class Child extends Base {
    public function new() {
        super();
    }

    override public function sayHello() {
        trace("GREETINGS FROM CHILD!");
    }
}

class VirtualClosure {
    public static function main() {
        // 1. Create an instance of the child class, but store it in a variable
        //    typed as the base class. This forces the compiler to consider
        //    virtual dispatch.
        var myObject:Base = new Child();

        // 2. THIS IS THE LINE THAT GENERATES OVirtualClosure.
        //    We are not calling the method directly. Instead, we are getting a
        //    reference to it, creating a closure. Because the compiler knows
        //    'sayHello' can be overridden, it must use a virtual lookup.
        var func = myObject.sayHello;

        // 3. Call the created closure.
        func(); // This will print "GREETINGS FROM CHILD!"
    }
}
Decompiled
class VirtualClosure {
    public static function main(): Void {
        var myObject: Base = new Child();
        var func: Dynamic = myObject.sayHello;
        func();
    }
}

class Child extends Base {
    public function new() {
        super();
    }

    public override function sayHello(): Void {
        trace("GREETINGS FROM CHILD!"); // { fileName: 'VirtualClosure.hx', lineNumber: 15, className: 'Child', methodName: 'sayHello' }
    }
}

class Base {
    public function new() {
    }

    public function sayHello(): Void {
        trace("Hello from Base"); // { fileName: 'VirtualClosure.hx', lineNumber: 5, className: 'Base', methodName: 'sayHello' }
    }
}

Array Bounds Var

92.0% opcode match
Original
class ArrayBoundsVar {
    static function main() {
        var a = [10, 20, 30];
        var i = 1;
        var x = a[i];
        trace(x);
    }
}
Decompiled
extern class Native {
    static function alloc_bytes(arg0: Dynamic): Dynamic;
}

extern class StdFuncs {
    static function __std_43_allocI32(arg0: Dynamic, arg1: Dynamic): Dynamic;
}

class ArrayBoundsVar {
    public static function main(): Void {
        var var2: Int = 0;
        var var1: hl.BytesAccess<Int> = cast Native.alloc_bytes(12);
        var1[0 << 2] = 10;
        var2++;
        var1[var2 << 2] = 20;
        var2++;
        var1[var2 << 2] = 30;
        var2++;
        var a: Array<Int> = cast hl.types.ArrayBase.allocI32(var1, 3);
        var i: Int = 1;
        var x: Int = a[1];
        trace(x); // { fileName: 'ArrayBoundsVar.hx', lineNumber: 6, className: 'ArrayBoundsVar', methodName: 'main' }
    }
}

Array Bounds Write

98.4% opcode match
Original
class ArrayBoundsWrite {
    static function main() {
        var a = [10, 20, 30];
        a[0] = 99;
        a[2] = a[1];
        trace(a);
    }
}
Decompiled
class ArrayBoundsWrite {
    public static function main(): Void {
        var a: Array<Int> = [10, 20, 30];
        a[0] = 99;
        var var3: Int = a[1];
        a[2] = var3;
        trace(a); // { fileName: 'ArrayBoundsWrite.hx', lineNumber: 6, className: 'ArrayBoundsWrite', methodName: 'main' }
    }
}

For Each Values

89.3% opcode match
Original
class ForEachValues {
    static function main() {
        var sum = 0;
        for (v in [1, 2, 3, 4]) {
            sum += v;
        }
        trace(sum);
    }
}
Decompiled
class ForEachValues {
    public static function main(): Void {
        var sum: Int = 0;
        var v: Int = 1;
        sum += v;
        v = 2;
        sum += v;
        v = 3;
        sum += v;
        v = 4;
        sum += v;
        trace(sum); // { fileName: 'ForEachValues.hx', lineNumber: 7, className: 'ForEachValues', methodName: 'main' }
    }
}

Array Bounds Const

100.0% opcode match
Original
class ArrayBoundsConst {
    static function make() {
        return [10, 20, 30];
    }

    static function main() {
        var a = make();
        var x = a[0];
        var y = a[2];
        trace(x);
        trace(y);
    }
}
Decompiled
class ArrayBoundsConst {
    public static function main(): Void {
        var a: Array<Int> = ArrayBoundsConst.make();
        var x: Int = a[0];
        var y: Int = a[2];
        trace(x); // { fileName: 'ArrayBoundsConst.hx', lineNumber: 10, className: 'ArrayBoundsConst', methodName: 'main' }
        trace(y); // { fileName: 'ArrayBoundsConst.hx', lineNumber: 11, className: 'ArrayBoundsConst', methodName: 'main' }
    }

    public static function make(): Array<Int> {
        return [10, 20, 30];
    }
}