#include <stdio.h>
void foo(int i)
{
static const void *sw[] = { &&lab_0, &&lab_1, &&lab_2 };
if (i < 0 || i >= sizeof(sw)/sizeof(*sw)) {
return;
}
goto *sw[i];
lab_0:
return;
lab_1:
return;
lab_2:
return;
}
int main(void) {
for (int i = -1; i < 4; ++i)
foo(i);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGZvbyhpbnQgaSkKewogICAgc3RhdGljIGNvbnN0IHZvaWQgKnN3W10gPSB7ICYmbGFiXzAsICYmbGFiXzEsICYmbGFiXzIgfTsKICAgIAogICAgaWYgKGkgPCAwIHx8IGkgPj0gc2l6ZW9mKHN3KS9zaXplb2YoKnN3KSkgewogICAgICAgIHByaW50Zigib3V0IG9mIHJhbmdlXG4iKTsKICAgICAgICByZXR1cm47CiAgICB9CiAgICAKICAgIGdvdG8gKnN3W2ldOwoKbGFiXzA6CiAgICBwcmludGYoImxhYl8wXG4iKTsKICAgIHJldHVybjsKICAgIApsYWJfMToKICAgIHByaW50ZigibGFiXzFcbiIpOwogICAgcmV0dXJuOwoKbGFiXzI6CiAgICBwcmludGYoImxhYl8yXG4iKTsKICAgIHJldHVybjsKCn0KCmludCBtYWluKHZvaWQpIHsKCWZvciAoaW50IGkgPSAtMTsgaSA8IDQ7ICsraSkKCSAgICBmb28oaSk7CglyZXR1cm4gMDsKfQo=