#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  device packed_float3* prevent_dce;
};

float3 subgroupShuffleDown_5d8b9f() {
  float3 arg_0 = float3(1.0f);
  uint arg_1 = 1u;
  float3 res = simd_shuffle_down(arg_0, arg_1);
  return res;
}

fragment void fragment_main(device packed_float3* prevent_dce [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
  (*tint_module_vars.prevent_dce) = packed_float3(subgroupShuffleDown_5d8b9f());
}

kernel void compute_main(device packed_float3* prevent_dce [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
  (*tint_module_vars.prevent_dce) = packed_float3(subgroupShuffleDown_5d8b9f());
}
