Can't Restore Samsung Galaxy S3 To Factory Firmware
.tar.md5 file is used by Odin (another firmware flashing tool), but AFAIK it cannot be used by Heimdall. Please make a backup of this file.

Remove md5sum

Run md5sum on any file to see what is it's output like. Something similar will be appended to original .tar file. Assuming you can open the .tar.md5 file in a text editor, remove the md5 sum from the end of file (and probably you'll have to remove last new line character). Then rename this file to I747UCDLK3_I747ATTDLK3_I747UCDLK3_HOME.tar.

Extract partitions

You should be able to run tar -xf I747UCDLK3_I747ATTDLK3_I747UCDLK3_HOME.tar. It should create a new directory with similar name and this directory will contain images of boot, cache, fat, hidden, recovery and system partitions (and maybe more):


boot.img
cache.img.ext4
hidden.img.ext4
system.img.ext4


Flashing

You should make sure that partitions on your device have the same names as I've written below (APPS, CACHE, HIDDEN, SYSTEM). You can do it be running heimdall download-pit --output &lt;filename&gt; and then heimdall print-pit --file &lt;filename&gt;. Finally, here's the actual flashing (you may want to add --no-reboot to the first command):

# heimdall flash --APPS boot.img --verbose
# heimdall flash --SYSTEM system.img.ext4 --CACHE cache.img.ext4 --HIDDEN hidden.img.ext4 --verbose


Re-flash recovery (added later)

In case your phone boots to recovery instead of system, you should flash your recovery (doesn't have to be stock) image again.