#include <metal_stdlib>

using namespace metal;
uint2 textureDimensions_41545f(texture2d_array<uint, access::write> tint_symbol) {
  uint2 res = uint2(tint_symbol.get_width(), tint_symbol.get_height());
  return res;
}

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

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

