#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  texture2d_array<float, access::read_write> arg_0;
};

void textureStore_1af236(tint_module_vars_struct tint_module_vars) {
  int2 arg_1 = int2(1);
  int arg_2 = 1;
  float4 arg_3 = float4(1.0f);
  int const v = arg_2;
  float4 const v_1 = arg_3;
  tint_module_vars.arg_0.write(v_1, uint2(arg_1), v);
  const_cast<texture2d_array<float, access::read_write>thread &>(tint_module_vars.arg_0).fence();
}

fragment void fragment_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0};
  textureStore_1af236(tint_module_vars);
}

kernel void compute_main(texture2d_array<float, access::read_write> arg_0 [[texture(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0};
  textureStore_1af236(tint_module_vars);
}
