; LLVM IR from AdarshGaur/Competitive-Programming :: Atcoder/AtCoder Beginner Contest 234/B - Longest Segment.ll (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<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.std::pair" = type { i64, i64 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 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 %"class.std::vector", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %15 = 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)
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #5
  %16 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  call void @_ZNSaISt4pairIllEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt6vectorISt4pairIllESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %16, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %17 unwind label %23

17:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %38, %17
  %19 = load i64, ptr %6, align 8, !tbaa !5
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %21 = icmp slt i64 %19, %20
  br i1 %21, label %27, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %45

23:                                               ; preds = %0
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %4, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %5, align 4
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  br label %163

27:                                               ; preds = %18
  %28 = load i64, ptr %6, align 8, !tbaa !5
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %28) #5
  %30 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 0
  %31 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %30)
          to label %32 unwind label %41

32:                                               ; preds = %27
  %33 = load i64, ptr %6, align 8, !tbaa !5
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %33) #5
  %35 = getelementptr inbounds %"struct.std::pair", ptr %34, i32 0, i32 1
  %36 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 8 dereferenceable(8) %35)
          to label %37 unwind label %41

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  %39 = load i64, ptr %6, align 8, !tbaa !5
  %40 = add nsw i64 %39, 1
  store i64 %40, ptr %6, align 8, !tbaa !5
  br label %18, !llvm.loop !9

41:                                               ; preds = %32, %27
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %4, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %162

45:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 0, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %145, %45
  %47 = load i64, ptr %8, align 8, !tbaa !5
  %48 = load i64, ptr %1, align 8, !tbaa !5
  %49 = sub nsw i64 %48, 1
  %50 = icmp slt i64 %47, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %46
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %148

52:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %53 = load i64, ptr %8, align 8, !tbaa !5
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr %10, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %137, %52
  %56 = load i64, ptr %10, align 8, !tbaa !5
  %57 = load i64, ptr %1, align 8, !tbaa !5
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %144

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %61 = load i64, ptr %10, align 8, !tbaa !5
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %61) #5
  %63 = getelementptr inbounds %"struct.std::pair", ptr %62, i32 0, i32 0
  %64 = load i64, ptr %63, align 8, !tbaa !11
  %65 = load i64, ptr %8, align 8, !tbaa !5
  %66 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %65) #5
  %67 = getelementptr inbounds %"struct.std::pair", ptr %66, i32 0, i32 0
  %68 = load i64, ptr %67, align 8, !tbaa !11
  %69 = sub nsw i64 %64, %68
  %70 = icmp slt i64 %69, 0
  br i1 %70, label %71, label %82

71:                                               ; preds = %60
  %72 = load i64, ptr %10, align 8, !tbaa !5
  %73 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %72) #5
  %74 = getelementptr inbounds %"struct.std::pair", ptr %73, i32 0, i32 0
  %75 = load i64, ptr %74, align 8, !tbaa !11
  %76 = load i64, ptr %8, align 8, !tbaa !5
  %77 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %76) #5
  %78 = getelementptr inbounds %"struct.std::pair", ptr %77, i32 0, i32 0
  %79 = load i64, ptr %78, align 8, !tbaa !11
  %80 = sub nsw i64 %75, %79
  %81 = sub nsw i64 0, %80
  br label %92

82:                                               ; preds = %60
  %83 = load i64, ptr %10, align 8, !tbaa !5
  %84 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %83) #5
  %85 = getelementptr inbounds %"struct.std::pair", ptr %84, i32 0, i32 0
  %86 = load i64, ptr %85, align 8, !tbaa !11
  %87 = load i64, ptr %8, align 8, !tbaa !5
  %88 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %87) #5
  %89 = getelementptr inbounds %"struct.std::pair", ptr %88, i32 0, i32 0
  %90 = load i64, ptr %89, align 8, !tbaa !11
  %91 = sub nsw i64 %86, %90
  br label %92

92:                                               ; preds = %82, %71
  %93 = phi i64 [ %81, %71 ], [ %91, %82 ]
  store i64 %93, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %94 = load i64, ptr %8, align 8, !tbaa !5
  %95 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %94) #5
  %96 = getelementptr inbounds %"struct.std::pair", ptr %95, i32 0, i32 1
  %97 = load i64, ptr %96, align 8, !tbaa !13
  %98 = load i64, ptr %10, align 8, !tbaa !5
  %99 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %98) #5
  %100 = getelementptr inbounds %"struct.std::pair", ptr %99, i32 0, i32 1
  %101 = load i64, ptr %100, align 8, !tbaa !13
  %102 = sub nsw i64 %97, %101
  %103 = icmp slt i64 %102, 0
  br i1 %103, label %104, label %115

104:                                              ; preds = %92
  %105 = load i64, ptr %8, align 8, !tbaa !5
  %106 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %105) #5
  %107 = getelementptr inbounds %"struct.std::pair", ptr %106, i32 0, i32 1
  %108 = load i64, ptr %107, align 8, !tbaa !13
  %109 = load i64, ptr %10, align 8, !tbaa !5
  %110 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %109) #5
  %111 = getelementptr inbounds %"struct.std::pair", ptr %110, i32 0, i32 1
  %112 = load i64, ptr %111, align 8, !tbaa !13
  %113 = sub nsw i64 %108, %112
  %114 = sub nsw i64 0, %113
  br label %125

115:                                              ; preds = %92
  %116 = load i64, ptr %8, align 8, !tbaa !5
  %117 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %116) #5
  %118 = getelementptr inbounds %"struct.std::pair", ptr %117, i32 0, i32 1
  %119 = load i64, ptr %118, align 8, !tbaa !13
  %120 = load i64, ptr %10, align 8, !tbaa !5
  %121 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %120) #5
  %122 = getelementptr inbounds %"struct.std::pair", ptr %121, i32 0, i32 1
  %123 = load i64, ptr %122, align 8, !tbaa !13
  %124 = sub nsw i64 %119, %123
  br label %125

125:                                              ; preds = %115, %104
  %126 = phi i64 [ %114, %104 ], [ %124, %115 ]
  store i64 %126, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %127 = load i64, ptr %11, align 8, !tbaa !5
  %128 = load i64, ptr %11, align 8, !tbaa !5
  %129 = mul nsw i64 %127, %128
  %130 = load i64, ptr %12, align 8, !tbaa !5
  %131 = load i64, ptr %12, align 8, !tbaa !5
  %132 = mul nsw i64 %130, %131
  %133 = add nsw i64 %129, %132
  store i64 %133, ptr %13, align 8, !tbaa !5
  %134 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %135 unwind label %140

135:                                              ; preds = %125
  %136 = load i64, ptr %134, align 8, !tbaa !5
  store i64 %136, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %137

137:                                              ; preds = %135
  %138 = load i64, ptr %10, align 8, !tbaa !5
  %139 = add nsw i64 %138, 1
  store i64 %139, ptr %10, align 8, !tbaa !5
  br label %55, !llvm.loop !14

140:                                              ; preds = %125
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %4, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  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 %8) #5
  br label %161

144:                                              ; preds = %59
  br label %145

145:                                              ; preds = %144
  %146 = load i64, ptr %8, align 8, !tbaa !5
  %147 = add nsw i64 %146, 1
  store i64 %147, ptr %8, align 8, !tbaa !5
  br label %46, !llvm.loop !15

148:                                              ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %149 = load i64, ptr %7, align 8, !tbaa !5
  %150 = invoke noundef double @_ZSt4sqrtIlEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef %149)
          to label %151 unwind label %157

151:                                              ; preds = %148
  store double %150, ptr %14, align 8, !tbaa !16
  %152 = load double, ptr %14, align 8, !tbaa !16
  %153 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEd(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, double noundef %152)
          to label %154 unwind label %157

154:                                              ; preds = %151
  %155 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %153, ptr noundef @.str)
          to label %156 unwind label %157

156:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void

157:                                              ; preds = %154, %151, %148
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %4, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %161

161:                                              ; preds = %157, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %162

162:                                              ; preds = %161, %41
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  br label %163

163:                                              ; preds = %162, %23
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  br label %164

164:                                              ; preds = %163
  %165 = load ptr, ptr %4, align 8
  %166 = load i32, ptr %5, align 4
  %167 = insertvalue { ptr, i32 } poison, ptr %165, 0
  %168 = insertvalue { ptr, i32 } %167, i32 %166, 1
  resume { ptr, i32 } %168
}

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSaISt4pairIllEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIlEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 = { 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 = { 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 #4 = { 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 #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 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt4pairIllE", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}


; 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<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, 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 [2 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 %"class.std::allocator", align 1
  %4 = alloca i64, align 8
  %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)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  %7 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  call void @_ZNSaISt4pairIllEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt6vectorISt4pairIllESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %7, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %8 unwind label %12

8:                                                ; preds = %0
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  %9 = load i64, ptr %1, align 8, !tbaa !5
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %._crit_edge42

._crit_edge:                                      ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  %11 = icmp sgt i64 %22, 1
  br i1 %11, label %.lr.ph41, label %._crit_edge42

12:                                               ; preds = %0
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  br label %77

.lr.ph:                                           ; preds = %8, %20
  %.02935 = phi i64 [ %21, %20 ], [ 0, %8 ]
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.02935) #5
  %15 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %16 unwind label %24

16:                                               ; preds = %.lr.ph
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.02935) #5
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  %19 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %20 unwind label %24

20:                                               ; preds = %16
  %21 = add nuw nsw i64 %.02935, 1
  %22 = load i64, ptr %1, align 8, !tbaa !5
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !9

24:                                               ; preds = %16, %.lr.ph
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %76

.loopexit:                                        ; preds = %.lr.ph38, %.lr.ph41
  %26 = phi i64 [ %33, %.lr.ph41 ], [ %67, %.lr.ph38 ]
  %27 = phi i64 [ %34, %.lr.ph41 ], [ %69, %.lr.ph38 ]
  %28 = add nsw i64 %27, -1
  %29 = icmp slt i64 %35, %28
  br i1 %29, label %.lr.ph41, label %._crit_edge42, !llvm.loop !11

._crit_edge42:                                    ; preds = %.loopexit, %._crit_edge.thread, %._crit_edge
  %30 = phi i64 [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ], [ %26, %.loopexit ]
  %31 = call noundef double @_ZSt4sqrtIlEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef %30)
  %32 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEd(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, double noundef %31)
          to label %71 unwind label %74

.lr.ph41:                                         ; preds = %._crit_edge, %.loopexit
  %33 = phi i64 [ %26, %.loopexit ], [ 0, %._crit_edge ]
  %34 = phi i64 [ %27, %.loopexit ], [ %22, %._crit_edge ]
  %.03139 = phi i64 [ %35, %.loopexit ], [ 0, %._crit_edge ]
  %35 = add nuw nsw i64 %.03139, 1
  %36 = icmp slt i64 %35, %34
  br i1 %36, label %.lr.ph38, label %.loopexit

.lr.ph38:                                         ; preds = %.lr.ph41, %.lr.ph38
  %.03036 = phi i64 [ %68, %.lr.ph38 ], [ %35, %.lr.ph41 ]
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03036) #5
  %38 = load i64, ptr %37, align 8, !tbaa !12
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03139) #5
  %40 = load i64, ptr %39, align 8, !tbaa !12
  %41 = icmp slt i64 %38, %40
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03036) #5
  %43 = load i64, ptr %42, align 8, !tbaa !12
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03139) #5
  %45 = load i64, ptr %44, align 8, !tbaa !12
  %.neg = sub nsw i64 %45, %43
  %46 = sub nsw i64 %43, %45
  %47 = select i1 %41, i64 %.neg, i64 %46
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03139) #5
  %49 = getelementptr inbounds i8, ptr %48, i64 8
  %50 = load i64, ptr %49, align 8, !tbaa !14
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03036) #5
  %52 = getelementptr inbounds i8, ptr %51, i64 8
  %53 = load i64, ptr %52, align 8, !tbaa !14
  %54 = icmp slt i64 %50, %53
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03139) #5
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %57 = load i64, ptr %56, align 8, !tbaa !14
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.03036) #5
  %59 = getelementptr inbounds i8, ptr %58, i64 8
  %60 = load i64, ptr %59, align 8, !tbaa !14
  %.neg32 = sub nsw i64 %60, %57
  %61 = sub nsw i64 %57, %60
  %62 = select i1 %54, i64 %.neg32, i64 %61
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %63 = mul nsw i64 %47, %47
  %64 = mul nsw i64 %62, %62
  %65 = add nuw nsw i64 %64, %63
  store i64 %65, ptr %5, align 8, !tbaa !5
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %67 = load i64, ptr %66, align 8, !tbaa !5
  store i64 %67, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %68 = add nuw nsw i64 %.03036, 1
  %69 = load i64, ptr %1, align 8, !tbaa !5
  %70 = icmp slt i64 %68, %69
  br i1 %70, label %.lr.ph38, label %.loopexit, !llvm.loop !15

71:                                               ; preds = %._crit_edge42
  %72 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull @.str)
          to label %73 unwind label %74

73:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void

74:                                               ; preds = %71, %._crit_edge42
  %75 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %76

76:                                               ; preds = %74, %24
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %75, %74 ]
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  br label %77

77:                                               ; preds = %76, %12
  %.pn.pn = phi { ptr, i32 } [ %.pn, %76 ], [ %13, %12 ]
  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 nounwind uwtable
declare dso_local void @_ZNSaISt4pairIllEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIlEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 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 = { 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 #4 = { 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 #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 = distinct !{!11, !10}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ZTSSt4pairIllE", !6, i64 0, !6, i64 8}
!14 = !{!13, !6, i64 8}
!15 = distinct !{!15, !10}


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