+} /* }}} int sn_network_cut_at */
+
+/* sn_network_concatenate
+ *
+ * `Glues' two networks together, resulting in a comparator network with twice
+ * as many inputs but one that doesn't really sort anymore. It produces a
+ * bitonic sequence, though, that can be used by the mergers below. */
+static sn_network_t *sn_network_concatenate (sn_network_t *n0, /* {{{ */
+ sn_network_t *n1)
+{
+ sn_network_t *n;
+ int stages_num;
+ int i;
+ int j;
+
+ stages_num = (n0->stages_num > n1->stages_num)
+ ? n0->stages_num
+ : n1->stages_num;
+
+ n = sn_network_create (n0->inputs_num + n1->inputs_num);
+ if (n == NULL)
+ return (NULL);
+
+ for (i = 0; i < stages_num; i++)
+ {
+ sn_stage_t *s = sn_stage_create (i);
+
+ if (i < n0->stages_num)
+ for (j = 0; j < SN_STAGE_COMP_NUM (n0->stages[i]); j++)
+ {
+ sn_comparator_t *c = SN_STAGE_COMP_GET (n0->stages[i], j);
+ sn_stage_comparator_add (s, c);
+ }
+
+ if (i < n1->stages_num)
+ for (j = 0; j < SN_STAGE_COMP_NUM (n1->stages[i]); j++)
+ {
+ sn_comparator_t *c_orig = SN_STAGE_COMP_GET (n1->stages[i], j);
+ sn_comparator_t c_copy;
+
+ SN_COMP_MIN(&c_copy) = SN_COMP_MIN(c_orig) + n0->inputs_num;
+ SN_COMP_MAX(&c_copy) = SN_COMP_MAX(c_orig) + n0->inputs_num;
+
+ sn_stage_comparator_add (s, &c_copy);
+ }