I've searching and I found this viewtopic.php?t=18842, but the image is gone, so please answer this again

Got 3 image below, layer1.png, layer2.png and result.png repsectively.
How could I produce the result (it is layer2 over layer1, but I got stuck at the end, when cutting the transparency).
Important note: the layer 1 could be white as well.
Many thanks



