#include "Relooper.h"
int main() {
  char buffer[100000];
  rl_set_output_buffer(buffer);
  void *block_map[10000];
  void *rl = rl_new_relooper();
  void *b-1 = rl_new_block("// code -1");
  block_map[-1] = b-1;
  rl_relooper_add_block(rl, block_map[-1]);
  void *b-1 = rl_new_block("// code -1");
  block_map[-1] = b-1;
  rl_relooper_add_block(rl, block_map[-1]);
  void *b-1 = rl_new_block("// code -1");
  block_map[-1] = b-1;
  rl_relooper_add_block(rl, block_map[-1]);
  void *b-1 = rl_new_block("// code -1");
  block_map[-1] = b-1;
  rl_relooper_add_block(rl, block_map[-1]);
  rl_block_add_branch_to(block_map[1], block_map[2], "ep -> LBB1", NULL);
  rl_block_add_branch_to(block_map[1], block_map[4], NULL, NULL);
  rl_block_add_branch_to(block_map[2], block_map[3], "LBB1 -> LBB2", NULL);
  rl_block_add_branch_to(block_map[2], block_map[4], NULL, NULL);
  rl_block_add_branch_to(block_map[3], block_map[4], NULL, NULL);
  rl_relooper_calculate(rl, block_map[1]);
  rl_relooper_render(rl);
  rl_delete_relooper(rl);
  puts(buffer);
  return 0;
}
// Adding block 1 (ep)
// Adding block 2 (LBB1)
// Adding block 3 (LBB2)
// Adding block 4 (LBB3)
// Process() called
// Process() running
  blocks :  1:
  -> 2
  -> 4
2:
  -> 3
  -> 4
3:
  -> 4
4:
  entries:  1:
  -> 2
  -> 4
// creating simple block with block #1
// Solipsizing branches into 2
  relevant to solipsize:  1:
  -> 2
  -> 4
//   eliminated branch from 1
// Solipsizing branches into 4
  relevant to solipsize:  1:
  -> 4
//   eliminated branch from 1
// Process() running
  blocks :  2:
  -> 3
  -> 4
3:
  -> 4
4:
  entries:  2:
  -> 3
  -> 4
4:
// Investigated independent groups:
 group:  2:
  -> 3
  -> 4
3:
  -> 4
// Independent groups: 1
// Handleable independent groups: 1
// creating multiple block with 1 inner groups
//   multiple group with entry 2:
     2:
  -> 3
  -> 4
3:
  -> 4
// Solipsizing branches into 4
  relevant to solipsize:  2:
  -> 3
  -> 4
3:
  -> 4
//   eliminated branch from 2
//   eliminated branch from 3
// Process() called
// Process() running
  blocks :  2:
  -> 3
3:
  entries:  2:
  -> 3
// creating simple block with block #2
// Solipsizing branches into 3
  relevant to solipsize:  2:
  -> 3
//   eliminated branch from 2
// Process() running
  blocks :  3:
  entries:  3:
// creating simple block with block #3
// Process() returning
  remaining blocks after multiple: 4:
// Process() running
  blocks :  4:
  entries:  4:
// creating simple block with block #4
// Process() returning
// === Optimizing shapes ===
// Fusing Multiple to Simple
 ep
 L1: do {
  switch (the_var) {
  ep -> LBB1 {
   LBB1
   switch (the_var) {
   LBB1 -> LBB2 {
    break;
   }
   default: {
    break L1;
   }
   }
   LBB2
   switch (the_var) {
   default: {
   }
   }
   break;
  }
  default: {
  }
  }
 } while(0);
 LBB3

