; LLVM IR from tangjz/acm-icpc :: lydsy (1908)

; 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::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" }
%"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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 }
%struct.Node = type { i32 }
%"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" }
%"struct.std::_List_const_iterator" = type { ptr }
%"struct.std::_List_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@rt = external dso_local global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@c = external dso_local global [1001 x i32], align 16
@fa = external dso_local global [1001 x i32], align 16
@dsu = external dso_local global [1001 x i32], align 16
@_Z3seqB5cxx11 = external dso_local global [1001 x %"class.std::__cxx11::list"], align 16
@e = external dso_local global [1001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx1110_List_baseIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) #1

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

26:                                               ; preds = %254, %0
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @rt)
  %28 = icmp eq i32 %27, 2
  br i1 %28, label %29, label %39

29:                                               ; preds = %26
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %36, label %32

32:                                               ; preds = %29
  %33 = load i32, ptr @rt, align 4, !tbaa !5
  %34 = icmp ne i32 %33, 0
  %35 = xor i1 %34, true
  br label %36

36:                                               ; preds = %32, %29
  %37 = phi i1 [ false, %29 ], [ %35, %32 ]
  %38 = xor i1 %37, true
  br label %39

39:                                               ; preds = %36, %26
  %40 = phi i1 [ false, %26 ], [ %38, %36 ]
  br i1 %40, label %41, label %260

41:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #6
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %97, %41
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %101

47:                                               ; preds = %42
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr @a, i64 %49
  %51 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %50)
          to label %52 unwind label %88

52:                                               ; preds = %47
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1001 x i32], ptr @c, i64 0, i64 %58
  store i32 %56, ptr %59, align 4, !tbaa !5
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %61
  store i32 -1, ptr %62, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #6
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 24, i1 false)
  call void @_ZNSt7__cxx114listIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %64
  call void @_ZNSt7__cxx114listIiSaIiEE4swapERS2_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %65) #6
  call void @_ZNSt7__cxx1110_List_baseIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #6
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %67
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %70
  invoke void @_ZNSt7__cxx114listIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 4 dereferenceable(4) %71)
          to label %72 unwind label %88

72:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #6
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1001 x %"class.std::vector"], ptr @e, i64 0, i64 %74
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %75) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #6
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = load i32, ptr @rt, align 4, !tbaa !5
  %78 = icmp ne i32 %76, %77
  br i1 %78, label %79, label %96

79:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %80 = getelementptr inbounds %struct.Node, ptr %8, i32 0, i32 0
  %81 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %81, ptr %80, align 4, !tbaa !9
  %82 = invoke { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %83 unwind label %92

83:                                               ; preds = %79
  %84 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %85 = extractvalue { ptr, i8 } %82, 0
  store ptr %85, ptr %84, align 8
  %86 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %87 = extractvalue { ptr, i8 } %82, 1
  store i8 %87, ptr %86, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %96

88:                                               ; preds = %52, %47
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %4, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %5, align 4
  br label %100

92:                                               ; preds = %79
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %4, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %100

96:                                               ; preds = %83, %72
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %3, align 4, !tbaa !5
  br label %42, !llvm.loop !11

100:                                              ; preds = %92, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %259

101:                                              ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %118, %101
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %125

107:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %108 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %11, ptr noundef %12)
          to label %109 unwind label %121

109:                                              ; preds = %107
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1001 x %"class.std::vector"], ptr @e, i64 0, i64 %111
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %112, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %113 unwind label %121

113:                                              ; preds = %109
  %114 = load i32, ptr %12, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1001 x %"class.std::vector"], ptr @e, i64 0, i64 %115
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %116, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %117 unwind label %121

117:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %10, align 4, !tbaa !5
  br label %102, !llvm.loop !13

121:                                              ; preds = %113, %109, %107
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %4, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %259

125:                                              ; preds = %106
  %126 = load i32, ptr @rt, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %127
  store i32 0, ptr %128, align 4, !tbaa !5
  %129 = load i32, ptr @rt, align 4, !tbaa !5
  invoke void @_Z3dfsi(i32 noundef %129)
          to label %130 unwind label %136

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %223, %130
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = load i32, ptr @n, align 4, !tbaa !5
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %140, label %135

135:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %228

136:                                              ; preds = %125
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %4, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %5, align 4
  br label %259

140:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %15, ptr noundef nonnull align 8 dereferenceable(48) %2) #6
  %141 = invoke noundef ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorI4NodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %142 unwind label %163

142:                                              ; preds = %140
  %143 = getelementptr inbounds %struct.Node, ptr %141, i32 0, i32 0
  %144 = load i32, ptr %143, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  store i32 %144, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %145 = getelementptr inbounds %struct.Node, ptr %16, i32 0, i32 0
  %146 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %146, ptr %145, align 4, !tbaa !9
  %147 = invoke noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %148 unwind label %167

148:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %149 = load i32, ptr %14, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = invoke noundef i32 @_Z8dsu_findi(i32 noundef %152)
          to label %154 unwind label %171

154:                                              ; preds = %148
  store i32 %153, ptr %17, align 4, !tbaa !5
  %155 = load i32, ptr %17, align 4, !tbaa !5
  %156 = load i32, ptr @rt, align 4, !tbaa !5
  %157 = icmp ne i32 %155, %156
  br i1 %157, label %158, label %179

158:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %159 = getelementptr inbounds %struct.Node, ptr %18, i32 0, i32 0
  %160 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %160, ptr %159, align 4, !tbaa !9
  %161 = invoke noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %18)
          to label %162 unwind label %175

162:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %179

163:                                              ; preds = %140
  %164 = landingpad { ptr, i32 }
          cleanup
  %165 = extractvalue { ptr, i32 } %164, 0
  store ptr %165, ptr %4, align 8
  %166 = extractvalue { ptr, i32 } %164, 1
  store i32 %166, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %227

167:                                              ; preds = %142
  %168 = landingpad { ptr, i32 }
          cleanup
  %169 = extractvalue { ptr, i32 } %168, 0
  store ptr %169, ptr %4, align 8
  %170 = extractvalue { ptr, i32 } %168, 1
  store i32 %170, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %227

171:                                              ; preds = %148
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %4, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %5, align 4
  br label %226

175:                                              ; preds = %158
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %4, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %226

179:                                              ; preds = %162, %154
  %180 = load i32, ptr %17, align 4, !tbaa !5
  %181 = load i32, ptr %14, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %182
  store i32 %180, ptr %183, align 4, !tbaa !5
  %184 = load i32, ptr %14, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1001 x i32], ptr @c, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = load i32, ptr %17, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [1001 x i32], ptr @c, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = add nsw i32 %191, %187
  store i32 %192, ptr %190, align 4, !tbaa !5
  %193 = load i32, ptr %17, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %194
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %196 = load i32, ptr %17, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %197
  %199 = call ptr @_ZNSt7__cxx114listIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %198) #6
  %200 = getelementptr inbounds %"struct.std::_List_iterator", ptr %20, i32 0, i32 0
  store ptr %199, ptr %200, align 8
  call void @_ZNSt20_List_const_iteratorIiEC2ERKSt14_List_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  %201 = load i32, ptr %14, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %202
  %204 = getelementptr inbounds %"struct.std::_List_const_iterator", ptr %19, i32 0, i32 0
  %205 = load ptr, ptr %204, align 8
  call void @_ZNSt7__cxx114listIiSaIiEE6spliceESt20_List_const_iteratorIiERS2_(ptr noundef nonnull align 8 dereferenceable(24) %195, ptr %205, ptr noundef nonnull align 8 dereferenceable(24) %203) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  %206 = load i32, ptr %17, align 4, !tbaa !5
  %207 = load i32, ptr @rt, align 4, !tbaa !5
  %208 = icmp ne i32 %206, %207
  br i1 %208, label %209, label %222

209:                                              ; preds = %179
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %210 = getelementptr inbounds %struct.Node, ptr %21, i32 0, i32 0
  %211 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %211, ptr %210, align 4, !tbaa !9
  %212 = invoke { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %213 unwind label %218

213:                                              ; preds = %209
  %214 = getelementptr inbounds { ptr, i8 }, ptr %22, i32 0, i32 0
  %215 = extractvalue { ptr, i8 } %212, 0
  store ptr %215, ptr %214, align 8
  %216 = getelementptr inbounds { ptr, i8 }, ptr %22, i32 0, i32 1
  %217 = extractvalue { ptr, i8 } %212, 1
  store i8 %217, ptr %216, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %222

218:                                              ; preds = %209
  %219 = landingpad { ptr, i32 }
          cleanup
  %220 = extractvalue { ptr, i32 } %219, 0
  store ptr %220, ptr %4, align 8
  %221 = extractvalue { ptr, i32 } %219, 1
  store i32 %221, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %226

222:                                              ; preds = %213, %179
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %13, align 4, !tbaa !5
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %13, align 4, !tbaa !5
  br label %131, !llvm.loop !14

226:                                              ; preds = %218, %175, %171
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %227

227:                                              ; preds = %226, %167, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %259

228:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 0, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 1, ptr %25, align 4, !tbaa !5
  br label %229

229:                                              ; preds = %248, %228
  %230 = load i32, ptr %25, align 4, !tbaa !5
  %231 = load i32, ptr @n, align 4, !tbaa !5
  %232 = icmp sle i32 %230, %231
  br i1 %232, label %234, label %233

233:                                              ; preds = %229
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %251

234:                                              ; preds = %229
  %235 = load i32, ptr @rt, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %236
  %238 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt7__cxx114listIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %237) #6
  %239 = load i32, ptr %238, align 4, !tbaa !5
  %240 = load i32, ptr %24, align 4, !tbaa !5
  %241 = add nsw i32 %240, %239
  store i32 %241, ptr %24, align 4, !tbaa !5
  %242 = load i32, ptr @rt, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %243
  call void @_ZNSt7__cxx114listIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %244) #6
  %245 = load i32, ptr %24, align 4, !tbaa !5
  %246 = load i32, ptr %23, align 4, !tbaa !5
  %247 = add nsw i32 %246, %245
  store i32 %247, ptr %23, align 4, !tbaa !5
  br label %248

248:                                              ; preds = %234
  %249 = load i32, ptr %25, align 4, !tbaa !5
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %25, align 4, !tbaa !5
  br label %229, !llvm.loop !15

251:                                              ; preds = %233
  %252 = load i32, ptr %23, align 4, !tbaa !5
  %253 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %252)
          to label %254 unwind label %255

254:                                              ; preds = %251
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #6
  br label %26, !llvm.loop !16

255:                                              ; preds = %251
  %256 = landingpad { ptr, i32 }
          cleanup
  %257 = extractvalue { ptr, i32 } %256, 0
  store ptr %257, ptr %4, align 8
  %258 = extractvalue { ptr, i32 } %256, 1
  store i32 %258, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %259

259:                                              ; preds = %255, %227, %136, %121, %100
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #6
  br label %261

260:                                              ; preds = %39
  ret i32 0

261:                                              ; preds = %259
  %262 = load ptr, ptr %4, align 8
  %263 = load i32, ptr %5, align 4
  %264 = insertvalue { ptr, i32 } poison, ptr %262, 0
  %265 = insertvalue { ptr, i32 } %264, i32 %263, 1
  resume { ptr, i32 } %265
}

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE4swapERS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #1 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)) #0 align 2

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

; 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(4)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE6spliceESt20_List_const_iteratorIiERS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr, ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt20_List_const_iteratorIiEC2ERKSt14_List_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt7__cxx114listIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

declare i32 @printf(ptr noundef, ...) #4

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

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


; 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::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" }
%"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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 }
%struct.Node = type { i32 }
%"class.std::reverse_iterator" = type { %"struct.std::_Rb_tree_const_iterator" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"struct.std::_List_const_iterator" = type { ptr }
%"struct.std::_List_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@rt = external dso_local global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@c = external dso_local local_unnamed_addr global [1001 x i32], align 16
@fa = external dso_local local_unnamed_addr global [1001 x i32], align 16
@dsu = external dso_local local_unnamed_addr global [1001 x i32], align 16
@_Z3seqB5cxx11 = external dso_local global [1001 x %"class.std::__cxx11::list"], align 16
@e = external dso_local global [1001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx1110_List_baseIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::set", align 8
  %2 = alloca %"class.std::__cxx11::list", align 8
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %struct.Node, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::reverse_iterator", align 8
  %8 = alloca %struct.Node, align 4
  %9 = alloca %struct.Node, align 4
  %10 = alloca %"struct.std::_List_const_iterator", align 8
  %11 = alloca %"struct.std::_List_iterator", align 8
  %12 = alloca %struct.Node, align 4
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @rt)
  %14 = icmp eq i32 %13, 2
  br i1 %14, label %.lr.ph77, label %.critedge

.lr.ph77:                                         ; preds = %0, %._crit_edge75
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %.not = icmp ne i32 %15, 0
  %16 = load i32, ptr @rt, align 4
  %.not50 = icmp ne i32 %16, 0
  %.not51 = select i1 %.not, i1 true, i1 %.not50
  br i1 %.not51, label %17, label %.critedge

17:                                               ; preds = %.lr.ph77
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #6
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %.not5264 = icmp slt i32 %18, 1
  br i1 %.not5264, label %._crit_edge, label %.lr.ph

.preheader63:                                     ; preds = %38
  %19 = icmp sgt i32 %39, 1
  br i1 %19, label %.lr.ph67, label %._crit_edge

.lr.ph:                                           ; preds = %17, %38
  %indvars.iv = phi i64 [ %indvars.iv.next, %38 ], [ 1, %17 ]
  %20 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %20)
  %22 = load i32, ptr %20, align 4, !tbaa !5
  %23 = getelementptr inbounds [1001 x i32], ptr @c, i64 0, i64 %indvars.iv
  store i32 %22, ptr %23, align 4, !tbaa !5
  %24 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %indvars.iv
  store i32 -1, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, i8 0, i64 24, i1 false)
  call void @_ZNSt7__cxx114listIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %25 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %indvars.iv
  call void @_ZNSt7__cxx114listIiSaIiEE4swapERS2_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %25) #6
  call void @_ZNSt7__cxx1110_List_baseIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  invoke void @_ZNSt7__cxx114listIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %26 unwind label %34

26:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  %27 = getelementptr inbounds [1001 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %27) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  %28 = load i32, ptr @rt, align 4, !tbaa !5
  %29 = zext i32 %28 to i64
  %.not58 = icmp eq i64 %indvars.iv, %29
  br i1 %.not58, label %38, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %31 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %31, ptr %4, align 4, !tbaa !9
  %32 = invoke { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %33 unwind label %36

33:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %38

34:                                               ; preds = %.lr.ph
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %122

36:                                               ; preds = %30
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %122

38:                                               ; preds = %26, %33
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %.not52.not = icmp slt i64 %indvars.iv, %40
  br i1 %.not52.not, label %.lr.ph, label %.preheader63, !llvm.loop !11

._crit_edge:                                      ; preds = %54, %17, %.preheader63
  %41 = load i32, ptr @rt, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %42
  store i32 0, ptr %43, align 4, !tbaa !5
  invoke void @_Z3dfsi(i32 noundef %41)
          to label %.preheader62 unwind label %61

.preheader62:                                     ; preds = %._crit_edge
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 1
  br i1 %45, label %.lr.ph69, label %.preheader

.lr.ph67:                                         ; preds = %.preheader63, %54
  %.04666 = phi i32 [ %55, %54 ], [ 1, %.preheader63 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1001 x %"class.std::vector"], ptr @e, i64 0, i64 %48
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %49, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %50 unwind label %58

50:                                               ; preds = %.lr.ph67
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1001 x %"class.std::vector"], ptr @e, i64 0, i64 %52
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %53, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %54 unwind label %58

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %55 = add nuw nsw i32 %.04666, 1
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %.lr.ph67, label %._crit_edge, !llvm.loop !13

58:                                               ; preds = %50, %.lr.ph67
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %122

.preheader:                                       ; preds = %103, %.preheader62
  %60 = phi i32 [ %44, %.preheader62 ], [ %105, %103 ]
  %.not5370 = icmp slt i32 %60, 1
  br i1 %.not5370, label %._crit_edge75, label %.lr.ph74

61:                                               ; preds = %._crit_edge
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %122

.lr.ph69:                                         ; preds = %.preheader62, %103
  %.04768 = phi i32 [ %104, %103 ], [ 1, %.preheader62 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @_ZNKSt3setI4NodeSt4lessIS0_ESaIS0_EE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  %63 = invoke noundef ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorI4NodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %64 unwind label %77

64:                                               ; preds = %.lr.ph69
  %65 = load i32, ptr %63, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 %65, ptr %8, align 4, !tbaa !9
  %66 = invoke noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %67 unwind label %79

67:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  %68 = sext i32 %65 to i64
  %69 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = invoke noundef i32 @_Z8dsu_findi(i32 noundef %70)
          to label %72 unwind label %81

72:                                               ; preds = %67
  %73 = load i32, ptr @rt, align 4, !tbaa !5
  %.not54 = icmp eq i32 %71, %73
  br i1 %.not54, label %85, label %74

74:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  store i32 %71, ptr %9, align 4, !tbaa !9
  %75 = invoke noundef i64 @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %76 unwind label %83

76:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %85

77:                                               ; preds = %.lr.ph69
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %122

79:                                               ; preds = %64
  %80 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %122

81:                                               ; preds = %67
  %82 = landingpad { ptr, i32 }
          cleanup
  br label %122

83:                                               ; preds = %74
  %84 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %122

85:                                               ; preds = %76, %72
  %86 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %68
  store i32 %71, ptr %86, align 4, !tbaa !5
  %87 = getelementptr inbounds [1001 x i32], ptr @c, i64 0, i64 %68
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %71 to i64
  %90 = getelementptr inbounds [1001 x i32], ptr @c, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %91, %88
  store i32 %92, ptr %90, align 4, !tbaa !5
  %93 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %89
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  %94 = call ptr @_ZNSt7__cxx114listIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %93) #6
  store ptr %94, ptr %11, align 8
  call void @_ZNSt20_List_const_iteratorIiEC2ERKSt14_List_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  %95 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %68
  %96 = load ptr, ptr %10, align 8
  call void @_ZNSt7__cxx114listIiSaIiEE6spliceESt20_List_const_iteratorIiERS2_(ptr noundef nonnull align 8 dereferenceable(24) %93, ptr %96, ptr noundef nonnull align 8 dereferenceable(24) %95) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  %97 = load i32, ptr @rt, align 4, !tbaa !5
  %.not55 = icmp eq i32 %71, %97
  br i1 %.not55, label %103, label %98

98:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  store i32 %71, ptr %12, align 4, !tbaa !9
  %99 = invoke { ptr, i8 } @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %100 unwind label %101

100:                                              ; preds = %98
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  br label %103

101:                                              ; preds = %98
  %102 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  br label %122

103:                                              ; preds = %100, %85
  %104 = add nuw nsw i32 %.04768, 1
  %105 = load i32, ptr @n, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %.lr.ph69, label %.preheader, !llvm.loop !14

._crit_edge75:                                    ; preds = %.lr.ph74, %.preheader
  %.039.lcssa = phi i32 [ 0, %.preheader ], [ %119, %.lr.ph74 ]
  %107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.039.lcssa)
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  %108 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @rt)
  %109 = icmp eq i32 %108, 2
  br i1 %109, label %.lr.ph77, label %.critedge, !llvm.loop !15

.lr.ph74:                                         ; preds = %.preheader, %.lr.ph74
  %.073 = phi i32 [ %120, %.lr.ph74 ], [ 1, %.preheader ]
  %.03872 = phi i32 [ %115, %.lr.ph74 ], [ 0, %.preheader ]
  %.03971 = phi i32 [ %119, %.lr.ph74 ], [ 0, %.preheader ]
  %110 = load i32, ptr @rt, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %111
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt7__cxx114listIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %112) #6
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = add nsw i32 %114, %.03872
  %116 = load i32, ptr @rt, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1001 x %"class.std::__cxx11::list"], ptr @_Z3seqB5cxx11, i64 0, i64 %117
  call void @_ZNSt7__cxx114listIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %118) #6
  %119 = add nsw i32 %115, %.03971
  %120 = add nuw nsw i32 %.073, 1
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %.not53.not = icmp slt i32 %.073, %121
  br i1 %.not53.not, label %.lr.ph74, label %._crit_edge75, !llvm.loop !16

122:                                              ; preds = %77, %79, %101, %83, %81, %34, %36, %61, %58
  %.pn59.pn = phi { ptr, i32 } [ %59, %58 ], [ %62, %61 ], [ %37, %36 ], [ %35, %34 ], [ %80, %79 ], [ %78, %77 ], [ %102, %101 ], [ %84, %83 ], [ %82, %81 ]
  call void @_ZNSt3setI4NodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn59.pn

.critedge:                                        ; preds = %.lr.ph77, %._crit_edge75, %0
  ret i32 0
}

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE4swapERS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 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 #0 align 2

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

; 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(4)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE6spliceESt20_List_const_iteratorIiERS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt20_List_const_iteratorIiEC2ERKSt14_List_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt7__cxx114listIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass