Question d’entretien chez Semrush

How would you refactor this big function?