#include <metal_stdlib>

using namespace metal;
float4 textureLoad_91ede5(texture3d<float, access::read_write> tint_symbol) {
  uint3 arg_1 = uint3(1u);
  float4 res = tint_symbol.read(uint3(arg_1));
  return res;
}

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

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

