#include "median.h"
// generated from ../res/m.swap.9_151205/run.00620.chr
#if MED_SIZE != 9
#error "Size is not 9"
#endif
 
med_type median(med_type* din) {
  med_type s9 = min(din[2], din[5]);
  med_type s10 = min(din[1], din[7]);
  med_type s11 = max(din[7], din[1]);
  med_type s12 = max(din[2], din[5]);
  med_type s13 = max(din[3], din[4]);
  med_type s16 = min(din[4], din[3]);
  med_type s18 = min(din[0], s11);
  med_type s20 = min(din[6], s12);
  med_type s23 = min(s13, din[8]);
  med_type s28 = max(s10, s18);
  med_type s31 = max(s20, s9);
  med_type s39 = min(s31, s28);
  med_type s41 = max(s39, s16);
  med_type s42 = max(s41, s23);
  med_type s44 = max(s28, s31);
  med_type s45 = min(s44, s42);
  return s45;
}