Can't get actual output when, both input logic is high
You can simplify your requirements somewhat by splitting your inputs up.


  light=0, ir=0 then output will pin 8 high &amp; pin 12 low.
  
  light=0, ir=1 then output will pin 8 high &amp; pin 12 high.


If light is 0 then pin 8 is high. AND ir is echoed to pin 12.


  light=1, ir=0 then output will pin 8 low &amp; pin 12 low.
  
  light=1, ir=1 then output will pin 8 low &amp; pin 12 low


If light is 1 then both pins 8 and 12 are low, and you don't care what ir does, since it doesn't have any effect on the outputs.

So your structure could look more like:

if (light == 0) {
    digitalWrite(8, HIGH); // 8 will always be high with light == 0
    digitalWrite(12, ir); // echo the ir value to pin 12
} else {
    digitalWrite(8, LOW); // if light is 1 then everything
    digitalWrite(12, LOW);// is low regardless of ir.
}