#include <metal_stdlib>

using namespace metal;
uint4 textureLoad_25b67f(texture2d<uint, access::read_write> tint_symbol) {
  uint2 arg_1 = uint2(1u);
  uint4 res = tint_symbol.read(uint2(arg_1));
  return res;
}

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

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

