It's very difficult to read code without the whitespace! Anyway, I think I figured out this much:
Code:
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}
{if $js_enabled}
{if $smarty.get.pconf ne ""}
<INPUT type=hidden name=slot value={$smarty.get.slot}>
<INPUT type=hidden name=addproductid value={$product.productid}>
{include file="buttons/button.tpl" button_title=$lng.lbl_pconf_add_to_configuration
style="button" href="javascript:if (FormValidation()) `$ldelim`document.orderform.productid.value='`$smarty.get.pconf`';document.orderform.action='pconf.php';document.orderform.submit()`$rdelim`"}
{/if}
{if $product.forsale ne "B"}
{include file="buttons/add_to_cart.tpl" style="button" href="javascript:if (FormValidation()) document.orderform.submit()"}
{if $login ne "" and $active_modules.Wishlist ne ""}
{include file="customer/add2wl.tpl"}
{/if}
{else} {$lng.txt_pconf_product_is_bundled}
{/if}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart}
{/if}
{*** ADD OUT OF STOCK NOTICE ***}
{elseif $product.avail eq 0 or $product.avail lt $product.min_amount}
[img]{$ImagesDir}/outofstock.gif[/img]
{*** END OUT OF STOCK NOTICE ***}
{/if}