#include <metal_stdlib>

using namespace metal;
int subgroupAny_cddda0() {
  bool arg_0 = true;
  bool res = simd_any(arg_0);
  return select(0, 1, all((res == false)));
}

fragment void fragment_main(device int* tint_symbol [[buffer(0)]]) {
  *(tint_symbol) = subgroupAny_cddda0();
  return;
}

kernel void compute_main(device int* tint_symbol_1 [[buffer(0)]]) {
  *(tint_symbol_1) = subgroupAny_cddda0();
  return;
}

