#include <metal_stdlib>
using namespace metal;
struct tint_module_vars_struct {
  device float* s;
};
template<typename T, size_t N>
struct tint_array {
  const constant T& operator[](size_t i) const constant { return elements[i]; }
  device T& operator[](size_t i) device { return elements[i]; }
  const device T& operator[](size_t i) const device { return elements[i]; }
  thread T& operator[](size_t i) thread { return elements[i]; }
  const thread T& operator[](size_t i) const thread { return elements[i]; }
  threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
  const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
  T elements[N];
};


fragment void tint_symbol(device float* s [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.s=s};
  tint_array<float, 4> signed_literal = {};
  tint_array<float, 4> unsigned_literal = {};
  tint_array<float, 4> signed_constant = {};
  tint_array<float, 4> unsigned_constant = {};
  tint_array<float, 4> shr_const_expr = {};
  unsigned_literal = signed_literal;
  signed_constant = signed_literal;
  unsigned_constant = signed_literal;
  shr_const_expr = signed_literal;
  (*tint_module_vars.s) = ((((signed_literal[0] + unsigned_literal[0]) + signed_constant[0]) + unsigned_constant[0]) + shr_const_expr[0]);
}
