need help as iam newbee this programe is hanging on the middlle some times runs

yes i will simply explain the requirement ok iam having i/p pin1 when it is low the o/p1 must go high for 1000ms and low, for i/p 2 when it is low the o/p2 must go high for 1000ms and low, similarly iam having 2button pins if buttonpin 1 goes low to high the o/p3 must go high for 1000ms and low,if buttonpin 2 goes high to low the o/p4 must go high for 1000ms and low where as the both buttons i/p is common,this is single program please suggest me the code thanking you in advance hoping for solution