+ 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);
+ }
+
+ sn_network_stage_add (n, s);
+ }
+
+ return (n);
+} /* }}} sn_network_t *sn_network_concatenate */
+
+static int sn_network_add_bitonic_merger_recursive (sn_network_t *n, /* {{{ */