#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_0b515a(tint_module_vars_struct tint_module_vars) {
  uint2 arg_1 = uint2(1u);
  uint arg_2 = 1u;
  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_0b515a(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_0b515a(tint_module_vars);
}
