Using a mandoline, thinly slice garlic; add to saucepan. Add peppercorns, star anise, bay leaves and cinnamon-stick pieces. Top with oil and cook over low heat – the temperature should be between 225°F and 250°F. Cook, stirring often, until garlic is light brown, 25 to 30 minutes. In heat-safe bowl, combine chili flakes, ginger and sugar. Strain garlic-oil mixture through a fine-mesh sieve set over chili-flake bowl.