#include "registers.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
void dupl(int r) {
for (int i = 0; i < 30; i++) {
append_left(67, r, 1);
append_or(r, r, 67);
}
}
void construct_instructions(int s, int n, int k, int q) {
if (k == 1) {
append_right(67, 0, 1);
append_and(0, 0, 67);
return;
}
vector<bool> bits(2000);
bits[0] = 1;
append_store(99, bits);
bits[1] = 1;
append_store(98, bits);
append_right(1, 0, 1); // x1 y0 y1 ...
append_right(2, 1, 1); // y0 y1 ...
append_right(3, 2, 1); // y1 ...
append_and (0, 0, 98); // x0 x1 ...
append_and(1, 1, 99);
append_not (4, 0); // ~x0 ~x1
append_not (5, 1); // ~x1
append_and (6, 3, 5); // x1 < y1
append_xor (7, 3, 5); // x1 = y1
append_and (8, 2, 4); // x0 < y0
append_and (9, 7, 8); // (x1 = y1) & (x0 < y0)
append_or (10, 6, 9); // x < y
append_and (10, 10, 99);
dupl(10); // dup r[10][0] everywhere
append_not (11, 10); // x ≥ y
dupl(11);
append_and (12, 0, 10);
append_and(13, 2, 11);
append_add(0, 12, 13);
}
//int main() {
//}