public final double grad(int var1, double var2, double var4, double var6) {
      int var8 = var1 & 15;
      double var9 = var8 < 8?var2:var4;
      double var11 = var8 < 4?var4:(var8 != 12 && var8 != 14?var6:var2);
      return ((var8 & 1) == 0?var9:-var9) + ((var8 & 2) == 0?var11:-var11);
   }