; LLVM IR from eyangch/competitive-programming :: USACOcontests/platinum/2015.12 (cardgame)

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

@N = external dso_local global i64, align 8
@e = external dso_local global [50000 x i64], align 16
@pfx = external dso_local global [50000 x i64], align 16
@sfx = external dso_local global [50000 x i64], align 16
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

36:                                               ; preds = %49, %0
  %37 = load i64, ptr %2, align 8, !tbaa !11
  %38 = load i64, ptr @N, align 8, !tbaa !11
  %39 = icmp slt i64 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  br label %52

41:                                               ; preds = %36
  %42 = load i64, ptr %2, align 8, !tbaa !11
  %43 = getelementptr inbounds [50000 x i64], ptr @e, i64 0, i64 %42
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = load i64, ptr %2, align 8, !tbaa !11
  %46 = getelementptr inbounds [50000 x i64], ptr @e, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !11
  %48 = add nsw i64 %47, -1
  store i64 %48, ptr %46, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %41
  %50 = load i64, ptr %2, align 8, !tbaa !11
  %51 = add nsw i64 %50, 1
  store i64 %51, ptr %2, align 8, !tbaa !11
  br label %36, !llvm.loop !13

52:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #8
  %53 = load i64, ptr @N, align 8, !tbaa !11
  %54 = getelementptr inbounds i64, ptr @e, i64 %53
  call void @_ZNSt3setIxSt4lessIxESaIxEEC2IPxEET_S6_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef @e, ptr noundef %54)
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #8
  call void @_ZNSt3setIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  store i64 0, ptr %5, align 8, !tbaa !11
  br label %55

55:                                               ; preds = %77, %52
  %56 = load i64, ptr %5, align 8, !tbaa !11
  %57 = load i64, ptr @N, align 8, !tbaa !11
  %58 = mul nsw i64 2, %57
  %59 = icmp slt i64 %56, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %80

61:                                               ; preds = %55
  %62 = invoke noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %63 unwind label %72

63:                                               ; preds = %61
  %64 = icmp ne i64 %62, 0
  br i1 %64, label %76, label %65

65:                                               ; preds = %63
  %66 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %67 unwind label %72

67:                                               ; preds = %65
  %68 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %69 = extractvalue { ptr, i8 } %66, 0
  store ptr %69, ptr %68, align 8
  %70 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %71 = extractvalue { ptr, i8 } %66, 1
  store i8 %71, ptr %70, align 8
  br label %76

72:                                               ; preds = %65, %61
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %6, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %228

76:                                               ; preds = %67, %63
  br label %77

77:                                               ; preds = %76
  %78 = load i64, ptr %5, align 8, !tbaa !11
  %79 = add nsw i64 %78, 1
  store i64 %79, ptr %5, align 8, !tbaa !11
  br label %55, !llvm.loop !15

80:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 48, ptr %9) #8
  invoke void @_ZNSt3setIxSt4lessIxESaIxEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(48) %4)
          to label %81 unwind label %87

81:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %82

82:                                               ; preds = %125, %81
  %83 = load i64, ptr %10, align 8, !tbaa !11
  %84 = load i64, ptr @N, align 8, !tbaa !11
  %85 = icmp slt i64 %83, %84
  br i1 %85, label %91, label %86

86:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %128

87:                                               ; preds = %80
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %6, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %7, align 4
  br label %227

91:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %92 = load i64, ptr %10, align 8, !tbaa !11
  %93 = getelementptr inbounds [50000 x i64], ptr @e, i64 0, i64 %92
  %94 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE11upper_boundERKx(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(8) %93)
          to label %95 unwind label %106

95:                                               ; preds = %91
  %96 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %11, i32 0, i32 0
  store ptr %94, ptr %96, align 8
  %97 = load i64, ptr %10, align 8, !tbaa !11
  %98 = icmp sgt i64 %97, 0
  br i1 %98, label %99, label %110

99:                                               ; preds = %95
  %100 = load i64, ptr %10, align 8, !tbaa !11
  %101 = sub nsw i64 %100, 1
  %102 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !11
  %104 = load i64, ptr %10, align 8, !tbaa !11
  %105 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %104
  store i64 %103, ptr %105, align 8, !tbaa !11
  br label %110

106:                                              ; preds = %114, %91
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %6, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %226

110:                                              ; preds = %99, %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %111 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  %112 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  store ptr %111, ptr %112, align 8
  %113 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br i1 %113, label %114, label %124

114:                                              ; preds = %110
  %115 = load i64, ptr %10, align 8, !tbaa !11
  %116 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = add nsw i64 %117, 1
  store i64 %118, ptr %116, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %11, i64 8, i1 false), !tbaa.struct !16
  %119 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  %120 = load ptr, ptr %119, align 8
  %121 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr %120)
          to label %122 unwind label %106

122:                                              ; preds = %114
  %123 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %121, ptr %123, align 8
  br label %124

124:                                              ; preds = %122, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %125

125:                                              ; preds = %124
  %126 = load i64, ptr %10, align 8, !tbaa !11
  %127 = add nsw i64 %126, 1
  store i64 %127, ptr %10, align 8, !tbaa !11
  br label %82, !llvm.loop !17

128:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 48, ptr %15) #8
  invoke void @_ZNSt3setIxSt4lessIxESaIxEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(48) %15, ptr noundef nonnull align 8 dereferenceable(48) %4)
          to label %129 unwind label %137

129:                                              ; preds = %128
  %130 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3setIxSt4lessIxESaIxEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(48) %15) #8
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %15) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %131 = load i64, ptr @N, align 8, !tbaa !11
  %132 = sub nsw i64 %131, 1
  store i64 %132, ptr %16, align 8, !tbaa !11
  br label %133

133:                                              ; preds = %179, %129
  %134 = load i64, ptr %16, align 8, !tbaa !11
  %135 = icmp sge i64 %134, 0
  br i1 %135, label %141, label %136

136:                                              ; preds = %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %182

137:                                              ; preds = %128
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %6, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #8
  br label %226

141:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %142 = load i64, ptr %16, align 8, !tbaa !11
  %143 = getelementptr inbounds [50000 x i64], ptr @e, i64 0, i64 %142
  %144 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE11upper_boundERKx(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(8) %143)
          to label %145 unwind label %158

145:                                              ; preds = %141
  %146 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  store ptr %144, ptr %146, align 8
  %147 = load i64, ptr %16, align 8, !tbaa !11
  %148 = load i64, ptr @N, align 8, !tbaa !11
  %149 = sub nsw i64 %148, 1
  %150 = icmp slt i64 %147, %149
  br i1 %150, label %151, label %162

151:                                              ; preds = %145
  %152 = load i64, ptr %16, align 8, !tbaa !11
  %153 = add nsw i64 %152, 1
  %154 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %153
  %155 = load i64, ptr %154, align 8, !tbaa !11
  %156 = load i64, ptr %16, align 8, !tbaa !11
  %157 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %156
  store i64 %155, ptr %157, align 8, !tbaa !11
  br label %162

158:                                              ; preds = %166, %141
  %159 = landingpad { ptr, i32 }
          cleanup
  %160 = extractvalue { ptr, i32 } %159, 0
  store ptr %160, ptr %6, align 8
  %161 = extractvalue { ptr, i32 } %159, 1
  store i32 %161, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %226

162:                                              ; preds = %151, %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %163 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  %164 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %18, i32 0, i32 0
  store ptr %163, ptr %164, align 8
  %165 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br i1 %165, label %166, label %178

166:                                              ; preds = %162
  %167 = call ptr @_ZNSt23_Rb_tree_const_iteratorIxEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef 0) #8
  %168 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %19, i32 0, i32 0
  store ptr %167, ptr %168, align 8
  %169 = load i64, ptr %16, align 8, !tbaa !11
  %170 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %169
  %171 = load i64, ptr %170, align 8, !tbaa !11
  %172 = add nsw i64 %171, 1
  store i64 %172, ptr %170, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %17, i64 8, i1 false), !tbaa.struct !16
  %173 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8
  %175 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr %174)
          to label %176 unwind label %158

176:                                              ; preds = %166
  %177 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %175, ptr %177, align 8
  br label %178

178:                                              ; preds = %176, %162
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %179

179:                                              ; preds = %178
  %180 = load i64, ptr %16, align 8, !tbaa !11
  %181 = add nsw i64 %180, -1
  store i64 %181, ptr %16, align 8, !tbaa !11
  br label %133, !llvm.loop !18

182:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %183 = load i64, ptr @N, align 8, !tbaa !11
  %184 = sub nsw i64 %183, 1
  %185 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %184
  %186 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %185, ptr noundef nonnull align 8 dereferenceable(8) @sfx)
          to label %187 unwind label %195

187:                                              ; preds = %182
  %188 = load i64, ptr %186, align 8, !tbaa !11
  store i64 %188, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  store i64 0, ptr %23, align 8, !tbaa !11
  br label %189

189:                                              ; preds = %211, %187
  %190 = load i64, ptr %23, align 8, !tbaa !11
  %191 = load i64, ptr @N, align 8, !tbaa !11
  %192 = sub nsw i64 %191, 1
  %193 = icmp slt i64 %190, %192
  br i1 %193, label %199, label %194

194:                                              ; preds = %189
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %218

195:                                              ; preds = %221, %218, %182
  %196 = landingpad { ptr, i32 }
          cleanup
  %197 = extractvalue { ptr, i32 } %196, 0
  store ptr %197, ptr %6, align 8
  %198 = extractvalue { ptr, i32 } %196, 1
  store i32 %198, ptr %7, align 4
  br label %225

199:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %200 = load i64, ptr %23, align 8, !tbaa !11
  %201 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %200
  %202 = load i64, ptr %201, align 8, !tbaa !11
  %203 = load i64, ptr %23, align 8, !tbaa !11
  %204 = add nsw i64 %203, 1
  %205 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %204
  %206 = load i64, ptr %205, align 8, !tbaa !11
  %207 = add nsw i64 %202, %206
  store i64 %207, ptr %24, align 8, !tbaa !11
  %208 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %209 unwind label %214

209:                                              ; preds = %199
  %210 = load i64, ptr %208, align 8, !tbaa !11
  store i64 %210, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %211

211:                                              ; preds = %209
  %212 = load i64, ptr %23, align 8, !tbaa !11
  %213 = add nsw i64 %212, 1
  store i64 %213, ptr %23, align 8, !tbaa !11
  br label %189, !llvm.loop !19

214:                                              ; preds = %199
  %215 = landingpad { ptr, i32 }
          cleanup
  %216 = extractvalue { ptr, i32 } %215, 0
  store ptr %216, ptr %6, align 8
  %217 = extractvalue { ptr, i32 } %215, 1
  store i32 %217, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %225

218:                                              ; preds = %194
  %219 = load i64, ptr %22, align 8, !tbaa !11
  %220 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %219)
          to label %221 unwind label %195

221:                                              ; preds = %218
  %222 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %220, i8 noundef signext 10)
          to label %223 unwind label %195

223:                                              ; preds = %221
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #8
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #8
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #8
  %224 = load i32, ptr %1, align 4
  ret i32 %224

225:                                              ; preds = %214, %195
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %226

226:                                              ; preds = %225, %158, %137, %106
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  br label %227

227:                                              ; preds = %226, %87
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #8
  br label %228

228:                                              ; preds = %227, %72
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #8
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #8
  br label %229

229:                                              ; preds = %228
  %230 = load ptr, ptr %6, align 8
  %231 = load i32, ptr %7, align 4
  %232 = insertvalue { ptr, i32 } poison, ptr %230, 0
  %233 = insertvalue { ptr, i32 } %232, i32 %231, 1
  resume { ptr, i32 } %233
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48), ptr) #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) #5

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i64 0, i64 8, !5}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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

@N = external dso_local global i64, align 8
@e = external dso_local global [50000 x i64], align 16
@pfx = external dso_local global [50000 x i64], align 16
@sfx = external dso_local global [50000 x i64], align 16
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i64 [ %23, %0 ], [ %33, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #7
  %25 = getelementptr inbounds i64, ptr @e, i64 %.lcssa
  call void @_ZNSt3setIxSt4lessIxESaIxEEC2IPxEET_S6_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull @e, ptr noundef nonnull %25)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store i64 0, ptr %3, align 8, !tbaa !11
  %26 = load i64, ptr @N, align 8, !tbaa !11
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph43, label %._crit_edge44

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02941 = phi i64 [ %32, %.lr.ph ], [ 0, %0 ]
  %28 = getelementptr inbounds [50000 x i64], ptr @e, i64 0, i64 %.02941
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %30 = load i64, ptr %28, align 8, !tbaa !11
  %31 = add nsw i64 %30, -1
  store i64 %31, ptr %28, align 8, !tbaa !11
  %32 = add nuw nsw i64 %.02941, 1
  %33 = load i64, ptr @N, align 8, !tbaa !11
  %34 = icmp slt i64 %32, %33
  br i1 %34, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge44:                                    ; preds = %54, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #7
  invoke void @_ZNSt3setIxSt4lessIxESaIxEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(48) %2)
          to label %.preheader unwind label %60

.preheader:                                       ; preds = %._crit_edge44
  %35 = load i64, ptr @N, align 8, !tbaa !11
  %36 = icmp sgt i64 %35, 0
  br i1 %36, label %.lr.ph46.preheader, label %._crit_edge47

.lr.ph46.preheader:                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %37 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE11upper_boundERKx(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) @e)
          to label %38 unwind label %.loopexit.split-lp

38:                                               ; preds = %.lr.ph46.preheader
  store ptr %37, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %39 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %39, ptr %6, align 8
  %40 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br i1 %40, label %41, label %45

41:                                               ; preds = %38
  %42 = load i64, ptr @pfx, align 16, !tbaa !11
  %43 = add nsw i64 %42, 1
  store i64 %43, ptr @pfx, align 16, !tbaa !11
  %.sroa.014.0.copyload.peel = load ptr, ptr %5, align 8, !tbaa !5
  %44 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %.sroa.014.0.copyload.peel)
          to label %45 unwind label %.loopexit.split-lp

45:                                               ; preds = %41, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %46 = load i64, ptr @N, align 8, !tbaa !11
  %47 = icmp sgt i64 %46, 1
  br i1 %47, label %.lr.ph46, label %._crit_edge47

.lr.ph43:                                         ; preds = %._crit_edge, %54
  %48 = invoke noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %49 unwind label %52

49:                                               ; preds = %.lr.ph43
  %.not38 = icmp eq i64 %48, 0
  br i1 %.not38, label %50, label %54

50:                                               ; preds = %49
  %51 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %54 unwind label %52

52:                                               ; preds = %50, %.lr.ph43
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %136

54:                                               ; preds = %50, %49
  %55 = load i64, ptr %3, align 8, !tbaa !11
  %56 = add nsw i64 %55, 1
  store i64 %56, ptr %3, align 8, !tbaa !11
  %57 = load i64, ptr @N, align 8, !tbaa !11
  %58 = shl nsw i64 %57, 1
  %59 = icmp slt i64 %56, %58
  br i1 %59, label %.lr.ph43, label %._crit_edge44, !llvm.loop !15

._crit_edge47:                                    ; preds = %77, %45, %.preheader
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #7
  invoke void @_ZNSt3setIxSt4lessIxESaIxEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(48) %2)
          to label %81 unwind label %92

60:                                               ; preds = %._crit_edge44
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %135

.lr.ph46:                                         ; preds = %45, %77
  %.03545 = phi i64 [ %78, %77 ], [ 1, %45 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %62 = getelementptr inbounds [50000 x i64], ptr @e, i64 0, i64 %.03545
  %63 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE11upper_boundERKx(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %62)
          to label %65 unwind label %.loopexit

.loopexit:                                        ; preds = %.lr.ph46, %72
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %64

.loopexit.split-lp:                               ; preds = %.lr.ph46.preheader, %41
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %64

64:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %134

65:                                               ; preds = %.lr.ph46
  store ptr %63, ptr %5, align 8
  %66 = add nsw i64 %.03545, -1
  %67 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !11
  %69 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %.03545
  store i64 %68, ptr %69, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %70 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %70, ptr %6, align 8
  %71 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br i1 %71, label %72, label %77

72:                                               ; preds = %65
  %73 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %.03545
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = add nsw i64 %74, 1
  store i64 %75, ptr %73, align 8, !tbaa !11
  %.sroa.014.0.copyload = load ptr, ptr %5, align 8, !tbaa !5
  %76 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %.sroa.014.0.copyload)
          to label %77 unwind label %.loopexit

77:                                               ; preds = %72, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %78 = add nuw nsw i64 %.03545, 1
  %79 = load i64, ptr @N, align 8, !tbaa !11
  %80 = icmp slt i64 %78, %79
  br i1 %80, label %.lr.ph46, label %._crit_edge47, !llvm.loop !16

81:                                               ; preds = %._crit_edge47
  %82 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3setIxSt4lessIxESaIxEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(48) %7) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #7
  %83 = load i64, ptr @N, align 8, !tbaa !11
  %84 = icmp sgt i64 %83, 0
  br i1 %84, label %.lr.ph52, label %._crit_edge53

._crit_edge53.loopexit:                           ; preds = %114
  %.pre = load i64, ptr @N, align 8, !tbaa !11
  br label %._crit_edge53

._crit_edge53:                                    ; preds = %._crit_edge53.loopexit, %81
  %85 = phi i64 [ %.pre, %._crit_edge53.loopexit ], [ %83, %81 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %86 = add nsw i64 %85, -1
  %87 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %86
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef nonnull align 8 dereferenceable(8) @sfx)
  %89 = load i64, ptr %88, align 8, !tbaa !11
  store i64 %89, ptr %10, align 8, !tbaa !11
  %90 = load i64, ptr @N, align 8, !tbaa !11
  %91 = icmp sgt i64 %90, 1
  br i1 %91, label %.lr.ph56, label %._crit_edge57

92:                                               ; preds = %._crit_edge47
  %93 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #7
  br label %134

.lr.ph52:                                         ; preds = %81, %114
  %.034.in49 = phi i64 [ %.03450, %114 ], [ %83, %81 ]
  %.03450 = add nsw i64 %.034.in49, -1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %94 = getelementptr inbounds [50000 x i64], ptr @e, i64 0, i64 %.03450
  %95 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE11upper_boundERKx(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %94)
          to label %96 unwind label %103

96:                                               ; preds = %.lr.ph52
  store ptr %95, ptr %8, align 8
  %97 = load i64, ptr @N, align 8, !tbaa !11
  %98 = icmp slt i64 %.034.in49, %97
  br i1 %98, label %99, label %105

99:                                               ; preds = %96
  %100 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %.034.in49
  %101 = load i64, ptr %100, align 8, !tbaa !11
  %102 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %.03450
  store i64 %101, ptr %102, align 8, !tbaa !11
  br label %105

103:                                              ; preds = %108, %.lr.ph52
  %104 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br label %134

105:                                              ; preds = %99, %96
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %106 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %106, ptr %9, align 8
  %107 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  br i1 %107, label %108, label %114

108:                                              ; preds = %105
  %109 = call ptr @_ZNSt23_Rb_tree_const_iteratorIxEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef 0) #7
  %110 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %.03450
  %111 = load i64, ptr %110, align 8, !tbaa !11
  %112 = add nsw i64 %111, 1
  store i64 %112, ptr %110, align 8, !tbaa !11
  %.sroa.04.0.copyload = load ptr, ptr %8, align 8, !tbaa !5
  %113 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %.sroa.04.0.copyload)
          to label %114 unwind label %103

114:                                              ; preds = %108, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  %115 = icmp ugt i64 %.034.in49, 1
  br i1 %115, label %.lr.ph52, label %._crit_edge53.loopexit, !llvm.loop !18

._crit_edge57:                                    ; preds = %.lr.ph56, %._crit_edge53
  %116 = phi i64 [ %89, %._crit_edge53 ], [ %127, %.lr.ph56 ]
  %117 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %116)
          to label %131 unwind label %118

118:                                              ; preds = %131, %._crit_edge57
  %119 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %134

.lr.ph56:                                         ; preds = %._crit_edge53, %.lr.ph56
  %.054 = phi i64 [ %122, %.lr.ph56 ], [ 0, %._crit_edge53 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %120 = getelementptr inbounds [50000 x i64], ptr @pfx, i64 0, i64 %.054
  %121 = load i64, ptr %120, align 8, !tbaa !11
  %122 = add nuw nsw i64 %.054, 1
  %123 = getelementptr inbounds [50000 x i64], ptr @sfx, i64 0, i64 %122
  %124 = load i64, ptr %123, align 8, !tbaa !11
  %125 = add nsw i64 %124, %121
  store i64 %125, ptr %11, align 8, !tbaa !11
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %127 = load i64, ptr %126, align 8, !tbaa !11
  store i64 %127, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  %128 = load i64, ptr @N, align 8, !tbaa !11
  %129 = add nsw i64 %128, -1
  %130 = icmp slt i64 %122, %129
  br i1 %130, label %.lr.ph56, label %._crit_edge57, !llvm.loop !19

131:                                              ; preds = %._crit_edge57
  %132 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %117, i8 noundef signext 10)
          to label %133 unwind label %118

133:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  ret i32 0

134:                                              ; preds = %118, %103, %92, %64
  %.pn = phi { ptr, i32 } [ %lpad.phi, %64 ], [ %104, %103 ], [ %119, %118 ], [ %93, %92 ]
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  br label %135

135:                                              ; preds = %134, %60
  %.pn.pn = phi { ptr, i32 } [ %.pn, %134 ], [ %61, %60 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  br label %136

136:                                              ; preds = %135, %52
  %.pn39 = phi { ptr, i32 } [ %53, %52 ], [ %.pn.pn, %135 ]
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn39
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress 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 #6 = { 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 #7 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14, !17}
!17 = !{!"llvm.loop.peeled.count", i32 1}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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