Huge nested loop in Arduino
All those variables a, b, etc. are just the individual bits of a
13-bit number. When you loop through all combinations, you are actually
looping through all the possible numeric values of a 13-bit number.
This can be simplified as this (warning: not tested):

void setup() {
    pinMode(2, OUTPUT);
}

// the bitstream is: 0.101x xxxx.xxxx xxxx.0101
void pulsetrain(uint16_t code) {
    uint32_t bitstream = (((uint32_t) code) &lt;&lt; 4) | 0x0a0005UL;
    for (uint8_t i = 0; i &lt; 21; i++) {
        PIND = _BV(PD2);    // toggle pin
        if (bitstream &amp; 0x100000)
            delayMicroseconds(566);
        else
            delayMicroseconds(283);
        bitstream &lt;&lt;= 1;
    }
    PORTD &amp;= ~_BV(PD2); // last LOW
}

void loop() {
    for (uint16_t code = 0; code &lt; 0x2000; code++) {
        pulsetrain(code);
    }
}