#include <metal_stdlib>

using namespace metal;
int4 textureLoad_424afd(texture2d_array<int, access::read_write> tint_symbol) {
  int4 res = tint_symbol.read(uint2(int2(1)), 1);
  return res;
}

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

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

