#include <metal_stdlib>

using namespace metal;
uint4 textureLoad_87f0a6(texture2d_array<uint, access::read_write> tint_symbol) {
  int2 arg_1 = int2(1);
  int arg_2 = 1;
  uint4 res = tint_symbol.read(uint2(arg_1), arg_2);
  return res;
}

fragment void fragment_main(device uint4* tint_symbol_1 [[buffer(0)]], texture2d_array<uint, access::read_write> tint_symbol_2 [[texture(0)]]) {
  *(tint_symbol_1) = textureLoad_87f0a6(tint_symbol_2);
  return;
}

kernel void compute_main(device uint4* tint_symbol_3 [[buffer(0)]], texture2d_array<uint, access::read_write> tint_symbol_4 [[texture(0)]]) {
  *(tint_symbol_3) = textureLoad_87f0a6(tint_symbol_4);
  return;
}

