#include <metal_stdlib>

using namespace metal;
void textureStore_5ec6b2(texture3d<float, access::read_write> tint_symbol) {
  uint3 arg_1 = uint3(1u);
  float4 arg_2 = float4(1.0f);
  tint_symbol.write(arg_2, uint3(arg_1)); tint_symbol.fence();
}

fragment void fragment_main(texture3d<float, access::read_write> tint_symbol_1 [[texture(0)]]) {
  textureStore_5ec6b2(tint_symbol_1);
  return;
}

kernel void compute_main(texture3d<float, access::read_write> tint_symbol_2 [[texture(0)]]) {
  textureStore_5ec6b2(tint_symbol_2);
  return;
}

