#include <metal_stdlib>

using namespace metal;
float4 textureLoad_aae9c3(texture2d_array<float, access::read_write> tint_symbol) {
  int2 arg_1 = int2(1);
  uint arg_2 = 1u;
  float4 res = tint_symbol.read(uint2(arg_1), arg_2);
  return res;
}

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

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

