#include <metal_stdlib>

using namespace metal;
void textureStore_7f7fae(texture1d<float, access::write> tint_symbol) {
  int arg_1 = 1;
  float4 arg_2 = float4(1.0f);
  tint_symbol.write(arg_2, uint(arg_1));
}

fragment void fragment_main(texture1d<float, access::write> tint_symbol_1 [[texture(0)]]) {
  textureStore_7f7fae(tint_symbol_1);
  return;
}

kernel void compute_main(texture1d<float, access::write> tint_symbol_2 [[texture(0)]]) {
  textureStore_7f7fae(tint_symbol_2);
  return;
}

