#1 return dogs 
#2 return side of #1 
#3 return bellies of #1 
#4 return backs of #1 
#5 return #1 that are lying down on   #3 
#6 return #1 that are lying down on   #4 
#7 return #1 that are lying down on   #2 
#8 return number of  #7 
#9 return if  #8 is equal to  zero 
#10 return #5 , #6 
#11 return number of  #10 
#12 return number of  #1 
#13 return if  #12 is equal to  #11 
#14 return if  both  #13 and #9 are true
If all of the dogs are lying down, either on their bellies or on their backs, but not on their side.