#include <metal_stdlib>

using namespace metal;
int4 textureLoad_cac876(texture1d<int, access::read_write> tint_symbol) {
  uint arg_1 = 1u;
  int4 res = tint_symbol.read(uint(arg_1));
  return res;
}

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

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

