#include <iostream>
#include <ostream>
#include <sstream>
#include <string>
using namespace std;
int level = 0;
void print_indent()
{
cout << string(level*4,' ');
}
class Integer
{
string name;
public:
Integer()
{
static int counter = 0;
stringstream ss;
ss << "var" << (++counter);
name = ss.str();
print_indent();
cout << "int " << name << "=0;" << endl;
}
Integer &operator++()
{
print_indent();
cout << "++" << name << ";" << endl;
return *this;
}
Integer &operator=(const Integer &rhs)
{
print_indent();
cout << name << "=" << rhs.name << ";" << endl;
return *this;
}
};
class Block
{
bool done;
public:
Block()
: done(false)
{
print_indent();
cout << "{" << endl;
++level;
}
bool next()
{
return !done;
}
void after()
{
--level;
print_indent();
cout << "}" << endl;
done = true;
}
};
#define BLOCK for(Block b##__LINE__;b##__LINE__.next();b##__LINE__.after())
int main()
{
BLOCK {
Integer a,b;
a=b;
++a;
Integer c;
BLOCK
a=b=c;
++b;
BLOCK {
b=++a;
c=++a;
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8b3N0cmVhbT4KI2luY2x1ZGUgPHNzdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGxldmVsID0gMDsKdm9pZCBwcmludF9pbmRlbnQoKQp7CiAgICBjb3V0IDw8IHN0cmluZyhsZXZlbCo0LCcgJyk7Cn0KCmNsYXNzIEludGVnZXIKewogICAgc3RyaW5nIG5hbWU7CnB1YmxpYzoKICAgIEludGVnZXIoKQogICAgewogICAgICAgIHN0YXRpYyBpbnQgY291bnRlciA9IDA7CiAgICAgICAgc3RyaW5nc3RyZWFtIHNzOwogICAgICAgIHNzIDw8ICJ2YXIiIDw8ICgrK2NvdW50ZXIpOwogICAgICAgIG5hbWUgPSBzcy5zdHIoKTsKICAgICAgICBwcmludF9pbmRlbnQoKTsKICAgICAgICBjb3V0IDw8ICJpbnQgIiA8PCBuYW1lIDw8ICI9MDsiIDw8IGVuZGw7CiAgICB9CiAgICBJbnRlZ2VyICZvcGVyYXRvcisrKCkKICAgIHsKICAgICAgICBwcmludF9pbmRlbnQoKTsKICAgICAgICBjb3V0IDw8ICIrKyIgPDwgbmFtZSA8PCAiOyIgPDwgZW5kbDsKICAgICAgICByZXR1cm4gKnRoaXM7CiAgICB9CiAgICBJbnRlZ2VyICZvcGVyYXRvcj0oY29uc3QgSW50ZWdlciAmcmhzKQogICAgewogICAgICAgIHByaW50X2luZGVudCgpOwogICAgICAgIGNvdXQgPDwgbmFtZSA8PCAiPSIgPDwgcmhzLm5hbWUgPDwgIjsiIDw8IGVuZGw7CiAgICAgICAgcmV0dXJuICp0aGlzOwogICAgfQp9OwpjbGFzcyBCbG9jawp7CiAgICBib29sIGRvbmU7CnB1YmxpYzoKICAgIEJsb2NrKCkKICAgICAgICA6IGRvbmUoZmFsc2UpCiAgICB7CiAgICAgICAgcHJpbnRfaW5kZW50KCk7CiAgICAgICAgY291dCA8PCAieyIgPDwgZW5kbDsKICAgICAgICArK2xldmVsOwogICAgfQogICAgYm9vbCBuZXh0KCkKICAgIHsKICAgICAgICByZXR1cm4gIWRvbmU7CiAgICB9CiAgICB2b2lkIGFmdGVyKCkKICAgIHsKICAgICAgICAtLWxldmVsOwogICAgICAgIHByaW50X2luZGVudCgpOwogICAgICAgIGNvdXQgPDwgIn0iIDw8IGVuZGw7CiAgICAgICAgZG9uZSA9IHRydWU7CiAgICB9Cn07CgojZGVmaW5lIEJMT0NLIGZvcihCbG9jayBiIyNfX0xJTkVfXztiIyNfX0xJTkVfXy5uZXh0KCk7YiMjX19MSU5FX18uYWZ0ZXIoKSkKCmludCBtYWluKCkKewogICAgQkxPQ0sgewogICAgICAgIEludGVnZXIgYSxiOwogICAgICAgIGE9YjsKICAgICAgICArK2E7CiAgICAgICAgSW50ZWdlciBjOwogICAgICAgIEJMT0NLCiAgICAgICAgICAgIGE9Yj1jOwogICAgICAgICsrYjsKICAgICAgICBCTE9DSyB7CiAgICAgICAgICAgIGI9KythOwogICAgICAgICAgICBjPSsrYTsKICAgICAgICB9CiAgICB9Cn0=