#include <metal_stdlib>

using namespace metal;
float3 subgroupShuffleDown_5d8b9f() {
  float3 res = simd_shuffle_down(float3(1.0f),1u);
  return res;
}

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

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

