; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 11/2064. Caterpillars (main)

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

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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 i32, align 4
@ans = external dso_local global [1500005 x i32], align 16
@maxis = external dso_local global [1500005 x i32], align 16
@toLeft = external dso_local global [1500005 x i32], align 16
@toRight = external dso_local global [1500005 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::set", align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @ans, ptr noundef getelementptr inbounds (i32, ptr @ans, i64 1500005), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @maxis, ptr noundef getelementptr inbounds (i32, ptr @maxis, i64 1500005), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @toLeft, ptr noundef getelementptr inbounds (i32, ptr @toLeft, i64 1500005), ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @toRight, ptr noundef getelementptr inbounds (i32, ptr @toRight, i64 1500005), ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #8
  store i8 0, ptr %7, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %51, %0
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %54

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %35 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %9)
          to label %36 unwind label %46

36:                                               ; preds = %34
  %37 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %38 unwind label %46

38:                                               ; preds = %36
  %39 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %40 = extractvalue { ptr, i8 } %37, 0
  store ptr %40, ptr %39, align 8
  %41 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %42 = extractvalue { ptr, i8 } %37, 1
  store i8 %42, ptr %41, align 8
  %43 = load i32, ptr %9, align 4, !tbaa !5
  %44 = icmp sge i32 %43, 1000000
  br i1 %44, label %45, label %50

45:                                               ; preds = %38
  store i8 1, ptr %7, align 1, !tbaa !9
  br label %50

46:                                               ; preds = %36, %34
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %10, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %242

50:                                               ; preds = %45, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %51

51:                                               ; preds = %50
  %52 = load i32, ptr %8, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %8, align 4, !tbaa !5
  br label %29, !llvm.loop !11

54:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store ptr %6, ptr %13, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %55 = load ptr, ptr %13, align 8, !tbaa !13
  %56 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %55) #8
  %57 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %56, ptr %57, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %58 = load ptr, ptr %13, align 8, !tbaa !13
  %59 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %58) #8
  %60 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %59, ptr %60, align 8
  br label %61

61:                                               ; preds = %105, %54
  %62 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #8
  br i1 %62, label %64, label %63

63:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %108

64:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  %66 = load i32, ptr %65, align 4, !tbaa !5
  store i32 %66, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %67 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %67, ptr %17, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %91, %64
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %17, align 4, !tbaa !5
  %71 = icmp sge i32 %70, 1500005
  br i1 %71, label %72, label %86

72:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %73 = load i32, ptr %16, align 4, !tbaa !5
  %74 = load i32, ptr %17, align 4, !tbaa !5
  %75 = sub nsw i32 %74, 1500005
  %76 = sub nsw i32 %75, 1
  %77 = sub nsw i32 %73, %76
  %78 = call i32 @llvm.abs.i32(i32 %77, i1 true)
  store i32 %78, ptr %18, align 4, !tbaa !5
  %79 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([1500005 x i32], ptr @maxis, i64 0, i64 1500004), ptr noundef nonnull align 4 dereferenceable(4) %18)
          to label %80 unwind label %82

80:                                               ; preds = %72
  %81 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %81, ptr getelementptr inbounds ([1500005 x i32], ptr @maxis, i64 0, i64 1500004), align 16, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %104

82:                                               ; preds = %72
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %10, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %107

86:                                               ; preds = %69
  %87 = load i32, ptr %17, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %88
  %90 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %89, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %91 unwind label %100

91:                                               ; preds = %86
  %92 = load i32, ptr %90, align 4, !tbaa !5
  %93 = load i32, ptr %17, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %94
  store i32 %92, ptr %95, align 4, !tbaa !5
  %96 = load i32, ptr %16, align 4, !tbaa !5
  %97 = mul nsw i32 %96, 2
  %98 = load i32, ptr %17, align 4, !tbaa !5
  %99 = add nsw i32 %98, %97
  store i32 %99, ptr %17, align 4, !tbaa !5
  br label %68, !llvm.loop !15

100:                                              ; preds = %86
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %10, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %11, align 4
  br label %107

104:                                              ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %105

105:                                              ; preds = %104
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  br label %61

107:                                              ; preds = %100, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %242

108:                                              ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 1500004, ptr %20, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %128, %108
  %110 = load i32, ptr %20, align 4, !tbaa !5
  %111 = icmp sge i32 %110, 0
  br i1 %111, label %113, label %112

112:                                              ; preds = %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %140

113:                                              ; preds = %109
  %114 = load i32, ptr %19, align 4, !tbaa !5
  %115 = add nsw i32 %114, -1
  store i32 %115, ptr %19, align 4, !tbaa !5
  %116 = load i32, ptr %20, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %117
  %119 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %118)
          to label %120 unwind label %131

120:                                              ; preds = %113
  %121 = load i32, ptr %119, align 4, !tbaa !5
  store i32 %121, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 0, ptr %21, align 4, !tbaa !5
  %122 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %123 unwind label %135

123:                                              ; preds = %120
  %124 = load i32, ptr %122, align 4, !tbaa !5
  %125 = load i32, ptr %20, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1500005 x i32], ptr @toLeft, i64 0, i64 %126
  store i32 %124, ptr %127, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %128

128:                                              ; preds = %123
  %129 = load i32, ptr %20, align 4, !tbaa !5
  %130 = add nsw i32 %129, -1
  store i32 %130, ptr %20, align 4, !tbaa !5
  br label %109, !llvm.loop !16

131:                                              ; preds = %113
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %10, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %11, align 4
  br label %139

135:                                              ; preds = %120
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %10, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %139

139:                                              ; preds = %135, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %241

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

141:                                              ; preds = %160, %140
  %142 = load i32, ptr %22, align 4, !tbaa !5
  %143 = icmp slt i32 %142, 1500005
  br i1 %143, label %145, label %144

144:                                              ; preds = %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %172

145:                                              ; preds = %141
  %146 = load i32, ptr %19, align 4, !tbaa !5
  %147 = add nsw i32 %146, -1
  store i32 %147, ptr %19, align 4, !tbaa !5
  %148 = load i32, ptr %22, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %149
  %151 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %150)
          to label %152 unwind label %163

152:                                              ; preds = %145
  %153 = load i32, ptr %151, align 4, !tbaa !5
  store i32 %153, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !5
  %154 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %23, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %155 unwind label %167

155:                                              ; preds = %152
  %156 = load i32, ptr %154, align 4, !tbaa !5
  %157 = load i32, ptr %22, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1500005 x i32], ptr @toRight, i64 0, i64 %158
  store i32 %156, ptr %159, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %160

160:                                              ; preds = %155
  %161 = load i32, ptr %22, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %22, align 4, !tbaa !5
  br label %141, !llvm.loop !17

163:                                              ; preds = %145
  %164 = landingpad { ptr, i32 }
          cleanup
  %165 = extractvalue { ptr, i32 } %164, 0
  store ptr %165, ptr %10, align 8
  %166 = extractvalue { ptr, i32 } %164, 1
  store i32 %166, ptr %11, align 4
  br label %171

167:                                              ; preds = %152
  %168 = landingpad { ptr, i32 }
          cleanup
  %169 = extractvalue { ptr, i32 } %168, 0
  store ptr %169, ptr %10, align 8
  %170 = extractvalue { ptr, i32 } %168, 1
  store i32 %170, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %171

171:                                              ; preds = %167, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %241

172:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %195, %172
  %174 = load i32, ptr %24, align 4, !tbaa !5
  %175 = icmp slt i32 %174, 1500005
  br i1 %175, label %177, label %176

176:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %202

177:                                              ; preds = %173
  %178 = load i32, ptr %24, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %179
  %181 = load i32, ptr %24, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [1500005 x i32], ptr @toLeft, i64 0, i64 %182
  %184 = load i32, ptr %24, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1500005 x i32], ptr @toRight, i64 0, i64 %185
  %187 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %183, ptr noundef nonnull align 4 dereferenceable(4) %186)
          to label %188 unwind label %198

188:                                              ; preds = %177
  %189 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %180, ptr noundef nonnull align 4 dereferenceable(4) %187)
          to label %190 unwind label %198

190:                                              ; preds = %188
  %191 = load i32, ptr %189, align 4, !tbaa !5
  %192 = load i32, ptr %24, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %193
  store i32 %191, ptr %194, align 4, !tbaa !5
  br label %195

195:                                              ; preds = %190
  %196 = load i32, ptr %24, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %24, align 4, !tbaa !5
  br label %173, !llvm.loop !18

198:                                              ; preds = %188, %177
  %199 = landingpad { ptr, i32 }
          cleanup
  %200 = extractvalue { ptr, i32 } %199, 0
  store ptr %200, ptr %10, align 8
  %201 = extractvalue { ptr, i32 } %199, 1
  store i32 %201, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %241

202:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  %203 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %25)
          to label %204 unwind label %210

204:                                              ; preds = %202
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %205

205:                                              ; preds = %235, %204
  %206 = load i32, ptr %26, align 4, !tbaa !5
  %207 = load i32, ptr %25, align 4, !tbaa !5
  %208 = icmp slt i32 %206, %207
  br i1 %208, label %214, label %209

209:                                              ; preds = %205
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  br label %238

210:                                              ; preds = %202
  %211 = landingpad { ptr, i32 }
          cleanup
  %212 = extractvalue { ptr, i32 } %211, 0
  store ptr %212, ptr %10, align 8
  %213 = extractvalue { ptr, i32 } %211, 1
  store i32 %213, ptr %11, align 4
  br label %240

214:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  %215 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %27)
          to label %216 unwind label %223

216:                                              ; preds = %214
  %217 = load i8, ptr %7, align 1, !tbaa !9, !range !19, !noundef !20
  %218 = trunc i8 %217 to i1
  br i1 %218, label %219, label %227

219:                                              ; preds = %216
  %220 = load i32, ptr %27, align 4, !tbaa !5
  %221 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %220)
          to label %222 unwind label %223

222:                                              ; preds = %219
  br label %234

223:                                              ; preds = %227, %219, %214
  %224 = landingpad { ptr, i32 }
          cleanup
  %225 = extractvalue { ptr, i32 } %224, 0
  store ptr %225, ptr %10, align 8
  %226 = extractvalue { ptr, i32 } %224, 1
  store i32 %226, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  br label %240

227:                                              ; preds = %216
  %228 = load i32, ptr %27, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %231)
          to label %233 unwind label %223

233:                                              ; preds = %227
  br label %234

234:                                              ; preds = %233, %222
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %235

235:                                              ; preds = %234
  %236 = load i32, ptr %26, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %26, align 4, !tbaa !5
  br label %205, !llvm.loop !21

238:                                              ; preds = %209
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #8
  %239 = load i32, ptr %1, align 4
  ret i32 %239

240:                                              ; preds = %223, %210
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %241

241:                                              ; preds = %240, %198, %171, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %242

242:                                              ; preds = %241, %107, %46
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #8
  br label %243

243:                                              ; preds = %242
  %244 = load ptr, ptr %10, align 8
  %245 = load i32, ptr %11, align 4
  %246 = insertvalue { ptr, i32 } poison, ptr %244, 0
  %247 = insertvalue { ptr, i32 } %246, i32 %245, 1
  resume { ptr, i32 } %247
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #7

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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 i32, align 4
@ans = external dso_local global [1500005 x i32], align 16
@maxis = external dso_local global [1500005 x i32], align 16
@toLeft = external dso_local global [1500005 x i32], align 16
@toRight = external dso_local global [1500005 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::set", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca i32, align 4
  %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 i32, align 4
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @ans, ptr noundef nonnull getelementptr inbounds (i8, ptr @ans, i64 6000020), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @maxis, ptr noundef nonnull getelementptr inbounds (i8, ptr @maxis, i64 6000020), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @toLeft, ptr noundef nonnull getelementptr inbounds (i8, ptr @toLeft, i64 6000020), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @toRight, ptr noundef nonnull getelementptr inbounds (i8, ptr @toRight, i64 6000020), ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %24, %0
  %.032.lcssa = phi i1 [ false, %0 ], [ %spec.select, %24 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %19 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  store ptr %19, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %20 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  store ptr %20, ptr %8, align 8
  %21 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  br i1 %21, label %.lr.ph43, label %._crit_edge44

.lr.ph:                                           ; preds = %0, %24
  %.03236 = phi i1 [ %spec.select, %24 ], [ false, %0 ]
  %.03335 = phi i32 [ %27, %24 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %6)
  %23 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %24 unwind label %30

24:                                               ; preds = %.lr.ph
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %.fr61 = freeze i32 %25
  %26 = icmp sgt i32 %.fr61, 999999
  %spec.select = select i1 %26, i1 true, i1 %.03236
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  %27 = add nuw nsw i32 %.03335, 1
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !9

30:                                               ; preds = %.lr.ph
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #8
  resume { ptr, i32 } %31

._crit_edge44:                                    ; preds = %._crit_edge40, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #8
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %51

.lr.ph43:                                         ; preds = %._crit_edge, %._crit_edge40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %33 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %33, ptr %9, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 1500004
  br i1 %34, label %._crit_edge40, label %.lr.ph39

._crit_edge40:                                    ; preds = %.lr.ph39, %.lr.ph43
  %35 = phi i32 [ %33, %.lr.ph43 ], [ %46, %.lr.ph39 ]
  %.031.lcssa = phi i32 [ %33, %.lr.ph43 ], [ %48, %.lr.ph39 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #8
  %reass.sub = sub i32 %35, %.031.lcssa
  %36 = add i32 %reass.sub, 1500006
  %37 = call i32 @llvm.abs.i32(i32 %36, i1 true)
  store i32 %37, ptr %10, align 4, !tbaa !5
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @maxis, i64 6000016), ptr noundef nonnull align 4 dereferenceable(4) %10)
  %39 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %39, ptr getelementptr inbounds (i8, ptr @maxis, i64 6000016), align 16, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %41 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  br i1 %41, label %.lr.ph43, label %._crit_edge44

.lr.ph39:                                         ; preds = %.lr.ph43, %.lr.ph39
  %.03137 = phi i32 [ %48, %.lr.ph39 ], [ %33, %.lr.ph43 ]
  %42 = sext i32 %.03137 to i64
  %43 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %42
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  store i32 %45, ptr %43, align 4, !tbaa !5
  %46 = load i32, ptr %9, align 4, !tbaa !5
  %47 = shl nsw i32 %46, 1
  %48 = add nsw i32 %47, %.03137
  %49 = icmp sgt i32 %48, 1500004
  br i1 %49, label %._crit_edge40, label %.lr.ph39, !llvm.loop !11

50:                                               ; preds = %51
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %60

51:                                               ; preds = %._crit_edge44, %51
  %indvars.iv = phi i64 [ 1500004, %._crit_edge44 ], [ %indvars.iv.next, %51 ]
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr %11, align 4, !tbaa !5
  %54 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %indvars.iv
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %54)
  %56 = load i32, ptr %55, align 4, !tbaa !5
  store i32 %56, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = getelementptr inbounds [1500005 x i32], ptr @toLeft, i64 0, i64 %indvars.iv
  store i32 %58, ptr %59, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #8
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %.not = icmp eq i64 %indvars.iv, 0
  br i1 %.not, label %50, label %51, !llvm.loop !12

60:                                               ; preds = %50, %60
  %indvars.iv54 = phi i64 [ 0, %50 ], [ %indvars.iv.next55, %60 ]
  %61 = load i32, ptr %11, align 4, !tbaa !5
  %62 = add nsw i32 %61, -1
  store i32 %62, ptr %11, align 4, !tbaa !5
  %63 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %indvars.iv54
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %63)
  %65 = load i32, ptr %64, align 4, !tbaa !5
  store i32 %65, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #8
  store i32 0, ptr %13, align 4, !tbaa !5
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = getelementptr inbounds [1500005 x i32], ptr @toRight, i64 0, i64 %indvars.iv54
  store i32 %67, ptr %68, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next55, 1500005
  br i1 %exitcond.not, label %.preheader, label %60, !llvm.loop !13

69:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #8
  %70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %14)
  %71 = load i32, ptr %14, align 4, !tbaa !5
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %.lr.ph50, label %._crit_edge51

.lr.ph50:                                         ; preds = %69
  br i1 %.032.lcssa, label %.lr.ph50.split.us, label %.lr.ph50.split

.lr.ph50.split.us:                                ; preds = %.lr.ph50, %.lr.ph50.split.us
  %.048.us = phi i32 [ %76, %.lr.ph50.split.us ], [ 0, %.lr.ph50 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #8
  %73 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %15)
  %74 = load i32, ptr %15, align 4, !tbaa !5
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %74)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #8
  %76 = add nuw nsw i32 %.048.us, 1
  %77 = load i32, ptr %14, align 4, !tbaa !5
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %.lr.ph50.split.us, label %._crit_edge51, !llvm.loop !14

.preheader:                                       ; preds = %60, %.preheader
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.preheader ], [ 0, %60 ]
  %79 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %indvars.iv57
  %80 = getelementptr inbounds [1500005 x i32], ptr @toLeft, i64 0, i64 %indvars.iv57
  %81 = getelementptr inbounds [1500005 x i32], ptr @toRight, i64 0, i64 %indvars.iv57
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %80, ptr noundef nonnull align 4 dereferenceable(4) %81)
  %83 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %79, ptr noundef nonnull align 4 dereferenceable(4) %82)
  %84 = load i32, ptr %83, align 4, !tbaa !5
  store i32 %84, ptr %79, align 4, !tbaa !5
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %exitcond60.not = icmp eq i64 %indvars.iv.next58, 1500005
  br i1 %exitcond60.not, label %69, label %.preheader, !llvm.loop !15

._crit_edge51:                                    ; preds = %.lr.ph50.split, %.lr.ph50.split.us, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #8
  ret i32 0

.lr.ph50.split:                                   ; preds = %.lr.ph50, %.lr.ph50.split
  %.048 = phi i32 [ %91, %.lr.ph50.split ], [ 0, %.lr.ph50 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #8
  %85 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %15)
  %86 = load i32, ptr %15, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1500005 x i32], ptr @maxis, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %89)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #8
  %91 = add nuw nsw i32 %.048, 1
  %92 = load i32, ptr %14, align 4, !tbaa !5
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %.lr.ph50.split, label %._crit_edge51, !llvm.loop !14
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #7

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 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 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }

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

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


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