If you knew/had known you were in for a sleepless night, you would’ve dozed off earlier in the day.
Had you known you wouldn’t get a wink of sleep all night, you would’ve gone to sleep in the middle of the day like a baby.