; LLVM IR from eyangch/competitive-programming :: Codeforces/1549 (c)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.std::reverse_iterator" = type { %"struct.std::_Rb_tree_const_iterator" }

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@s = external dso_local global [200000 x %"class.std::set"], align 16
@bad = external dso_local global [200000 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca %"class.std::reverse_iterator", align 8
  %10 = alloca %"class.std::reverse_iterator", align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca i64, align 8
  %17 = alloca %"struct.std::pair", align 8
  %18 = alloca %"class.std::reverse_iterator", align 8
  %19 = alloca %"class.std::reverse_iterator", align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca %"class.std::reverse_iterator", align 8
  %25 = alloca %"class.std::reverse_iterator", align 8
  store i32 0, ptr %1, align 4
  %26 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %27 = getelementptr i8, ptr %26, i64 -24
  %28 = load i64, ptr %27, align 8
  %29 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %28
  %30 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %29, ptr noundef null)
  %31 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %34 = load i64, ptr @N, align 8, !tbaa !8
  store i64 %34, ptr @ans, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %35

35:                                               ; preds = %109, %0
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %37 = load i64, ptr @M, align 8, !tbaa !8
  %38 = icmp slt i64 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %112

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %43 = load i64, ptr %3, align 8, !tbaa !8
  %44 = sub nsw i64 %43, 1
  %45 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %46 = load i64, ptr %4, align 8, !tbaa !8
  %47 = sub nsw i64 %46, 1
  store i64 %47, ptr %5, align 8, !tbaa !8
  %48 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %45, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %49 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 0
  %50 = extractvalue { ptr, i8 } %48, 0
  store ptr %50, ptr %49, align 8
  %51 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 1
  %52 = extractvalue { ptr, i8 } %48, 1
  store i8 %52, ptr %51, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %53 = load i64, ptr %4, align 8, !tbaa !8
  %54 = sub nsw i64 %53, 1
  %55 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %56 = load i64, ptr %3, align 8, !tbaa !8
  %57 = sub nsw i64 %56, 1
  store i64 %57, ptr %7, align 8, !tbaa !8
  %58 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %55, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %59 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %60 = extractvalue { ptr, i8 } %58, 0
  store ptr %60, ptr %59, align 8
  %61 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %62 = extractvalue { ptr, i8 } %58, 1
  store i8 %62, ptr %61, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %63 = load i64, ptr %3, align 8, !tbaa !8
  %64 = sub nsw i64 %63, 1
  %65 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !11, !range !13, !noundef !14
  %67 = trunc i8 %66 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  br i1 %67, label %77, label %68

68:                                               ; preds = %40
  %69 = load i64, ptr %3, align 8, !tbaa !8
  %70 = sub nsw i64 %69, 1
  %71 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %70
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %9, ptr noundef nonnull align 8 dereferenceable(48) %71) #6
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = load i64, ptr %3, align 8, !tbaa !8
  %75 = sub nsw i64 %74, 1
  %76 = icmp sgt i64 %73, %75
  br label %77

77:                                               ; preds = %68, %40
  %78 = phi i1 [ false, %40 ], [ %76, %68 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br i1 %78, label %79, label %85

79:                                               ; preds = %77
  %80 = load i64, ptr @ans, align 8, !tbaa !8
  %81 = add nsw i64 %80, -1
  store i64 %81, ptr @ans, align 8, !tbaa !8
  %82 = load i64, ptr %3, align 8, !tbaa !8
  %83 = sub nsw i64 %82, 1
  %84 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %83
  store i8 1, ptr %84, align 1, !tbaa !11
  br label %85

85:                                               ; preds = %79, %77
  %86 = load i64, ptr %4, align 8, !tbaa !8
  %87 = sub nsw i64 %86, 1
  %88 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %87
  %89 = load i8, ptr %88, align 1, !tbaa !11, !range !13, !noundef !14
  %90 = trunc i8 %89 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  br i1 %90, label %100, label %91

91:                                               ; preds = %85
  %92 = load i64, ptr %4, align 8, !tbaa !8
  %93 = sub nsw i64 %92, 1
  %94 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %93
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %10, ptr noundef nonnull align 8 dereferenceable(48) %94) #6
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
  %96 = load i64, ptr %95, align 8, !tbaa !8
  %97 = load i64, ptr %4, align 8, !tbaa !8
  %98 = sub nsw i64 %97, 1
  %99 = icmp sgt i64 %96, %98
  br label %100

100:                                              ; preds = %91, %85
  %101 = phi i1 [ false, %85 ], [ %99, %91 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br i1 %101, label %102, label %108

102:                                              ; preds = %100
  %103 = load i64, ptr @ans, align 8, !tbaa !8
  %104 = add nsw i64 %103, -1
  store i64 %104, ptr @ans, align 8, !tbaa !8
  %105 = load i64, ptr %4, align 8, !tbaa !8
  %106 = sub nsw i64 %105, 1
  %107 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %106
  store i8 1, ptr %107, align 1, !tbaa !11
  br label %108

108:                                              ; preds = %102, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %109

109:                                              ; preds = %108
  %110 = load i64, ptr %2, align 8, !tbaa !8
  %111 = add nsw i64 %110, 1
  store i64 %111, ptr %2, align 8, !tbaa !8
  br label %35, !llvm.loop !15

112:                                              ; preds = %39
  %113 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  br label %114

114:                                              ; preds = %276, %112
  %115 = load i64, ptr @Q, align 8, !tbaa !8
  %116 = add nsw i64 %115, -1
  store i64 %116, ptr @Q, align 8, !tbaa !8
  %117 = icmp ne i64 %115, 0
  br i1 %117, label %118, label %277

118:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %119 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %120 = load i64, ptr %11, align 8, !tbaa !8
  %121 = icmp eq i64 %120, 1
  br i1 %121, label %122, label %191

122:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %123 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %124 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %123, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %125 = load i64, ptr %12, align 8, !tbaa !8
  %126 = sub nsw i64 %125, 1
  %127 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %128 = load i64, ptr %13, align 8, !tbaa !8
  %129 = sub nsw i64 %128, 1
  store i64 %129, ptr %14, align 8, !tbaa !8
  %130 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %127, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %131 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 0
  %132 = extractvalue { ptr, i8 } %130, 0
  store ptr %132, ptr %131, align 8
  %133 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 1
  %134 = extractvalue { ptr, i8 } %130, 1
  store i8 %134, ptr %133, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %135 = load i64, ptr %13, align 8, !tbaa !8
  %136 = sub nsw i64 %135, 1
  %137 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %138 = load i64, ptr %12, align 8, !tbaa !8
  %139 = sub nsw i64 %138, 1
  store i64 %139, ptr %16, align 8, !tbaa !8
  %140 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %137, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %141 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 0
  %142 = extractvalue { ptr, i8 } %140, 0
  store ptr %142, ptr %141, align 8
  %143 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 1
  %144 = extractvalue { ptr, i8 } %140, 1
  store i8 %144, ptr %143, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  %145 = load i64, ptr %12, align 8, !tbaa !8
  %146 = sub nsw i64 %145, 1
  %147 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %146
  %148 = load i8, ptr %147, align 1, !tbaa !11, !range !13, !noundef !14
  %149 = trunc i8 %148 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  br i1 %149, label %159, label %150

150:                                              ; preds = %122
  %151 = load i64, ptr %12, align 8, !tbaa !8
  %152 = sub nsw i64 %151, 1
  %153 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %152
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %18, ptr noundef nonnull align 8 dereferenceable(48) %153) #6
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %18)
  %155 = load i64, ptr %154, align 8, !tbaa !8
  %156 = load i64, ptr %12, align 8, !tbaa !8
  %157 = sub nsw i64 %156, 1
  %158 = icmp sgt i64 %155, %157
  br label %159

159:                                              ; preds = %150, %122
  %160 = phi i1 [ false, %122 ], [ %158, %150 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br i1 %160, label %161, label %167

161:                                              ; preds = %159
  %162 = load i64, ptr @ans, align 8, !tbaa !8
  %163 = add nsw i64 %162, -1
  store i64 %163, ptr @ans, align 8, !tbaa !8
  %164 = load i64, ptr %12, align 8, !tbaa !8
  %165 = sub nsw i64 %164, 1
  %166 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %165
  store i8 1, ptr %166, align 1, !tbaa !11
  br label %167

167:                                              ; preds = %161, %159
  %168 = load i64, ptr %13, align 8, !tbaa !8
  %169 = sub nsw i64 %168, 1
  %170 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %169
  %171 = load i8, ptr %170, align 1, !tbaa !11, !range !13, !noundef !14
  %172 = trunc i8 %171 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  br i1 %172, label %182, label %173

173:                                              ; preds = %167
  %174 = load i64, ptr %13, align 8, !tbaa !8
  %175 = sub nsw i64 %174, 1
  %176 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %175
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %19, ptr noundef nonnull align 8 dereferenceable(48) %176) #6
  %177 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19)
  %178 = load i64, ptr %177, align 8, !tbaa !8
  %179 = load i64, ptr %13, align 8, !tbaa !8
  %180 = sub nsw i64 %179, 1
  %181 = icmp sgt i64 %178, %180
  br label %182

182:                                              ; preds = %173, %167
  %183 = phi i1 [ false, %167 ], [ %181, %173 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br i1 %183, label %184, label %190

184:                                              ; preds = %182
  %185 = load i64, ptr @ans, align 8, !tbaa !8
  %186 = add nsw i64 %185, -1
  store i64 %186, ptr @ans, align 8, !tbaa !8
  %187 = load i64, ptr %13, align 8, !tbaa !8
  %188 = sub nsw i64 %187, 1
  %189 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %188
  store i8 1, ptr %189, align 1, !tbaa !11
  br label %190

190:                                              ; preds = %184, %182
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %276

191:                                              ; preds = %118
  %192 = load i64, ptr %11, align 8, !tbaa !8
  %193 = icmp eq i64 %192, 2
  br i1 %193, label %194, label %271

194:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %195 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %196 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %195, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %197 = load i64, ptr %20, align 8, !tbaa !8
  %198 = sub nsw i64 %197, 1
  %199 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %198
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %200 = load i64, ptr %21, align 8, !tbaa !8
  %201 = sub nsw i64 %200, 1
  store i64 %201, ptr %22, align 8, !tbaa !8
  %202 = call noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %199, ptr noundef nonnull align 8 dereferenceable(8) %22)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  %203 = load i64, ptr %21, align 8, !tbaa !8
  %204 = sub nsw i64 %203, 1
  %205 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %204
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %206 = load i64, ptr %20, align 8, !tbaa !8
  %207 = sub nsw i64 %206, 1
  store i64 %207, ptr %23, align 8, !tbaa !8
  %208 = call noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %205, ptr noundef nonnull align 8 dereferenceable(8) %23)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  %209 = load i64, ptr %20, align 8, !tbaa !8
  %210 = sub nsw i64 %209, 1
  %211 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %210
  %212 = load i8, ptr %211, align 1, !tbaa !11, !range !13, !noundef !14
  %213 = trunc i8 %212 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  br i1 %213, label %214, label %231

214:                                              ; preds = %194
  %215 = load i64, ptr %20, align 8, !tbaa !8
  %216 = sub nsw i64 %215, 1
  %217 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %216
  %218 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %217) #6
  %219 = icmp eq i64 %218, 0
  br i1 %219, label %229, label %220

220:                                              ; preds = %214
  %221 = load i64, ptr %20, align 8, !tbaa !8
  %222 = sub nsw i64 %221, 1
  %223 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %222
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %24, ptr noundef nonnull align 8 dereferenceable(48) %223) #6
  %224 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
  %225 = load i64, ptr %224, align 8, !tbaa !8
  %226 = load i64, ptr %20, align 8, !tbaa !8
  %227 = sub nsw i64 %226, 1
  %228 = icmp slt i64 %225, %227
  br label %229

229:                                              ; preds = %220, %214
  %230 = phi i1 [ true, %214 ], [ %228, %220 ]
  br label %231

231:                                              ; preds = %229, %194
  %232 = phi i1 [ false, %194 ], [ %230, %229 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br i1 %232, label %233, label %239

233:                                              ; preds = %231
  %234 = load i64, ptr @ans, align 8, !tbaa !8
  %235 = add nsw i64 %234, 1
  store i64 %235, ptr @ans, align 8, !tbaa !8
  %236 = load i64, ptr %20, align 8, !tbaa !8
  %237 = sub nsw i64 %236, 1
  %238 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %237
  store i8 0, ptr %238, align 1, !tbaa !11
  br label %239

239:                                              ; preds = %233, %231
  %240 = load i64, ptr %21, align 8, !tbaa !8
  %241 = sub nsw i64 %240, 1
  %242 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %241
  %243 = load i8, ptr %242, align 1, !tbaa !11, !range !13, !noundef !14
  %244 = trunc i8 %243 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  br i1 %244, label %245, label %262

245:                                              ; preds = %239
  %246 = load i64, ptr %21, align 8, !tbaa !8
  %247 = sub nsw i64 %246, 1
  %248 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %247
  %249 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %248) #6
  %250 = icmp eq i64 %249, 0
  br i1 %250, label %260, label %251

251:                                              ; preds = %245
  %252 = load i64, ptr %21, align 8, !tbaa !8
  %253 = sub nsw i64 %252, 1
  %254 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %253
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %25, ptr noundef nonnull align 8 dereferenceable(48) %254) #6
  %255 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %25)
  %256 = load i64, ptr %255, align 8, !tbaa !8
  %257 = load i64, ptr %21, align 8, !tbaa !8
  %258 = sub nsw i64 %257, 1
  %259 = icmp slt i64 %256, %258
  br label %260

260:                                              ; preds = %251, %245
  %261 = phi i1 [ true, %245 ], [ %259, %251 ]
  br label %262

262:                                              ; preds = %260, %239
  %263 = phi i1 [ false, %239 ], [ %261, %260 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br i1 %263, label %264, label %270

264:                                              ; preds = %262
  %265 = load i64, ptr @ans, align 8, !tbaa !8
  %266 = add nsw i64 %265, 1
  store i64 %266, ptr @ans, align 8, !tbaa !8
  %267 = load i64, ptr %21, align 8, !tbaa !8
  %268 = sub nsw i64 %267, 1
  %269 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %268
  store i8 0, ptr %269, align 1, !tbaa !11
  br label %270

270:                                              ; preds = %264, %262
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %275

271:                                              ; preds = %191
  %272 = load i64, ptr @ans, align 8, !tbaa !8
  %273 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %272)
  %274 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %273, i8 noundef signext 10)
  br label %275

275:                                              ; preds = %271, %270
  br label %276

276:                                              ; preds = %275, %190
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %114, !llvm.loop !17

277:                                              ; preds = %114
  %278 = load i32, ptr %1, align 4
  ret i32 %278
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !10, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::reverse_iterator" = type { %"struct.std::_Rb_tree_const_iterator" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@s = external dso_local global [200000 x %"class.std::set"], align 16
@bad = external dso_local local_unnamed_addr global [200000 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::reverse_iterator", align 8
  %6 = alloca %"class.std::reverse_iterator", align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %"class.std::reverse_iterator", align 8
  %13 = alloca %"class.std::reverse_iterator", align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca %"class.std::reverse_iterator", align 8
  %19 = alloca %"class.std::reverse_iterator", align 8
  %20 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %22
  %24 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %23, ptr noundef null)
  %25 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %27 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %28 = load i64, ptr @N, align 8, !tbaa !8
  store i64 %28, ptr @ans, align 8, !tbaa !8
  %29 = load i64, ptr @M, align 8, !tbaa !8
  %30 = icmp sgt i64 %29, 0
  br i1 %30, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %79, %0
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  %32 = load i64, ptr @Q, align 8, !tbaa !8
  %33 = add nsw i64 %32, -1
  store i64 %33, ptr @Q, align 8, !tbaa !8
  %.not29 = icmp eq i64 %32, 0
  br i1 %.not29, label %._crit_edge32, label %.lr.ph31

.lr.ph:                                           ; preds = %0, %79
  %.028 = phi i64 [ %80, %79 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %36 = load i64, ptr %1, align 8, !tbaa !8
  %37 = add nsw i64 %36, -1
  %38 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %37
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %39 = load i64, ptr %2, align 8, !tbaa !8
  %40 = add nsw i64 %39, -1
  store i64 %40, ptr %3, align 8, !tbaa !8
  %41 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %38, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %42 = load i64, ptr %2, align 8, !tbaa !8
  %43 = add nsw i64 %42, -1
  %44 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %43
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %45 = load i64, ptr %1, align 8, !tbaa !8
  %46 = add nsw i64 %45, -1
  store i64 %46, ptr %4, align 8, !tbaa !8
  %47 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %44, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %48 = load i64, ptr %1, align 8, !tbaa !8
  %49 = add nsw i64 %48, -1
  %50 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !11, !range !13, !noundef !14
  %52 = trunc nuw i8 %51 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  br i1 %52, label %.critedge, label %53

53:                                               ; preds = %.lr.ph
  %54 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %49
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(48) %54) #6
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = load i64, ptr %1, align 8, !tbaa !8
  %.not26 = icmp slt i64 %56, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br i1 %.not26, label %63, label %58

58:                                               ; preds = %53
  %59 = load i64, ptr @ans, align 8, !tbaa !8
  %60 = add nsw i64 %59, -1
  store i64 %60, ptr @ans, align 8, !tbaa !8
  %61 = add nsw i64 %57, -1
  %62 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %61
  store i8 1, ptr %62, align 1, !tbaa !11
  br label %63

.critedge:                                        ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %63

63:                                               ; preds = %.critedge, %58, %53
  %64 = load i64, ptr %2, align 8, !tbaa !8
  %65 = add nsw i64 %64, -1
  %66 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %65
  %67 = load i8, ptr %66, align 1, !tbaa !11, !range !13, !noundef !14
  %68 = trunc nuw i8 %67 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  br i1 %68, label %.critedge2, label %69

69:                                               ; preds = %63
  %70 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %65
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(48) %70) #6
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %72 = load i64, ptr %71, align 8, !tbaa !8
  %73 = load i64, ptr %2, align 8, !tbaa !8
  %.not27 = icmp slt i64 %72, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %.not27, label %79, label %74

74:                                               ; preds = %69
  %75 = load i64, ptr @ans, align 8, !tbaa !8
  %76 = add nsw i64 %75, -1
  store i64 %76, ptr @ans, align 8, !tbaa !8
  %77 = add nsw i64 %73, -1
  %78 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %77
  store i8 1, ptr %78, align 1, !tbaa !11
  br label %79

.critedge2:                                       ; preds = %63
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %79

79:                                               ; preds = %.critedge2, %74, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %80 = add nuw nsw i64 %.028, 1
  %81 = load i64, ptr @M, align 8, !tbaa !8
  %82 = icmp slt i64 %80, %81
  br i1 %82, label %.lr.ph, label %._crit_edge, !llvm.loop !15

.lr.ph31:                                         ; preds = %._crit_edge, %197
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %83 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %84 = load i64, ptr %7, align 8, !tbaa !8
  switch i64 %84, label %193 [
    i64 1, label %85
    i64 2, label %132
  ]

85:                                               ; preds = %.lr.ph31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %86 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %87 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %86, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %88 = load i64, ptr %8, align 8, !tbaa !8
  %89 = add nsw i64 %88, -1
  %90 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %89
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %91 = load i64, ptr %9, align 8, !tbaa !8
  %92 = add nsw i64 %91, -1
  store i64 %92, ptr %10, align 8, !tbaa !8
  %93 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %90, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  %94 = load i64, ptr %9, align 8, !tbaa !8
  %95 = add nsw i64 %94, -1
  %96 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %95
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  %97 = load i64, ptr %8, align 8, !tbaa !8
  %98 = add nsw i64 %97, -1
  store i64 %98, ptr %11, align 8, !tbaa !8
  %99 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %96, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  %100 = load i64, ptr %8, align 8, !tbaa !8
  %101 = add nsw i64 %100, -1
  %102 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %101
  %103 = load i8, ptr %102, align 1, !tbaa !11, !range !13, !noundef !14
  %104 = trunc nuw i8 %103 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  br i1 %104, label %.critedge4, label %105

105:                                              ; preds = %85
  %106 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %101
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %12, ptr noundef nonnull align 8 dereferenceable(48) %106) #6
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %108 = load i64, ptr %107, align 8, !tbaa !8
  %109 = load i64, ptr %8, align 8, !tbaa !8
  %.not24 = icmp slt i64 %108, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  br i1 %.not24, label %115, label %110

110:                                              ; preds = %105
  %111 = load i64, ptr @ans, align 8, !tbaa !8
  %112 = add nsw i64 %111, -1
  store i64 %112, ptr @ans, align 8, !tbaa !8
  %113 = add nsw i64 %109, -1
  %114 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %113
  store i8 1, ptr %114, align 1, !tbaa !11
  br label %115

.critedge4:                                       ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  br label %115

115:                                              ; preds = %.critedge4, %110, %105
  %116 = load i64, ptr %9, align 8, !tbaa !8
  %117 = add nsw i64 %116, -1
  %118 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %117
  %119 = load i8, ptr %118, align 1, !tbaa !11, !range !13, !noundef !14
  %120 = trunc nuw i8 %119 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  br i1 %120, label %.critedge6, label %121

121:                                              ; preds = %115
  %122 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %117
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %13, ptr noundef nonnull align 8 dereferenceable(48) %122) #6
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13)
  %124 = load i64, ptr %123, align 8, !tbaa !8
  %125 = load i64, ptr %9, align 8, !tbaa !8
  %.not25 = icmp slt i64 %124, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  br i1 %.not25, label %131, label %126

126:                                              ; preds = %121
  %127 = load i64, ptr @ans, align 8, !tbaa !8
  %128 = add nsw i64 %127, -1
  store i64 %128, ptr @ans, align 8, !tbaa !8
  %129 = add nsw i64 %125, -1
  %130 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %129
  store i8 1, ptr %130, align 1, !tbaa !11
  br label %131

.critedge6:                                       ; preds = %115
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  br label %131

131:                                              ; preds = %.critedge6, %126, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  br label %197

132:                                              ; preds = %.lr.ph31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #6
  %133 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %134 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %133, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %135 = load i64, ptr %14, align 8, !tbaa !8
  %136 = add nsw i64 %135, -1
  %137 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %136
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #6
  %138 = load i64, ptr %15, align 8, !tbaa !8
  %139 = add nsw i64 %138, -1
  store i64 %139, ptr %16, align 8, !tbaa !8
  %140 = call noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %137, ptr noundef nonnull align 8 dereferenceable(8) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #6
  %141 = load i64, ptr %15, align 8, !tbaa !8
  %142 = add nsw i64 %141, -1
  %143 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %142
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #6
  %144 = load i64, ptr %14, align 8, !tbaa !8
  %145 = add nsw i64 %144, -1
  store i64 %145, ptr %17, align 8, !tbaa !8
  %146 = call noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %143, ptr noundef nonnull align 8 dereferenceable(8) %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #6
  %147 = load i64, ptr %14, align 8, !tbaa !8
  %148 = add nsw i64 %147, -1
  %149 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %148
  %150 = load i8, ptr %149, align 1, !tbaa !11, !range !13, !noundef !14
  %151 = trunc nuw i8 %150 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #6
  br i1 %151, label %152, label %.critedge8

152:                                              ; preds = %132
  %153 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %148
  %154 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %153) #6
  %155 = icmp eq i64 %154, 0
  br i1 %155, label %.critedge10, label %156

156:                                              ; preds = %152
  %157 = load i64, ptr %14, align 8, !tbaa !8
  %158 = add nsw i64 %157, -1
  %159 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %158
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %18, ptr noundef nonnull align 8 dereferenceable(48) %159) #6
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %18)
  %161 = load i64, ptr %160, align 8, !tbaa !8
  %162 = load i64, ptr %14, align 8, !tbaa !8
  %163 = add nsw i64 %162, -1
  %164 = icmp slt i64 %161, %163
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  br i1 %164, label %165, label %169

.critedge10:                                      ; preds = %152
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  %.pre = load i64, ptr %14, align 8, !tbaa !8
  %.pre34 = add nsw i64 %.pre, -1
  br label %165

165:                                              ; preds = %.critedge10, %156
  %.pre-phi = phi i64 [ %.pre34, %.critedge10 ], [ %163, %156 ]
  %166 = load i64, ptr @ans, align 8, !tbaa !8
  %167 = add nsw i64 %166, 1
  store i64 %167, ptr @ans, align 8, !tbaa !8
  %168 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %.pre-phi
  store i8 0, ptr %168, align 1, !tbaa !11
  br label %169

.critedge8:                                       ; preds = %132
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  br label %169

169:                                              ; preds = %.critedge8, %165, %156
  %170 = load i64, ptr %15, align 8, !tbaa !8
  %171 = add nsw i64 %170, -1
  %172 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %171
  %173 = load i8, ptr %172, align 1, !tbaa !11, !range !13, !noundef !14
  %174 = trunc nuw i8 %173 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #6
  br i1 %174, label %175, label %.critedge12

175:                                              ; preds = %169
  %176 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %171
  %177 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %176) #6
  %178 = icmp eq i64 %177, 0
  br i1 %178, label %.critedge14, label %179

179:                                              ; preds = %175
  %180 = load i64, ptr %15, align 8, !tbaa !8
  %181 = add nsw i64 %180, -1
  %182 = getelementptr inbounds [200000 x %"class.std::set"], ptr @s, i64 0, i64 %181
  call void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %19, ptr noundef nonnull align 8 dereferenceable(48) %182) #6
  %183 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19)
  %184 = load i64, ptr %183, align 8, !tbaa !8
  %185 = load i64, ptr %15, align 8, !tbaa !8
  %186 = add nsw i64 %185, -1
  %187 = icmp slt i64 %184, %186
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #6
  br i1 %187, label %188, label %192

.critedge14:                                      ; preds = %175
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #6
  %.pre33 = load i64, ptr %15, align 8, !tbaa !8
  %.pre35 = add nsw i64 %.pre33, -1
  br label %188

188:                                              ; preds = %.critedge14, %179
  %.pre-phi36 = phi i64 [ %.pre35, %.critedge14 ], [ %186, %179 ]
  %189 = load i64, ptr @ans, align 8, !tbaa !8
  %190 = add nsw i64 %189, 1
  store i64 %190, ptr @ans, align 8, !tbaa !8
  %191 = getelementptr inbounds [200000 x i8], ptr @bad, i64 0, i64 %.pre-phi36
  store i8 0, ptr %191, align 1, !tbaa !11
  br label %192

.critedge12:                                      ; preds = %169
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #6
  br label %192

192:                                              ; preds = %.critedge12, %188, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  br label %197

193:                                              ; preds = %.lr.ph31
  %194 = load i64, ptr @ans, align 8, !tbaa !8
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %194)
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %195, i8 noundef signext 10)
  br label %197

197:                                              ; preds = %192, %193, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %198 = load i64, ptr @Q, align 8, !tbaa !8
  %199 = add nsw i64 %198, -1
  store i64 %199, ptr @Q, align 8, !tbaa !8
  %.not = icmp eq i64 %198, 0
  br i1 %.not, label %._crit_edge32, label %.lr.ph31, !llvm.loop !17

._crit_edge32:                                    ; preds = %197, %._crit_edge
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt3setIxSt4lessIxESaIxEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorIxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !10, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass