  The competition among superconductivity, stripe-type magnetic order, and a
new type of $C_4$ symmetric magnetic order in $\mathrm{Ba_{1-x}K_xFe_2As_2}$ is
theoretically studied, focusing on its impact on the global phase diagram. By
carrying out a renormalization group analysis of an effective field theory, we
obtain the energy-scale dependent flows of all the model parameters, and then
apply the results to understand the observed phase diagram. On the basis of the
renormalization group analysis, we show that the critical line of nematic order
has a negative slope in the superconducting dome and superconductivity is
suppressed near the magnetic quantum critical point, which are both consistent
with recent experiments. Moreover, we find that, although the observed $C_4$
symmetric magnetic state could be a charge-spin density wave or a spin-vortex
crystal at high temperatures, charge-spin density wave is the only stable $C_4$
magnetic state in the low-temperature regime. Therefore, ordering competition
provides a method to distinguish these two candidate $C_4$ magnetic states.
