; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Educational Codeforces Round 134 (Rated for Div. 2)/C. Min-Max Array Tra_8035e843 (Z5solvev)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca %"class.std::vector", align 8
  %17 = alloca i64, align 8
  %18 = alloca %"class.std::allocator", align 1
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %26 = load i64, ptr %1, align 8, !tbaa !5
  %27 = call ptr @llvm.stacksave.p0()
  store ptr %27, ptr %2, align 8
  %28 = alloca i64, i64 %26, align 16
  store i64 %26, ptr %3, align 8
  %29 = load i64, ptr %1, align 8, !tbaa !5
  %30 = alloca i64, i64 %29, align 16
  store i64 %29, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store ptr %28, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %31, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = mul nuw i64 8, %26
  %34 = udiv i64 %33, 8
  %35 = getelementptr inbounds i64, ptr %32, i64 %34
  store ptr %35, ptr %7, align 8, !tbaa !9
  br label %36

36:                                               ; preds = %45, %0
  %37 = load ptr, ptr %6, align 8, !tbaa !9
  %38 = load ptr, ptr %7, align 8, !tbaa !9
  %39 = icmp ne ptr %37, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %42 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %42, ptr %8, align 8, !tbaa !9
  %43 = load ptr, ptr %8, align 8, !tbaa !9
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %43)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %45

45:                                               ; preds = %41
  %46 = load ptr, ptr %6, align 8, !tbaa !9
  %47 = getelementptr inbounds i64, ptr %46, i32 1
  store ptr %47, ptr %6, align 8, !tbaa !9
  br label %36

48:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store ptr %30, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %49 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %49, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %50 = load ptr, ptr %9, align 8, !tbaa !9
  %51 = mul nuw i64 8, %29
  %52 = udiv i64 %51, 8
  %53 = getelementptr inbounds i64, ptr %50, i64 %52
  store ptr %53, ptr %11, align 8, !tbaa !9
  br label %54

54:                                               ; preds = %63, %48
  %55 = load ptr, ptr %10, align 8, !tbaa !9
  %56 = load ptr, ptr %11, align 8, !tbaa !9
  %57 = icmp ne ptr %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %66

59:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %60 = load ptr, ptr %10, align 8, !tbaa !9
  store ptr %60, ptr %12, align 8, !tbaa !9
  %61 = load ptr, ptr %12, align 8, !tbaa !9
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %61)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %63

63:                                               ; preds = %59
  %64 = load ptr, ptr %10, align 8, !tbaa !9
  %65 = getelementptr inbounds i64, ptr %64, i32 1
  store ptr %65, ptr %10, align 8, !tbaa !9
  br label %54

66:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 0, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 0, ptr %14, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %102, %66
  %68 = load i64, ptr %13, align 8, !tbaa !5
  %69 = load i64, ptr %1, align 8, !tbaa !5
  %70 = icmp slt i64 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %105

72:                                               ; preds = %67
  br label %73

73:                                               ; preds = %81, %72
  %74 = load i64, ptr %14, align 8, !tbaa !5
  %75 = getelementptr inbounds i64, ptr %30, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !5
  %77 = load i64, ptr %13, align 8, !tbaa !5
  %78 = getelementptr inbounds i64, ptr %28, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = icmp slt i64 %76, %79
  br i1 %80, label %81, label %84

81:                                               ; preds = %73
  %82 = load i64, ptr %14, align 8, !tbaa !5
  %83 = add nsw i64 %82, 1
  store i64 %83, ptr %14, align 8, !tbaa !5
  br label %73, !llvm.loop !11

84:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %85 = load i64, ptr %14, align 8, !tbaa !5
  %86 = getelementptr inbounds i64, ptr %30, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !5
  %88 = load i64, ptr %13, align 8, !tbaa !5
  %89 = getelementptr inbounds i64, ptr %28, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !5
  %91 = sub nsw i64 %87, %90
  store i64 %91, ptr %15, align 8, !tbaa !5
  %92 = load i64, ptr %15, align 8, !tbaa !5
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %92)
  %94 = load i64, ptr %13, align 8, !tbaa !5
  %95 = load i64, ptr %1, align 8, !tbaa !5
  %96 = sub nsw i64 %95, 1
  %97 = icmp eq i64 %94, %96
  %98 = zext i1 %97 to i64
  %99 = getelementptr inbounds [3 x i8], ptr @.str, i64 0, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !13
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %93, i8 noundef signext %100)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %102

102:                                              ; preds = %84
  %103 = load i64, ptr %13, align 8, !tbaa !5
  %104 = add nsw i64 %103, 1
  store i64 %104, ptr %13, align 8, !tbaa !5
  br label %67, !llvm.loop !14

105:                                              ; preds = %71
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %106 = load i64, ptr %1, align 8, !tbaa !5
  %107 = sub nsw i64 %106, 1
  %108 = getelementptr inbounds i64, ptr %30, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !5
  %110 = load i64, ptr %1, align 8, !tbaa !5
  %111 = sub nsw i64 %110, 1
  %112 = getelementptr inbounds i64, ptr %28, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !5
  %114 = sub nsw i64 %109, %113
  store i64 %114, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef 1, ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %115 unwind label %124

115:                                              ; preds = %105
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %116 = load i64, ptr %1, align 8, !tbaa !5
  %117 = sub nsw i64 %116, 2
  store i64 %117, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %118 = load i64, ptr %1, align 8, !tbaa !5
  %119 = sub nsw i64 %118, 1
  store i64 %119, ptr %22, align 8, !tbaa !5
  br label %120

120:                                              ; preds = %149, %115
  %121 = load i64, ptr %21, align 8, !tbaa !5
  %122 = icmp sge i64 %121, 0
  br i1 %122, label %128, label %123

123:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %156

124:                                              ; preds = %105
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %19, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %20, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %186

128:                                              ; preds = %120
  %129 = load i64, ptr %21, align 8, !tbaa !5
  %130 = add nsw i64 %129, 1
  %131 = getelementptr inbounds i64, ptr %28, i64 %130
  %132 = load i64, ptr %131, align 8, !tbaa !5
  %133 = load i64, ptr %21, align 8, !tbaa !5
  %134 = getelementptr inbounds i64, ptr %30, i64 %133
  %135 = load i64, ptr %134, align 8, !tbaa !5
  %136 = icmp sgt i64 %132, %135
  br i1 %136, label %137, label %139

137:                                              ; preds = %128
  %138 = load i64, ptr %21, align 8, !tbaa !5
  store i64 %138, ptr %22, align 8, !tbaa !5
  br label %139

139:                                              ; preds = %137, %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %140 = load i64, ptr %22, align 8, !tbaa !5
  %141 = getelementptr inbounds i64, ptr %30, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !5
  %143 = load i64, ptr %21, align 8, !tbaa !5
  %144 = getelementptr inbounds i64, ptr %28, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !5
  %146 = sub nsw i64 %142, %145
  store i64 %146, ptr %23, align 8, !tbaa !5
  %147 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEE12emplace_backIJlEEERlDpOT_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %148 unwind label %152

148:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br label %149

149:                                              ; preds = %148
  %150 = load i64, ptr %21, align 8, !tbaa !5
  %151 = add nsw i64 %150, -1
  store i64 %151, ptr %21, align 8, !tbaa !5
  br label %120, !llvm.loop !15

152:                                              ; preds = %139
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %19, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %185

156:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %157 = load i64, ptr %1, align 8, !tbaa !5
  %158 = sub nsw i64 %157, 1
  store i64 %158, ptr %24, align 8, !tbaa !5
  br label %159

159:                                              ; preds = %176, %156
  %160 = load i64, ptr %24, align 8, !tbaa !5
  %161 = icmp sge i64 %160, 0
  br i1 %161, label %163, label %162

162:                                              ; preds = %159
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  br label %183

163:                                              ; preds = %159
  %164 = load i64, ptr %24, align 8, !tbaa !5
  %165 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %164) #5
  %166 = load i64, ptr %165, align 8, !tbaa !5
  %167 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %166)
          to label %168 unwind label %179

168:                                              ; preds = %163
  %169 = load i64, ptr %24, align 8, !tbaa !5
  %170 = icmp eq i64 %169, 0
  %171 = zext i1 %170 to i64
  %172 = getelementptr inbounds [3 x i8], ptr @.str, i64 0, i64 %171
  %173 = load i8, ptr %172, align 1, !tbaa !13
  %174 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %167, i8 noundef signext %173)
          to label %175 unwind label %179

175:                                              ; preds = %168
  br label %176

176:                                              ; preds = %175
  %177 = load i64, ptr %24, align 8, !tbaa !5
  %178 = add nsw i64 %177, -1
  store i64 %178, ptr %24, align 8, !tbaa !5
  br label %159, !llvm.loop !16

179:                                              ; preds = %168, %163
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %19, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  br label %185

183:                                              ; preds = %162
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #5
  %184 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %184)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void

185:                                              ; preds = %179, %152
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #5
  br label %186

186:                                              ; preds = %185, %124
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  br label %187

187:                                              ; preds = %186
  %188 = load ptr, ptr %19, align 8
  %189 = load i32, ptr %20, align 4
  %190 = insertvalue { ptr, i32 } poison, ptr %188, 0
  %191 = insertvalue { ptr, i32 } %190, i32 %189, 1
  resume { ptr, i32 } %191
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; 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) #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

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


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

%"class.std::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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = call ptr @llvm.stacksave.p0()
  %9 = alloca i64, i64 %7, align 16
  %10 = load i64, ptr %1, align 8, !tbaa !5
  %11 = alloca i64, i64 %10, align 16
  %12 = getelementptr inbounds i64, ptr %9, i64 %7
  %.not55 = icmp eq i64 %7, 0
  br i1 %.not55, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %13 = getelementptr inbounds i64, ptr %11, i64 %10
  %.not4957 = icmp eq i64 %10, 0
  br i1 %.not4957, label %.preheader52, label %.lr.ph60

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.04256 = phi ptr [ %15, %.lr.ph ], [ %9, %0 ]
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %.04256)
  %15 = getelementptr inbounds i8, ptr %.04256, i64 8
  %.not = icmp eq ptr %15, %12
  br i1 %.not, label %._crit_edge, label %.lr.ph

.preheader52:                                     ; preds = %.lr.ph60, %._crit_edge
  %16 = load i64, ptr %1, align 8, !tbaa !5
  %17 = icmp sgt i64 %16, 0
  br i1 %17, label %.preheader, label %._crit_edge63

.lr.ph60:                                         ; preds = %._crit_edge, %.lr.ph60
  %.04658 = phi ptr [ %19, %.lr.ph60 ], [ %11, %._crit_edge ]
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %.04658)
  %19 = getelementptr inbounds i8, ptr %.04658, i64 8
  %.not49 = icmp eq ptr %19, %13
  br i1 %.not49, label %.preheader52, label %.lr.ph60

.preheader:                                       ; preds = %.preheader52, %33
  %.04362 = phi i64 [ %.144, %33 ], [ 0, %.preheader52 ]
  %.04561 = phi i64 [ %43, %33 ], [ 0, %.preheader52 ]
  %20 = getelementptr inbounds i64, ptr %9, i64 %.04561
  %21 = load i64, ptr %20, align 8, !tbaa !5
  br label %28

._crit_edge63:                                    ; preds = %33, %.preheader52
  %.lcssa54 = phi i64 [ %16, %.preheader52 ], [ %44, %33 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %22 = add nsw i64 %.lcssa54, -1
  %23 = getelementptr inbounds i64, ptr %11, i64 %22
  %24 = load i64, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds i64, ptr %9, i64 %22
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = sub nsw i64 %24, %26
  store i64 %27, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %46 unwind label %51

28:                                               ; preds = %28, %.preheader
  %.144 = phi i64 [ %32, %28 ], [ %.04362, %.preheader ]
  %29 = getelementptr inbounds i64, ptr %11, i64 %.144
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = icmp slt i64 %30, %21
  %32 = add nsw i64 %.144, 1
  br i1 %31, label %28, label %33, !llvm.loop !9

33:                                               ; preds = %28
  %34 = sub nsw i64 %30, %21
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %34)
  %36 = load i64, ptr %1, align 8, !tbaa !5
  %37 = add nsw i64 %36, -1
  %38 = icmp eq i64 %.04561, %37
  %39 = zext i1 %38 to i64
  %40 = getelementptr inbounds [3 x i8], ptr @.str, i64 0, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %35, i8 noundef signext %41)
  %43 = add nuw nsw i64 %.04561, 1
  %44 = load i64, ptr %1, align 8, !tbaa !5
  %45 = icmp slt i64 %43, %44
  br i1 %45, label %.preheader, label %._crit_edge63, !llvm.loop !12

46:                                               ; preds = %._crit_edge63
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %47 = load i64, ptr %1, align 8, !tbaa !5
  %48 = icmp sgt i64 %47, 1
  br i1 %48, label %.lr.ph67.preheader, label %._crit_edge68.preheader

._crit_edge68.preheader:                          ; preds = %._crit_edge68.loopexit, %46
  %.0.in.ph = phi i64 [ %47, %46 ], [ %.pre, %._crit_edge68.loopexit ]
  br label %._crit_edge68

.lr.ph67.preheader:                               ; preds = %46
  %49 = add nsw i64 %47, -1
  %50 = add nsw i64 %47, -2
  br label %.lr.ph67

._crit_edge68.loopexit:                           ; preds = %64
  %.pre = load i64, ptr %1, align 8, !tbaa !5
  br label %._crit_edge68.preheader

51:                                               ; preds = %._crit_edge63
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %84

.lr.ph67:                                         ; preds = %.lr.ph67.preheader, %64
  %.03665 = phi i64 [ %spec.select, %64 ], [ %49, %.lr.ph67.preheader ]
  %.03764 = phi i64 [ %65, %64 ], [ %50, %.lr.ph67.preheader ]
  %53 = getelementptr inbounds i64, ptr %9, i64 %.03764
  %54 = getelementptr inbounds i8, ptr %53, i64 8
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = getelementptr inbounds i64, ptr %11, i64 %.03764
  %57 = load i64, ptr %56, align 8, !tbaa !5
  %58 = icmp sgt i64 %55, %57
  %spec.select = select i1 %58, i64 %.03764, i64 %.03665
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %59 = getelementptr inbounds i64, ptr %11, i64 %spec.select
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %61 = load i64, ptr %53, align 8, !tbaa !5
  %62 = sub nsw i64 %60, %61
  store i64 %62, ptr %5, align 8, !tbaa !5
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEE12emplace_backIJlEEERlDpOT_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %64 unwind label %67

64:                                               ; preds = %.lr.ph67
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %65 = add nsw i64 %.03764, -1
  %66 = icmp sgt i64 %.03764, 0
  br i1 %66, label %.lr.ph67, label %._crit_edge68.loopexit, !llvm.loop !13

67:                                               ; preds = %.lr.ph67
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %83

._crit_edge68:                                    ; preds = %._crit_edge68.preheader, %75
  %.0.in = phi i64 [ %.0, %75 ], [ %.0.in.ph, %._crit_edge68.preheader ]
  %.0 = add nsw i64 %.0.in, -1
  %69 = icmp sgt i64 %.0.in, 0
  br i1 %69, label %71, label %70

70:                                               ; preds = %._crit_edge68
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  call void @llvm.stackrestore.p0(ptr %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void

71:                                               ; preds = %._crit_edge68
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.0) #5
  %73 = load i64, ptr %72, align 8, !tbaa !5
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %73)
          to label %75 unwind label %81

75:                                               ; preds = %71
  %76 = icmp eq i64 %.0, 0
  %77 = zext i1 %76 to i64
  %78 = getelementptr inbounds [3 x i8], ptr @.str, i64 0, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !11
  %80 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %74, i8 noundef signext %79)
          to label %._crit_edge68 unwind label %81, !llvm.loop !14

81:                                               ; preds = %75, %71
  %82 = landingpad { ptr, i32 }
          cleanup
  br label %83

83:                                               ; preds = %81, %67
  %.pn = phi { ptr, i32 } [ %68, %67 ], [ %82, %81 ]
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  br label %84

84:                                               ; preds = %83, %51
  %.pn.pn = phi { ptr, i32 } [ %.pn, %83 ], [ %52, %51 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn.pn
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; 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 #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass