When the Pokémon takes damage from a move that knocks it out, it deals the same amount of damage to the attacker.
When this Pokémon faints from an opponent's move, that opponent takes damage equal to the HP this Pokémon had remaining.