; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Codesprints 2016/Codesprint July/Problem E/brute.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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator.5" = type { ptr }

@g = external dso_local global [100100 x %"class.std::vector"], align 16
@c = external dso_local global [100100 x i64], align 16
@bad = external dso_local global [100100 x i32], align 16
@vis = external dso_local global [100100 x i32], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z3dfsii(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #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 %"struct.std::pair", align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::vector.0", align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca %"class.std::vector.0", align 8
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  %25 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %26 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1)
  store i64 1152921504606846976, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %41, %0
  %29 = load i32, ptr %2, align 4, !tbaa !9
  %30 = load i32, ptr %1, align 4, !tbaa !9
  %31 = icmp sle i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %44

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %35
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #6
  %37 = load i32, ptr %2, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i64, ptr @c, i64 %38
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %39)
  br label %41

41:                                               ; preds = %33
  %42 = load i32, ptr %2, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !9
  br label %28, !llvm.loop !11

44:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %60, %44
  %46 = load i32, ptr %3, align 4, !tbaa !9
  %47 = load i32, ptr %1, align 4, !tbaa !9
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %4, ptr noundef %5)
  %52 = load i32, ptr %4, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %55 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %55, ptr %6, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %59 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %59, ptr %7, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %60

60:                                               ; preds = %50
  %61 = load i32, ptr %3, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %3, align 4, !tbaa !9
  br label %45, !llvm.loop !13

63:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %165, %63
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = load i32, ptr %1, align 4, !tbaa !9
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %168

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %10, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %160, %69
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = load i32, ptr %1, align 4, !tbaa !9
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %164

77:                                               ; preds = %72
  %78 = load i32, ptr %8, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %79
  store i32 1, ptr %80, align 4, !tbaa !9
  %81 = load i32, ptr %10, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %82
  store i32 1, ptr %83, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %93, %77
  %85 = load i32, ptr %11, align 4, !tbaa !9
  %86 = load i32, ptr %1, align 4, !tbaa !9
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %96

89:                                               ; preds = %84
  %90 = load i32, ptr %11, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100100 x i32], ptr @vis, i64 0, i64 %91
  store i32 0, ptr %92, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %89
  %94 = load i32, ptr %11, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %11, align 4, !tbaa !9
  br label %84, !llvm.loop !14

96:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %118, %96
  %98 = load i32, ptr %13, align 4, !tbaa !9
  %99 = load i32, ptr %1, align 4, !tbaa !9
  %100 = icmp sle i32 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  store i32 17, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %121

102:                                              ; preds = %97
  %103 = load i32, ptr %13, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100100 x i32], ptr @vis, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %117, label %108

108:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = invoke noundef i64 @_Z3dfsii(i32 noundef %109, i32 noundef -1)
          to label %111 unwind label %113

111:                                              ; preds = %108
  store i64 %110, ptr %14, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %112 unwind label %113

112:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %117

113:                                              ; preds = %111, %108
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %15, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %163

117:                                              ; preds = %112, %102
  br label %118

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

121:                                              ; preds = %101
  %122 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  %123 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %17, i32 0, i32 0
  store ptr %122, ptr %123, align 8
  %124 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  %125 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %18, i32 0, i32 0
  store ptr %124, ptr %125, align 8
  %126 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %17, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8
  %128 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %18, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %127, ptr %129)
          to label %130 unwind label %145

130:                                              ; preds = %121
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef 1) #6
  %132 = load i64, ptr %131, align 8, !tbaa !5
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef 2) #6
  %134 = load i64, ptr %133, align 8, !tbaa !5
  %135 = icmp eq i64 %132, %134
  br i1 %135, label %136, label %153

136:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef 1) #6
  %138 = load i64, ptr %137, align 8, !tbaa !5
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef 0) #6
  %140 = load i64, ptr %139, align 8, !tbaa !5
  %141 = sub nsw i64 %138, %140
  store i64 %141, ptr %19, align 8, !tbaa !5
  %142 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %143 unwind label %149

143:                                              ; preds = %136
  %144 = load i64, ptr %142, align 8, !tbaa !5
  store i64 %144, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %153

145:                                              ; preds = %121
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %15, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %16, align 4
  br label %163

149:                                              ; preds = %136
  %150 = landingpad { ptr, i32 }
          cleanup
  %151 = extractvalue { ptr, i32 } %150, 0
  store ptr %151, ptr %15, align 8
  %152 = extractvalue { ptr, i32 } %150, 1
  store i32 %152, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %163

153:                                              ; preds = %143, %130
  %154 = load i32, ptr %8, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %155
  store i32 0, ptr %156, align 4, !tbaa !9
  %157 = load i32, ptr %10, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %158
  store i32 0, ptr %159, align 4, !tbaa !9
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  br label %160

160:                                              ; preds = %153
  %161 = load i32, ptr %10, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %10, align 4, !tbaa !9
  br label %72, !llvm.loop !16

163:                                              ; preds = %149, %145, %113
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %254

164:                                              ; preds = %76
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %8, align 4, !tbaa !9
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %8, align 4, !tbaa !9
  br label %64, !llvm.loop !17

168:                                              ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 1, ptr %20, align 4, !tbaa !9
  br label %169

169:                                              ; preds = %243, %168
  %170 = load i32, ptr %20, align 4, !tbaa !9
  %171 = load i32, ptr %1, align 4, !tbaa !9
  %172 = icmp slt i32 %170, %171
  br i1 %172, label %174, label %173

173:                                              ; preds = %169
  store i32 20, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %247

174:                                              ; preds = %169
  %175 = load i32, ptr %20, align 4, !tbaa !9
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %176
  store i32 1, ptr %177, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 1, ptr %21, align 4, !tbaa !9
  br label %178

178:                                              ; preds = %187, %174
  %179 = load i32, ptr %21, align 4, !tbaa !9
  %180 = load i32, ptr %1, align 4, !tbaa !9
  %181 = icmp sle i32 %179, %180
  br i1 %181, label %183, label %182

182:                                              ; preds = %178
  store i32 23, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %190

183:                                              ; preds = %178
  %184 = load i32, ptr %21, align 4, !tbaa !9
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100100 x i32], ptr @vis, i64 0, i64 %185
  store i32 0, ptr %186, align 4, !tbaa !9
  br label %187

187:                                              ; preds = %183
  %188 = load i32, ptr %21, align 4, !tbaa !9
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %21, align 4, !tbaa !9
  br label %178, !llvm.loop !18

190:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #6
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 1, ptr %23, align 4, !tbaa !9
  br label %191

191:                                              ; preds = %212, %190
  %192 = load i32, ptr %23, align 4, !tbaa !9
  %193 = load i32, ptr %1, align 4, !tbaa !9
  %194 = icmp sle i32 %192, %193
  br i1 %194, label %196, label %195

195:                                              ; preds = %191
  store i32 26, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %215

196:                                              ; preds = %191
  %197 = load i32, ptr %23, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [100100 x i32], ptr @vis, i64 0, i64 %198
  %200 = load i32, ptr %199, align 4, !tbaa !9
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %211, label %202

202:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %203 = load i32, ptr %23, align 4, !tbaa !9
  %204 = invoke noundef i64 @_Z3dfsii(i32 noundef %203, i32 noundef -1)
          to label %205 unwind label %207

205:                                              ; preds = %202
  store i64 %204, ptr %24, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %206 unwind label %207

206:                                              ; preds = %205
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %211

207:                                              ; preds = %205, %202
  %208 = landingpad { ptr, i32 }
          cleanup
  %209 = extractvalue { ptr, i32 } %208, 0
  store ptr %209, ptr %15, align 8
  %210 = extractvalue { ptr, i32 } %208, 1
  store i32 %210, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %246

211:                                              ; preds = %206, %196
  br label %212

212:                                              ; preds = %211
  %213 = load i32, ptr %23, align 4, !tbaa !9
  %214 = add nsw i32 %213, 1
  store i32 %214, ptr %23, align 4, !tbaa !9
  br label %191, !llvm.loop !19

215:                                              ; preds = %195
  %216 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #6
  %217 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %25, i32 0, i32 0
  store ptr %216, ptr %217, align 8
  %218 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #6
  %219 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %26, i32 0, i32 0
  store ptr %218, ptr %219, align 8
  %220 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %25, i32 0, i32 0
  %221 = load ptr, ptr %220, align 8
  %222 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %26, i32 0, i32 0
  %223 = load ptr, ptr %222, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %221, ptr %223)
          to label %224 unwind label %235

224:                                              ; preds = %215
  %225 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef 1) #6
  %226 = load i64, ptr %225, align 8, !tbaa !5
  %227 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef 0) #6
  %228 = load i64, ptr %227, align 8, !tbaa !5
  %229 = icmp eq i64 %226, %228
  br i1 %229, label %230, label %239

230:                                              ; preds = %224
  %231 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef 1) #6
  %232 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %231)
          to label %233 unwind label %235

233:                                              ; preds = %230
  %234 = load i64, ptr %232, align 8, !tbaa !5
  store i64 %234, ptr @ans, align 8, !tbaa !5
  br label %239

235:                                              ; preds = %230, %215
  %236 = landingpad { ptr, i32 }
          cleanup
  %237 = extractvalue { ptr, i32 } %236, 0
  store ptr %237, ptr %15, align 8
  %238 = extractvalue { ptr, i32 } %236, 1
  store i32 %238, ptr %16, align 4
  br label %246

239:                                              ; preds = %233, %224
  %240 = load i32, ptr %20, align 4, !tbaa !9
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %241
  store i32 0, ptr %242, align 4, !tbaa !9
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #6
  br label %243

243:                                              ; preds = %239
  %244 = load i32, ptr %20, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %20, align 4, !tbaa !9
  br label %169, !llvm.loop !20

246:                                              ; preds = %235, %207
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %254

247:                                              ; preds = %173
  %248 = load i64, ptr @ans, align 8, !tbaa !5
  %249 = icmp eq i64 %248, 1152921504606846976
  br i1 %249, label %250, label %251

250:                                              ; preds = %247
  store i64 -1, ptr @ans, align 8, !tbaa !5
  br label %251

251:                                              ; preds = %250, %247
  %252 = load i64, ptr @ans, align 8, !tbaa !5
  %253 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %252)
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void

254:                                              ; preds = %246, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  br label %255

255:                                              ; preds = %254
  %256 = load ptr, ptr %15, align 8
  %257 = load i32, ptr %16, align 4
  %258 = insertvalue { ptr, i32 } poison, ptr %256, 0
  %259 = insertvalue { ptr, i32 } %258, i32 %257, 1
  resume { ptr, i32 } %259
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) #4

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

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

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

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

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

declare i32 @printf(ptr noundef, ...) #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 = { "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 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@g = external dso_local global [100100 x %"class.std::vector"], align 16
@c = external dso_local global [100100 x i64], align 16
@bad = external dso_local local_unnamed_addr global [100100 x i32], align 16
@vis = external dso_local local_unnamed_addr global [100100 x i32], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #0

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() 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 %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca %"class.std::vector.0", align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca %"class.std::vector.0", align 8
  %11 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  store i64 1152921504606846976, ptr @ans, align 8, !tbaa !5
  %13 = load i32, ptr %1, align 4, !tbaa !9
  %.not56 = icmp slt i32 %13, 1
  br i1 %.not56, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  br label %._crit_edge60.thread

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 1, ptr %2, align 4, !tbaa !9
  %14 = icmp sgt i32 %18, 1
  br i1 %14, label %.lr.ph59, label %._crit_edge60.thread

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %15 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  %16 = getelementptr inbounds i64, ptr @c, i64 %indvars.iv
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr %1, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %.not.not = icmp slt i64 %indvars.iv, %19
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge60.thread:                             ; preds = %._crit_edge, %._crit_edge.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  br label %._crit_edge89

._crit_edge60:                                    ; preds = %.lr.ph59
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %20 = icmp sgt i32 %32, 1
  br i1 %20, label %.lr.ph76, label %._crit_edge89

.lr.ph59:                                         ; preds = %._crit_edge, %.lr.ph59
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %25 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %25, ptr %5, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %29 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %29, ptr %6, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %30 = load i32, ptr %2, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %2, align 4, !tbaa !9
  %32 = load i32, ptr %1, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %.lr.ph59, label %._crit_edge60, !llvm.loop !13

.loopexit.loopexit:                               ; preds = %78
  %.pre115 = sext i32 %79 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph76
  %.pre-phi = phi i64 [ %.pre115, %.loopexit.loopexit ], [ %38, %.lr.ph76 ]
  %34 = phi i32 [ %79, %.loopexit.loopexit ], [ %37, %.lr.ph76 ]
  %35 = icmp slt i64 %indvars.iv.next103, %.pre-phi
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  br i1 %35, label %.lr.ph76, label %.preheader, !llvm.loop !14

.preheader:                                       ; preds = %.loopexit
  %36 = icmp sgt i32 %34, 1
  br i1 %36, label %.lr.ph88, label %._crit_edge89

.lr.ph76:                                         ; preds = %._crit_edge60, %.loopexit
  %37 = phi i32 [ %34, %.loopexit ], [ %32, %._crit_edge60 ]
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %.loopexit ], [ 1, %._crit_edge60 ]
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.loopexit ], [ 2, %._crit_edge60 ]
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next103, %38
  br i1 %39, label %.lr.ph73, label %.loopexit

.lr.ph73:                                         ; preds = %.lr.ph76
  %40 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %indvars.iv102
  br label %41

41:                                               ; preds = %.lr.ph73, %78
  %indvars.iv99 = phi i64 [ %indvars.iv97, %.lr.ph73 ], [ %indvars.iv.next100, %78 ]
  %42 = phi i32 [ %37, %.lr.ph73 ], [ %79, %78 ]
  store i32 1, ptr %40, align 4, !tbaa !9
  %43 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %indvars.iv99
  store i32 1, ptr %43, align 4, !tbaa !9
  %.not5061 = icmp slt i32 %42, 1
  br i1 %.not5061, label %._crit_edge65, label %.lr.ph64.preheader

.lr.ph64.preheader:                               ; preds = %41
  %44 = zext nneg i32 %42 to i64
  %45 = shl nuw nsw i64 %44, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @vis, i64 4), i8 0, i64 %45, i1 false), !tbaa !9
  br label %._crit_edge65

._crit_edge65:                                    ; preds = %.lr.ph64.preheader, %41
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %46 = load i32, ptr %1, align 4, !tbaa !9
  %.not5166 = icmp slt i32 %46, 1
  br i1 %.not5166, label %._crit_edge70, label %.lr.ph69

._crit_edge70:                                    ; preds = %59, %._crit_edge65
  %47 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %48 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %47, ptr %48)
          to label %62 unwind label %76

.lr.ph69:                                         ; preds = %._crit_edge65, %59
  %49 = phi i32 [ %60, %59 ], [ %46, %._crit_edge65 ]
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %59 ], [ 1, %._crit_edge65 ]
  %50 = getelementptr inbounds [100100 x i32], ptr @vis, i64 0, i64 %indvars.iv94
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %.not52 = icmp eq i32 %51, 0
  br i1 %.not52, label %52, label %59

52:                                               ; preds = %.lr.ph69
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %53 = trunc nuw nsw i64 %indvars.iv94 to i32
  %54 = invoke noundef i64 @_Z3dfsii(i32 noundef %53, i32 noundef -1)
          to label %55 unwind label %57

55:                                               ; preds = %52
  store i64 %54, ptr %8, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %56 unwind label %57

56:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  %.pre = load i32, ptr %1, align 4, !tbaa !9
  br label %59

57:                                               ; preds = %55, %52
  %58 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br label %82

59:                                               ; preds = %.lr.ph69, %56
  %60 = phi i32 [ %49, %.lr.ph69 ], [ %.pre, %56 ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %61 = sext i32 %60 to i64
  %.not51.not = icmp slt i64 %indvars.iv94, %61
  br i1 %.not51.not, label %.lr.ph69, label %._crit_edge70, !llvm.loop !15

62:                                               ; preds = %._crit_edge70
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 1) #7
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 2) #7
  %66 = load i64, ptr %65, align 8, !tbaa !5
  %67 = icmp eq i64 %64, %66
  br i1 %67, label %68, label %78

68:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 1) #7
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #7
  %72 = load i64, ptr %71, align 8, !tbaa !5
  %73 = sub nsw i64 %70, %72
  store i64 %73, ptr %9, align 8, !tbaa !5
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %75 = load i64, ptr %74, align 8, !tbaa !5
  store i64 %75, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  br label %78

76:                                               ; preds = %._crit_edge70
  %77 = landingpad { ptr, i32 }
          cleanup
  br label %82

78:                                               ; preds = %68, %62
  store i32 0, ptr %40, align 4, !tbaa !9
  store i32 0, ptr %43, align 4, !tbaa !9
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %79 = load i32, ptr %1, align 4, !tbaa !9
  %80 = trunc nuw i64 %indvars.iv.next100 to i32
  %81 = icmp sgt i32 %79, %80
  br i1 %81, label %41, label %.loopexit.loopexit, !llvm.loop !16

82:                                               ; preds = %76, %57
  %.pn53 = phi { ptr, i32 } [ %58, %57 ], [ %77, %76 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  br label %126

._crit_edge89:                                    ; preds = %117, %._crit_edge60.thread, %._crit_edge60, %.preheader
  %83 = load i64, ptr @ans, align 8, !tbaa !5
  %84 = icmp eq i64 %83, 1152921504606846976
  br i1 %84, label %122, label %123

.lr.ph88:                                         ; preds = %.preheader, %117
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %117 ], [ 1, %.preheader ]
  %85 = phi i32 [ %118, %117 ], [ %34, %.preheader ]
  %86 = getelementptr inbounds [100100 x i32], ptr @bad, i64 0, i64 %indvars.iv111
  store i32 1, ptr %86, align 4, !tbaa !9
  %.not4677 = icmp slt i32 %85, 1
  br i1 %.not4677, label %._crit_edge81, label %.lr.ph80.preheader

.lr.ph80.preheader:                               ; preds = %.lr.ph88
  %87 = zext nneg i32 %85 to i64
  %88 = shl nuw nsw i64 %87, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @vis, i64 4), i8 0, i64 %88, i1 false), !tbaa !9
  br label %._crit_edge81

._crit_edge81:                                    ; preds = %.lr.ph80.preheader, %.lr.ph88
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %89 = load i32, ptr %1, align 4, !tbaa !9
  %.not4782 = icmp slt i32 %89, 1
  br i1 %.not4782, label %._crit_edge86, label %.lr.ph85

._crit_edge86:                                    ; preds = %102, %._crit_edge81
  %90 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %91 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %90, ptr %91)
          to label %105 unwind label %115

.lr.ph85:                                         ; preds = %._crit_edge81, %102
  %92 = phi i32 [ %103, %102 ], [ %89, %._crit_edge81 ]
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %102 ], [ 1, %._crit_edge81 ]
  %93 = getelementptr inbounds [100100 x i32], ptr @vis, i64 0, i64 %indvars.iv108
  %94 = load i32, ptr %93, align 4, !tbaa !9
  %.not48 = icmp eq i32 %94, 0
  br i1 %.not48, label %95, label %102

95:                                               ; preds = %.lr.ph85
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %96 = trunc nuw nsw i64 %indvars.iv108 to i32
  %97 = invoke noundef i64 @_Z3dfsii(i32 noundef %96, i32 noundef -1)
          to label %98 unwind label %100

98:                                               ; preds = %95
  store i64 %97, ptr %11, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %99 unwind label %100

99:                                               ; preds = %98
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  %.pre114 = load i32, ptr %1, align 4, !tbaa !9
  br label %102

100:                                              ; preds = %98, %95
  %101 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br label %121

102:                                              ; preds = %.lr.ph85, %99
  %103 = phi i32 [ %92, %.lr.ph85 ], [ %.pre114, %99 ]
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %104 = sext i32 %103 to i64
  %.not47.not = icmp slt i64 %indvars.iv108, %104
  br i1 %.not47.not, label %.lr.ph85, label %._crit_edge86, !llvm.loop !17

105:                                              ; preds = %._crit_edge86
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef 1) #7
  %107 = load i64, ptr %106, align 8, !tbaa !5
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef 0) #7
  %109 = load i64, ptr %108, align 8, !tbaa !5
  %110 = icmp eq i64 %107, %109
  br i1 %110, label %111, label %117

111:                                              ; preds = %105
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef 1) #7
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %112)
  %114 = load i64, ptr %113, align 8, !tbaa !5
  store i64 %114, ptr @ans, align 8, !tbaa !5
  br label %117

115:                                              ; preds = %._crit_edge86
  %116 = landingpad { ptr, i32 }
          cleanup
  br label %121

117:                                              ; preds = %111, %105
  store i32 0, ptr %86, align 4, !tbaa !9
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %118 = load i32, ptr %1, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = icmp slt i64 %indvars.iv.next112, %119
  br i1 %120, label %.lr.ph88, label %._crit_edge89, !llvm.loop !18

121:                                              ; preds = %115, %100
  %.pn = phi { ptr, i32 } [ %101, %100 ], [ %116, %115 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  br label %126

122:                                              ; preds = %._crit_edge89
  store i64 -1, ptr @ans, align 8, !tbaa !5
  br label %123

123:                                              ; preds = %122, %._crit_edge89
  %124 = phi i64 [ -1, %122 ], [ %83, %._crit_edge89 ]
  %125 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %124)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret void

126:                                              ; preds = %121, %82
  %.pn53.pn = phi { ptr, i32 } [ %.pn53, %82 ], [ %.pn, %121 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn53.pn
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) local_unnamed_addr #4

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

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

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

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

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

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

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

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 = { 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 #3 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass