; LLVM IR from eyangch/competitive-programming :: Codeforces/1553 (e)

; 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 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" = type { ptr }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@p = external dso_local global [300000 x i64], align 16
@occ = external dso_local global [300000 x i64], align 16
@vis = external dso_local global [300000 x i64], align 16
@nxt = external dso_local global [300000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %20 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %22
  %24 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %23, ptr noundef null)
  %25 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %27

27:                                               ; preds = %191, %0
  %28 = load i64, ptr @T, align 8, !tbaa !8
  %29 = add nsw i64 %28, -1
  store i64 %29, ptr @T, align 8, !tbaa !8
  %30 = icmp ne i64 %28, 0
  br i1 %30, label %31, label %193

31:                                               ; preds = %27
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %34 = load i64, ptr @N, align 8, !tbaa !8
  %35 = getelementptr inbounds i64, ptr @occ, i64 %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @occ, ptr noundef %35, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %36

36:                                               ; preds = %60, %31
  %37 = load i64, ptr %3, align 8, !tbaa !8
  %38 = load i64, ptr @N, align 8, !tbaa !8
  %39 = icmp slt i64 %37, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %43 = load i64, ptr %3, align 8, !tbaa !8
  %44 = load i64, ptr %4, align 8, !tbaa !8
  %45 = sub nsw i64 %44, 1
  %46 = sub nsw i64 %43, %45
  %47 = load i64, ptr @N, align 8, !tbaa !8
  %48 = srem i64 %46, %47
  %49 = load i64, ptr @N, align 8, !tbaa !8
  %50 = add nsw i64 %48, %49
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %52 = srem i64 %50, %51
  %53 = getelementptr inbounds [300000 x i64], ptr @occ, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !8
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %53, align 8, !tbaa !8
  %56 = load i64, ptr %4, align 8, !tbaa !8
  %57 = sub nsw i64 %56, 1
  %58 = load i64, ptr %3, align 8, !tbaa !8
  %59 = getelementptr inbounds [300000 x i64], ptr @p, i64 0, i64 %58
  store i64 %57, ptr %59, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %60

60:                                               ; preds = %41
  %61 = load i64, ptr %3, align 8, !tbaa !8
  %62 = add nsw i64 %61, 1
  store i64 %62, ptr %3, align 8, !tbaa !8
  br label %36, !llvm.loop !13

63:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %64

64:                                               ; preds = %154, %63
  %65 = load i64, ptr %6, align 8, !tbaa !8
  %66 = load i64, ptr @N, align 8, !tbaa !8
  %67 = icmp slt i64 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  %70 = load i64, ptr %6, align 8, !tbaa !8
  %71 = getelementptr inbounds [300000 x i64], ptr @occ, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !8
  %73 = load i64, ptr @N, align 8, !tbaa !8
  %74 = load i64, ptr @M, align 8, !tbaa !8
  %75 = mul nsw i64 2, %74
  %76 = sub nsw i64 %73, %75
  %77 = icmp sge i64 %72, %76
  br i1 %77, label %78, label %153

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

79:                                               ; preds = %96, %78
  %80 = load i64, ptr %8, align 8, !tbaa !8
  %81 = load i64, ptr @N, align 8, !tbaa !8
  %82 = icmp slt i64 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %99

84:                                               ; preds = %79
  %85 = load i64, ptr %8, align 8, !tbaa !8
  %86 = getelementptr inbounds [300000 x i64], ptr @p, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !8
  %88 = load i64, ptr %8, align 8, !tbaa !8
  %89 = load i64, ptr %6, align 8, !tbaa !8
  %90 = sub nsw i64 %88, %89
  %91 = load i64, ptr @N, align 8, !tbaa !8
  %92 = add nsw i64 %90, %91
  %93 = load i64, ptr @N, align 8, !tbaa !8
  %94 = srem i64 %92, %93
  %95 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %94
  store i64 %87, ptr %95, align 8, !tbaa !8
  br label %96

96:                                               ; preds = %84
  %97 = load i64, ptr %8, align 8, !tbaa !8
  %98 = add nsw i64 %97, 1
  store i64 %98, ptr %8, align 8, !tbaa !8
  br label %79, !llvm.loop !15

99:                                               ; preds = %83
  %100 = load i64, ptr @N, align 8, !tbaa !8
  %101 = getelementptr inbounds i64, ptr @vis, i64 %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !11
  invoke void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @vis, ptr noundef %101, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %102 unwind label %108

102:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !8
  br label %103

103:                                              ; preds = %139, %102
  %104 = load i64, ptr %13, align 8, !tbaa !8
  %105 = load i64, ptr @N, align 8, !tbaa !8
  %106 = icmp slt i64 %104, %105
  br i1 %106, label %112, label %107

107:                                              ; preds = %103
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %142

108:                                              ; preds = %99
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %10, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %157

112:                                              ; preds = %103
  %113 = load i64, ptr %13, align 8, !tbaa !8
  %114 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = icmp ne i64 %115, 0
  br i1 %116, label %117, label %118

117:                                              ; preds = %112
  br label %139

118:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %119 = load i64, ptr %13, align 8, !tbaa !8
  store i64 %119, ptr %14, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  store i64 0, ptr %15, align 8, !tbaa !8
  br label %120

120:                                              ; preds = %126, %118
  %121 = load i64, ptr %14, align 8, !tbaa !8
  %122 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !8
  %124 = icmp ne i64 %123, 0
  %125 = xor i1 %124, true
  br i1 %125, label %126, label %134

126:                                              ; preds = %120
  %127 = load i64, ptr %14, align 8, !tbaa !8
  %128 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %127
  store i64 1, ptr %128, align 8, !tbaa !8
  %129 = load i64, ptr %15, align 8, !tbaa !8
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %15, align 8, !tbaa !8
  %131 = load i64, ptr %14, align 8, !tbaa !8
  %132 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !8
  store i64 %133, ptr %14, align 8, !tbaa !8
  br label %120, !llvm.loop !16

134:                                              ; preds = %120
  %135 = load i64, ptr %15, align 8, !tbaa !8
  %136 = sub nsw i64 %135, 1
  %137 = load i64, ptr %12, align 8, !tbaa !8
  %138 = add nsw i64 %137, %136
  store i64 %138, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %139

139:                                              ; preds = %134, %117
  %140 = load i64, ptr %13, align 8, !tbaa !8
  %141 = add nsw i64 %140, 1
  store i64 %141, ptr %13, align 8, !tbaa !8
  br label %103, !llvm.loop !17

142:                                              ; preds = %107
  %143 = load i64, ptr %12, align 8, !tbaa !8
  %144 = load i64, ptr @M, align 8, !tbaa !8
  %145 = icmp sle i64 %143, %144
  br i1 %145, label %146, label %152

146:                                              ; preds = %142
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %147 unwind label %148

147:                                              ; preds = %146
  br label %152

148:                                              ; preds = %146
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %10, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %157

152:                                              ; preds = %147, %142
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %153

153:                                              ; preds = %152, %69
  br label %154

154:                                              ; preds = %153
  %155 = load i64, ptr %6, align 8, !tbaa !8
  %156 = add nsw i64 %155, 1
  store i64 %156, ptr %6, align 8, !tbaa !8
  br label %64, !llvm.loop !18

157:                                              ; preds = %148, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %192

158:                                              ; preds = %68
  %159 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %160 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %159)
          to label %161 unwind label %171

161:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store ptr %5, ptr %16, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %162 = load ptr, ptr %16, align 8, !tbaa !19
  %163 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %162) #7
  %164 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %163, ptr %164, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %165 = load ptr, ptr %16, align 8, !tbaa !19
  %166 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %165) #7
  %167 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %166, ptr %167, align 8
  br label %168

168:                                              ; preds = %183, %161
  %169 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  br i1 %169, label %175, label %170

170:                                              ; preds = %168
  store i32 18, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %189

171:                                              ; preds = %189, %158
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %10, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %11, align 4
  br label %192

175:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %176 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  %177 = load i64, ptr %176, align 8, !tbaa !8
  store i64 %177, ptr %19, align 8, !tbaa !8
  %178 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 32)
          to label %179 unwind label %185

179:                                              ; preds = %175
  %180 = load i64, ptr %19, align 8, !tbaa !8
  %181 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %178, i64 noundef %180)
          to label %182 unwind label %185

182:                                              ; preds = %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %183

183:                                              ; preds = %182
  %184 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  br label %168

185:                                              ; preds = %179, %175
  %186 = landingpad { ptr, i32 }
          cleanup
  %187 = extractvalue { ptr, i32 } %186, 0
  store ptr %187, ptr %10, align 8
  %188 = extractvalue { ptr, i32 } %186, 1
  store i32 %188, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %192

189:                                              ; preds = %170
  %190 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
          to label %191 unwind label %171

191:                                              ; preds = %189
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #7
  br label %27, !llvm.loop !21

192:                                              ; preds = %185, %171, %157
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #7
  br label %195

193:                                              ; preds = %27
  %194 = load i32, ptr %1, align 4
  ret i32 %194

195:                                              ; preds = %192
  %196 = load ptr, ptr %10, align 8
  %197 = load i32, ptr %11, align 4
  %198 = insertvalue { ptr, i32 } poison, ptr %196, 0
  %199 = insertvalue { ptr, i32 } %198, i32 %197, 1
  resume { ptr, i32 } %199
}

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

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

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


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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" = type { ptr }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@p = external dso_local local_unnamed_addr global [300000 x i64], align 16
@occ = external dso_local global [300000 x i64], align 16
@vis = external dso_local global [300000 x i64], align 16
@nxt = external dso_local local_unnamed_addr global [300000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %15 = load i64, ptr @T, align 8, !tbaa !8
  %16 = add nsw i64 %15, -1
  store i64 %16, ptr @T, align 8, !tbaa !8
  %.not67 = icmp eq i64 %15, 0
  br i1 %.not67, label %._crit_edge70, label %.lr.ph69

.lr.ph69:                                         ; preds = %0, %132
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %19 = load i64, ptr @N, align 8, !tbaa !8
  %20 = getelementptr inbounds i64, ptr @occ, i64 %19
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @occ, ptr noundef nonnull %20, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %21 = load i64, ptr @N, align 8, !tbaa !8
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph69
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  store i64 0, ptr %4, align 8, !tbaa !8
  %23 = load i64, ptr @N, align 8, !tbaa !8
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %.lr.ph62, label %._crit_edge63

.lr.ph:                                           ; preds = %.lr.ph69, %.lr.ph
  %.044 = phi i64 [ %37, %.lr.ph ], [ 0, %.lr.ph69 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %26 = load i64, ptr %2, align 8, !tbaa !8
  %27 = add nsw i64 %26, -1
  %28 = sub nsw i64 %.044, %27
  %29 = load i64, ptr @N, align 8, !tbaa !8
  %30 = srem i64 %28, %29
  %31 = add nsw i64 %30, %29
  %32 = srem i64 %31, %29
  %33 = getelementptr inbounds [300000 x i64], ptr @occ, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %33, align 8, !tbaa !8
  %36 = getelementptr inbounds [300000 x i64], ptr @p, i64 0, i64 %.044
  store i64 %27, ptr %36, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %37 = add nuw nsw i64 %.044, 1
  %38 = icmp slt i64 %37, %29
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge63:                                    ; preds = %109, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %39 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %40 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %39)
          to label %115 unwind label %120

.lr.ph62:                                         ; preds = %._crit_edge, %109
  %41 = phi i64 [ %110, %109 ], [ %23, %._crit_edge ]
  %storemerge60 = phi i64 [ %112, %109 ], [ 0, %._crit_edge ]
  %42 = getelementptr inbounds [300000 x i64], ptr @occ, i64 0, i64 %storemerge60
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = load i64, ptr @M, align 8, !tbaa !8
  %45 = shl nsw i64 %44, 1
  %46 = sub nsw i64 %41, %45
  %.not37 = icmp slt i64 %43, %46
  br i1 %.not37, label %109, label %.preheader43

.preheader43:                                     ; preds = %.lr.ph62
  %47 = icmp sgt i64 %41, 0
  br i1 %47, label %.lr.ph46, label %._crit_edge47

.lr.ph46:                                         ; preds = %.preheader43
  %48 = sub i64 %41, %storemerge60
  %xtraiter = and i64 %41, 1
  %49 = icmp eq i64 %41, 1
  br i1 %49, label %._crit_edge47.loopexit.unr-lcssa, label %.lr.ph46.new

.lr.ph46.new:                                     ; preds = %.lr.ph46
  %unroll_iter = and i64 %41, 9223372036854775806
  br label %56

._crit_edge47.loopexit.unr-lcssa:                 ; preds = %56, %.lr.ph46
  %.03245.unr = phi i64 [ 0, %.lr.ph46 ], [ %68, %56 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge47, label %._crit_edge47.loopexit.epilog-lcssa

._crit_edge47.loopexit.epilog-lcssa:              ; preds = %._crit_edge47.loopexit.unr-lcssa
  %50 = getelementptr inbounds [300000 x i64], ptr @p, i64 0, i64 %.03245.unr
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = add i64 %48, %.03245.unr
  %53 = srem i64 %52, %41
  %54 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %53
  store i64 %51, ptr %54, align 8, !tbaa !8
  br label %._crit_edge47

._crit_edge47:                                    ; preds = %._crit_edge47.loopexit.epilog-lcssa, %._crit_edge47.loopexit.unr-lcssa, %.preheader43
  %55 = getelementptr inbounds i64, ptr @vis, i64 %41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 0, ptr %5, align 4, !tbaa !11
  invoke void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @vis, ptr noundef nonnull %55, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %69 unwind label %83

56:                                               ; preds = %56, %.lr.ph46.new
  %.03245 = phi i64 [ 0, %.lr.ph46.new ], [ %68, %56 ]
  %niter = phi i64 [ 0, %.lr.ph46.new ], [ %niter.next.1, %56 ]
  %57 = getelementptr inbounds [300000 x i64], ptr @p, i64 0, i64 %.03245
  %58 = load i64, ptr %57, align 16, !tbaa !8
  %59 = add i64 %48, %.03245
  %60 = srem i64 %59, %41
  %61 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %60
  store i64 %58, ptr %61, align 8, !tbaa !8
  %62 = or disjoint i64 %.03245, 1
  %63 = getelementptr inbounds [300000 x i64], ptr @p, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !8
  %65 = add i64 %48, %62
  %66 = srem i64 %65, %41
  %67 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %66
  store i64 %64, ptr %67, align 8, !tbaa !8
  %68 = add nuw nsw i64 %.03245, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge47.loopexit.unr-lcssa, label %56, !llvm.loop !15

69:                                               ; preds = %._crit_edge47
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %70 = load i64, ptr @N, align 8, !tbaa !8
  %71 = icmp sgt i64 %70, 0
  br i1 %71, label %.lr.ph57.preheader, label %._crit_edge58

.lr.ph57.preheader:                               ; preds = %69
  %xtraiter73 = and i64 %70, 1
  %72 = icmp eq i64 %70, 1
  br i1 %72, label %._crit_edge58.loopexit.unr-lcssa, label %.lr.ph57.preheader.new

.lr.ph57.preheader.new:                           ; preds = %.lr.ph57.preheader
  %unroll_iter76 = and i64 %70, 9223372036854775806
  br label %.lr.ph57

._crit_edge58.loopexit.unr-lcssa:                 ; preds = %104, %.lr.ph57.preheader
  %.1.lcssa.ph = phi i64 [ poison, %.lr.ph57.preheader ], [ %.1.1, %104 ]
  %.02654.unr = phi i64 [ 0, %.lr.ph57.preheader ], [ %105, %104 ]
  %.02753.unr = phi i64 [ 0, %.lr.ph57.preheader ], [ %.1.1, %104 ]
  %lcmp.mod74.not = icmp eq i64 %xtraiter73, 0
  br i1 %lcmp.mod74.not, label %._crit_edge58, label %.lr.ph57.epil

.lr.ph57.epil:                                    ; preds = %._crit_edge58.loopexit.unr-lcssa
  %73 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %.02654.unr
  %74 = load i64, ptr %73, align 8, !tbaa !8
  %.not41.epil = icmp eq i64 %74, 0
  br i1 %.not41.epil, label %.lr.ph51.epil, label %._crit_edge58

.lr.ph51.epil:                                    ; preds = %.lr.ph57.epil, %.lr.ph51.epil
  %75 = phi ptr [ %79, %.lr.ph51.epil ], [ %73, %.lr.ph57.epil ]
  %.02450.epil = phi i64 [ %76, %.lr.ph51.epil ], [ 0, %.lr.ph57.epil ]
  %.02549.epil = phi i64 [ %78, %.lr.ph51.epil ], [ %.02654.unr, %.lr.ph57.epil ]
  store i64 1, ptr %75, align 8, !tbaa !8
  %76 = add nuw nsw i64 %.02450.epil, 1
  %77 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %.02549.epil
  %78 = load i64, ptr %77, align 8, !tbaa !8
  %79 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !8
  %.not42.epil = icmp eq i64 %80, 0
  br i1 %.not42.epil, label %.lr.ph51.epil, label %._crit_edge52.epil, !llvm.loop !16

._crit_edge52.epil:                               ; preds = %.lr.ph51.epil
  %81 = add i64 %.02753.unr, %.02450.epil
  br label %._crit_edge58

._crit_edge58:                                    ; preds = %._crit_edge58.loopexit.unr-lcssa, %._crit_edge52.epil, %.lr.ph57.epil, %69
  %.027.lcssa = phi i64 [ 0, %69 ], [ %.1.lcssa.ph, %._crit_edge58.loopexit.unr-lcssa ], [ %.02753.unr, %.lr.ph57.epil ], [ %81, %._crit_edge52.epil ]
  %82 = load i64, ptr @M, align 8, !tbaa !8
  %.not38 = icmp sgt i64 %.027.lcssa, %82
  br i1 %.not38, label %109, label %106

83:                                               ; preds = %._crit_edge47
  %84 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %114

.lr.ph57:                                         ; preds = %104, %.lr.ph57.preheader.new
  %.02654 = phi i64 [ 0, %.lr.ph57.preheader.new ], [ %105, %104 ]
  %.02753 = phi i64 [ 0, %.lr.ph57.preheader.new ], [ %.1.1, %104 ]
  %niter77 = phi i64 [ 0, %.lr.ph57.preheader.new ], [ %niter77.next.1, %104 ]
  %85 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %.02654
  %86 = load i64, ptr %85, align 16, !tbaa !8
  %.not41 = icmp eq i64 %86, 0
  br i1 %.not41, label %.lr.ph51, label %.lr.ph57.1

.lr.ph51:                                         ; preds = %.lr.ph57, %.lr.ph51
  %87 = phi ptr [ %91, %.lr.ph51 ], [ %85, %.lr.ph57 ]
  %.02450 = phi i64 [ %88, %.lr.ph51 ], [ 0, %.lr.ph57 ]
  %.02549 = phi i64 [ %90, %.lr.ph51 ], [ %.02654, %.lr.ph57 ]
  store i64 1, ptr %87, align 8, !tbaa !8
  %88 = add nuw nsw i64 %.02450, 1
  %89 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %.02549
  %90 = load i64, ptr %89, align 8, !tbaa !8
  %91 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !8
  %.not42 = icmp eq i64 %92, 0
  br i1 %.not42, label %.lr.ph51, label %._crit_edge52, !llvm.loop !16

._crit_edge52:                                    ; preds = %.lr.ph51
  %93 = add i64 %.02753, %.02450
  br label %.lr.ph57.1

.lr.ph57.1:                                       ; preds = %.lr.ph57, %._crit_edge52
  %.1 = phi i64 [ %.02753, %.lr.ph57 ], [ %93, %._crit_edge52 ]
  %94 = or disjoint i64 %.02654, 1
  %95 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !8
  %.not41.1 = icmp eq i64 %96, 0
  br i1 %.not41.1, label %.lr.ph51.1, label %104

.lr.ph51.1:                                       ; preds = %.lr.ph57.1, %.lr.ph51.1
  %97 = phi ptr [ %101, %.lr.ph51.1 ], [ %95, %.lr.ph57.1 ]
  %.02450.1 = phi i64 [ %98, %.lr.ph51.1 ], [ 0, %.lr.ph57.1 ]
  %.02549.1 = phi i64 [ %100, %.lr.ph51.1 ], [ %94, %.lr.ph57.1 ]
  store i64 1, ptr %97, align 8, !tbaa !8
  %98 = add nuw nsw i64 %.02450.1, 1
  %99 = getelementptr inbounds [300000 x i64], ptr @nxt, i64 0, i64 %.02549.1
  %100 = load i64, ptr %99, align 8, !tbaa !8
  %101 = getelementptr inbounds [300000 x i64], ptr @vis, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !8
  %.not42.1 = icmp eq i64 %102, 0
  br i1 %.not42.1, label %.lr.ph51.1, label %._crit_edge52.1, !llvm.loop !16

._crit_edge52.1:                                  ; preds = %.lr.ph51.1
  %103 = add i64 %.1, %.02450.1
  br label %104

104:                                              ; preds = %._crit_edge52.1, %.lr.ph57.1
  %.1.1 = phi i64 [ %.1, %.lr.ph57.1 ], [ %103, %._crit_edge52.1 ]
  %105 = add nuw nsw i64 %.02654, 2
  %niter77.next.1 = add i64 %niter77, 2
  %niter77.ncmp.1 = icmp eq i64 %niter77.next.1, %unroll_iter76
  br i1 %niter77.ncmp.1, label %._crit_edge58.loopexit.unr-lcssa, label %.lr.ph57, !llvm.loop !17

106:                                              ; preds = %._crit_edge58
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %._crit_edge72 unwind label %107

._crit_edge72:                                    ; preds = %106
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %109

107:                                              ; preds = %106
  %108 = landingpad { ptr, i32 }
          cleanup
  br label %114

109:                                              ; preds = %._crit_edge72, %._crit_edge58, %.lr.ph62
  %110 = phi i64 [ %.pre, %._crit_edge72 ], [ %70, %._crit_edge58 ], [ %41, %.lr.ph62 ]
  %111 = load i64, ptr %4, align 8, !tbaa !8
  %112 = add nsw i64 %111, 1
  store i64 %112, ptr %4, align 8, !tbaa !8
  %113 = icmp slt i64 %112, %110
  br i1 %113, label %.lr.ph62, label %._crit_edge63, !llvm.loop !18

114:                                              ; preds = %107, %83
  %.pn = phi { ptr, i32 } [ %108, %107 ], [ %84, %83 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %135

115:                                              ; preds = %._crit_edge63
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %116 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  store ptr %116, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %117 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  store ptr %117, ptr %7, align 8
  %118 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br i1 %118, label %.lr.ph65, label %._crit_edge66

._crit_edge66:                                    ; preds = %127, %115
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %119 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
          to label %132 unwind label %120

120:                                              ; preds = %._crit_edge66, %._crit_edge63
  %121 = landingpad { ptr, i32 }
          cleanup
  br label %135

.lr.ph65:                                         ; preds = %115, %127
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %123 = load i64, ptr %122, align 8, !tbaa !8
  %124 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 32)
          to label %125 unwind label %130

125:                                              ; preds = %.lr.ph65
  %126 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %124, i64 noundef %123)
          to label %127 unwind label %130

127:                                              ; preds = %125
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %129 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br i1 %129, label %.lr.ph65, label %._crit_edge66

130:                                              ; preds = %125, %.lr.ph65
  %131 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %135

132:                                              ; preds = %._crit_edge66
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  %133 = load i64, ptr @T, align 8, !tbaa !8
  %134 = add nsw i64 %133, -1
  store i64 %134, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %133, 0
  br i1 %.not, label %._crit_edge70, label %.lr.ph69, !llvm.loop !19

135:                                              ; preds = %130, %120, %114
  %.pn.pn = phi { ptr, i32 } [ %.pn, %114 ], [ %131, %130 ], [ %121, %120 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn.pn

._crit_edge70:                                    ; preds = %132, %0
  ret i32 0
}

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass