These two lines say...while this is true, stay on this line until it becomes false. The lines could cause large delays. You need to change them to "if" statements or something besides "while".
while(digitalRead(clk) == LOW) { } // hold until clock is high
while(digitalRead(clk) == HIGH) { } // hold until clock is low