#include <metal_stdlib>
using namespace metal;

#define TINT_ISOLATE_UB(VOLATILE_NAME) \
  {volatile bool VOLATILE_NAME = false; if (VOLATILE_NAME) break;}

kernel void tint_symbol() {
  {
    int i = 0;
    while(true) {
      TINT_ISOLATE_UB(tint_volatile_false)
      if ((i < 2)) {
      } else {
        break;
      }
      bool tint_continue = false;
      switch(i) {
        case 0:
        {
          tint_continue = true;
          break;
        }
        case 1:
        {
          tint_continue = true;
          break;
        }
        case 2:
        {
          tint_continue = true;
          break;
        }
        default:
        {
          break;
        }
      }
      if (tint_continue) {
        {
          i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
        }
        continue;
      }
      {
        i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
      }
      continue;
    }
  }
}
