If, in the same compilation, you compile two independent functions each with its own if-statement, without renaming the labels, the result won't even assemble in some assemblers. It is an issue broader than nesting; the mere presence of another if-statement later in the same function, or even in another function can cause label conflicts.
The labels are an integral part of the translation of structured statements to the if-goto-label form, and each label needed by the pattern must be conjured uniquely, every time the translated pattern is applied to a structured statement, or else the patterns just don't work. Each if-goto-label pattern has some number of labels and each particular label has uses and definitions that must bind to each other (and to nothing else) to make the patterns work.
It is a bit like Free variables vs. Bound variables in logic statements. When combining two otherwise separate formulas/statements, sometimes variable names conflict, so one of them has to be renamed before combining them.
You may find a scheme in which you can rely on a local labels feature in some assemblers, but the simplest solution is to generate new label names (usually using numbering) for each structured statement translation in the compilation unit. The numbering can start (e.g. at 1) at the beginning of the translation unit, but is not usually even reset between functions.
In pseudo code, here's what I do. There's an interface on a code gen context object, which allows conjuring and placing labels. With this, we know the binding of labels to their usages, and without changes here, various labeling scheme can be supported, whether fully unique, unique to a procedure, or perhaps local labels.
void codeGenIfStatment () {
var else_label = context.GetNewLabel ();
// generates code to branch to else when the condition is false
generateBranch ( this.condition, else_label, false );
// and falls through to then part otherwise (condition true)
generateCode ( this.then_part );
var end_label = context.GetNewLabel ();
generateBranch ( end_label ); // unconditional branch
context.PlaceLabelHere ( else_label );
generateCode ( this.else_part );
context.PlaceLabelHere ( end_label );
}