Program: 135933
Project: 135933
Buggy source:
public static Value CombineFcn(Value f1,Value f2){
  FcnRcdValue fcn1=FcnRcdValue.convert(f1);
  FcnRcdValue fcn2=FcnRcdValue.convert(f2);
  if (fcn1 == null) {
    throw new EvalException(EC.TLC_MODULE_ARGUMENT_ERROR,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",Value.ppr(f1.toString())});
  }
  if (fcn2 == null) {
    throw new EvalException(EC.TLC_MODULE_ARGUMENT_ERROR,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",Value.ppr(f2.toString())});
  }
  ValueVec dom=new ValueVec();
  ValueVec vals=new ValueVec();
  Value[] vals1=fcn1.values;
  Value[] vals2=fcn2.values;
  Value[] dom1=fcn1.domain;
  if (dom1 == null) {
    IntervalValue intv1=fcn1.intv;
    for (int i=intv1.low; i <= intv1.high; i++) {
      dom.addElement(IntValue.gen(i));
      vals.addElement(vals1[i]);
    }
  }
 else {
    for (int i=0; i < dom1.length; i++) {
      dom.addElement(dom1[i]);
      vals.addElement(vals1[i]);
    }
  }
  int len1=dom.size();
  Value[] dom2=fcn2.domain;
  if (dom2 == null) {
    IntervalValue intv2=fcn2.intv;
    for (int i=intv2.low; i <= intv2.high; i++) {
      Value val=IntValue.gen(i);
      boolean found=false;
      for (int j=0; j < len1; j++) {
        if (val.equals(dom.elementAt(j))) {
          found=true;
          break;
        }
      }
      if (!found) {
        dom.addElement(val);
        vals.addElement(vals2[i]);
      }
    }
  }
 else {
    for (int i=0; i < dom2.length; i++) {
      Value val=dom2[i];
      boolean found=false;
      for (int j=0; j < len1; j++) {
        if (val.equals(dom.elementAt(j))) {
          found=true;
          break;
        }
      }
      if (!found) {
        dom.addElement(val);
        vals.addElement(vals2[i]);
      }
    }
  }
  Value[] domain=new Value[dom.size()];
  Value[] values=new Value[dom.size()];
  for (int i=0; i < domain.length; i++) {
    domain[i]=dom.elementAt(i);
    values[i]=vals.elementAt(i);
  }
  return new FcnRcdValue(domain,values,false);
}

Fixed version (ground truth):
public static Value CombineFcn(Value f1,Value f2){
  FcnRcdValue fcn1=FcnRcdValue.convert(f1);
  FcnRcdValue fcn2=FcnRcdValue.convert(f2);
  if (fcn1 == null) {
    throw new EvalException(EC.TLC_MODULE_ARGUMENT_ERROR,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",Value.ppr(f1.toString())});
  }
  if (fcn2 == null) {
    throw new EvalException(EC.TLC_MODULE_ARGUMENT_ERROR,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",Value.ppr(f2.toString())});
  }
  ValueVec dom=new ValueVec();
  ValueVec vals=new ValueVec();
  Value[] vals1=fcn1.values;
  Value[] vals2=fcn2.values;
  Value[] dom1=fcn1.domain;
  if (dom1 == null) {
    IntervalValue intv1=fcn1.intv;
    for (int i=intv1.low; i <= intv1.high; i++) {
      dom.addElement(IntValue.gen(i));
      vals.addElement(vals1[i - intv1.low]);
    }
  }
 else {
    for (int i=0; i < dom1.length; i++) {
      dom.addElement(dom1[i]);
      vals.addElement(vals1[i]);
    }
  }
  int len1=dom.size();
  Value[] dom2=fcn2.domain;
  if (dom2 == null) {
    IntervalValue intv2=fcn2.intv;
    for (int i=intv2.low; i <= intv2.high; i++) {
      Value val=IntValue.gen(i);
      boolean found=false;
      for (int j=0; j < len1; j++) {
        if (val.equals(dom.elementAt(j))) {
          found=true;
          break;
        }
      }
      if (!found) {
        dom.addElement(val);
        vals.addElement(vals2[i]);
      }
    }
  }
 else {
    for (int i=0; i < dom2.length; i++) {
      Value val=dom2[i];
      boolean found=false;
      for (int j=0; j < len1; j++) {
        if (val.equals(dom.elementAt(j))) {
          found=true;
          break;
        }
      }
      if (!found) {
        dom.addElement(val);
        vals.addElement(vals2[i]);
      }
    }
  }
  Value[] domain=new Value[dom.size()];
  Value[] values=new Value[dom.size()];
  for (int i=0; i < domain.length; i++) {
    domain[i]=dom.elementAt(i);
    values[i]=vals.elementAt(i);
  }
  return new FcnRcdValue(domain,values,false);
}