Program: 133130
Project: 133130
Buggy source:
private void ifStatement(Context context,SwiftAST tree) throws UserException {
  LogHelper.trace(context,"String_Node_Str");
  If ifStmt=If.fromAST(context,tree);
  Var conditionVar=exprWalker.eval(context,ifStmt.getCondition(),ifStmt.getCondType(context),false,null);
  assert(conditionVar != null);
  List<Var> usedVariables=new ArrayList<Var>();
  List<Var> keepOpenVars=new ArrayList<Var>();
  VariableUsageInfo thenVU=ifStmt.getThenBlock().checkedGetVariableUsage();
  List<VariableUsageInfo> branchVUs;
  if (ifStmt.hasElse()) {
    VariableUsageInfo elseVU=ifStmt.getElseBlock().checkedGetVariableUsage();
    branchVUs=Arrays.asList(thenVU,elseVU);
  }
 else {
    branchVUs=Arrays.asList(thenVU);
  }
  checkConditionalDeadlock(context,conditionVar,branchVUs);
  summariseBranchVariableUsage(context,branchVUs,usedVariables,keepOpenVars);
  if (!usedVariables.contains(conditionVar))   usedVariables.add(conditionVar);
  FunctionContext fc=context.getFunctionContext();
  backend.startWaitStatement(fc.constructName("String_Node_Str"),Arrays.asList(conditionVar),usedVariables,keepOpenVars,WaitMode.DATA_ONLY,false,TaskMode.LOCAL_CONTROL);
  Context waitContext=new LocalContext(context);
  Var condVal=varCreator.fetchValueOf(waitContext,conditionVar);
  backend.startIfStatement(Arg.createVar(condVal),ifStmt.hasElse());
  block(new LocalContext(waitContext),ifStmt.getThenBlock());
  if (ifStmt.hasElse()) {
    backend.startElseBlock();
    block(new LocalContext(waitContext),ifStmt.getElseBlock());
  }
  backend.endIfStatement();
  backend.endWaitStatement(usedVariables,keepOpenVars);
}

Fixed version (ground truth):
private void ifStatement(Context context,SwiftAST tree) throws UserException {
  LogHelper.trace(context,"String_Node_Str");
  If ifStmt=If.fromAST(context,tree);
  Var conditionVar=exprWalker.eval(context,ifStmt.getCondition(),ifStmt.getCondType(context),false,null);
  assert(conditionVar != null);
  List<Var> usedVariables=new ArrayList<Var>();
  List<Var> keepOpenVars=new ArrayList<Var>();
  VariableUsageInfo thenVU=ifStmt.getThenBlock().checkedGetVariableUsage();
  List<VariableUsageInfo> branchVUs;
  if (ifStmt.hasElse()) {
    VariableUsageInfo elseVU=ifStmt.getElseBlock().checkedGetVariableUsage();
    branchVUs=Arrays.asList(thenVU,elseVU);
  }
 else {
    branchVUs=Arrays.asList(thenVU);
  }
  checkConditionalDeadlock(context,conditionVar,branchVUs);
  summariseBranchVariableUsage(context,branchVUs,usedVariables,keepOpenVars);
  if (!usedVariables.contains(conditionVar))   usedVariables.add(conditionVar);
  FunctionContext fc=context.getFunctionContext();
  backend.startWaitStatement(fc.constructName("String_Node_Str"),Arrays.asList(conditionVar),usedVariables,keepOpenVars,null,WaitMode.DATA_ONLY,false,TaskMode.LOCAL_CONTROL);
  Context waitContext=new LocalContext(context);
  Var condVal=varCreator.fetchValueOf(waitContext,conditionVar);
  backend.startIfStatement(Arg.createVar(condVal),ifStmt.hasElse());
  block(new LocalContext(waitContext),ifStmt.getThenBlock());
  if (ifStmt.hasElse()) {
    backend.startElseBlock();
    block(new LocalContext(waitContext),ifStmt.getElseBlock());
  }
  backend.endIfStatement();
  backend.endWaitStatement(usedVariables,keepOpenVars);
}