#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  device int4* prevent_dce;
  texture2d_array<int, access::read_write> arg_0;
};

int4 textureLoad_32a7b8(tint_module_vars_struct tint_module_vars) {
  uint2 arg_1 = uint2(1u);
  int arg_2 = 1;
  int4 res = tint_module_vars.arg_0.read(arg_1, arg_2);
  return res;
}

fragment void fragment_main(device int4* prevent_dce [[buffer(0)]], texture2d_array<int, access::read_write> arg_0 [[texture(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_0=arg_0};
  (*tint_module_vars.prevent_dce) = textureLoad_32a7b8(tint_module_vars);
}

kernel void compute_main(device int4* prevent_dce [[buffer(0)]], texture2d_array<int, access::read_write> arg_0 [[texture(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_0=arg_0};
  (*tint_module_vars.prevent_dce) = textureLoad_32a7b8(tint_module_vars);
}
