Repository: mishoo/UglifyJS (JavaScript)

Issue:
ufuzz failure
```js
// original code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;

async function f0(foo_2, foo_2_2) {
    {
        var brake1 = 5;
        L19252: while (2 in [ (c = c + 1) + ((c = c + 1) + a-- || a || 3).toString() ] && --brake1 > 0) {
            var a = (c = c + 1) + !function() {
                {
                    var brake3 = 5;
                    while ((c = c + 1) + (foo_2_2 = --b + +b) && --brake3 > 0) {
                        var brake4 = 5;
                        L19253: while (foo_2_2 && foo_2_2.done && --brake4 > 0) {
                            typeof foo_2_2 == "function" && --_calls_ >= 0 && foo_2_2();
                        }
                    }
                }
            }(), a_1 = --b;
        }
    }
    switch (a++ + (--b + 2 || a || 3).toString()) {
      case -a:
        switch ({
            in: --b + ([ , 0 ].length === 2),
            foo: a++ + (1 === 1 ? a : b)
        }[{
            undefined: --b + typeof ([] > [] | (a_1 += -3 ^ "foo") | -2 >= 2 & 24..toString() == "function"),
            done: a++ + (typeof f0 == "function" && --_calls_ >= 0 && f0(a++ + (typeof a_1 == "function" && --_calls_ >= 0 && a_1()), true, "b"))
        }[typeof foo_2_2 == "function" && --_calls_ >= 0 && foo_2_2(/[abc4]/g.exec(({
            foo_2: foo_2,
            undefined: (c = 1 + c, ({} / "foo" | -4 < "") ^ (-1 != "c" ^ "b" !== -4)),
            3: (c = 1 + c, foo_2 && (foo_2.undefined = ((2, -0) == NaN <= undefined) >> (true <= "c" <= (2 || [])))),
            "-2": (c = 1 + c, (foo_2_2 && (foo_2_2.a += 0 >> "object")) <= "function" % "foo" || +2 >>> (0 | "a")),
            length: (c = 1 + c, foo_2 && (foo_2[a++ + --b] = 24..toString() % "function" / ([ , 0 ].length === 2 === NaN) > (-0 !== undefined === (-0 ^ "undefined"))))
        }.next || b || 5).toString()), 25)]]) {
          case a++ + ("a" in [ ...[ a++ + 5, void (("a" > -3 & NaN << 5) / (2 + ([ , 0 ].length === 2) & +3)), typeof (--b + (typeof f0 == "function" && --_calls_ >= 0 && f0("a", (c = 1 + c, 
            (3 << true | "object" * 2) == -4 % 5 + (5 >> 2))))), --b + (1 === 1 ? a : b), a++ + (--b + 23..toString()) ], (c = c + 1) + a, (c = c + 1) + /[abc4]/g.exec((b++ || b || 5).toString()), (c = c + 1) + "c", typeof undefined_2 ]):
          case --b + ((c = c + 1) + (typeof a === "string")):
            switch (a_1) {
              case --b + {}.done:
                break;

              case (c = c + 1) + (b = a):
                break;

              case typeof b != "function":
                break;

              case typeof foo == "symbol":
                break;
            }
            break;

          default:
            {
                var expr9 = [ (c = c + 1) + (0 in [ void ((38..toString() + "foo") / (c = c + 1, 
                [ , 0 ].length === 2) < (false != /[a2][^e]+$/ === 0 * "number")) ]), [ --b + [ , 0 ][1], (c = c + 1) + a++, a++ + [ (c = 1 + c, 
                ("a" <= "" ^ (23..toString() ^ 5)) == (4 == undefined) > (2 ^ -5)), (c = 1 + c, 
                (a /= "b" ^ {} && "number" ^ -2) != ((1 ^ Infinity) != (a && (a.c >>= 5 < 38..toString())))), (c = 1 + c, 
                foo_2 && (foo_2[a++ + -(foo_2 && ({
                    null: foo_2.value
                } = {
                    null: ("b" ^ "bar") >= 22 >>> "function" ^ true >>> 0 > (undefined ^ Infinity)
                }))] <<= ("b" ^ 1) + ("" & 2) ^ (-2 <= 25) % (/[a2][^e]+$/ - "foo"))), (c = 1 + c, 
                a_1 && (a_1.NaN = (a += true * 1 * (NaN && 22)) || foo_2_2 && (foo_2_2.done = (foo_2_2 && (foo_2_2.b = {} && NaN)) == [ , 0 ][1] < 23..toString()))) ][c = 1 + c, 
                foo_2 && (foo_2[(c = c + 1) + (0 === 1 ? a : b)] += -2 << "undefined" >= "foo" >> -0) && (4 === -5, 
                -4 <= "object")] ][[ (c = 1 + c, (foo_2 &= 3 | 23..toString()) > (this || "number") < ((NaN | "undefined") > (-1 === -5))), (c = 1 + c, 
                (-0 ^ -4) % ("undefined" & "foo") || (c = c + 1, 0, -0 >= -5)), (c = 1 + c, ("foo" > 0, 
                Infinity >> -1) === (undefined > 3, delete -1)), (c = 1 + c, +([ , 0 ].length === 2 & -4) << (-3 << NaN) - "" * "undefined") ]], {
                    "": ~("bar" / "function" !== ~23..toString() != ((foo_2_2 ^= true ^ "bar") && "bar" + 5))
                }.null, --b + -a, (c = c + 1, NaN) ^ (foo_2 && (foo_2.var |= 1 >= 4)) || [ , 0 ][1] == "bar" && "foo" > "" ];
                for (const key9 of expr9) {
                    c = 1 + c;
                    var Infinity = expr9[key9];
                    (c = c + 1) + b--;
                }
            }
            switch (a++ + (false in [ a++ + [ , (c = 1 + c, Infinity && (Infinity.in = ({} | 22 | true >= "object") === (4 === -2 ^ 23..toString() === [ , 0 ][1]))) ], +function foo() {
                c = 1 + c, (5 - "bar" == (25 ^ "bar")) << ((23..toString(), 2) > (2 > 0));
            }(), a++, a++ + b--, (c = c + 1) + {
                "\t": (c = 1 + c, (a_1 && (a_1.next = ([ , 0 ].length === 2 === [ , 0 ][1]) >>> (/[a2][^e]+$/ >= "object"))) & (foo_2_2 && (foo_2_2[a && typeof a.a == "function" && --_calls_ >= 0 && a.a([ , 0 ].length === 2, (c = 1 + c, 
                ((NaN === "bar") <= ("bar" < [])) - (-5 == 24..toString() ^ ~-2)))] <<= 2 - 38..toString() >= ([ , 0 ].length === 2 === -2)))),
                done: (c = 1 + c, (-1 != "a" & false << 23..toString()) > (c = c + 1, false) - ("function" | [ , 0 ].length === 2)),
                foo: (c = 1 + c, c = c + 1, a_1 && (a_1[c = 1 + c, foo_2_2 && (foo_2_2[(c = c + 1) + void function() {}()] = ({} >>> "") % (true <= 3) === (a_1 && (a_1.c = !"undefined" != "a" / 2)))] = {} | 1), 
                -1 <= false)
            }[/[abc4]/g.exec(((c = 1 + c, (a && (a[--b + 2] += true % Infinity !== (Infinity <<= /[a2][^e]+$/ == {}))) ^ false >>> -1 >>> (Infinity && (Infinity[c = 1 + c, 
            (1 % "function" === "a" >> -3) >= (-2 < "bar") >>> ("bar" > "bar")] += -5 >> undefined))) || b || 5).toString())] ])) {
              case {
                    null: a_1 && a_1.undefined,
                    ...foo_2,
                    b: b--,
                    get var() {
                        return c = 1 + c, ([] || 3) <= ([ , 0 ].length === 2) * 25 == ("a" >= "foo") % ("a" | -1);
                        {
                            return;
                            a_1 && typeof a_1.NaN == "function" && --_calls_ >= 0 && a_1.NaN((c = 1 + c, ("undefined" <= "b" && (a_1 && (a_1.foo += "foo" != ""))) ^ "foo" < false < -3 - -3));
                        }
                    },
                    NaN: a++ + (/[abc4]/g.exec(((c = 1 + c, (25 > true) * (true < "bar") || (foo_2_2 && (foo_2_2.b %= -2 && [ , 0 ][1])) === delete true) || b || 5).toString()) || a || 3).toString()
                }.done:
                switch ({}[typeof f2 == "function" && --_calls_ >= 0 && f2((c = 1 + c, ~("function" <= {} != 24..toString() << 2)), (c = 1 + c, 
                false << false != "function" / 2 ^ (c = c + 1, -1 << undefined)))]) {
                  default:
                  case a++ + Infinity:
                    var b_2;
                    {
                        var brake17 = 5;
                        L19254: while ((c = 1 + c, foo_2_2 /= (([ , 0 ].length === 2 ^ [ , 0 ].length === 2) <= NaN / {}) % ([ , 0 ][1] >> "number" == (1 | [ , 0 ].length === 2))) && --brake17 > 0) {
                            c = 1 + c, (foo_2_2 = (-0 < 23..toString()) >> "undefined" / 23..toString()) >> (c = c + 1, 
                            0 >>> true);
                        }
                    }
                    break;

                  case b_2 && b_2.Infinity:
                    break;

                  case (c = c + 1) + ~(-0 > "bar" !== ("foo" ^ "bar") && 5 !== 25 | 3 ^ "undefined"):
                    {
                        var expr19 = (c = 1 + c, ({} - [] && 1 << "a") < ([] === 1 & "a" < undefined));
                        for (var key19 in expr19) {
                            c = 1 + c;
                            var Infinity = expr19[key19];
                            c = 1 + c, (3 == -4 != -3 >>> -0) >>> ((-3 | Infinity) != (23..toString() | null));
                        }
                    }
                    {
                    }
                    break;
                }
                ({});

              default:
              case /[abc4]/g.exec((a++ + (typeof a == "function" && --_calls_ >= 0 && a("a", a++ + (a_1 && typeof a_1.var == "function" && --_calls_ >= 0 && a_1.var("bar", (c = 1 + c, 
                ("b" || {}) <= (-5 >= 25) ^ ("b" > "a" | ([ , 0 ].length === 2) * 4)), false)), a && typeof a.b == "function" && --_calls_ >= 0 && a.b(0))) || b || 5).toString()):
                break;

              case typeof f2 == "function" && --_calls_ >= 0 && f2((c = c + 1) + [ (c = 1 + c, void (c = c + 1, 
                "" <= {})), (c = 1 + c, Infinity && (Infinity[void ((2 - "a") % ("a" <= 5) !== -1 + 0 >> (-5 ^ true))] = 24..toString() > undefined | {} << 3) || "function" <= 0 <= delete "undefined"), (c = 1 + c, 
                +((-0 == ([ , 0 ].length === 2)) - ("c" === Infinity))) ]):
                if (--b + (typeof f0 == "function" && --_calls_ >= 0 && f0("object"))) {
                    return;
                    a++ + (b = a);
                }
                {
                    var expr25 = ~(a /= (c = c + 1, 2) == (23..toString(), 23..toString()) || ~38..toString() ^ (/[a2][^e]+$/ | 38..toString()));
                    for (var key25 in expr25) {
                        c = 1 + c;
                        var b_1 = expr25[key25];
                        switch (a++ + typeof arguments_2) {
                          default:
                            c = 1 + c, (-38..toString(), "undefined", "bar") * (c = c + 1, a && (a[c = 1 + c, 
                            Infinity = (a && (a[a++ + [ (c = 1 + c, ("function" >= 24..toString() ^ "bar" >> Infinity) > (b_1 && (b_1.value = (c = c + 1, 
                            22) << (0 ^ "bar")))), (c = 1 + c, (a %= undefined != 4) % (-4 << 24..toString()) >= (+true >= (-3 == "undefined"))), (c = 1 + c, 
                            -4 < -0 == /[a2][^e]+$/ >> null === ([] / -0 !== 38..toString() <= 5)) ].foo] += 5 != "" || /[a2][^e]+$/ == "b")) - ~("" | -4)] >>>= -5 < ([ , 0 ].length === 2)));

                          case a++ + (1 === 1 ? a : b):
                            c = 1 + c, ("c" == 24..toString()) <= "" % Infinity <= delete (0 - this);
                            break;

                          case 5 in {
                                "-2": (c = 1 + c, (a_1 && (a_1[c = 1 + c, (-5 * 23..toString() !== ([] != "bar")) << (25 <= -4) % (undefined && 3)] = this == undefined)) * ("function" < "bar") - (2 ^ 1) * (1 !== undefined)),
                                b: (c = 1 + c, (-3 / 23..toString() == [] <= 23..toString()) < ((-1 && -3) > (foo_2_2 && (foo_2_2.c -= [ , 0 ].length === 2 != Infinity)))),
                                a: a,
                                done: (c = 1 + c, !("c" & -3) % (("a", 5) >= ("number" > "undefined"))),
                                done: (c = 1 + c, a && (a.b -= ((false == 22) >> Infinity - -2) - (a && (a[c = 1 + c, 
                                (foo_2_2 && (foo_2_2[c = 1 + c, (5 < undefined ^ -2 == 0) >>> ("function" !== true ^ ~-0)] >>= null === Infinity)) > ("function" & -1) == (24..toString() >= -2) / (Infinity != [ , 0 ][1])] |= "object" == /[a2][^e]+$/)) % (this / "bar")))
                            }:
                            break;

                          case b + 1 - .1 - .1 - .1:
                            break;
                        }
                    }
                }
            }

          case !(delete ("number" / this) >= -5 * 0 % (-3 >> "foo")):
            {
                var brake29 = 5;
                do {
                    try {
                    } finally {
                        {
                            c = 1 + c, ((1 ^ undefined) < -0 >>> 4) >>> ("a" > "number" || 3 * 1);
                            c = 1 + c, "function" <= "a" === (true && "bar"), 38..toString() / undefined === (0 != 38..toString());
                            c = 1 + c, (undefined | "a" | ("undefined" || -1)) < ((undefined ^ -3) >= (3 <= {}));
                            c = 1 + c, -5 * 0 <= -5 * -3 ^ (-2 < -3 | 23..toString() ^ "a");
                        }
                        switch ((c = c + 1) + (b += a)) {
                          default:
                            c = 1 + c, (c = c + 1, [ , 0 ].length === 2 ^ "c") >> (a_1 && (a_1.undefined += this === 24..toString() != (-1 && -2)));
                            c = 1 + c, a_1 && (a_1.var = (a && (a[a++ + b_2] ^= ({} ^ null) == (38..toString() == NaN))) >= (c = c + 1, 
                            "undefined" == [ , 0 ][1]));

                          case a++ + (a_1 && typeof a_1.value == "function" && --_calls_ >= 0 && a_1.value(23..toString(), (c = 1 + c, 
                            "undefined" >= "number" >= (38..toString() === undefined) & (b_2 && (b_2.c = 25 && -5)) * ("object" - 24..toString())))):
                            c = 1 + c, 0 + Infinity >>> ([ , 0 ][1], 3) << ~([ , 0 ].length === 2) * ("number" + {});
                            break;

                          case a++ + a_1:
                            c = 1 + c, (c = c + 1, 25 % "function") * ((Infinity >>>= 0 / false) < (3 !== "c"));
                            break;

                          case -3:
                            c = 1 + c, "number" >>> 4 != (4 && "number") ^ (a && (a[c = 1 + c, ((/[a2][^e]+$/ && -0) & (false, 
                            -3)) / (0 / 0 === ([ , 0 ][1] != "a"))] |= true || {})) <= delete undefined;
                            break;
                        }
                    }
                } while (void b && --brake29 > 0);
            }
            break;
        }
        {
            return {} in {
                Infinity: Infinity,
                null: --b + b--,
                [--b + (foo_2 && typeof foo_2.var == "function" && --_calls_ >= 0 && foo_2.var())]: (c = c + 1) + (a++ + (--b + 3 || 4).toString()[--b + /[a2][^e]+$/] ? b_2 : --b + !((c = c + 1, 
                Infinity === "undefined") > ("foo" / Infinity !== "bar" >>> "object")))
            };
        }
        break;

      case 1 === 1 ? a : b:
        break;

      case -(!(38..toString() === -0) / ((24..toString() ^ "foo") & (22 | 22))):
        break;

      case [ ++b, --b + !function() {
            try {
                {
                    var brake45 = 5;
                    while (a++ + Infinity && --brake45 > 0) {
                        try {
                            L19255: for (var brake47 = 5; (c = 1 + c, (-3 >>> 25 ^ -2 === {}) & 25 > Infinity < (2 != 3)) && brake47 > 0; --brake47) {
                                c = 1 + c, (c = c + 1, [ , 0 ].length === 2) - (c = c + 1, NaN) & -4 === "number" != -2 <= "undefined";
                            }
                        } catch (Infinity_1) {
                            c = 1 + c, 38..toString() * "function" + (1, [ , 0 ][1]) | (foo_2 <<= (23..toString() | [ , 0 ][1]) * (25 ^ -2));
                            c = 1 + c, (5 >= -0 != (-0 ^ -1)) >> (22 >= "object" === (-4, /[a2][^e]+$/));
                        } finally {
                            c = 1 + c, ("a" ^ {}, undefined === "function") !== ("function" >= "undefined") % (undefined > 22);
                            c = 1 + c, (24..toString() & NaN || 0 >> false) / (-22 >= ("a" !== ""));
                        }
                    }
                }
            } finally {
                try {
                    var foo_2_2;
                } finally {
                    c = 1 + c, ((/[a2][^e]+$/ == 0) << (24..toString() == -3)) + (Infinity && (Infinity.b = (-2 < -2) - 3 / 25));
                    c = 1 + c, foo_2_2 %= ("a" < -5 < 38..toString() % true) - ((b_2 && (b_2[c = 1 + c, 
                    (false << [ , 0 ][1] ^ (this && -5)) <= ((b_1 && ({
                        foo: b_1[c = 1 + c, ([ , 0 ].length === 2) / {} / (2, -0) < (23..toString() & "c", 
                        b_2 && (b_2[c = 1 + c, 2 >>> "undefined" & "c" >>> -3, ([] == -2) << (/[a2][^e]+$/ != 25)] = -1 != /[a2][^e]+$/))]
                    } = {
                        foo: 2 == -3
                    })) ^ -0 <= 5)] <<= 5 * true)) >= 23..toString() * "a");
                }
                {
                    var a_1 = function f1(a, foo_2_2, a) {
                    }("", 0);
                }
            }
            {
                {
                    var expr59 = (c = c + 1) + ((c = 1 + c, (24..toString(), 25) * ("a" - -1) >>> (22 * undefined >>> Infinity % "function")) || a || 3).toString();
                    L19256: for (foo_2_2 in expr59) {
                        switch (c = 1 + c, (a && (a.undefined <<= "number" !== 22)) << ({} >> {}) | ("a" == null) >= ("undefined" ^ 24..toString())) {
                          case c = 1 + c, (("function" & /[a2][^e]+$/) <= delete -0) + (-5 === NaN | ([ , 0 ].length === 2) << /[a2][^e]+$/):
                            ;
                            break;

                          case c = 1 + c, (3 > "c" != (a_1 && (a_1.null = this < Infinity))) + (1 !== 1 !== (c = c + 1, 
                            -1)):
                            ;
                            break;

                          case c = 1 + c, ~("undefined" != /[a2][^e]+$/ != -0 <= "foo"):
                            ;
                            break;

                          case c = 1 + c, (b_1 = [ , 0 ][1] + 5 != NaN >> "") != (a && (a[({
                                b_2: b_2
                            } = (c = 1 + c, "a" * NaN - ([ , 0 ][1] >>> 22), (b_2 && (b_2.done += "foo" % 25)) + (23..toString() > 38..toString())) || {})] = (null | -1) === ("function" | "a"))):
                            ;
                            break;
                        }
                    }
                }
                {
                    c = 1 + c, {} <= -3 < (c = c + 1, "object") | (NaN ^ 22 || !2);
                    c = 1 + c, [] === true === (Infinity && (Infinity[c = 1 + c, delete (/[a2][^e]+$/ == 4) === (0 === 2 || (b_1 += {} << -1))] = "foo" * undefined)) ^ (/[a2][^e]+$/ >> "bar") * ("number" ^ null);
                }
                {
                    var expr64 = a_1;
                    for (var key64 in expr64) {
                        {
                            var expr65 = (c = 1 + c, ((/[a2][^e]+$/ ^ 38..toString()) !== (c = c + 1, 1)) >= 25 - Infinity << ({} || "object"));
                            for ([ Infinity ] in expr65) {
                                c = 1 + c, (a && (a[Infinity && typeof Infinity.var == "function" && --_calls_ >= 0 && Infinity.var((c = 1 + c, 
                                Infinity / -2 + (3 ^ 3) < (this >= Infinity > "bar" >> "bar")), -4, [ , 0 ].length === 2)] += ("number" === -1) < (undefined ^ -5))) & ("" == [ , 0 ][1]) <= (-1 ^ "a");
                            }
                        }
                    }
                }
            }
            {
                var expr67 = delete a;
                for (var key67 in expr67) {
                    c = 1 + c;
                    var a_2 = expr67[key67];
                    {
                        return ((1 === 1 ? a : b) || a || 3).toString();
                    }
                }
            }
        }() ][{
            foo: (c = c + 1) + -a,
            null: (a++ || 1).toString()[(c = c + 1) + (1 === 1 ? a : b) ? typeof f3 == "function" && --_calls_ >= 0 && f3("undefined", [], {}) : (Infinity || a || 3).toString()]
        }]:
        typeof f2 == "function" && --_calls_ >= 0 && f2`${([ , 0 ].length === 2) in [ (c = c + 1) + a++, (c = c + 1) + !a, await ((c = 1 + c, 
        (b_2 && (b_2.b = true >>> "") || 4 & NaN) ^ (Infinity && (Infinity[c = 1 + c, a_1 && (a_1[a++ + 24..toString()] = (foo_2 >>>= 22 == 0) ** ("a" ^ -1) >> ((38..toString() & "bar") >> (true >= [])))] += null == [ , 0 ][1])) >> ("foo" != -3)) ? (c = 1 + c, 
        null < "a" !== (foo_2_2 && (foo_2_2.done = [] || 5)) == -5 << this <= (/[a2][^e]+$/ != 5)) : (c = 1 + c, 
        (Infinity - 4) / (3 * -1) ^ (NaN | "undefined", ~"object"))), Infinity ]}
${a++ + (b_2 && b_2[[ (c = 1 + c, Infinity && (Infinity[--b + {
            "": (c = 1 + c, 25 * 25 >>> ("b" !== this) ^ (-0 | true) - (Infinity && (Infinity.var = 24..toString() << "bar"))),
            [(c = 1 + c, (([ , 0 ].length === 2) <= 22) / (undefined >> NaN) + (38..toString() ^ 38..toString() ^ null !== -0))]: (c = 1 + c, 
            (2 >= 22) % (undefined / 24..toString()) >>> (a && (a[c = 1 + c, (c = c + 1, 23..toString()) - (1 + "function") ^ (-5 > "function") * ([] ^ "object")] = 5 | 0)) / (2 + -1))
        }.undefined] |= -2 >> 38..toString() >>> ("undefined" !== [ , 0 ][1])) && (2 <= "c") % (1 >> "a")), (c = 1 + c, 
        (-0 ^ 3) <= {} / 38..toString() ^ ("foo" ^ -5) != Infinity % "undefined") ].var])}
${{}[a--]}`;
        break;
    }
}

var a_1 = f0(typeof f1 == "function" && --_calls_ >= 0 && f1([ (c = c + 1) + a_1, (c = c + 1) + a_1, typeof f2 == "function" && --_calls_ >= 0 && f2(), a_1, void ((undefined < undefined != -2 > 4) >= (1 >= null && 38..toString() << "a")) ][(c = c + 1) + /[abc4]/.test((b++ || b || 5).toString())], 25), /[abc4]/g.exec((a_1 && typeof a_1.b == "function" && --_calls_ >= 0 && a_1.b() || b || 5).toString()), "function");

console.log(null, a, b, c, Infinity, NaN, undefined);
```
```js
// uglified code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;

async function f0(o, a) {
    for (var e = 5; 2 in [ (c += 1) + ("" + ((c += 1) + l-- || l || 3)) ] && 0 < --e; ) {
        var l = (c += 1) + !function() {
            for (var e = 5; (c += 1) + (a = --b + +b) && 0 < --e; ) {
                for (var n = 5; a && a.done && 0 < --n; ) {
                    "function" == typeof a && 0 <= --_calls_ && a();
                }
            }
        }(), n = --b;
    }
    switch (l++ + ("" + (2 + --b || l || 3))) {
      case -l:
        switch ({
            in: --b + (2 === [ , 0 ].length),
            foo: l++ + l
        }[{
            undefined: --b + typeof (!1 | (n += -3) | 0),
            done: l++ + ("function" == typeof f0 && 0 <= --_calls_ && f0(l++ + ("function" == typeof n && 0 <= --_calls_ && n()), !0, "b"))
        }["function" == typeof a && 0 <= --_calls_ && a(/[abc4]/g.exec("" + ({
            foo_2: o,
            undefined: 1,
            3: (c = 1 + (1 + c), o && (o.undefined = 0)),
            "-2": (c = 1 + c, (a && (a.a += 0)) <= NaN || 2),
            length: (c = 1 + c, o && (o[l++ + --b] = !1 < NaN / (2 === [ , 0 ].length === NaN)))
        }.next || b || 5)), 25)]]) {
          case l++ + ("a" in [ 5 + l++, void 0, typeof (--b + ("function" == typeof f0 && 0 <= --_calls_ && f0("a", (c = 1 + c, 
            !1)))), --b + l, l++ + (--b + "23"), (c += 1) + l, (c += 1) + /[abc4]/g.exec("" + (b++ || b || 5)), (c += 1) + "c", typeof undefined_2 ]):
          case --b + ((c += 1) + ("string" == typeof l)):
            switch (n) {
              case --b + {}.done:
              case (c += 1) + (b = l):
              case "function" != typeof b:
              case "symbol" == typeof foo:
            }
            break;

          default:
            var f = [ (c += 1) + (0 in [ void (c += 1) ]), [ --b, (c += 1) + l++, l++ + [ !1, (c = 1 + (1 + c), 
            (l /= 0) != ((1 ^ i) != (l && (l.c >>= !0)))), (c = 1 + c, o && (o[l++ - (o && ({
                null: o.value
            } = {
                null: !1 ^ (void 0 ^ i) < 1
            }))] <<= 1)), (c = 1 + c, n && (n.NaN = (l += NaN) || a && (a.done = 1 == (a && (a.b = NaN))))) ][c = 1 + c, 
            o && (o[(c += 1) + b] += !1) && !1] ][[ (o &= 23) > (this || "number") < !1, !0, i >> -1 === !0, (c = 1 + (1 + ((c = 1 + (1 + c)) + 1)), 
            +(2 === [ , 0 ].length & -4) << NaN) ]], {
                "": ~(1 != ((a ^= 1) && "bar5"))
            }.null, --b - l, (c += 1, NaN ^ (o && (o.var |= !1)) || !1) ];
            for (const v of f) {
                c = 1 + c;
                var i = f[v];
                c += 1, b--;
            }
            switch (l++ + (!1 in [ l++ + [ , (c = 1 + c, i && (i.in = !1)) ], +void (c = 1 + c), l++, l++ + b--, (c += 1) + {
                "\t": (c = 1 + c, (n && (n.next = (2 === [ , 0 ].length === 0) >>> !1)) & (a && (a[l && "function" == typeof l.a && 0 <= --_calls_ && l.a(2 === [ , 0 ].length, (c = 1 + c, 
                0))] <<= (2 === [ , 0 ].length === -2) <= -36))),
                done: !1 - ("function" | 2 === [ , 0 ].length) < 0,
                foo: (c = 1 + ((c = 1 + c) + 1), c += 1, n && (n[c = 1 + c, a && (a[(c += 1) + void 0] = 0 === (n && (n.c = !0)))] = 1), 
                !0)
            }[/[abc4]/g.exec((c = 1 + c, "" + ((l && (l[2 + --b] += !0 % i != (i <<= !1))) ^ 0 >>> (i && (i[c = 1 + c, 
            !0] += -5)) || b || 5)))] ])) {
              case {
                    null: n && n.undefined,
                    ...o,
                    b: b--,
                    get var() {
                        return c = 1 + c, [] <= 25 * (2 === [ , 0 ].length) == 0;
                    },
                    NaN: l++ + ("" + (/[abc4]/g.exec((c = 1 + c, "" + (!0 === (a && (a.b %= 0)) || b || 5))) || l || 3))
                }.done:
                switch ({}["function" == typeof f2 && 0 <= --_calls_ && f2(-2, (c = 1 + (1 + c), 
                !0 ^ (c += 1, -1)))]) {
                  default:
                  case l++ + i:
                    for (var s, t = 5; c = 1 + c, (a /= ((2 === [ , 0 ].length ^ 2 === [ , 0 ].length) <= NaN) % (0 == (1 | 2 === [ , 0 ].length))) && 0 < --t; ) {
                        c = 1 + c, c += a = 1;
                    }
                    break;

                  case s && s.Infinity:
                    break;

                  case (c += 1) + -4:
                    for (var r in c = 1 + c, !1) {
                        i = (!1)[r], c = 1 + (1 + c);
                    }
                }

              default:
              case /[abc4]/g.exec("" + (l++ + ("function" == typeof l && 0 <= --_calls_ && l("a", l++ + (n && "function" == typeof n.var && 0 <= --_calls_ && n.var("bar", (c = 1 + c, 
                !1 ^ (!0 | 4 * (2 === [ , 0 ].length))), !1)), l && "function" == typeof l.b && 0 <= --_calls_ && l.b(0))) || b || 5)):
                break;

              case "function" == typeof f2 && 0 <= --_calls_ && f2((c += 1) + [ (c = 1 + c, void (c += 1)), (c = 1 + c, 
                i && (i[void 0] = 0) || !0), (c = 1 + c, +((-0 == (2 === [ , 0 ].length)) - ("c" === i))) ]):
                if (--b + ("function" == typeof f0 && 0 <= --_calls_ && f0("object"))) {
                    return;
                }
                var u, _ = ~(l /= (c += 1, -1));
                for (u in _) {
                    c = 1 + c;
                    var d = _[u];
                    switch (l++ + typeof arguments_2) {
                      default:
                        c = 1 + c, c += 1, l && (l[c = 1 + c, i = (l && (l[l++ + [ (c = 1 + c, (!0 ^ "bar" >> i) > (d && (d.value = (c += 1, 
                        22)))), !0 <= (l %= !0) % (-4 << "24"), (c = 1 + (1 + c), !1) ].foo] += !0)) - 3] >>>= -5 < (2 === [ , 0 ].length));

                      case l++ + l:
                        c = 1 + c;
                        break;

                      case 5 in {
                            "-2": (c = 1 + c, !1 * (n && (n[c = 1 + c, 1] = null == this)) - 3),
                            b: (c = 1 + c, !1 < ((a && (a.c -= 2 === [ , 0 ].length != i)) < -3)),
                            a: l,
                            done: 0,
                            done: (c = 1 + (1 + c), l && (l.b -= (!1 >> i - -2) - (l && (l[c = 1 + c, 0 < (a && (a[c = 1 + c, 
                            0] >>= null === i)) == !0 / (0 != i)] |= !1)) % (this / "bar")))
                        }:
                      case b + 1 - .3:
                    }
                }
            }

          case !1:
            switch (c = 1 + (1 + (1 + (1 + c))), (c += 1) + (b += l)) {
              default:
                c = 1 + c, c += 1, n && (n.undefined += "24" === this != -2), c = 1 + c, n && (n.var = (l && (l[l++ + s] ^= !0)) >= (c += 1, 
                !1));

              case l++ + (n && "function" == typeof n.value && 0 <= --_calls_ && n.value("23", (c = 1 + c, 
                !0 & NaN * (s && (s.c = -5))))):
                c = 1 + c;
                break;

              case l++ + n:
                c = 1 + c, c += 1, i >>>= NaN;
                break;

              case -3:
                c = 1 + c, l && (l[c = 1 + c, NaN] |= !0), delete undefined;
            }
        }
        return {} in {
            Infinity: i,
            null: --b + b--,
            [--b + (o && "function" == typeof o.var && 0 <= --_calls_ && o.var())]: (c += 1) + (l++ + ("" + (3 + --b || 4))[--b + /[a2][^e]+$/] ? s : --b + (c += 1, 
            !(("foo" / i != 0) < ("undefined" === i))))
        };

      case l:
      case -.0625:
        break;

      case [ ++b, --b + !function() {
            try {
                for (var e = 5; l++ + i && 0 < --e; ) {
                    try {
                        for (var n = 5; c = 1 + c, 127 & i < 25 < !0 && 0 < n; --n) {
                            c = 1 + c, c += 1, c += 1;
                        }
                    } catch (e) {
                        o <<= -575, c = 1 + (c = 1 + c);
                    } finally {
                        c = 1 + (c = 1 + c);
                    }
                }
            } finally {
                c = 1 + c, i && (i.b = -.12), c = 1 + c, a %= !1 - (NaN <= (s && (s[c = 1 + c, (0 ^ (this && -5)) <= (!0 ^ (d && ({
                    foo: d[c = 1 + c, (2 === [ , 0 ].length) / {} / -0 < (s && (s[c = 1 + c, 0] = !0))]
                } = {
                    foo: !1
                })))] <<= 5))), a = void 0;
            }
            for (var a in (c += 1) + (c = 1 + c, "" + (NaN >>> (NaN >>> i % "function") || l || 3))) {
                switch (c = 1 + c, (l && (l.undefined <<= !0)) << 0 | !1) {
                  case c = 1 + c, !0 + (!1 | (2 === [ , 0 ].length) << /[a2][^e]+$/):
                  case c = 1 + c, !0 + (!1 !== (c += 1, -1)):
                  case c = 1 + c, -2:
                  case c = 1 + c, (d = !0) != (l && (l[({
                        b_2: s
                    } = (c = 1 + c, (s && (s.done += NaN)) + !1 || {}))] = !1)):
                }
            }
            for (var f in c = 1 + ((c = 1 + c) + 1), i && (i[c = 1 + c, !0 === (d += 0)] = NaN), 
            a) {
                for ([ i ] in c = 1 + c, (38 != (c += 1, 1)) >= 25 - i << {}) {
                    c = 1 + c, l && (l[i && "function" == typeof i.var && 0 <= --_calls_ && i.var((c = 1 + c, 
                    i / -2 + 0 < (0 < (i <= this))), -4, 2 === [ , 0 ].length)] += !1);
                }
            }
            for (var t in delete l) {
                return c = 1 + c, "" + (l || l || 3);
            }
        }() ][{
            foo: (c += 1) + -l,
            null: ("" + (l++ || 1))[(c += 1) + l ? "function" == typeof f3 && 0 <= --_calls_ && f3("undefined", [], {}) : "" + (i || l || 3)]
        }]:
        "function" == typeof f2 && 0 <= --_calls_ && f2`${(2 === [ , 0 ].length) in [ (c += 1) + l++, (c += 1) + !l, (c = 1 + c, 
        await ((s ? s.b = 1 : 0) ^ (i && (i[c = 1 + c, n && (n[l++ + "24"] = (o >>>= !1) ** -1 >> 0)] += !1)) >> !0 ? (c = 1 + c, 
        !1 !== (a && (a.done = [])) == -5 << this <= !0) : (c = 1 + c, (i - 4) / -3 ^ -1))), i ]}
${l++ + (s && s[[ (c = 1 + c, i && (i[--b + {
            "": (c = 1 + c, 625 >>> ("b" !== this) ^ 1 - (i && (i.var = 24))),
            [(c = 1 + c, ((2 === [ , 0 ].length) <= 22) / 0 + 1)]: (c = 1 + c, NaN >>> +(l && (l[c = 1 + c, 
            0 ^ (c += 1, NaN)] = 5)))
        }.undefined] |= -1 >>> !0) && 0), (c = 1 + c, !1 ^ -5 != i % "undefined") ].var])}
${{}[l--]}`;
    }
}

var a_1 = f0("function" == typeof f1 && 0 <= --_calls_ && f1([ (c += 1) + a_1, (c += 1) + a_1, "function" == typeof f2 && 0 <= --_calls_ && f2(), a_1, void 0 ][(c += 1) + /[abc4]/.test("" + (b++ || b || 5))], 25), /[abc4]/g.exec("" + (a_1 && "function" == typeof a_1.b && 0 <= --_calls_ && a_1.b() || b || 5)), "function");

console.log(null, a, b, c, 1 / 0, NaN, void 0);
```
```
original result:
null 100 9 23 Infinity NaN undefined

uglified result:
null 100 9 25 Infinity NaN undefined
```
```js
// reduced test case (output will differ)

// (beautified)
var a = 0;

async function f0() {
    try {
        a++;
    } finally {
        try {
            var foo_2_2;
        } finally {
            console.log(foo_2_2);
        }
        var a_1 = function f1() {}();
    }
    var expr59 = 0..toString();
    for (foo_2_2 in expr59) {
        a_1 && (a_1.null = 0);
    }
    var expr64 = a_1;
    for (var key64 in expr64) {
        console.log();
    }
}

f0();
// (stringified)
// output: "undefined\n"
// minify: "undefined\n\n"
// options: {
//   "compress": {
//     "passes": 1000000,
//     "sequences": 1000000,
//     "unsafe": true,
//     "unsafe_Function": true,
//     "unsafe_math": true,
//     "unsafe_proto": true,
//     "unsafe_regexp": true
//   },
//   "mangle": {
//     "v8": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
```
```
minify(options):
{
  "compress": {
    "passes": 1000000,
    "sequences": 1000000,
    "unsafe": true,
    "unsafe_Function": true,
    "unsafe_math": true,
    "unsafe_proto": true,
    "unsafe_regexp": true
  },
  "mangle": {
    "v8": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  collapse_vars
  evaluate
  merge_vars
  passes
  reduce_vars
  unused

Suspicious options:
  rename
```


Discussion:

Patch:
diff --git a/lib/compress.js b/lib/compress.js
index 1d8c71c7ce6..c822a8e714f 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -5276,8 +5276,13 @@ merge(Compressor.prototype, {
                 return true;
             }
             if (node instanceof AST_VarDef) {
-                if (node.value) node.value.walk(tw);
-                node.name.mark_symbol(node.value ? function(node) {
+                var assigned = node.value;
+                if (assigned) {
+                    assigned.walk(tw);
+                } else {
+                    assigned = segment.block instanceof AST_ForEnumeration && segment.block.init === tw.parent();
+                }
+                node.name.mark_symbol(assigned ? function(node) {
                     if (!(node instanceof AST_SymbolDeclaration)) return;
                     if (node instanceof AST_SymbolVar) {
                         mark(node);


Test patch:
diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js
index 1212be9394e..02d17d3108b 100644
--- a/test/compress/merge_vars.js
+++ b/test/compress/merge_vars.js
@@ -3183,3 +3183,32 @@ issue_4257: {
         "1",
     ]
 }
+
+issue_4628: {
+    options = {
+        merge_vars: true,
+    }
+    input: {
+        (function() {
+            try {
+                console;
+            } finally {
+                var b = a;
+            }
+            for (var a in "foo");
+            console.log(b);
+        })();
+    }
+    expect: {
+        (function() {
+            try {
+                console;
+            } finally {
+                var b = a;
+            }
+            for (var a in "foo");
+            console.log(b);
+        })();
+    }
+    expect_stdout: "undefined"
+}