#include <metal_stdlib>

using namespace metal;
void textureStore_90a553(texture2d_array<int, access::read_write> tint_symbol) {
  tint_symbol.write(int4(1), uint2(int2(1)), 1u); tint_symbol.fence();
}

fragment void fragment_main(texture2d_array<int, access::read_write> tint_symbol_1 [[texture(0)]]) {
  textureStore_90a553(tint_symbol_1);
  return;
}

kernel void compute_main(texture2d_array<int, access::read_write> tint_symbol_2 [[texture(0)]]) {
  textureStore_90a553(tint_symbol_2);
  return;
}

