Structure and role of carbon-related defects in yttrium aluminum garnet