interleavePainter = reverse => args => {
    if (args.positionInCircuit !== undefined) {
        GatePainting.PERMUTATION_DRAWER(args);
        return;
    }

    GatePainting.paintBackground(args);
    GatePainting.paintOutline(args);
    GatePainting.paintResizeTab(args);

    let x1 = args.rect.x + 6;
    let x2 = args.rect.right() - 6;
    let y = args.rect.center().y - Config.GATE_RADIUS + 6;
    let dh = ((Config.GATE_RADIUS - 6)*2 - 14) / 5;

    for (let i = 0; i < 6; i++) {
        let j = interleaveBit(i, 6);
        let yi = y + i*dh + Math.floor(i/3)*14;
        let yj = y + j*dh + Math.floor(j/2)*7;
        let [y1, y2] = reverse ? [yj, yi] : [yi, yj];
        args.painter.strokePath([
            new Point(x1, y1),
            new Point(x1 + 8, y1),
            new Point(x2 - 8, y2),
            new Point(x2, y2)
        ]);
    }
}
@type {!Map.<!int, !{withArgs: !function(args: ...!WglArg|!WglTexture) : !WglConfiguredShader}>}