#include <metal_stdlib>
using namespace metal;

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

uint2 textureDimensions_3834f8(tint_module_vars_struct tint_module_vars) {
  uint2 res = uint2(tint_module_vars.arg_0.get_width(0u), tint_module_vars.arg_0.get_height(0u));
  return res;
}

fragment void fragment_main(device uint2* 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) = textureDimensions_3834f8(tint_module_vars);
}

kernel void compute_main(device uint2* 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) = textureDimensions_3834f8(tint_module_vars);
}
