gt:         a2 = engine.aregs[2];
context: package jp.ac.kobe_u.cs.prolog.builtin;
  import jp.ac.kobe_u.cs.prolog.lang.IntegerTerm;
  import jp.ac.kobe_u.cs.prolog.lang.Predicate;
  import jp.ac.kobe_u.cs.prolog.lang.Prolog;
  import jp.ac.kobe_u.cs.prolog.lang.StructureTerm;
  import jp.ac.kobe_u.cs.prolog.lang.SymbolTerm;
  import jp.ac.kobe_u.cs.prolog.lang.Term;
  import jp.ac.kobe_u.cs.prolog.lang.VariableTerm;
  /*
   This file is generated by Prolog Cafe.
   PLEASE DO NOT EDIT!
  */
  /**
   <code>'$check_procedure_permission'/4</code> defined in builtins.pl<br>
   @author Mutsunori Banbara (banbara@kobe-u.ac.jp)
   @author Naoyuki Tamura (tamura@kobe-u.ac.jp)
   @version 1.0
  */
  class PRED_$check_procedure_permission_4 extends Predicate {
      static SymbolTerm s1 = SymbolTerm.makeSymbol(":", 2);
      static SymbolTerm s2 = SymbolTerm.makeSymbol("/", 2);
      static SymbolTerm s3 = SymbolTerm.makeSymbol("permission", 4);
      static Predicate _$check_procedure_permission_4_var = new PRED_$check_procedure_permission_4_var();
      static Predicate _$check_procedure_permission_4_var_1 = new PRED_$check_procedure_permission_4_var_1();
      static Predicate _$check_procedure_permission_4_var_2 = new PRED_$check_procedure_permission_4_var_2();
      static Predicate _$check_procedure_permission_4_1 = new PRED_$check_procedure_permission_4_1();
      static Predicate _$check_procedure_permission_4_2 = new PRED_$check_procedure_permission_4_2();
      static Predicate _$check_procedure_permission_4_3 = new PRED_$check_procedure_permission_4_3();
  
      public Term arg1, arg2, arg3, arg4;
  
      public PRED_$check_procedure_permission_4(Term a1, Term a2, Term a3, Term a4, Predicate cont) {
          arg1 = a1;
          arg2 = a2;
          arg3 = a3;
          arg4 = a4;
          this.cont = cont;
      }
  
      public PRED_$check_procedure_permission_4(){}
  
      public void setArgument(Term[] args, Predicate cont) {
          arg1 = args[0];
          arg2 = args[1];
          arg3 = args[2];
          arg4 = args[3];
          this.cont = cont;
      }
  
      public int arity() { return 4; }
  
      public String toString() {
          return "$check_procedure_permission(" + arg1 + "," + arg2 + "," + arg3 + "," + arg4 + ")";
      }
  
      public Predicate exec(Prolog engine) {
          engine.aregs[1] = arg1;
          engine.aregs[2] = arg2;
          engine.aregs[3] = arg3;
          engine.aregs[4] = arg4;
          engine.cont = cont;
          engine.setB0();
          return engine.switch_on_term(_$check_procedure_permission_4_var, _$check_procedure_permission_4_3, _$check_procedure_permission_4_3, _$check_procedure_permission_4_3, _$check_procedure_permission_4_var, _$check_procedure_permission_4_3);
      }
  }
  
  class PRED_$check_procedure_permission_4_var extends PRED_$check_procedure_permission_4 {
      public Predicate exec(Prolog engine) {
          return engine.jtry(_$check_procedure_permission_4_1, _$check_procedure_permission_4_var_1);
      }
  }
  
  class PRED_$check_procedure_permission_4_var_1 extends PRED_$check_procedure_permission_4 {
      public Predicate exec(Prolog engine) {
          return engine.retry(_$check_procedure_permission_4_2, _$check_procedure_permission_4_var_2);
      }
  }
  
  class PRED_$check_procedure_permission_4_var_2 extends PRED_$check_procedure_permission_4 {
      public Predicate exec(Prolog engine) {
          return engine.trust(_$check_procedure_permission_4_3);
      }
  }
  
  class PRED_$check_procedure_permission_4_1 extends PRED_$check_procedure_permission_4 {
      public Predicate exec(Prolog engine) {
      // '$check_procedure_permission'(A:B/C,D,E,F):-hash_contains_key(A,B/C),!
          Term a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
          Predicate p1;
          Predicate cont;
          a1 = engine.aregs[1];
          a2 = engine.aregs[2];
          a3 = engine.aregs[3];
          a4 = engine.aregs[4];
          cont = engine.cont;
      // '$check_procedure_permission'(A:B/C,D,E,F):-['$get_level'(G),hash_contains_key(A,B/C),'$cut'(G)]
          a1 = a1.dereference();
          if (a1.isStructure()){
              if (! s1.equals(((StructureTerm)a1).functor()))
                  return engine.fail();
              Term[] args = ((StructureTerm)a1).args();
              a5 = args[0];
              a6 = args[1];
          } else if (a1.isVariable()){
              a5 = new VariableTerm(engine);
              a6 = new VariableTerm(engine);
              Term[] args = {a5, a6};
              ((VariableTerm) a1).bind(new StructureTerm(s1, args), engine.trail);
          } else {
              return engine.fail();
          }
          a6 = a6.dereference();
          if (a6.isStructure()){
              if (! s2.equals(((StructureTerm)a6).functor()))
                  return engine.fail();
              Term[] args = ((StructureTerm)a6).args();
              a7 = args[0];
              a8 = args[1];
          } else if (a6.isVariable()){
              a7 = new VariableTerm(engine);
              a8 = new VariableTerm(engine);
              Term[] args = {a7, a8};
              ((VariableTerm) a6).bind(new StructureTerm(s2, args), engine.trail);
          } else {
              return engine.fail();
          }
          a9 = new VariableTerm(engine);
          //START inline expansion of $get_level(a(9))
          if (! a9.unify(new IntegerTerm(engine.B0), engine.trail)) {
              return engine.fail();
          }
          //END inline expansion
          Term[] y1 = {a7, a8};
          a10 = new StructureTerm(s2, y1);
          p1 = new PRED_$cut_1(a9, cont);
          return new PRED_hash_contains_key_2(a5, a10, p1);
      }
  }
  
  class PRED_$check_procedure_permission_4_2 extends PRED_$check_procedure_permission_4 {
      public Predicate exec(Prolog engine) {
      // '$check_procedure_permission'(A:B/C,D,E,F):-'$compiled_predicate_or_builtin'(A,B,C),!,illarg(permission(D,E,A:B/C,G),F,H)
          Term a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12;
          Predicate p1, p2;
          Predicate cont;
          a1 = engine.aregs[1];
          a2 = engine.aregs[2];
          a3 = engine.aregs[3];
          a4 = engine.aregs[4];
          cont = engine.cont;
      // '$check_procedure_permission'(A:B/C,D,E,F):-['$get_level'(G),'$compiled_predicate_or_builtin'(A,B,C),'$cut'(G),illarg(permission(D,E,A:B/C,H),F,I)]
          a1 = a1.dereference();
          if (a1.isStructure()){
              if (! s1.equals(((StructureTerm)a1).functor()))
                  return engine.fail();
              Term[] args = ((StructureTerm)a1).args();
              a5 = args[0];
              a6 = args[1];
          } else if (a1.isVariable()){
              a5 = new VariableTerm(engine);
              a6 = new VariableTerm(engine);
              Term[] args = {a5, a6};
              ((VariableTerm) a1).bind(new StructureTerm(s1, args), engine.trail);
          } else {
              return engine.fail();
          }
          a6 = a6.dereference();
          if (a6.isStructure()){
              if (! s2.equals(((StructureTerm)a6).functor()))
                  return engine.fail();
              Term[] args = ((StructureTerm)a6).args();
              a7 = args[0];
              a8 = args[1];
          } else if (a6.isVariable()){
              a7 = new VariableTerm(engine);
              a8 = new VariableTerm(engine);
              Term[] args = {a7, a8};
              ((VariableTerm) a6).bind(new StructureTerm(s2, args), engine.trail);
          } else {
              return engine.fail();
          }
          a9 = new VariableTerm(engine);
          //START inline expansion of $get_level(a(9))
          if (! a9.unify(new IntegerTerm(engine.B0), engine.trail)) {
              return engine.fail();
          }
          //END inline expansion
          Term[] y1 = {a7, a8};
          a10 = new StructureTerm(s2, y1);
          Term[] y2 = {a5, a10};
          a11 = new StructureTerm(s1, y2);
          Term[] y3 = {a2, a3, a11, new VariableTerm(engine)};
          a12 = new StructureTerm(s3, y3);
          p1 = new PRED_illarg_3(a12, a4, new VariableTerm(engine), cont);
          p2 = new PRED_$cut_1(a9, p1);
          return new PRED_$compiled_predicate_or_builtin_3(a5, a7, a8, p2);
      }
  }
  
  class PRED_$check_procedure_permission_4_3 extends PRED_$check_procedure_permission_4 {
      public Predicate exec(Prolog engine) {
      // '$check_procedure_permission'(A,B,C,D):-true
          Term a1, a2, a3, a4;
          Predicate cont;
          a1 = engine.aregs[1];
  