; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-11-22 (F - Funny Language - tjz)

; 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"

%struct.Node = type { i32, [26 x i32] }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<Node, Node, std::_Identity<Node>, std::less<Node>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Node, Node, std::_Identity<Node>, std::less<Node>>::_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::set.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::_Identity<std::__cxx11::basic_string<char>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::_Identity<std::__cxx11::basic_string<char>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.6" = type { i8 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"struct.std::pair.9" = type <{ %"struct.std::_Rb_tree_const_iterator.11", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator.11" = type { ptr }
%"class.std::reverse_iterator" = type { %"struct.std::_Rb_tree_const_iterator.11" }

@a = external dso_local global [1001 x %struct.Node], align 16
@tmp = external dso_local global %struct.Node, align 4
@Hash = external dso_local global %"class.std::set", align 8
@_Z3AAAB5cxx11 = external dso_local global %"class.std::set.0", align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@str = external dso_local global [101 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator.6", align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair.9", align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator.11", align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator.11", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"class.std::reverse_iterator", align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"class.std::__cxx11::basic_string", align 8
  %21 = alloca %"class.std::allocator.6", align 1
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca %"struct.std::pair.9", align 8
  %27 = alloca %"struct.std::_Rb_tree_const_iterator.11", align 8
  %28 = alloca %"struct.std::_Rb_tree_const_iterator.11", align 8
  %29 = alloca %"struct.std::_Rb_tree_const_iterator.11", align 8
  %30 = alloca %"struct.std::pair.9", align 8
  store i32 0, ptr %1, align 4
  br label %31

31:                                               ; preds = %341, %0
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @n, ptr noundef @m)
  %33 = icmp eq i32 %32, 2
  br i1 %33, label %34, label %342

34:                                               ; preds = %31
  call void @_ZNSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @_Z3AAAB5cxx11) #8
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = mul i64 %36, 108
  call void @llvm.memset.p0.i64(ptr align 16 @a, i8 0, i64 %37, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %78, %34
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = load i32, ptr @m, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %90

43:                                               ; preds = %38
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @str)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %67, %43
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [101 x i8], ptr @str, i64 0, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !9
  %50 = icmp ne i8 %49, 0
  br i1 %50, label %52, label %51

51:                                               ; preds = %45
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %70

52:                                               ; preds = %45
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1001 x %struct.Node], ptr @a, i64 0, i64 %54
  %56 = getelementptr inbounds %struct.Node, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [101 x i8], ptr @str, i64 0, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !9
  %61 = sext i8 %60 to i32
  %62 = sub nsw i32 %61, 65
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [26 x i32], ptr %56, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %64, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %52
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %4, align 4, !tbaa !5
  br label %45, !llvm.loop !10

70:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef @str, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %71 unwind label %81

71:                                               ; preds = %70
  %72 = invoke { ptr, i8 } @_ZNSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE6insertEOS5_(ptr noundef nonnull align 8 dereferenceable(48) @_Z3AAAB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %73 unwind label %85

73:                                               ; preds = %71
  %74 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %75 = extractvalue { ptr, i8 } %72, 0
  store ptr %75, ptr %74, align 8
  %76 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %77 = extractvalue { ptr, i8 } %72, 1
  store i8 %77, ptr %76, align 8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #8
  br label %78

78:                                               ; preds = %73
  %79 = load i32, ptr %2, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %2, align 4, !tbaa !5
  br label %38, !llvm.loop !12

81:                                               ; preds = %70
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %7, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %8, align 4
  br label %89

85:                                               ; preds = %71
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %7, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %8, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  br label %89

89:                                               ; preds = %85, %81
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %343

90:                                               ; preds = %42
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  call void @llvm.memset.p0.i64(ptr align 4 @tmp, i8 0, i64 108, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %131, %90
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = icmp slt i32 %92, 26
  br i1 %93, label %95, label %94

94:                                               ; preds = %91
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %134

95:                                               ; preds = %91
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (%struct.Node, ptr @tmp, i32 0, i32 1), i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %98, align 4, !tbaa !5
  store i32 0, ptr @tmp, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %115, %95
  %102 = load i32, ptr %11, align 4, !tbaa !5
  %103 = load i32, ptr @m, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %118

106:                                              ; preds = %101
  %107 = load i32, ptr %11, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1001 x %struct.Node], ptr @a, i64 0, i64 %108
  %110 = call noundef zeroext i1 @_ZNK4Node4haveERKS_(ptr noundef nonnull align 4 dereferenceable(108) %109, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  br i1 %110, label %111, label %114

111:                                              ; preds = %106
  %112 = load i32, ptr @tmp, align 4, !tbaa !13
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr @tmp, align 4, !tbaa !13
  br label %114

114:                                              ; preds = %111, %106
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %11, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %11, align 4, !tbaa !5
  br label %101, !llvm.loop !15

118:                                              ; preds = %105
  %119 = call { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %120 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %121 = extractvalue { ptr, i8 } %119, 0
  store ptr %121, ptr %120, align 8
  %122 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %123 = extractvalue { ptr, i8 } %119, 1
  store i8 %123, ptr %122, align 8
  %124 = load i32, ptr @tot, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr @tot, align 4, !tbaa !5
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (%struct.Node, ptr @tmp, i32 0, i32 1), i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = add nsw i32 %129, -1
  store i32 %130, ptr %128, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %118
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %10, align 4, !tbaa !5
  br label %91, !llvm.loop !16

134:                                              ; preds = %94
  br label %135

135:                                              ; preds = %148, %134
  %136 = load i32, ptr @tot, align 4, !tbaa !5
  %137 = load i32, ptr @n, align 4, !tbaa !5
  %138 = load i32, ptr @m, align 4, !tbaa !5
  %139 = add nsw i32 %137, %138
  %140 = icmp sgt i32 %136, %139
  br i1 %140, label %141, label %151

141:                                              ; preds = %135
  %142 = call ptr @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %143 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.11", ptr %13, i32 0, i32 0
  store ptr %142, ptr %143, align 8
  %144 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.11", ptr %13, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8
  %146 = call ptr @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS0_E(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr %145)
  %147 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.11", ptr %14, i32 0, i32 0
  store ptr %146, ptr %147, align 8
  br label %148

148:                                              ; preds = %141
  %149 = load i32, ptr @tot, align 4, !tbaa !5
  %150 = add nsw i32 %149, -1
  store i32 %150, ptr @tot, align 4, !tbaa !5
  br label %135, !llvm.loop !17

151:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %339, %151
  %153 = load i32, ptr %15, align 4, !tbaa !5
  %154 = load i32, ptr @n, align 4, !tbaa !5
  %155 = icmp sle i32 %153, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  store i32 19, ptr %3, align 4
  br label %340

157:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  call void @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %16, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %158 = call noundef nonnull align 4 dereferenceable(108) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorI4NodeEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @tmp, ptr align 4 %158, i64 108, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  %159 = call noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %160 = load i32, ptr @tot, align 4, !tbaa !5
  %161 = add nsw i32 %160, -1
  store i32 %161, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %187, %157
  %163 = load i32, ptr %18, align 4, !tbaa !5
  %164 = icmp slt i32 %163, 26
  br i1 %164, label %166, label %165

165:                                              ; preds = %162
  store i32 21, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %190

166:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %167

167:                                              ; preds = %183, %166
  %168 = load i32, ptr %19, align 4, !tbaa !5
  %169 = load i32, ptr %18, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (%struct.Node, ptr @tmp, i32 0, i32 1), i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = icmp slt i32 %168, %172
  br i1 %173, label %175, label %174

174:                                              ; preds = %167
  store i32 24, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %186

175:                                              ; preds = %167
  %176 = load i32, ptr %18, align 4, !tbaa !5
  %177 = add nsw i32 65, %176
  %178 = trunc i32 %177 to i8
  %179 = load i32, ptr %17, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %17, align 4, !tbaa !5
  %181 = sext i32 %179 to i64
  %182 = getelementptr inbounds [101 x i8], ptr @str, i64 0, i64 %181
  store i8 %178, ptr %182, align 1, !tbaa !9
  br label %183

183:                                              ; preds = %175
  %184 = load i32, ptr %19, align 4, !tbaa !5
  %185 = add nsw i32 %184, 1
  store i32 %185, ptr %19, align 4, !tbaa !5
  br label %167, !llvm.loop !19

186:                                              ; preds = %174
  br label %187

187:                                              ; preds = %186
  %188 = load i32, ptr %18, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %18, align 4, !tbaa !5
  br label %162, !llvm.loop !20

190:                                              ; preds = %165
  %191 = load i32, ptr %17, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [101 x i8], ptr @str, i64 0, i64 %192
  store i8 0, ptr %193, align 1, !tbaa !9
  br label %194

194:                                              ; preds = %223, %190
  %195 = load i32, ptr %15, align 4, !tbaa !5
  %196 = load i32, ptr @n, align 4, !tbaa !5
  %197 = icmp sle i32 %195, %196
  br i1 %197, label %198, label %224

198:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef @str, ptr noundef nonnull align 1 dereferenceable(1) %21)
          to label %199 unwind label %208

199:                                              ; preds = %198
  %200 = invoke noundef i64 @_ZNKSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE5countERKS5_(ptr noundef nonnull align 8 dereferenceable(48) @_Z3AAAB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %20)
          to label %201 unwind label %212

201:                                              ; preds = %199
  %202 = icmp ne i64 %200, 0
  %203 = xor i1 %202, true
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #8
  br i1 %203, label %204, label %217

204:                                              ; preds = %201
  %205 = call i32 @puts(ptr noundef @str)
  %206 = load i32, ptr %15, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %15, align 4, !tbaa !5
  br label %217

208:                                              ; preds = %198
  %209 = landingpad { ptr, i32 }
          cleanup
  %210 = extractvalue { ptr, i32 } %209, 0
  store ptr %210, ptr %7, align 8
  %211 = extractvalue { ptr, i32 } %209, 1
  store i32 %211, ptr %8, align 4
  br label %216

212:                                              ; preds = %199
  %213 = landingpad { ptr, i32 }
          cleanup
  %214 = extractvalue { ptr, i32 } %213, 0
  store ptr %214, ptr %7, align 8
  %215 = extractvalue { ptr, i32 } %213, 1
  store i32 %215, ptr %8, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #8
  br label %216

216:                                              ; preds = %212, %208
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %343

217:                                              ; preds = %204, %201
  %218 = load i32, ptr %17, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds i8, ptr @str, i64 %219
  %221 = call noundef zeroext i1 @_ZSt16next_permutationIPcEbT_S1_(ptr noundef @str, ptr noundef %220)
  br i1 %221, label %223, label %222

222:                                              ; preds = %217
  br label %224

223:                                              ; preds = %217
  br label %194, !llvm.loop !21

224:                                              ; preds = %222, %194
  %225 = load i32, ptr %15, align 4, !tbaa !5
  %226 = load i32, ptr @n, align 4, !tbaa !5
  %227 = icmp sgt i32 %225, %226
  br i1 %227, label %228, label %229

228:                                              ; preds = %224
  store i32 19, ptr %3, align 4
  br label %337

229:                                              ; preds = %224
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  store i32 0, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %230

230:                                              ; preds = %243, %229
  %231 = load i32, ptr %23, align 4, !tbaa !5
  %232 = icmp slt i32 %231, 26
  br i1 %232, label %234, label %233

233:                                              ; preds = %230
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %246

234:                                              ; preds = %230
  %235 = load i32, ptr %23, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (%struct.Node, ptr @tmp, i32 0, i32 1), i64 0, i64 %236
  %238 = load i32, ptr %237, align 4, !tbaa !5
  %239 = icmp ne i32 %238, 0
  br i1 %239, label %240, label %242

240:                                              ; preds = %234
  %241 = load i32, ptr %23, align 4, !tbaa !5
  store i32 %241, ptr %22, align 4, !tbaa !5
  br label %242

242:                                              ; preds = %240, %234
  br label %243

243:                                              ; preds = %242
  %244 = load i32, ptr %23, align 4, !tbaa !5
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %23, align 4, !tbaa !5
  br label %230, !llvm.loop !22

246:                                              ; preds = %233
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  %247 = load i32, ptr %22, align 4, !tbaa !5
  store i32 %247, ptr %24, align 4, !tbaa !5
  br label %248

248:                                              ; preds = %333, %246
  %249 = load i32, ptr %24, align 4, !tbaa !5
  %250 = icmp slt i32 %249, 26
  br i1 %250, label %252, label %251

251:                                              ; preds = %248
  store i32 32, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %336

252:                                              ; preds = %248
  %253 = load i32, ptr %24, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (%struct.Node, ptr @tmp, i32 0, i32 1), i64 0, i64 %254
  %256 = load i32, ptr %255, align 4, !tbaa !5
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %255, align 4, !tbaa !5
  store i32 0, ptr @tmp, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %258

258:                                              ; preds = %272, %252
  %259 = load i32, ptr %25, align 4, !tbaa !5
  %260 = load i32, ptr @m, align 4, !tbaa !5
  %261 = icmp slt i32 %259, %260
  br i1 %261, label %263, label %262

262:                                              ; preds = %258
  store i32 35, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %275

263:                                              ; preds = %258
  %264 = load i32, ptr %25, align 4, !tbaa !5
  %265 = sext i32 %264 to i64
  %266 = getelementptr inbounds [1001 x %struct.Node], ptr @a, i64 0, i64 %265
  %267 = call noundef zeroext i1 @_ZNK4Node4haveERKS_(ptr noundef nonnull align 4 dereferenceable(108) %266, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  br i1 %267, label %268, label %271

268:                                              ; preds = %263
  %269 = load i32, ptr @tmp, align 4, !tbaa !13
  %270 = add nsw i32 %269, 1
  store i32 %270, ptr @tmp, align 4, !tbaa !13
  br label %271

271:                                              ; preds = %268, %263
  br label %272

272:                                              ; preds = %271
  %273 = load i32, ptr %25, align 4, !tbaa !5
  %274 = add nsw i32 %273, 1
  store i32 %274, ptr %25, align 4, !tbaa !5
  br label %258, !llvm.loop !23

275:                                              ; preds = %262
  %276 = call noundef i64 @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %277 = icmp ne i64 %276, 0
  br i1 %277, label %278, label %284

278:                                              ; preds = %275
  %279 = load i32, ptr %24, align 4, !tbaa !5
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (%struct.Node, ptr @tmp, i32 0, i32 1), i64 0, i64 %280
  %282 = load i32, ptr %281, align 4, !tbaa !5
  %283 = add nsw i32 %282, -1
  store i32 %283, ptr %281, align 4, !tbaa !5
  br label %333

284:                                              ; preds = %275
  %285 = load i32, ptr @tot, align 4, !tbaa !5
  %286 = load i32, ptr @n, align 4, !tbaa !5
  %287 = load i32, ptr @m, align 4, !tbaa !5
  %288 = add nsw i32 %286, %287
  %289 = icmp slt i32 %285, %288
  br i1 %289, label %290, label %298

290:                                              ; preds = %284
  %291 = call { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %292 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 0
  %293 = extractvalue { ptr, i8 } %291, 0
  store ptr %293, ptr %292, align 8
  %294 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 1
  %295 = extractvalue { ptr, i8 } %291, 1
  store i8 %295, ptr %294, align 8
  %296 = load i32, ptr @tot, align 4, !tbaa !5
  %297 = add nsw i32 %296, 1
  store i32 %297, ptr @tot, align 4, !tbaa !5
  br label %327

298:                                              ; preds = %284
  %299 = load i32, ptr @tot, align 4, !tbaa !5
  %300 = load i32, ptr @n, align 4, !tbaa !5
  %301 = load i32, ptr @m, align 4, !tbaa !5
  %302 = add nsw i32 %300, %301
  %303 = icmp eq i32 %299, %302
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  br i1 %303, label %304, label %312

304:                                              ; preds = %298
  %305 = call ptr @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %306 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.11", ptr %27, i32 0, i32 0
  store ptr %305, ptr %306, align 8
  %307 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI4NodeEptEv(ptr noundef nonnull align 8 dereferenceable(8) %27) #8
  %308 = getelementptr inbounds %struct.Node, ptr %307, i32 0, i32 0
  %309 = load i32, ptr %308, align 4, !tbaa !13
  %310 = load i32, ptr @tmp, align 4, !tbaa !13
  %311 = icmp slt i32 %309, %310
  br label %312

312:                                              ; preds = %304, %298
  %313 = phi i1 [ false, %298 ], [ %311, %304 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  br i1 %313, label %314, label %326

314:                                              ; preds = %312
  %315 = call ptr @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %316 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.11", ptr %28, i32 0, i32 0
  store ptr %315, ptr %316, align 8
  %317 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.11", ptr %28, i32 0, i32 0
  %318 = load ptr, ptr %317, align 8
  %319 = call ptr @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS0_E(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr %318)
  %320 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.11", ptr %29, i32 0, i32 0
  store ptr %319, ptr %320, align 8
  %321 = call { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %322 = getelementptr inbounds { ptr, i8 }, ptr %30, i32 0, i32 0
  %323 = extractvalue { ptr, i8 } %321, 0
  store ptr %323, ptr %322, align 8
  %324 = getelementptr inbounds { ptr, i8 }, ptr %30, i32 0, i32 1
  %325 = extractvalue { ptr, i8 } %321, 1
  store i8 %325, ptr %324, align 8
  br label %326

326:                                              ; preds = %314, %312
  br label %327

327:                                              ; preds = %326, %290
  %328 = load i32, ptr %24, align 4, !tbaa !5
  %329 = sext i32 %328 to i64
  %330 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (%struct.Node, ptr @tmp, i32 0, i32 1), i64 0, i64 %329
  %331 = load i32, ptr %330, align 4, !tbaa !5
  %332 = add nsw i32 %331, -1
  store i32 %332, ptr %330, align 4, !tbaa !5
  br label %333

333:                                              ; preds = %327, %278
  %334 = load i32, ptr %24, align 4, !tbaa !5
  %335 = add nsw i32 %334, 1
  store i32 %335, ptr %24, align 4, !tbaa !5
  br label %248, !llvm.loop !24

336:                                              ; preds = %251
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  store i32 0, ptr %3, align 4
  br label %337

337:                                              ; preds = %336, %228
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  %338 = load i32, ptr %3, align 4
  switch i32 %338, label %340 [
    i32 0, label %339
  ]

339:                                              ; preds = %337
  br label %152, !llvm.loop !25

340:                                              ; preds = %337, %156
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %341

341:                                              ; preds = %340
  br label %31, !llvm.loop !26

342:                                              ; preds = %31
  ret i32 0

343:                                              ; preds = %216, %89
  %344 = load ptr, ptr %7, align 8
  %345 = load i32, ptr %8, align 4
  %346 = insertvalue { ptr, i32 } poison, ptr %344, 0
  %347 = insertvalue { ptr, i32 } %346, i32 %345, 1
  resume { ptr, i32 } %347
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Node4haveERKS_(ptr noundef nonnull align 4 dereferenceable(108), ptr noundef nonnull align 4 dereferenceable(108)) #3 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(108) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorI4NodeEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(108)) #5 align 2

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

declare i32 @puts(ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSt16next_permutationIPcEbT_S1_(ptr noundef, ptr noundef) #7

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(108)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS4Node", !6, i64 0, !7, i64 4}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = !{i64 0, i64 4, !5, i64 4, i64 104, !9}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}
!24 = distinct !{!24, !11}
!25 = distinct !{!25, !11}
!26 = distinct !{!26, !11}


; 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"

%struct.Node = type { i32, [26 x i32] }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<Node, Node, std::_Identity<Node>, std::less<Node>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Node, Node, std::_Identity<Node>, std::less<Node>>::_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::set.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::_Identity<std::__cxx11::basic_string<char>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::_Identity<std::__cxx11::basic_string<char>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.6" = type { i8 }
%"class.std::reverse_iterator" = type { %"struct.std::_Rb_tree_const_iterator.11" }
%"struct.std::_Rb_tree_const_iterator.11" = type { ptr }

@a = external dso_local global [1001 x %struct.Node], align 16
@tmp = external dso_local global %struct.Node, align 4
@Hash = external dso_local global %"class.std::set", align 8
@_Z3AAAB5cxx11 = external dso_local global %"class.std::set.0", align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@str = external dso_local global [101 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator.6", align 1
  %3 = alloca %"class.std::reverse_iterator", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator.6", align 1
  %6 = alloca %"struct.std::_Rb_tree_const_iterator.11", align 8
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %8 = icmp eq i32 %7, 2
  br i1 %8, label %.lr.ph122, label %._crit_edge123

.lr.ph122:                                        ; preds = %0, %.critedge85
  call void @_ZNSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @_Z3AAAB5cxx11) #8
  %9 = load i32, ptr @m, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = mul nsw i64 %10, 108
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @a, i8 0, i64 %11, i1 false)
  %12 = icmp sgt i32 %9, 0
  br i1 %12, label %.lr.ph94, label %._crit_edge95

._crit_edge95:                                    ; preds = %25, %.lr.ph122
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(108) @tmp, i8 0, i64 108, i1 false)
  br label %37

.lr.ph94:                                         ; preds = %.lr.ph122, %25
  %indvars.iv124 = phi i64 [ %indvars.iv.next125, %25 ], [ 0, %.lr.ph122 ]
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @str)
  %14 = load i8, ptr @str, align 16, !tbaa !9
  %.not8090 = icmp eq i8 %14, 0
  br i1 %.not8090, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph94
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @str, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %23 unwind label %29

.lr.ph:                                           ; preds = %.lr.ph94, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph94 ]
  %15 = phi i8 [ %22, %.lr.ph ], [ %14, %.lr.ph94 ]
  %16 = sext i8 %15 to i64
  %17 = add nsw i64 %16, -65
  %18 = getelementptr inbounds [1001 x %struct.Node], ptr @a, i64 0, i64 %indvars.iv124, i32 1, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %18, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = getelementptr inbounds [101 x i8], ptr @str, i64 0, i64 %indvars.iv.next
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %.not80 = icmp eq i8 %22, 0
  br i1 %.not80, label %._crit_edge, label %.lr.ph, !llvm.loop !10

23:                                               ; preds = %._crit_edge
  %24 = invoke { ptr, i8 } @_ZNSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE6insertEOS5_(ptr noundef nonnull align 8 dereferenceable(48) @_Z3AAAB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %25 unwind label %31

25:                                               ; preds = %23
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next125, %27
  br i1 %28, label %.lr.ph94, label %._crit_edge95, !llvm.loop !12

29:                                               ; preds = %._crit_edge
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %33

31:                                               ; preds = %23
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  br label %33

33:                                               ; preds = %31, %29
  %.pn81 = phi { ptr, i32 } [ %32, %31 ], [ %30, %29 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  br label %305

.preheader89:                                     ; preds = %._crit_edge99
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = add nsw i32 %35, %34
  %.not154 = icmp slt i32 %44, %36
  br i1 %.not154, label %.preheader88, label %.lr.ph101

37:                                               ; preds = %._crit_edge95, %._crit_edge99
  %indvars.iv130 = phi i64 [ 0, %._crit_edge95 ], [ %indvars.iv.next131, %._crit_edge99 ]
  %38 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (i8, ptr @tmp, i64 4), i64 0, i64 %indvars.iv130
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %38, align 4, !tbaa !5
  store i32 0, ptr @tmp, align 4, !tbaa !13
  %41 = load i32, ptr @m, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %.lr.ph98, label %._crit_edge99

._crit_edge99:                                    ; preds = %53, %37
  %43 = call { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %44 = load i32, ptr @tot, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr @tot, align 4, !tbaa !5
  %46 = load i32, ptr %38, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  store i32 %47, ptr %38, align 4, !tbaa !5
  %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next131, 26
  br i1 %exitcond.not, label %.preheader89, label %37, !llvm.loop !15

.lr.ph98:                                         ; preds = %37, %53
  %indvars.iv127 = phi i64 [ %indvars.iv.next128, %53 ], [ 0, %37 ]
  %48 = getelementptr inbounds [1001 x %struct.Node], ptr @a, i64 0, i64 %indvars.iv127
  %49 = call noundef zeroext i1 @_ZNK4Node4haveERKS_(ptr noundef nonnull align 4 dereferenceable(108) %48, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  br i1 %49, label %50, label %53

50:                                               ; preds = %.lr.ph98
  %51 = load i32, ptr @tmp, align 4, !tbaa !13
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr @tmp, align 4, !tbaa !13
  br label %53

53:                                               ; preds = %.lr.ph98, %50
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %54 = load i32, ptr @m, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next128, %55
  br i1 %56, label %.lr.ph98, label %._crit_edge99, !llvm.loop !16

.preheader88:                                     ; preds = %.lr.ph101, %.preheader89
  %57 = phi i32 [ %34, %.preheader89 ], [ %62, %.lr.ph101 ]
  %.not117 = icmp slt i32 %57, 1
  br i1 %.not117, label %.critedge85, label %.lr.ph119

.lr.ph101:                                        ; preds = %.preheader89, %.lr.ph101
  %58 = call ptr @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %59 = call ptr @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS0_E(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr %58)
  %60 = load i32, ptr @tot, align 4, !tbaa !5
  %61 = add nsw i32 %60, -1
  store i32 %61, ptr @tot, align 4, !tbaa !5
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = load i32, ptr @m, align 4, !tbaa !5
  %64 = add nsw i32 %63, %62
  %65 = icmp sgt i32 %61, %64
  br i1 %65, label %.lr.ph101, label %.preheader88, !llvm.loop !17

.lr.ph119:                                        ; preds = %.preheader88, %._crit_edge116
  %.067118 = phi i32 [ %.3, %._crit_edge116 ], [ 1, %.preheader88 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %3, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %66 = call noundef nonnull align 4 dereferenceable(108) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorI4NodeEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(108) @tmp, ptr noundef nonnull align 4 dereferenceable(108) %66, i64 108, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %67 = call noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %68 = load i32, ptr @tot, align 4, !tbaa !5
  %69 = add nsw i32 %68, -1
  store i32 %69, ptr @tot, align 4, !tbaa !5
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 4), align 4, !tbaa !5
  %71 = icmp sgt i32 %70, 0
  br i1 %71, label %.lr.ph104, label %._crit_edge105

.lr.ph104:                                        ; preds = %.lr.ph119
  %72 = zext nneg i32 %70 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @str, i8 65, i64 %72, i1 false), !tbaa !9
  br label %._crit_edge105

._crit_edge105:                                   ; preds = %.lr.ph104, %.lr.ph119
  %.166.lcssa = phi i32 [ 0, %.lr.ph119 ], [ %70, %.lr.ph104 ]
  %73 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 8), align 4, !tbaa !5
  %74 = icmp sgt i32 %73, 0
  br i1 %74, label %.lr.ph104.1, label %._crit_edge105.1

.lr.ph104.1:                                      ; preds = %._crit_edge105
  %75 = zext nneg i32 %.166.lcssa to i64
  %scevgep.1 = getelementptr i8, ptr @str, i64 %75
  %76 = zext nneg i32 %73 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.1, i8 66, i64 %76, i1 false), !tbaa !9
  %77 = add nuw i32 %.166.lcssa, %73
  br label %._crit_edge105.1

._crit_edge105.1:                                 ; preds = %.lr.ph104.1, %._crit_edge105
  %.166.lcssa.1 = phi i32 [ %.166.lcssa, %._crit_edge105 ], [ %77, %.lr.ph104.1 ]
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 12), align 4, !tbaa !5
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %.lr.ph104.2, label %._crit_edge105.2

.lr.ph104.2:                                      ; preds = %._crit_edge105.1
  %80 = sext i32 %.166.lcssa.1 to i64
  %scevgep.2 = getelementptr i8, ptr @str, i64 %80
  %81 = zext nneg i32 %78 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.2, i8 67, i64 %81, i1 false), !tbaa !9
  %82 = add i32 %.166.lcssa.1, %78
  br label %._crit_edge105.2

._crit_edge105.2:                                 ; preds = %.lr.ph104.2, %._crit_edge105.1
  %.166.lcssa.2 = phi i32 [ %.166.lcssa.1, %._crit_edge105.1 ], [ %82, %.lr.ph104.2 ]
  %83 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 16), align 4, !tbaa !5
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.lr.ph104.3, label %._crit_edge105.3

.lr.ph104.3:                                      ; preds = %._crit_edge105.2
  %85 = sext i32 %.166.lcssa.2 to i64
  %scevgep.3 = getelementptr i8, ptr @str, i64 %85
  %86 = zext nneg i32 %83 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.3, i8 68, i64 %86, i1 false), !tbaa !9
  %87 = add i32 %.166.lcssa.2, %83
  br label %._crit_edge105.3

._crit_edge105.3:                                 ; preds = %.lr.ph104.3, %._crit_edge105.2
  %.166.lcssa.3 = phi i32 [ %.166.lcssa.2, %._crit_edge105.2 ], [ %87, %.lr.ph104.3 ]
  %88 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 20), align 4, !tbaa !5
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph104.4, label %._crit_edge105.4

.lr.ph104.4:                                      ; preds = %._crit_edge105.3
  %90 = sext i32 %.166.lcssa.3 to i64
  %scevgep.4 = getelementptr i8, ptr @str, i64 %90
  %91 = zext nneg i32 %88 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.4, i8 69, i64 %91, i1 false), !tbaa !9
  %92 = add i32 %.166.lcssa.3, %88
  br label %._crit_edge105.4

._crit_edge105.4:                                 ; preds = %.lr.ph104.4, %._crit_edge105.3
  %.166.lcssa.4 = phi i32 [ %.166.lcssa.3, %._crit_edge105.3 ], [ %92, %.lr.ph104.4 ]
  %93 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 24), align 4, !tbaa !5
  %94 = icmp sgt i32 %93, 0
  br i1 %94, label %.lr.ph104.5, label %._crit_edge105.5

.lr.ph104.5:                                      ; preds = %._crit_edge105.4
  %95 = sext i32 %.166.lcssa.4 to i64
  %scevgep.5 = getelementptr i8, ptr @str, i64 %95
  %96 = zext nneg i32 %93 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.5, i8 70, i64 %96, i1 false), !tbaa !9
  %97 = add i32 %.166.lcssa.4, %93
  br label %._crit_edge105.5

._crit_edge105.5:                                 ; preds = %.lr.ph104.5, %._crit_edge105.4
  %.166.lcssa.5 = phi i32 [ %.166.lcssa.4, %._crit_edge105.4 ], [ %97, %.lr.ph104.5 ]
  %98 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 28), align 4, !tbaa !5
  %99 = icmp sgt i32 %98, 0
  br i1 %99, label %.lr.ph104.6, label %._crit_edge105.6

.lr.ph104.6:                                      ; preds = %._crit_edge105.5
  %100 = sext i32 %.166.lcssa.5 to i64
  %scevgep.6 = getelementptr i8, ptr @str, i64 %100
  %101 = zext nneg i32 %98 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.6, i8 71, i64 %101, i1 false), !tbaa !9
  %102 = add i32 %.166.lcssa.5, %98
  br label %._crit_edge105.6

._crit_edge105.6:                                 ; preds = %.lr.ph104.6, %._crit_edge105.5
  %.166.lcssa.6 = phi i32 [ %.166.lcssa.5, %._crit_edge105.5 ], [ %102, %.lr.ph104.6 ]
  %103 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 32), align 4, !tbaa !5
  %104 = icmp sgt i32 %103, 0
  br i1 %104, label %.lr.ph104.7, label %._crit_edge105.7

.lr.ph104.7:                                      ; preds = %._crit_edge105.6
  %105 = sext i32 %.166.lcssa.6 to i64
  %scevgep.7 = getelementptr i8, ptr @str, i64 %105
  %106 = zext nneg i32 %103 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.7, i8 72, i64 %106, i1 false), !tbaa !9
  %107 = add i32 %.166.lcssa.6, %103
  br label %._crit_edge105.7

._crit_edge105.7:                                 ; preds = %.lr.ph104.7, %._crit_edge105.6
  %.166.lcssa.7 = phi i32 [ %.166.lcssa.6, %._crit_edge105.6 ], [ %107, %.lr.ph104.7 ]
  %108 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 36), align 4, !tbaa !5
  %109 = icmp sgt i32 %108, 0
  br i1 %109, label %.lr.ph104.8, label %._crit_edge105.8

.lr.ph104.8:                                      ; preds = %._crit_edge105.7
  %110 = sext i32 %.166.lcssa.7 to i64
  %scevgep.8 = getelementptr i8, ptr @str, i64 %110
  %111 = zext nneg i32 %108 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.8, i8 73, i64 %111, i1 false), !tbaa !9
  %112 = add i32 %.166.lcssa.7, %108
  br label %._crit_edge105.8

._crit_edge105.8:                                 ; preds = %.lr.ph104.8, %._crit_edge105.7
  %.166.lcssa.8 = phi i32 [ %.166.lcssa.7, %._crit_edge105.7 ], [ %112, %.lr.ph104.8 ]
  %113 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 40), align 4, !tbaa !5
  %114 = icmp sgt i32 %113, 0
  br i1 %114, label %.lr.ph104.9, label %._crit_edge105.9

.lr.ph104.9:                                      ; preds = %._crit_edge105.8
  %115 = sext i32 %.166.lcssa.8 to i64
  %scevgep.9 = getelementptr i8, ptr @str, i64 %115
  %116 = zext nneg i32 %113 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.9, i8 74, i64 %116, i1 false), !tbaa !9
  %117 = add i32 %.166.lcssa.8, %113
  br label %._crit_edge105.9

._crit_edge105.9:                                 ; preds = %.lr.ph104.9, %._crit_edge105.8
  %.166.lcssa.9 = phi i32 [ %.166.lcssa.8, %._crit_edge105.8 ], [ %117, %.lr.ph104.9 ]
  %118 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 44), align 4, !tbaa !5
  %119 = icmp sgt i32 %118, 0
  br i1 %119, label %.lr.ph104.10, label %._crit_edge105.10

.lr.ph104.10:                                     ; preds = %._crit_edge105.9
  %120 = sext i32 %.166.lcssa.9 to i64
  %scevgep.10 = getelementptr i8, ptr @str, i64 %120
  %121 = zext nneg i32 %118 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.10, i8 75, i64 %121, i1 false), !tbaa !9
  %122 = add i32 %.166.lcssa.9, %118
  br label %._crit_edge105.10

._crit_edge105.10:                                ; preds = %.lr.ph104.10, %._crit_edge105.9
  %.166.lcssa.10 = phi i32 [ %.166.lcssa.9, %._crit_edge105.9 ], [ %122, %.lr.ph104.10 ]
  %123 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 48), align 4, !tbaa !5
  %124 = icmp sgt i32 %123, 0
  br i1 %124, label %.lr.ph104.11, label %._crit_edge105.11

.lr.ph104.11:                                     ; preds = %._crit_edge105.10
  %125 = sext i32 %.166.lcssa.10 to i64
  %scevgep.11 = getelementptr i8, ptr @str, i64 %125
  %126 = zext nneg i32 %123 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.11, i8 76, i64 %126, i1 false), !tbaa !9
  %127 = add i32 %.166.lcssa.10, %123
  br label %._crit_edge105.11

._crit_edge105.11:                                ; preds = %.lr.ph104.11, %._crit_edge105.10
  %.166.lcssa.11 = phi i32 [ %.166.lcssa.10, %._crit_edge105.10 ], [ %127, %.lr.ph104.11 ]
  %128 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 52), align 4, !tbaa !5
  %129 = icmp sgt i32 %128, 0
  br i1 %129, label %.lr.ph104.12, label %._crit_edge105.12

.lr.ph104.12:                                     ; preds = %._crit_edge105.11
  %130 = sext i32 %.166.lcssa.11 to i64
  %scevgep.12 = getelementptr i8, ptr @str, i64 %130
  %131 = zext nneg i32 %128 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.12, i8 77, i64 %131, i1 false), !tbaa !9
  %132 = add i32 %.166.lcssa.11, %128
  br label %._crit_edge105.12

._crit_edge105.12:                                ; preds = %.lr.ph104.12, %._crit_edge105.11
  %.166.lcssa.12 = phi i32 [ %.166.lcssa.11, %._crit_edge105.11 ], [ %132, %.lr.ph104.12 ]
  %133 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 56), align 4, !tbaa !5
  %134 = icmp sgt i32 %133, 0
  br i1 %134, label %.lr.ph104.13, label %._crit_edge105.13

.lr.ph104.13:                                     ; preds = %._crit_edge105.12
  %135 = sext i32 %.166.lcssa.12 to i64
  %scevgep.13 = getelementptr i8, ptr @str, i64 %135
  %136 = zext nneg i32 %133 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.13, i8 78, i64 %136, i1 false), !tbaa !9
  %137 = add i32 %.166.lcssa.12, %133
  br label %._crit_edge105.13

._crit_edge105.13:                                ; preds = %.lr.ph104.13, %._crit_edge105.12
  %.166.lcssa.13 = phi i32 [ %.166.lcssa.12, %._crit_edge105.12 ], [ %137, %.lr.ph104.13 ]
  %138 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 60), align 4, !tbaa !5
  %139 = icmp sgt i32 %138, 0
  br i1 %139, label %.lr.ph104.14, label %._crit_edge105.14

.lr.ph104.14:                                     ; preds = %._crit_edge105.13
  %140 = sext i32 %.166.lcssa.13 to i64
  %scevgep.14 = getelementptr i8, ptr @str, i64 %140
  %141 = zext nneg i32 %138 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.14, i8 79, i64 %141, i1 false), !tbaa !9
  %142 = add i32 %.166.lcssa.13, %138
  br label %._crit_edge105.14

._crit_edge105.14:                                ; preds = %.lr.ph104.14, %._crit_edge105.13
  %.166.lcssa.14 = phi i32 [ %.166.lcssa.13, %._crit_edge105.13 ], [ %142, %.lr.ph104.14 ]
  %143 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 64), align 4, !tbaa !5
  %144 = icmp sgt i32 %143, 0
  br i1 %144, label %.lr.ph104.15, label %._crit_edge105.15

.lr.ph104.15:                                     ; preds = %._crit_edge105.14
  %145 = sext i32 %.166.lcssa.14 to i64
  %scevgep.15 = getelementptr i8, ptr @str, i64 %145
  %146 = zext nneg i32 %143 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.15, i8 80, i64 %146, i1 false), !tbaa !9
  %147 = add i32 %.166.lcssa.14, %143
  br label %._crit_edge105.15

._crit_edge105.15:                                ; preds = %.lr.ph104.15, %._crit_edge105.14
  %.166.lcssa.15 = phi i32 [ %.166.lcssa.14, %._crit_edge105.14 ], [ %147, %.lr.ph104.15 ]
  %148 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 68), align 4, !tbaa !5
  %149 = icmp sgt i32 %148, 0
  br i1 %149, label %.lr.ph104.16, label %._crit_edge105.16

.lr.ph104.16:                                     ; preds = %._crit_edge105.15
  %150 = sext i32 %.166.lcssa.15 to i64
  %scevgep.16 = getelementptr i8, ptr @str, i64 %150
  %151 = zext nneg i32 %148 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.16, i8 81, i64 %151, i1 false), !tbaa !9
  %152 = add i32 %.166.lcssa.15, %148
  br label %._crit_edge105.16

._crit_edge105.16:                                ; preds = %.lr.ph104.16, %._crit_edge105.15
  %.166.lcssa.16 = phi i32 [ %.166.lcssa.15, %._crit_edge105.15 ], [ %152, %.lr.ph104.16 ]
  %153 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 72), align 4, !tbaa !5
  %154 = icmp sgt i32 %153, 0
  br i1 %154, label %.lr.ph104.17, label %._crit_edge105.17

.lr.ph104.17:                                     ; preds = %._crit_edge105.16
  %155 = sext i32 %.166.lcssa.16 to i64
  %scevgep.17 = getelementptr i8, ptr @str, i64 %155
  %156 = zext nneg i32 %153 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.17, i8 82, i64 %156, i1 false), !tbaa !9
  %157 = add i32 %.166.lcssa.16, %153
  br label %._crit_edge105.17

._crit_edge105.17:                                ; preds = %.lr.ph104.17, %._crit_edge105.16
  %.166.lcssa.17 = phi i32 [ %.166.lcssa.16, %._crit_edge105.16 ], [ %157, %.lr.ph104.17 ]
  %158 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 76), align 4, !tbaa !5
  %159 = icmp sgt i32 %158, 0
  br i1 %159, label %.lr.ph104.18, label %._crit_edge105.18

.lr.ph104.18:                                     ; preds = %._crit_edge105.17
  %160 = sext i32 %.166.lcssa.17 to i64
  %scevgep.18 = getelementptr i8, ptr @str, i64 %160
  %161 = zext nneg i32 %158 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.18, i8 83, i64 %161, i1 false), !tbaa !9
  %162 = add i32 %.166.lcssa.17, %158
  br label %._crit_edge105.18

._crit_edge105.18:                                ; preds = %.lr.ph104.18, %._crit_edge105.17
  %.166.lcssa.18 = phi i32 [ %.166.lcssa.17, %._crit_edge105.17 ], [ %162, %.lr.ph104.18 ]
  %163 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 80), align 4, !tbaa !5
  %164 = icmp sgt i32 %163, 0
  br i1 %164, label %.lr.ph104.19, label %._crit_edge105.19

.lr.ph104.19:                                     ; preds = %._crit_edge105.18
  %165 = sext i32 %.166.lcssa.18 to i64
  %scevgep.19 = getelementptr i8, ptr @str, i64 %165
  %166 = zext nneg i32 %163 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.19, i8 84, i64 %166, i1 false), !tbaa !9
  %167 = add i32 %.166.lcssa.18, %163
  br label %._crit_edge105.19

._crit_edge105.19:                                ; preds = %.lr.ph104.19, %._crit_edge105.18
  %.166.lcssa.19 = phi i32 [ %.166.lcssa.18, %._crit_edge105.18 ], [ %167, %.lr.ph104.19 ]
  %168 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 84), align 4, !tbaa !5
  %169 = icmp sgt i32 %168, 0
  br i1 %169, label %.lr.ph104.20, label %._crit_edge105.20

.lr.ph104.20:                                     ; preds = %._crit_edge105.19
  %170 = sext i32 %.166.lcssa.19 to i64
  %scevgep.20 = getelementptr i8, ptr @str, i64 %170
  %171 = zext nneg i32 %168 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.20, i8 85, i64 %171, i1 false), !tbaa !9
  %172 = add i32 %.166.lcssa.19, %168
  br label %._crit_edge105.20

._crit_edge105.20:                                ; preds = %.lr.ph104.20, %._crit_edge105.19
  %.166.lcssa.20 = phi i32 [ %.166.lcssa.19, %._crit_edge105.19 ], [ %172, %.lr.ph104.20 ]
  %173 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 88), align 4, !tbaa !5
  %174 = icmp sgt i32 %173, 0
  br i1 %174, label %.lr.ph104.21, label %._crit_edge105.21

.lr.ph104.21:                                     ; preds = %._crit_edge105.20
  %175 = sext i32 %.166.lcssa.20 to i64
  %scevgep.21 = getelementptr i8, ptr @str, i64 %175
  %176 = zext nneg i32 %173 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.21, i8 86, i64 %176, i1 false), !tbaa !9
  %177 = add i32 %.166.lcssa.20, %173
  br label %._crit_edge105.21

._crit_edge105.21:                                ; preds = %.lr.ph104.21, %._crit_edge105.20
  %.166.lcssa.21 = phi i32 [ %.166.lcssa.20, %._crit_edge105.20 ], [ %177, %.lr.ph104.21 ]
  %178 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 92), align 4, !tbaa !5
  %179 = icmp sgt i32 %178, 0
  br i1 %179, label %.lr.ph104.22, label %._crit_edge105.22

.lr.ph104.22:                                     ; preds = %._crit_edge105.21
  %180 = sext i32 %.166.lcssa.21 to i64
  %scevgep.22 = getelementptr i8, ptr @str, i64 %180
  %181 = zext nneg i32 %178 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.22, i8 87, i64 %181, i1 false), !tbaa !9
  %182 = add i32 %.166.lcssa.21, %178
  br label %._crit_edge105.22

._crit_edge105.22:                                ; preds = %.lr.ph104.22, %._crit_edge105.21
  %.166.lcssa.22 = phi i32 [ %.166.lcssa.21, %._crit_edge105.21 ], [ %182, %.lr.ph104.22 ]
  %183 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 96), align 4, !tbaa !5
  %184 = icmp sgt i32 %183, 0
  br i1 %184, label %.lr.ph104.23, label %._crit_edge105.23

.lr.ph104.23:                                     ; preds = %._crit_edge105.22
  %185 = sext i32 %.166.lcssa.22 to i64
  %scevgep.23 = getelementptr i8, ptr @str, i64 %185
  %186 = zext nneg i32 %183 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.23, i8 88, i64 %186, i1 false), !tbaa !9
  %187 = add i32 %.166.lcssa.22, %183
  br label %._crit_edge105.23

._crit_edge105.23:                                ; preds = %.lr.ph104.23, %._crit_edge105.22
  %.166.lcssa.23 = phi i32 [ %.166.lcssa.22, %._crit_edge105.22 ], [ %187, %.lr.ph104.23 ]
  %188 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 100), align 4, !tbaa !5
  %189 = icmp sgt i32 %188, 0
  br i1 %189, label %.lr.ph104.24, label %._crit_edge105.24

.lr.ph104.24:                                     ; preds = %._crit_edge105.23
  %190 = sext i32 %.166.lcssa.23 to i64
  %scevgep.24 = getelementptr i8, ptr @str, i64 %190
  %191 = zext nneg i32 %188 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.24, i8 89, i64 %191, i1 false), !tbaa !9
  %192 = add i32 %.166.lcssa.23, %188
  br label %._crit_edge105.24

._crit_edge105.24:                                ; preds = %.lr.ph104.24, %._crit_edge105.23
  %.166.lcssa.24 = phi i32 [ %.166.lcssa.23, %._crit_edge105.23 ], [ %192, %.lr.ph104.24 ]
  %193 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 104), align 4, !tbaa !5
  %194 = icmp sgt i32 %193, 0
  br i1 %194, label %.lr.ph104.25, label %._crit_edge105.25

.lr.ph104.25:                                     ; preds = %._crit_edge105.24
  %195 = sext i32 %.166.lcssa.24 to i64
  %scevgep.25 = getelementptr i8, ptr @str, i64 %195
  %196 = zext nneg i32 %193 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %scevgep.25, i8 90, i64 %196, i1 false), !tbaa !9
  %197 = add i32 %.166.lcssa.24, %193
  br label %._crit_edge105.25

._crit_edge105.25:                                ; preds = %.lr.ph104.25, %._crit_edge105.24
  %.166.lcssa.25 = phi i32 [ %.166.lcssa.24, %._crit_edge105.24 ], [ %197, %.lr.ph104.25 ]
  %198 = sext i32 %.166.lcssa.25 to i64
  %199 = getelementptr inbounds [101 x i8], ptr @str, i64 0, i64 %198
  store i8 0, ptr %199, align 1, !tbaa !9
  br label %200

200:                                              ; preds = %214, %._crit_edge105.25
  %.168 = phi i32 [ %.067118, %._crit_edge105.25 ], [ %.269, %214 ]
  %201 = load i32, ptr @n, align 4, !tbaa !5
  %.not74 = icmp sgt i32 %.168, %201
  br i1 %.not74, label %split, label %202

202:                                              ; preds = %200
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @str, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %203 unwind label %209

203:                                              ; preds = %202
  %204 = invoke noundef i64 @_ZNKSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE5countERKS5_(ptr noundef nonnull align 8 dereferenceable(48) @_Z3AAAB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %205 unwind label %211

205:                                              ; preds = %203
  %.not76 = icmp eq i64 %204, 0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  br i1 %.not76, label %206, label %214

206:                                              ; preds = %205
  %207 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @str)
  %208 = add nsw i32 %.168, 1
  br label %214

209:                                              ; preds = %202
  %210 = landingpad { ptr, i32 }
          cleanup
  br label %213

211:                                              ; preds = %203
  %212 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  br label %213

213:                                              ; preds = %211, %209
  %.pn = phi { ptr, i32 } [ %212, %211 ], [ %210, %209 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  br label %305

214:                                              ; preds = %206, %205
  %.269 = phi i32 [ %208, %206 ], [ %.168, %205 ]
  %215 = call noundef zeroext i1 @_ZSt16next_permutationIPcEbT_S1_(ptr noundef nonnull @str, ptr noundef nonnull %199)
  br i1 %215, label %200, label %._crit_edge152, !llvm.loop !19

._crit_edge152:                                   ; preds = %214
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %split

split:                                            ; preds = %200, %._crit_edge152
  %216 = phi i32 [ %.pre, %._crit_edge152 ], [ %201, %200 ]
  %.3 = phi i32 [ %.269, %._crit_edge152 ], [ %.168, %200 ]
  %.not79 = icmp sgt i32 %.3, %216
  br i1 %.not79, label %.critedge85, label %.lr.ph115.preheader

.lr.ph115.preheader:                              ; preds = %split
  %217 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 104), align 4, !tbaa !5
  %.not78.25 = icmp eq i32 %217, 0
  %218 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 100), align 4, !tbaa !5
  %.not78.24 = icmp eq i32 %218, 0
  %219 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 96), align 4, !tbaa !5
  %.not78.23 = icmp eq i32 %219, 0
  %220 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 92), align 4, !tbaa !5
  %.not78.22 = icmp eq i32 %220, 0
  %221 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 88), align 4, !tbaa !5
  %.not78.21 = icmp eq i32 %221, 0
  %222 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 84), align 4, !tbaa !5
  %.not78.20 = icmp eq i32 %222, 0
  %223 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 80), align 4, !tbaa !5
  %.not78.19 = icmp eq i32 %223, 0
  %224 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 76), align 4, !tbaa !5
  %.not78.18 = icmp eq i32 %224, 0
  %225 = load <16 x i32>, ptr getelementptr inbounds (i8, ptr @tmp, i64 12), align 4, !tbaa !5
  %226 = icmp eq <16 x i32> %225, zeroinitializer
  %227 = load i32, ptr getelementptr inbounds (i8, ptr @tmp, i64 8), align 4, !tbaa !5
  %.not78.1 = icmp ne i32 %227, 0
  %spec.select.1 = zext i1 %.not78.1 to i64
  %228 = extractelement <16 x i1> %226, i64 0
  %spec.select.2 = select i1 %228, i64 %spec.select.1, i64 2
  %229 = extractelement <16 x i1> %226, i64 1
  %spec.select.3 = select i1 %229, i64 %spec.select.2, i64 3
  %230 = extractelement <16 x i1> %226, i64 2
  %spec.select.4 = select i1 %230, i64 %spec.select.3, i64 4
  %231 = extractelement <16 x i1> %226, i64 3
  %spec.select.5 = select i1 %231, i64 %spec.select.4, i64 5
  %232 = extractelement <16 x i1> %226, i64 4
  %233 = select i1 %232, i64 %spec.select.5, i64 6
  %234 = extractelement <16 x i1> %226, i64 5
  %235 = select i1 %234, i64 %233, i64 7
  %236 = extractelement <16 x i1> %226, i64 6
  %237 = select i1 %236, i64 %235, i64 8
  %238 = extractelement <16 x i1> %226, i64 7
  %239 = select i1 %238, i64 %237, i64 9
  %240 = extractelement <16 x i1> %226, i64 8
  %241 = select i1 %240, i64 %239, i64 10
  %242 = extractelement <16 x i1> %226, i64 9
  %243 = select i1 %242, i64 %241, i64 11
  %244 = extractelement <16 x i1> %226, i64 10
  %245 = select i1 %244, i64 %243, i64 12
  %246 = extractelement <16 x i1> %226, i64 11
  %247 = select i1 %246, i64 %245, i64 13
  %248 = extractelement <16 x i1> %226, i64 12
  %249 = select i1 %248, i64 %247, i64 14
  %250 = extractelement <16 x i1> %226, i64 13
  %251 = select i1 %250, i64 %249, i64 15
  %252 = extractelement <16 x i1> %226, i64 14
  %253 = select i1 %252, i64 %251, i64 16
  %254 = extractelement <16 x i1> %226, i64 15
  %255 = select i1 %254, i64 %253, i64 17
  %256 = select i1 %.not78.18, i64 %255, i64 18
  %257 = select i1 %.not78.19, i64 %256, i64 19
  %258 = select i1 %.not78.20, i64 %257, i64 20
  %259 = select i1 %.not78.21, i64 %258, i64 21
  %260 = select i1 %.not78.22, i64 %259, i64 22
  %261 = select i1 %.not78.23, i64 %260, i64 23
  %262 = select i1 %.not78.24, i64 %261, i64 24
  %263 = select i1 %.not78.25, i64 %262, i64 25
  br label %.lr.ph115

.lr.ph115:                                        ; preds = %.lr.ph115.preheader, %301
  %indvars.iv148 = phi i64 [ %263, %.lr.ph115.preheader ], [ %indvars.iv.next149, %301 ]
  %264 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds (i8, ptr @tmp, i64 4), i64 0, i64 %indvars.iv148
  %265 = load i32, ptr %264, align 4, !tbaa !5
  %266 = add nsw i32 %265, 1
  store i32 %266, ptr %264, align 4, !tbaa !5
  store i32 0, ptr @tmp, align 4, !tbaa !13
  %267 = load i32, ptr @m, align 4, !tbaa !5
  %268 = icmp sgt i32 %267, 0
  br i1 %268, label %.lr.ph112, label %._crit_edge113

._crit_edge113:                                   ; preds = %275, %.lr.ph115
  %269 = call noundef i64 @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %.not77 = icmp eq i64 %269, 0
  br i1 %.not77, label %279, label %301

.lr.ph112:                                        ; preds = %.lr.ph115, %275
  %indvars.iv145 = phi i64 [ %indvars.iv.next146, %275 ], [ 0, %.lr.ph115 ]
  %270 = getelementptr inbounds [1001 x %struct.Node], ptr @a, i64 0, i64 %indvars.iv145
  %271 = call noundef zeroext i1 @_ZNK4Node4haveERKS_(ptr noundef nonnull align 4 dereferenceable(108) %270, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  br i1 %271, label %272, label %275

272:                                              ; preds = %.lr.ph112
  %273 = load i32, ptr @tmp, align 4, !tbaa !13
  %274 = add nsw i32 %273, 1
  store i32 %274, ptr @tmp, align 4, !tbaa !13
  br label %275

275:                                              ; preds = %.lr.ph112, %272
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %276 = load i32, ptr @m, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = icmp slt i64 %indvars.iv.next146, %277
  br i1 %278, label %.lr.ph112, label %._crit_edge113, !llvm.loop !20

279:                                              ; preds = %._crit_edge113
  %280 = load i32, ptr @tot, align 4, !tbaa !5
  %281 = load i32, ptr @n, align 4, !tbaa !5
  %282 = load i32, ptr @m, align 4, !tbaa !5
  %283 = add nsw i32 %282, %281
  %284 = icmp slt i32 %280, %283
  br i1 %284, label %285, label %289

285:                                              ; preds = %279
  %286 = call { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  %287 = load i32, ptr @tot, align 4, !tbaa !5
  %288 = add nsw i32 %287, 1
  store i32 %288, ptr @tot, align 4, !tbaa !5
  br label %301

289:                                              ; preds = %279
  %290 = icmp eq i32 %280, %283
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  br i1 %290, label %291, label %.critedge

291:                                              ; preds = %289
  %292 = call ptr @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  store ptr %292, ptr %6, align 8
  %293 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI4NodeEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %294 = load i32, ptr %293, align 4, !tbaa !13
  %295 = load i32, ptr @tmp, align 4, !tbaa !13
  %296 = icmp slt i32 %294, %295
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  br i1 %296, label %297, label %301

297:                                              ; preds = %291
  %298 = call ptr @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %299 = call ptr @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS0_E(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr %298)
  %300 = call { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(108) @tmp)
  br label %301

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

301:                                              ; preds = %285, %.critedge, %297, %291, %._crit_edge113
  %storemerge.in = load i32, ptr %264, align 4, !tbaa !5
  %storemerge = add nsw i32 %storemerge.in, -1
  store i32 %storemerge, ptr %264, align 4, !tbaa !5
  %indvars.iv.next149 = add nsw i64 %indvars.iv148, 1
  %302 = and i64 %indvars.iv.next149, 4294967295
  %exitcond151.not = icmp eq i64 %302, 26
  br i1 %exitcond151.not, label %._crit_edge116, label %.lr.ph115, !llvm.loop !21

._crit_edge116:                                   ; preds = %301
  %.pre153 = load i32, ptr @n, align 4, !tbaa !5
  %.not = icmp sgt i32 %.3, %.pre153
  br i1 %.not, label %.critedge85, label %.lr.ph119

.critedge85:                                      ; preds = %._crit_edge116, %split, %.preheader88
  %303 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %304 = icmp eq i32 %303, 2
  br i1 %304, label %.lr.ph122, label %._crit_edge123, !llvm.loop !22

._crit_edge123:                                   ; preds = %.critedge85, %0
  ret i32 0

305:                                              ; preds = %213, %33
  %.pn81.pn = phi { ptr, i32 } [ %.pn81, %33 ], [ %.pn, %213 ]
  resume { ptr, i32 } %.pn81.pn
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIS5_ESaIS5_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Node4haveERKS_(ptr noundef nonnull align 4 dereferenceable(108), ptr noundef nonnull align 4 dereferenceable(108)) local_unnamed_addr #3 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(108) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorI4NodeEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(108)) local_unnamed_addr #5 align 2

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSt16next_permutationIPcEbT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(108)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nofree nounwind "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 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS4Node", !6, i64 0, !7, i64 4}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = !{i64 0, i64 4, !5, i64 4, i64 104, !9}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}


; Effective O3 passes: ConstraintEliminationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass