#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  device int2* prevent_dce;
};

int2 quadSwapX_b1a5fe() {
  int2 res = quad_shuffle_xor(int2(1), 1u);
  return res;
}

fragment void fragment_main(device int2* 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) = quadSwapX_b1a5fe();
}

kernel void compute_main(device int2* 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) = quadSwapX_b1a5fe();
}
