// File: kernel.cpp
#include "loop_105.h"
#include <stdint.h>
#include <arm_sve.h>
#define restrict __restrict
#define SC_SVE_ATTR
#define FOR_COND(P, S, I, N) svptest_first(svptrue_b##S(), P = svwhilelt_b##S(I, N))
#define FOR_LOOP(T, I, M, N, P, S, W) for (T I = M; FOR_COND(P, S, I, N); I += svcnt##W())
#define FOR_LOOP_8(T, I, M, N, P)  FOR_LOOP(T, I, M, N, P, 8, b)
#define FOR_LOOP_16(T, I, M, N, P) FOR_LOOP(T, I, M, N, P, 16, h)
#define FOR_LOOP_32(T, I, M, N, P) FOR_LOOP(T, I, M, N, P, 32, w)
#define FOR_LOOP_64(T, I, M, N, P) FOR_LOOP(T, I, M, N, P, 64, d)
static inline uint32_t get_sve_vl(void) {
  uint64_t vl = 0; asm volatile("incb %[vl], all, mul #8" : [vl] "+r"(vl) : :);
  return (uint32_t)vl;
}
static inline uint32_t get_vl(void) { return get_sve_vl(); }

defined(__ARM_FEATURE_SVE2) || defined(__ARM_FEATURE_SME) || defined(__ARM_FEATURE_SVE) || defined(__ARM_NEON)
float cascade_summation_16(float * a)

{
  float t0 = a[0] + a[1];
  float t1 = a[2] + a[3];
  float t2 = a[4] + a[5];
  float t3 = a[6] + a[7];
  float t4 = a[8] + a[9];
  float t5 = a[10] + a[11];
  float t6 = a[12] + a[13];
  float t7 = a[14] + a[15];
  float t10 = t0 + t1;
  float t11 = t2 + t3;
  float t12 = t4 + t5;
  float t13 = t6 + t7;
  float t100 = t10 + t11;
  float t101 = t12 + t13;
  return t100 + t101;
}