Program: 54607
Project: 54607
Buggy source:
public JExpression conditional(JConditional original,SourceInfo sourceInfo,JType type,JExpression condExpr,JExpression thenExpr,JExpression elseExpr){
  if (condExpr instanceof JMultiExpression) {
    JMultiExpression condMulti=(JMultiExpression)condExpr;
    JMultiExpression newMulti=new JMultiExpression(program,sourceInfo);
    newMulti.exprs.addAll(allButLast(condMulti.exprs));
    newMulti.exprs.add(conditional(null,sourceInfo,type,last(condMulti.exprs),thenExpr,elseExpr));
    return newMulti;
  }
  if (condExpr instanceof JBooleanLiteral) {
    if (((JBooleanLiteral)condExpr).getValue()) {
      return thenExpr;
    }
 else {
      return elseExpr;
    }
  }
 else   if (thenExpr instanceof JBooleanLiteral) {
    if (((JBooleanLiteral)thenExpr).getValue()) {
      JBinaryOperation binOp=new JBinaryOperation(program,original.getSourceInfo(),original.getType(),JBinaryOperator.OR,condExpr,elseExpr);
      return binOp;
    }
 else {
      JPrefixOperation notCondExpr=new JPrefixOperation(program,condExpr.getSourceInfo(),JUnaryOperator.NOT,condExpr);
      JBinaryOperation binOp=new JBinaryOperation(program,original.getSourceInfo(),original.getType(),JBinaryOperator.AND,notCondExpr,elseExpr);
      return binOp;
    }
  }
 else   if (elseExpr instanceof JBooleanLiteral) {
    if (((JBooleanLiteral)elseExpr).getValue()) {
      JPrefixOperation notCondExpr=new JPrefixOperation(program,condExpr.getSourceInfo(),JUnaryOperator.NOT,condExpr);
      JBinaryOperation binOp=new JBinaryOperation(program,original.getSourceInfo(),original.getType(),JBinaryOperator.OR,notCondExpr,thenExpr);
      return binOp;
    }
 else {
      JBinaryOperation binOp=new JBinaryOperation(program,original.getSourceInfo(),original.getType(),JBinaryOperator.AND,condExpr,thenExpr);
      return binOp;
    }
  }
 else {
    JExpression unflipped=maybeUnflipBoolean(condExpr);
    if (unflipped != null) {
      return new JConditional(program,original.getSourceInfo(),original.getType(),unflipped,elseExpr,thenExpr);
    }
  }
  if (original != null) {
    return original;
  }
  return new JConditional(program,sourceInfo,type,condExpr,thenExpr,elseExpr);
}

Fixed version (ground truth):
public JExpression conditional(JConditional original,SourceInfo sourceInfo,JType type,JExpression condExpr,JExpression thenExpr,JExpression elseExpr){
  if (condExpr instanceof JMultiExpression) {
    JMultiExpression condMulti=(JMultiExpression)condExpr;
    JMultiExpression newMulti=new JMultiExpression(program,sourceInfo);
    newMulti.exprs.addAll(allButLast(condMulti.exprs));
    newMulti.exprs.add(conditional(null,sourceInfo,type,last(condMulti.exprs),thenExpr,elseExpr));
    return newMulti;
  }
  if (condExpr instanceof JBooleanLiteral) {
    if (((JBooleanLiteral)condExpr).getValue()) {
      return thenExpr;
    }
 else {
      return elseExpr;
    }
  }
 else   if (thenExpr instanceof JBooleanLiteral) {
    if (((JBooleanLiteral)thenExpr).getValue()) {
      JBinaryOperation binOp=new JBinaryOperation(program,sourceInfo,type,JBinaryOperator.OR,condExpr,elseExpr);
      return binOp;
    }
 else {
      JPrefixOperation notCondExpr=new JPrefixOperation(program,condExpr.getSourceInfo(),JUnaryOperator.NOT,condExpr);
      JBinaryOperation binOp=new JBinaryOperation(program,sourceInfo,type,JBinaryOperator.AND,notCondExpr,elseExpr);
      return binOp;
    }
  }
 else   if (elseExpr instanceof JBooleanLiteral) {
    if (((JBooleanLiteral)elseExpr).getValue()) {
      JPrefixOperation notCondExpr=new JPrefixOperation(program,condExpr.getSourceInfo(),JUnaryOperator.NOT,condExpr);
      JBinaryOperation binOp=new JBinaryOperation(program,sourceInfo,type,JBinaryOperator.OR,notCondExpr,thenExpr);
      return binOp;
    }
 else {
      JBinaryOperation binOp=new JBinaryOperation(program,sourceInfo,type,JBinaryOperator.AND,condExpr,thenExpr);
      return binOp;
    }
  }
 else {
    JExpression unflipped=maybeUnflipBoolean(condExpr);
    if (unflipped != null) {
      return new JConditional(program,sourceInfo,type,unflipped,elseExpr,thenExpr);
    }
  }
  if (original != null) {
    return original;
  }
  return new JConditional(program,sourceInfo,type,condExpr,thenExpr,elseExpr);
}