Bolsanaro has attacked the voting system and threatened to contest defeat.