If the Barrel's X position is equal to jumpman's X position, then the barrel will go down the ladder. This means if jumpman is on the ladder, or on a ladder exactly underneath the one the barrel is deciding to go down, or standing exactly underneath it, then the barrel will take the ladder.
If not, then the game checks to see if the barrel is to the left or to the right of jumpman's position. If the barrel is to the left of jumpman and his joystick is pushed to the left, then the barrel will take the ladder. If the barrel is to the right of jumpman and the joystick is pushed to the right, then the barrel will take the ladder.