/**
 * This is an implementation of the Bron-Kerbosch algorithm for
 * finding maximal cliques in a graph. It makes use of our fully
 * extended language.
 *
 * @author Elvis Stansvik <elvstone@gmail.com>
 */

//EXT:IWE
//EXT:NBD
//EXT:CLE
//EXT:CGT
//EXT:CGE
//EXT:CEQ
//EXT:CNE
//EXT:BDJ

class FullLanguageBronKerbosch {
    public static void main(String[] args) {
        /*
         * Test the algorithm on:
         *
         *     1
         *    / \
         *   0---2
         *       |
         *   4---3
         *
         * which has maximal cliques {0,1,2}, {2,3} and {3,4}.
         */
        Graph g;
        boolean result;
        g = new Graph();
        result = g.init(5);
        result = g.addEdge(0, 1);
        result = g.addEdge(0, 2);
        result = g.addEdge(2, 3);
        result = g.addEdge(1, 2);
        result = g.addEdge(3, 4);
        result = g.printMaxCliques();
    }
}

// Very basic graph class.
class Graph {
    int[] edges;
    int size;

    Set set; // Set utility methods.

    // Initialize the graph with N vertices.
    public boolean init(int N) {
        int i;
        size = N;
        set = new Set();

        edges = new int[size * size];
        i = 0;
        while (i <= N * N - 1) { // CLE.
            edges[i] = 0;
            i = i + 1;
        }

        return true;
    }

    // Add an edge between u and v.
    public boolean addEdge(int u, int v) {
        edges[u * size + v] = 1;
        edges[v * size + u] = 1;
        return true;
    }

    // Prints each maximal clique followed by 666.
    public boolean printMaxCliques() {
        int[] R;
        int[] P;
        int[] X;
        int i;
        R = new int[size];
        P = new int[size];
        X = new int[size];
        i = 0;
        while (R.length > i) { // CGT
            R[i] = 0;
            P[i] = 1;
            X[i] = 0;
            i = i + 1;
        }
        bronKerbosch(R, P, X);
        return true;
    }

    /*
     * The Bron-Kerbosch algorithm.
     *
     * Prints each maximal clique followed by 666.
     *
     * R is the current clique, P are candidates vertices for inclusion into R,
     * X are the forbidden (already evaluated vertices).
     */
    public boolean bronKerbosch(int[] R, int[] P, int[] X) {
        int v;

        if (set.isEmpty(P) && set.isEmpty(X)) { // IWE
            // R is a maximal clique.
            set.print(R);
            System.out.println(666);
        }

        // For each vertex v in P.
        v = 0;
        while (v < P.length) {
            boolean has_v = P[v] == 1; // NBD + CEQ
            if (has_v) {
                bronKerbosch(
                        set.add(R, v),
                        set.intersect(P, edges, v * size),
                        set.intersect(X, edges, v * size));
                P = set.del(P, v);
                X = set.add(X, v);
            }
            v = v + 1;
        }

        return true;
    }

}

/*
 * Some (slow) methods for treating arrays as sets.
 *
 * E.g. a[i] = 1 ==> i is in set a, a[i] = 0 ==> i is not in set a.
 */
class Set {
    // Return a copy of s with e added.
    public int[] add(int[] s, int e) {
        int[] result;
        int i;
        result = new int[s.length];
        i = 0;
        while (result.length - 1 >= i) { // CGE
            if (s[i] == 1)
                result[i] = 1;
            i = i + 1;
        }
        result[e] = 1;
        return result;
    }

    // Return a copy of s with e removed.
    public int[] del(int[] s, int e) {
        int[] result;
        int i;
        result = new int[s.length];
        i = 0;
        while (i < result.length) {
            if (s[i] == 1)
                result[i] = 1;
            i = i + 1;
        }
        result[e] = 0;
        return result;
    }

    // Return the union of a and b[bOffset..bOffset + a.length - 1]
    public int[] union(int[] a, int[] b, int bOffset) {
        int[] result;
        int i;
        result = new int[a.length];
        i = 0;
        while (i < result.length) {
            if (a[i] == 1 || b[i + bOffset] == 1) // BDJ
                result[i] = 1;
            else
                result[i] = 0;
            i = i + 1;
        }
        return result;
    }

    // Return the intersection of a and b[bOffset..bOffset + a.length - 1]
    public int[] intersect(int[] a, int[] b, int bOffset) {
        int[] result;
        int i;
        result = new int[a.length];
        i = 0;
        while (i < result.length) {
            if (a[i] == 1 && b[i + bOffset] == 1)
                result[i] = 1;
            else
                result[i] = 0;
            i = i + 1;
        }
        return result;
    }

    // Returns true if a is an empty set.
    public boolean isEmpty(int[] a) {
        int i;
        boolean result;
        result = true;
        i = 0;
        while (i < a.length) {
            if (a[i] == 1)
                result = false;
            i = i + 1;
        }
        return result;
    }

    // Prints the elements of s.
    public boolean print(int[] s) {
        int i;
        i = 0;
        while (i < s.length) {
            if (s[i] != 0) // CNE
                System.out.println(i);
            i = i + 1;
        }
        return true;
    }
}


@@ -1658,32 +1658,51 @@
 %0A        int i;%0A
+        boolean r;%0A
         R = new 
@@ -1704,32 +1704,32 @@
  new int%5Bsize%5D;%0A
-
         P = new 
@@ -1918,32 +1918,41 @@
       %7D%0A        
+r = this.
 bronKerbosch(R, 
@@ -2416,24 +2416,58 @@
 %0A           
+ boolean r; // NBD%0A            r =
  set.print(R
@@ -2614,24 +2614,12 @@
     
-boolean has_v = 
+if (
 P%5Bv%5D
@@ -2627,18 +2627,14 @@
 == 1
-;
+) %7B
  //
- NBD +
  CEQ
@@ -2650,20 +2650,22 @@
     
+ 
-if (has_v) %7B
+   boolean r;
 %0A   
@@ -2677,16 +2677,25 @@
         
+r = this.
 bronKerb

Make the test case actually MiniJava :)