IRLabel naLabel = builder.newLabel();
IRLabel finishLabel = builder.newLabel();
// check the first condition
SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
builder.addStatement(new IfStatement(condition1, firstTrue, falseLabel, firstNA));
// first is true.
// set the result to true and do the next test
builder.addLabel(firstTrue);
builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(true))));
builder.addStatement(new GotoStatement(test2Label));
// first is NA
// set the result to NA and do the next test
builder.addLabel(firstNA);
builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(LogicalVector.NA))));
builder.addStatement(new GotoStatement(test2Label));
// check second condition
builder.addLabel(test2Label);
SimpleExpression condition2 = builder.translateSimpleExpression(context, call.getArgument(1));
builder.addStatement(new IfStatement(condition2,
finishLabel, // if condition 2 is true, then the result is equal to condition2
falseLabel, // if false, final result is false,
naLabel));
builder.addLabel(falseLabel);