#include <metal_stdlib>

using namespace metal;
uint subgroupShuffleDown_d90c2f() {
  uint arg_0 = 1u;
  uint arg_1 = 1u;
  uint res = simd_shuffle_down(arg_0,arg_1);
  return res;
}

fragment void fragment_main(device uint* tint_symbol [[buffer(0)]]) {
  *(tint_symbol) = subgroupShuffleDown_d90c2f();
  return;
}

kernel void compute_main(device uint* tint_symbol_1 [[buffer(0)]]) {
  *(tint_symbol_1) = subgroupShuffleDown_d90c2f();
  return;
}

