#include <metal_stdlib>

using namespace metal;
uint textureDimensions_ea25bc(texture1d<uint, access::write> tint_symbol) {
  uint res = tint_symbol.get_width(0);
  return res;
}

fragment void fragment_main(device uint* tint_symbol_1 [[buffer(0)]], texture1d<uint, access::write> tint_symbol_2 [[texture(0)]]) {
  *(tint_symbol_1) = textureDimensions_ea25bc(tint_symbol_2);
  return;
}

kernel void compute_main(device uint* tint_symbol_3 [[buffer(0)]], texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
  *(tint_symbol_3) = textureDimensions_ea25bc(tint_symbol_4);
  return;
}

