Problem with your code is, that you display only registered image (Ir). As Image Analyst suggested , you should first combine image A with registered image Ir.
So instead of:
you should do something like this:
maskA = imfill(original ~= 0, 'holes');
maskB = imfill(rgb2gray(Ir) ~= 0, 'holes');
overlapMask = maskA & maskB;
overlapMaskRGB = cat(3, overlapMask, overlapMask, overlapMask);
C = A+Ir;
C(overlapMaskRGB) = C(overlapMaskRGB)/2;
Result image is attached below. Now, as you can see, there is a little problem around the edges. (there are some dark pixels). That is because in this example we 'assume' that background of your input images is completely black (that means pixel values [0 0 0]). It doesn't have to be always true, especially for JPEG images, because of the compression artifacts.
You can use one of the image formats with lossless compression (for example png) for better results, or you can set the threshold and mask pixels darker than this threshold.