; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/257 Division 2/Problem D/D.ll (Z2spv)

; 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, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>
%"struct.std::pair.5" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair.7" = type { i32, %"struct.std::pair.5" }

@n = external dso_local global i32, align 4
@visit = external dso_local global [100100 x i32], align 16
@cnt = external dso_local global i32, align 4
@d = external dso_local global [100100 x i64], align 16
@train = external dso_local global [100100 x i8], align 16
@g = external dso_local global [100100 x %"class.std::vector"], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2spv() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::priority_queue", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair.5", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca %"struct.std::pair", align 8
  %18 = alloca i64, align 8
  %19 = alloca { i64, i32 }, align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr %1) #5
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %34, %0
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %37

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %29
  store i64 1000000000000000000, ptr %30, align 8, !tbaa !9
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %32
  store i8 0, ptr %33, align 1, !tbaa !11
  br label %34

34:                                               ; preds = %27
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !13

37:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i64 0, ptr getelementptr inbounds ([100100 x i64], ptr @d, i64 0, i64 1), align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  %38 = invoke i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %39 unwind label %58

39:                                               ; preds = %37
  store i64 %38, ptr %5, align 4
  invoke void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(8) %5)
          to label %40 unwind label %58

40:                                               ; preds = %39
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(12) %4)
          to label %41 unwind label %58

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

42:                                               ; preds = %172, %170, %41
  %43 = invoke noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %44 unwind label %62

44:                                               ; preds = %42
  %45 = xor i1 %43, true
  br i1 %45, label %46, label %174

46:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  %47 = invoke noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %48 unwind label %66

48:                                               ; preds = %46
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %47, i64 16, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %49 unwind label %66

49:                                               ; preds = %48
  %50 = getelementptr inbounds %"struct.std::pair", ptr %10, i32 0, i32 1
  %51 = load i32, ptr %50, align 8, !tbaa !15
  store i32 %51, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100100 x i32], ptr @visit, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp eq i32 %55, 1
  br i1 %56, label %57, label %70

57:                                               ; preds = %49
  store i32 5, ptr %11, align 4
  br label %170, !llvm.loop !17

58:                                               ; preds = %40, %39, %37
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %8, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #5
  br label %194

62:                                               ; preds = %42
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %8, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %9, align 4
  br label %194

66:                                               ; preds = %48, %46
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %8, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %9, align 4
  br label %173

70:                                               ; preds = %49
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100100 x i32], ptr @visit, i64 0, i64 %72
  store i32 1, ptr %73, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %75
  %77 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %76) #5
  %78 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %77, ptr %78, align 8
  br label %79

79:                                               ; preds = %162, %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %81
  %83 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %82) #5
  %84 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %83, ptr %84, align 8
  %85 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br i1 %85, label %87, label %86

86:                                               ; preds = %79
  store i32 7, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %169

87:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %88 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  %89 = getelementptr inbounds %"struct.std::pair.7", ptr %88, i32 0, i32 1
  %90 = getelementptr inbounds %"struct.std::pair.5", ptr %89, i32 0, i32 0
  %91 = load i32, ptr %90, align 4, !tbaa !18
  store i32 %91, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %92 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  %93 = getelementptr inbounds %"struct.std::pair.7", ptr %92, i32 0, i32 1
  %94 = getelementptr inbounds %"struct.std::pair.5", ptr %93, i32 0, i32 1
  %95 = load i32, ptr %94, align 4, !tbaa !21
  store i32 %95, ptr %15, align 4, !tbaa !5
  %96 = load i32, ptr %14, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100100 x i32], ptr @visit, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp eq i32 %99, 1
  br i1 %100, label %101, label %102

101:                                              ; preds = %87
  store i32 9, ptr %11, align 4
  br label %159

102:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !9
  %107 = load i32, ptr %15, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = add nsw i64 %106, %108
  store i64 %109, ptr %16, align 8, !tbaa !9
  %110 = load i64, ptr %16, align 8, !tbaa !9
  %111 = load i32, ptr %14, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !9
  %115 = icmp slt i64 %110, %114
  br i1 %115, label %116, label %134

116:                                              ; preds = %102
  %117 = load i64, ptr %16, align 8, !tbaa !9
  %118 = load i32, ptr %14, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %119
  store i64 %117, ptr %120, align 8, !tbaa !9
  %121 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  %122 = getelementptr inbounds %"struct.std::pair.7", ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 4, !tbaa !22
  %124 = icmp eq i32 %123, 1
  br i1 %124, label %125, label %129

125:                                              ; preds = %116
  %126 = load i32, ptr %14, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %127
  store i8 1, ptr %128, align 1, !tbaa !11
  br label %133

129:                                              ; preds = %116
  %130 = load i32, ptr %14, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %131
  store i8 0, ptr %132, align 1, !tbaa !11
  br label %133

133:                                              ; preds = %129, %125
  br label %134

134:                                              ; preds = %133, %102
  %135 = load i64, ptr %16, align 8, !tbaa !9
  %136 = load i32, ptr %14, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %137
  %139 = load i64, ptr %138, align 8, !tbaa !9
  %140 = icmp eq i64 %135, %139
  br i1 %140, label %141, label %150

141:                                              ; preds = %134
  %142 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  %143 = getelementptr inbounds %"struct.std::pair.7", ptr %142, i32 0, i32 0
  %144 = load i32, ptr %143, align 4, !tbaa !22
  %145 = icmp eq i32 %144, 0
  br i1 %145, label %146, label %150

146:                                              ; preds = %141
  %147 = load i32, ptr %14, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %148
  store i8 0, ptr %149, align 1, !tbaa !11
  br label %150

150:                                              ; preds = %146, %141, %134
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %151 = load i32, ptr %14, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !9
  %155 = sub nsw i64 0, %154
  store i64 %155, ptr %18, align 8, !tbaa !9
  %156 = invoke { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %157 unwind label %165

157:                                              ; preds = %150
  store { i64, i32 } %156, ptr %19, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %19, i64 12, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(12) %17)
          to label %158 unwind label %165

158:                                              ; preds = %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  store i32 0, ptr %11, align 4
  br label %159

159:                                              ; preds = %158, %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %160 = load i32, ptr %11, align 4
  switch i32 %160, label %200 [
    i32 0, label %161
    i32 9, label %162
  ]

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161, %159
  %163 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %12, i32 noundef 0) #5
  %164 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %20, i32 0, i32 0
  store ptr %163, ptr %164, align 8
  br label %79, !llvm.loop !23

165:                                              ; preds = %157, %150
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %8, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %173

169:                                              ; preds = %86
  store i32 0, ptr %11, align 4
  br label %170

170:                                              ; preds = %169, %57
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  %171 = load i32, ptr %11, align 4
  switch i32 %171, label %200 [
    i32 0, label %172
    i32 5, label %42
  ]

172:                                              ; preds = %170
  br label %42, !llvm.loop !17

173:                                              ; preds = %165, %66
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  br label %194

174:                                              ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %190, %174
  %176 = load i32, ptr %21, align 4, !tbaa !5
  %177 = load i32, ptr @n, align 4, !tbaa !5
  %178 = icmp sle i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  store i32 10, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %193

180:                                              ; preds = %175
  %181 = load i32, ptr %21, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %182
  %184 = load i8, ptr %183, align 1, !tbaa !11, !range !24, !noundef !25
  %185 = trunc i8 %184 to i1
  br i1 %185, label %186, label %189

186:                                              ; preds = %180
  %187 = load i32, ptr @cnt, align 4, !tbaa !5
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr @cnt, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %186, %180
  br label %190

190:                                              ; preds = %189
  %191 = load i32, ptr %21, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %21, align 4, !tbaa !5
  br label %175, !llvm.loop !26

193:                                              ; preds = %179
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %1) #5
  ret void

194:                                              ; preds = %173, %62, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %1) #5
  br label %195

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

200:                                              ; preds = %170, %159
  unreachable
}

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

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

; 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
declare dso_local void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(12)) #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #2 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSSt4pairIxiE", !10, i64 0, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = !{!19, !6, i64 4}
!19 = !{!"_ZTSSt4pairIiS_IiiEE", !6, i64 0, !20, i64 4}
!20 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!21 = !{!19, !6, i64 8}
!22 = !{!19, !6, i64 0}
!23 = distinct !{!23, !14}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = distinct !{!26, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>
%"struct.std::pair.5" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local local_unnamed_addr global i32, align 4
@visit = external dso_local local_unnamed_addr global [100100 x i32], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local local_unnamed_addr global [100100 x i64], align 16
@train = external dso_local local_unnamed_addr global [100100 x i8], align 16
@g = external dso_local global [100100 x %"class.std::vector"], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2spv() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::priority_queue", align 8
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca %"struct.std::pair.5", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #5
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %.not27 = icmp slt i32 %11, 1
  br i1 %.not27, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %0
  %12 = zext nneg i32 %11 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 1 getelementptr inbounds (i8, ptr @train, i64 1), i8 0, i64 %12, i1 false), !tbaa !9
  %13 = add nuw i32 %11, 1
  %wide.trip.count = zext i32 %13 to i64
  %14 = zext nneg i32 %11 to i64
  %min.iters.check = icmp ult i32 %11, 4
  br i1 %min.iters.check, label %.lr.ph.preheader44, label %vector.ph

.lr.ph.preheader44:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %14, 2147483644
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %15 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %offset.idx
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <2 x i64> <i64 1000000000000000000, i64 1000000000000000000>, ptr %15, align 8, !tbaa !11
  store <2 x i64> <i64 1000000000000000000, i64 1000000000000000000>, ptr %16, align 8, !tbaa !11
  %index.next = add nuw i64 %index, 4
  %17 = icmp eq i64 %index.next, %n.vec
  br i1 %17, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %14
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader44

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %0
  store i64 0, ptr getelementptr inbounds (i8, ptr @d, i64 8), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  %18 = invoke i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %20 unwind label %33

.lr.ph:                                           ; preds = %.lr.ph.preheader44, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader44 ]
  %19 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %indvars.iv
  store i64 1000000000000000000, ptr %19, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !17

20:                                               ; preds = %._crit_edge
  store i64 %18, ptr %3, align 8
  call void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(8) %3)
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(12) %2)
          to label %21 unwind label %33

21:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  %22 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  br i1 %22, label %.preheader, label %.lr.ph33

.lr.ph33:                                         ; preds = %21
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %9, i64 8
  br label %26

.preheader:                                       ; preds = %95, %21
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %.not2434 = icmp slt i32 %23, 1
  br i1 %.not2434, label %._crit_edge37, label %.lr.ph36.preheader

.lr.ph36.preheader:                               ; preds = %.preheader
  %cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5
  %24 = zext nneg i32 %23 to i64
  %xtraiter = and i64 %24, 3
  %25 = icmp ult i32 %23, 4
  br i1 %25, label %._crit_edge37.loopexit.unr-lcssa, label %.lr.ph36.preheader.new

.lr.ph36.preheader.new:                           ; preds = %.lr.ph36.preheader
  %unroll_iter = and i64 %24, 2147483644
  br label %.lr.ph36

26:                                               ; preds = %.lr.ph33, %95
  %27 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %27, i64 8
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %28 unwind label %35

28:                                               ; preds = %26
  %29 = sext i32 %.sroa.4.0.copyload to i64
  %30 = getelementptr inbounds [100100 x i32], ptr @visit, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %95, label %37, !llvm.loop !18

33:                                               ; preds = %20, %._crit_edge
  %34 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  br label %131

35:                                               ; preds = %26
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %131

37:                                               ; preds = %28
  store i32 1, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %38 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %29
  %39 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #5
  store ptr %39, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %40 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #5
  store ptr %40, ptr %7, align 8
  %41 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br i1 %41, label %.lr.ph30, label %._crit_edge31

.lr.ph30:                                         ; preds = %37
  %42 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %29
  br label %43

._crit_edge31:                                    ; preds = %89, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %95

43:                                               ; preds = %.lr.ph30, %89
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %44 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %45 = getelementptr inbounds i8, ptr %44, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !19
  store i32 %46, ptr %8, align 4, !tbaa !5
  %47 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %48 = load i32, ptr %8, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100100 x i32], ptr @visit, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %89, label %53

53:                                               ; preds = %43
  %54 = getelementptr inbounds i8, ptr %47, i64 8
  %55 = load i32, ptr %54, align 4, !tbaa !22
  %56 = load i64, ptr %42, align 8, !tbaa !11
  %57 = sext i32 %55 to i64
  %58 = add nsw i64 %56, %57
  %59 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %49
  %60 = load i64, ptr %59, align 8, !tbaa !11
  %61 = icmp slt i64 %58, %60
  br i1 %61, label %.sink.split, label %68

.sink.split:                                      ; preds = %53
  store i64 %58, ptr %59, align 8, !tbaa !11
  %62 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %63 = load i32, ptr %62, align 4, !tbaa !23
  %64 = icmp eq i32 %63, 1
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %66
  %. = zext i1 %64 to i8
  store i8 %., ptr %67, align 1, !tbaa !9
  br label %68

68:                                               ; preds = %.sink.split, %53
  %.pre-phi = phi i64 [ %49, %53 ], [ %66, %.sink.split ]
  %69 = phi i32 [ %48, %53 ], [ %65, %.sink.split ]
  %70 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %.pre-phi
  %71 = load i64, ptr %70, align 8, !tbaa !11
  %72 = icmp eq i64 %58, %71
  br i1 %72, label %73, label %80

73:                                               ; preds = %68
  %74 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %75 = load i32, ptr %74, align 4, !tbaa !23
  %76 = icmp eq i32 %75, 0
  %.pre = load i32, ptr %8, align 4, !tbaa !5
  br i1 %76, label %77, label %80

77:                                               ; preds = %73
  %78 = sext i32 %.pre to i64
  %79 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %78
  store i8 0, ptr %79, align 1, !tbaa !9
  br label %80

80:                                               ; preds = %77, %73, %68
  %81 = phi i32 [ %.pre, %77 ], [ %.pre, %73 ], [ %69, %68 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100100 x i64], ptr @d, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = sub nsw i64 0, %84
  store i64 %85, ptr %10, align 8, !tbaa !11
  %86 = invoke { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %87 unwind label %93

87:                                               ; preds = %80
  %.fca.0.extract = extractvalue { i64, i32 } %86, 0
  %.fca.1.extract = extractvalue { i64, i32 } %86, 1
  store i64 %.fca.0.extract, ptr %9, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  invoke void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(12) %9)
          to label %88 unwind label %93

88:                                               ; preds = %87
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  br label %89

89:                                               ; preds = %43, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  %90 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %91 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #5
  store ptr %91, ptr %7, align 8
  %92 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br i1 %92, label %43, label %._crit_edge31, !llvm.loop !24

93:                                               ; preds = %87, %80
  %94 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %131

95:                                               ; preds = %28, %._crit_edge31
  %96 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  br i1 %96, label %.preheader, label %26

._crit_edge37.loopexit.unr-lcssa:                 ; preds = %129, %.lr.ph36.preheader
  %indvars.iv39.unr = phi i64 [ 1, %.lr.ph36.preheader ], [ %indvars.iv.next40.3, %129 ]
  %.unr = phi i32 [ %cnt.promoted, %.lr.ph36.preheader ], [ %130, %129 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge37, label %.lr.ph36.epil

.lr.ph36.epil:                                    ; preds = %._crit_edge37.loopexit.unr-lcssa, %103
  %indvars.iv39.epil = phi i64 [ %indvars.iv.next40.epil, %103 ], [ %indvars.iv39.unr, %._crit_edge37.loopexit.unr-lcssa ]
  %97 = phi i32 [ %104, %103 ], [ %.unr, %._crit_edge37.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %103 ], [ 0, %._crit_edge37.loopexit.unr-lcssa ]
  %98 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %indvars.iv39.epil
  %99 = load i8, ptr %98, align 1, !tbaa !9, !range !25, !noundef !26
  %100 = trunc nuw i8 %99 to i1
  br i1 %100, label %101, label %103

101:                                              ; preds = %.lr.ph36.epil
  %102 = add nsw i32 %97, 1
  store i32 %102, ptr @cnt, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %101, %.lr.ph36.epil
  %104 = phi i32 [ %97, %.lr.ph36.epil ], [ %102, %101 ]
  %indvars.iv.next40.epil = add nuw nsw i64 %indvars.iv39.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge37, label %.lr.ph36.epil, !llvm.loop !27

._crit_edge37:                                    ; preds = %._crit_edge37.loopexit.unr-lcssa, %103, %.preheader
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  ret void

.lr.ph36:                                         ; preds = %129, %.lr.ph36.preheader.new
  %indvars.iv39 = phi i64 [ 1, %.lr.ph36.preheader.new ], [ %indvars.iv.next40.3, %129 ]
  %105 = phi i32 [ %cnt.promoted, %.lr.ph36.preheader.new ], [ %130, %129 ]
  %niter = phi i64 [ 0, %.lr.ph36.preheader.new ], [ %niter.next.3, %129 ]
  %106 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %indvars.iv39
  %107 = load i8, ptr %106, align 1, !tbaa !9, !range !25, !noundef !26
  %108 = trunc nuw i8 %107 to i1
  br i1 %108, label %109, label %.lr.ph36.1

109:                                              ; preds = %.lr.ph36
  %110 = add nsw i32 %105, 1
  store i32 %110, ptr @cnt, align 4, !tbaa !5
  br label %.lr.ph36.1

.lr.ph36.1:                                       ; preds = %.lr.ph36, %109
  %111 = phi i32 [ %105, %.lr.ph36 ], [ %110, %109 ]
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %112 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %indvars.iv.next40
  %113 = load i8, ptr %112, align 1, !tbaa !9, !range !25, !noundef !26
  %114 = trunc nuw i8 %113 to i1
  br i1 %114, label %115, label %.lr.ph36.2

115:                                              ; preds = %.lr.ph36.1
  %116 = add nsw i32 %111, 1
  store i32 %116, ptr @cnt, align 4, !tbaa !5
  br label %.lr.ph36.2

.lr.ph36.2:                                       ; preds = %115, %.lr.ph36.1
  %117 = phi i32 [ %111, %.lr.ph36.1 ], [ %116, %115 ]
  %indvars.iv.next40.1 = add nuw nsw i64 %indvars.iv39, 2
  %118 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %indvars.iv.next40.1
  %119 = load i8, ptr %118, align 1, !tbaa !9, !range !25, !noundef !26
  %120 = trunc nuw i8 %119 to i1
  br i1 %120, label %121, label %.lr.ph36.3

121:                                              ; preds = %.lr.ph36.2
  %122 = add nsw i32 %117, 1
  store i32 %122, ptr @cnt, align 4, !tbaa !5
  br label %.lr.ph36.3

.lr.ph36.3:                                       ; preds = %121, %.lr.ph36.2
  %123 = phi i32 [ %117, %.lr.ph36.2 ], [ %122, %121 ]
  %indvars.iv.next40.2 = add nuw nsw i64 %indvars.iv39, 3
  %124 = getelementptr inbounds [100100 x i8], ptr @train, i64 0, i64 %indvars.iv.next40.2
  %125 = load i8, ptr %124, align 1, !tbaa !9, !range !25, !noundef !26
  %126 = trunc nuw i8 %125 to i1
  br i1 %126, label %127, label %129

127:                                              ; preds = %.lr.ph36.3
  %128 = add nsw i32 %123, 1
  store i32 %128, ptr @cnt, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %127, %.lr.ph36.3
  %130 = phi i32 [ %123, %.lr.ph36.3 ], [ %128, %127 ]
  %indvars.iv.next40.3 = add nuw nsw i64 %indvars.iv39, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge37.loopexit.unr-lcssa, label %.lr.ph36, !llvm.loop !29

131:                                              ; preds = %35, %93, %33
  %.pn.pn = phi { ptr, i32 } [ %34, %33 ], [ %94, %93 ], [ %36, %35 ]
  call void @_ZNSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn.pn
}

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIxiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #2 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14, !15, !16}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !14, !16, !15}
!18 = distinct !{!18, !14}
!19 = !{!20, !6, i64 4}
!20 = !{!"_ZTSSt4pairIiS_IiiEE", !6, i64 0, !21, i64 4}
!21 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!22 = !{!20, !6, i64 8}
!23 = !{!20, !6, i64 0}
!24 = distinct !{!24, !14}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.unroll.disable"}
!29 = distinct !{!29, !14}


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