Simulating a PLC ladder diagram on arduino

I'm not familiar with the thing you call a 'keep' but the behaviour you're describing could be coded like this:

// a high (I1) and a low (I2) with make the output high (keep1)
// however the low (I3) will make it the output low
// in the code below, true corresponds to logic high and false corresponds to logic low

boolean I1, I2, I3, result;
if(I3)
{
    if(I1 && !I2)
    {
        result = true;
    }
    else
    {
        result = false;
    }
}
else
{
    result = false;
}

There are more concise ways to code that calculation, but they are harder to get your head around. For example:

result = I3 && (I2 && !I3);

This 'keep' logic may make sense as a way to build logical behaviour in a PLC, but unless your goal is to make the microcontroller emulate a PLC I wouldn't expect to use this type of thing very often - usually, logical expressions can be expressed much more simply than this. I wouldn't use I1, I2, I3 as variable names either - I'd use names that indicate the purpose of the variables.