No Php required here, just simple HTML coding and some mind power and logic.
HTML Code:
<if condition="$prepared['profilepicurl']">
<td id="profilepic_cell" class="tborder alt2">
<img src="$prepared[profilepicurl]" $prepared[profilepicsize] alt="<phrase 1="$prepared[username]">$vbphrase[xs_picture]</phrase>" />
<else />
<if condition="$userinfo[field12]==Male">
<img src="http://www.your-domain.com/images/Default-Male-Pic.gif">
<else />
<img src="http://www.your-domain.com/images/no-gender-pic.gif">
</if>
<if condition="$userinfo[field12]==Female">
<img src="http://www.your-domain.com/images/Default-Female-Pic.gif">
<else />
<img src="http://www.your-domain.com/images/no-gender-pic.gif">
</if>
</td>
</if>