#include <metal_stdlib>
using namespace metal;

#define TINT_ISOLATE_UB(VOLATILE_NAME) \
  volatile bool VOLATILE_NAME = true; \
  if (VOLATILE_NAME)

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