Compose a piece of music based on the provided motif and adhering to the outlined musical structure.
X:1
L:1/8
M:4/4
K:G
['', 'g>d (3(ddd) b2', 'BGdG cAeA cAeA'  
X:1
L:1/8
M:4/4
K:G
 f |: g>d (3(ddd) b2 (ag) | (3(abc') (ba) geef |1 g>d (3(ddd) b2 ag | (3(abc') ba g2 (ga) :|2 
 gaba gedB | cAdB G2 G || d | BGdG BGdG | cAeA cAeA | BGdG BGdG | cAdB G2 Gd | BGdG BGdG | 
 cAeA cAeA | GB (3(def) gedB | cAdB G2 G ||  