And, just in case a picture helps...
... where straight continuous lines differentiate (downward) or integrate (upward) with respect to x, and the straight dashed line with respect to the dashed balloon expression. So that the right-hand, triangular network satisfies the chain-rule for differentiation. To fill in the blanks, you need to do the 'dashed' integration, as though the dashed balloon were just a variable like x or u. But actually this too involves the chain rule, so you might like to consider
And now you can complete both pictures by doing
Don't integrate - balloontegrate! Balloon Calculus: worked examples from past papers