; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2015-16/Open 2016/Plat (bcs_editorial)

; 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"

%"struct.std::array.2" = type { [250000 x i32] }
%struct.hsh = type { i32, i32, i32, %"struct.std::array" }
%"struct.std::array" = type { [2 x %struct.mi] }
%struct.mi = type { i32 }
%"struct.std::pair.0" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator.16" = type { ptr }
%"struct.std::pair.17" = type { i32, %"struct.std::pair.0" }

@cumR = external dso_local global [800 x ptr], align 16
@CUMR = external dso_local global %"struct.std::array.2", align 4
@st = external dso_local global %struct.hsh, align 4
@stor = external dso_local global [800 x %struct.hsh], align 16
@_ZL3MOD = external hidden constant i32, align 4

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @_Z8getFirstSt6vectorISt4pairIiS0_IiiEESaIS2_EE(ptr noundef %0) #2 {
  %2 = alloca %"struct.std::pair.0", align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %20 = load i32, ptr @st, align 4, !tbaa !11
  %21 = load i32, ptr getelementptr inbounds (%struct.hsh, ptr @st, i32 0, i32 1), align 4, !tbaa !14
  %22 = mul nsw i32 %20, %21
  store i32 %22, ptr %5, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %160, %1
  %24 = load i32, ptr %4, align 4, !tbaa !9
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %161

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = add nsw i32 %28, %29
  %31 = sdiv i32 %30, 2
  store i32 %31, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = load i32, ptr getelementptr inbounds (%struct.hsh, ptr @st, i32 0, i32 1), align 4, !tbaa !14
  %34 = sdiv i32 %32, %33
  store i32 %34, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = load i32, ptr getelementptr inbounds (%struct.hsh, ptr @st, i32 0, i32 1), align 4, !tbaa !14
  %37 = srem i32 %35, %36
  store i32 %37, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm250000EEixEm(ptr noundef nonnull align 4 dereferenceable(1000000) @CUMR, i64 noundef %39) #4
  %41 = load i32, ptr %40, align 4, !tbaa !9
  store i32 %41, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store ptr %0, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %42) #4
  %44 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.16", ptr %11, i32 0, i32 0
  store ptr %43, ptr %44, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %45) #4
  %47 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.16", ptr %12, i32 0, i32 0
  store ptr %46, ptr %47, align 8
  br label %48

48:                                               ; preds = %150, %27
  %49 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  br i1 %49, label %51, label %50

50:                                               ; preds = %48
  store i32 4, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %152

51:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %52 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  store ptr %52, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.std::pair.17", ptr %54, i32 0, i32 1
  %56 = getelementptr inbounds %"struct.std::pair.0", ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 4, !tbaa !15
  %58 = sub nsw i32 %53, %57
  store i32 %58, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = load ptr, ptr %14, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.std::pair.17", ptr %60, i32 0, i32 1
  %62 = getelementptr inbounds %"struct.std::pair.0", ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !18
  %64 = sub nsw i32 %59, %63
  store i32 %64, ptr %16, align 4, !tbaa !9
  %65 = load i32, ptr %16, align 4, !tbaa !9
  %66 = icmp slt i32 %65, 0
  br i1 %66, label %67, label %70

67:                                               ; preds = %51
  %68 = load i32, ptr %15, align 4, !tbaa !9
  %69 = add nsw i32 %68, -1
  store i32 %69, ptr %15, align 4, !tbaa !9
  store i32 1000000007, ptr %16, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %67, %51
  %71 = load i32, ptr %15, align 4, !tbaa !9
  %72 = icmp slt i32 %71, 0
  br i1 %72, label %73, label %74

73:                                               ; preds = %70
  store i32 5, ptr %13, align 4
  br label %144

74:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.std::pair.17", ptr %75, i32 0, i32 0
  %77 = load i32, ptr %76, align 4, !tbaa !19
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [800 x %struct.hsh], ptr @stor, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.hsh, ptr %79, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !14
  %82 = sub nsw i32 %81, 1
  store i32 %82, ptr %17, align 4, !tbaa !9
  %83 = call noundef zeroext i1 @_Z5ckminIiEbRT_RKS0_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  %84 = load i32, ptr %15, align 4, !tbaa !9
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.std::pair.17", ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 4, !tbaa !19
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [800 x %struct.hsh], ptr @stor, i64 0, i64 %88
  %90 = getelementptr inbounds %struct.hsh, ptr %89, i32 0, i32 0
  %91 = load i32, ptr %90, align 4, !tbaa !11
  %92 = icmp sge i32 %84, %91
  br i1 %92, label %93, label %121

93:                                               ; preds = %74
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = getelementptr inbounds %"struct.std::pair.17", ptr %94, i32 0, i32 0
  %96 = load i32, ptr %95, align 4, !tbaa !19
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [800 x ptr], ptr @cumR, i64 0, i64 %97
  %99 = load ptr, ptr %98, align 8, !tbaa !5
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  %101 = getelementptr inbounds %"struct.std::pair.17", ptr %100, i32 0, i32 0
  %102 = load i32, ptr %101, align 4, !tbaa !19
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [800 x %struct.hsh], ptr @stor, i64 0, i64 %103
  %105 = getelementptr inbounds %struct.hsh, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %105, align 4, !tbaa !11
  %107 = load ptr, ptr %14, align 8, !tbaa !5
  %108 = getelementptr inbounds %"struct.std::pair.17", ptr %107, i32 0, i32 0
  %109 = load i32, ptr %108, align 4, !tbaa !19
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [800 x %struct.hsh], ptr @stor, i64 0, i64 %110
  %112 = getelementptr inbounds %struct.hsh, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !14
  %114 = mul nsw i32 %106, %113
  %115 = sub nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i32, ptr %99, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = sub nsw i32 %119, %118
  store i32 %120, ptr %9, align 4, !tbaa !9
  store i32 5, ptr %13, align 4
  br label %144

121:                                              ; preds = %74
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = getelementptr inbounds %"struct.std::pair.17", ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 4, !tbaa !19
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [800 x ptr], ptr @cumR, i64 0, i64 %125
  %127 = load ptr, ptr %126, align 8, !tbaa !5
  %128 = load i32, ptr %15, align 4, !tbaa !9
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = getelementptr inbounds %"struct.std::pair.17", ptr %129, i32 0, i32 0
  %131 = load i32, ptr %130, align 4, !tbaa !19
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [800 x %struct.hsh], ptr @stor, i64 0, i64 %132
  %134 = getelementptr inbounds %struct.hsh, ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 4, !tbaa !14
  %136 = mul nsw i32 %128, %135
  %137 = load i32, ptr %16, align 4, !tbaa !9
  %138 = add nsw i32 %136, %137
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds i32, ptr %127, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !9
  %142 = load i32, ptr %9, align 4, !tbaa !9
  %143 = sub nsw i32 %142, %141
  store i32 %143, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %13, align 4
  br label %144

144:                                              ; preds = %121, %93, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %145 = load i32, ptr %13, align 4
  switch i32 %145, label %147 [
    i32 0, label %146
  ]

146:                                              ; preds = %144
  store i32 0, ptr %13, align 4
  br label %147

147:                                              ; preds = %146, %144
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %148 = load i32, ptr %13, align 4
  switch i32 %148, label %177 [
    i32 0, label %149
    i32 5, label %150
  ]

149:                                              ; preds = %147
  br label %150

150:                                              ; preds = %149, %147
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  br label %48

152:                                              ; preds = %50
  %153 = load i32, ptr %9, align 4, !tbaa !9
  %154 = icmp eq i32 %153, 0
  br i1 %154, label %155, label %158

155:                                              ; preds = %152
  %156 = load i32, ptr %6, align 4, !tbaa !9
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %4, align 4, !tbaa !9
  br label %160

158:                                              ; preds = %152
  %159 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %159, ptr %5, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %158, %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %23, !llvm.loop !20

161:                                              ; preds = %23
  %162 = load i32, ptr %4, align 4, !tbaa !9
  %163 = load i32, ptr @st, align 4, !tbaa !11
  %164 = load i32, ptr getelementptr inbounds (%struct.hsh, ptr @st, i32 0, i32 1), align 4, !tbaa !14
  %165 = mul nsw i32 %163, %164
  %166 = icmp eq i32 %162, %165
  br i1 %166, label %167, label %168

167:                                              ; preds = %161
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS3_S4_EEEbE4typeELb1EEERKiS8_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3MOD, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3MOD)
  store i32 1, ptr %13, align 4
  br label %175

168:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %169 = load i32, ptr %4, align 4, !tbaa !9
  %170 = load i32, ptr getelementptr inbounds (%struct.hsh, ptr @st, i32 0, i32 1), align 4, !tbaa !14
  %171 = sdiv i32 %169, %170
  store i32 %171, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %172 = load i32, ptr %4, align 4, !tbaa !9
  %173 = load i32, ptr getelementptr inbounds (%struct.hsh, ptr @st, i32 0, i32 1), align 4, !tbaa !14
  %174 = srem i32 %172, %173
  store i32 %174, ptr %19, align 4, !tbaa !9
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %19)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  store i32 1, ptr %13, align 4
  br label %175

175:                                              ; preds = %168, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %176 = load i64, ptr %2, align 4
  ret i64 %176

177:                                              ; preds = %147
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm250000EEixEm(ptr noundef nonnull align 4 dereferenceable(1000000), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 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)) #3

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS3hsh", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 12}
!13 = !{!"_ZTSSt5arrayI2miLm2EE", !7, i64 0}
!14 = !{!12, !10, i64 4}
!15 = !{!16, !10, i64 4}
!16 = !{!"_ZTSSt4pairIiS_IiiEE", !10, i64 0, !17, i64 4}
!17 = !{!"_ZTSSt4pairIiiE", !10, i64 0, !10, i64 4}
!18 = !{!16, !10, i64 8}
!19 = !{!16, !10, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; 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"

%"struct.std::array.2" = type { [250000 x i32] }
%struct.hsh = type { i32, i32, i32, %"struct.std::array" }
%"struct.std::array" = type { [2 x %struct.mi] }
%struct.mi = type { i32 }
%"struct.std::pair.0" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator.16" = type { ptr }

@cumR = external dso_local local_unnamed_addr global [800 x ptr], align 16
@CUMR = external dso_local global %"struct.std::array.2", align 4
@st = external dso_local local_unnamed_addr global %struct.hsh, align 4
@stor = external dso_local local_unnamed_addr global [800 x %struct.hsh], align 16
@_ZL3MOD = external hidden constant i32, align 4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5ckminIiEbRT_RKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local i64 @_Z8getFirstSt6vectorISt4pairIiS0_IiiEESaIS2_EE(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca %"struct.std::pair.0", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = load i32, ptr @st, align 4, !tbaa !5
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @st, i64 4), align 4, !tbaa !11
  %11 = mul nsw i32 %10, %9
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph44, label %._crit_edge45

.lr.ph44:                                         ; preds = %1, %._crit_edge
  %.03242 = phi i32 [ %.1, %._crit_edge ], [ 0, %1 ]
  %.03441 = phi i32 [ %.135, %._crit_edge ], [ %11, %1 ]
  %13 = add nuw nsw i32 %.03242, %.03441
  %14 = lshr i32 %13, 1
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @st, i64 4), align 4, !tbaa !11
  %16 = sdiv i32 %14, %15
  %17 = srem i32 %14, %15
  %18 = zext nneg i32 %14 to i64
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm250000EEixEm(ptr noundef nonnull align 4 dereferenceable(1000000) @CUMR, i64 noundef %18) #3
  %20 = load i32, ptr %19, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %21 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  store ptr %21, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %22 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  store ptr %22, ptr %4, align 8
  %23 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br i1 %23, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %64, %.lr.ph44
  %.036.lcssa = phi i32 [ %20, %.lr.ph44 ], [ %.137, %64 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %24 = icmp eq i32 %.036.lcssa, 0
  %25 = add nuw nsw i32 %14, 1
  %.135 = select i1 %24, i32 %.03441, i32 %14
  %.1 = select i1 %24, i32 %25, i32 %.03242
  %26 = icmp slt i32 %.1, %.135
  br i1 %26, label %.lr.ph44, label %._crit_edge45.loopexit, !llvm.loop !13

.lr.ph:                                           ; preds = %.lr.ph44, %64
  %.03640 = phi i32 [ %.137, %64 ], [ %20, %.lr.ph44 ]
  %27 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !15
  %30 = sub nsw i32 %16, %29
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  %31 = getelementptr inbounds i8, ptr %27, i64 8
  %32 = load i32, ptr %31, align 4, !tbaa !18
  %33 = sub nsw i32 %17, %32
  %34 = icmp slt i32 %33, 0
  %spec.select = select i1 %34, i32 1000000007, i32 %33
  %.lobit = ashr i32 %33, 31
  %spec.select39 = add nsw i32 %.lobit, %30
  store i32 %spec.select, ptr %5, align 4, !tbaa !12
  %35 = icmp slt i32 %spec.select39, 0
  br i1 %35, label %64, label %36

36:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  %37 = load i32, ptr %27, align 4, !tbaa !19
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [800 x %struct.hsh], ptr @stor, i64 0, i64 %38, i32 1
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr %6, align 4, !tbaa !12
  %42 = call noundef zeroext i1 @_Z5ckminIiEbRT_RKS0_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  %43 = load i32, ptr %27, align 4, !tbaa !19
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [800 x %struct.hsh], ptr @stor, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %.not = icmp slt i32 %spec.select39, %46
  %47 = getelementptr inbounds [800 x ptr], ptr @cumR, i64 0, i64 %44
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = getelementptr inbounds i8, ptr %45, i64 4
  %50 = load i32, ptr %49, align 4, !tbaa !11
  br i1 %.not, label %56, label %51

51:                                               ; preds = %36
  %52 = mul nsw i32 %50, %46
  %53 = sext i32 %52 to i64
  %54 = getelementptr i32, ptr %48, i64 %53
  %55 = getelementptr i8, ptr %54, i64 -4
  br label %.sink.split

56:                                               ; preds = %36
  %57 = mul nsw i32 %50, %spec.select39
  %58 = load i32, ptr %5, align 4, !tbaa !12
  %59 = add nsw i32 %57, %58
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i32, ptr %48, i64 %60
  br label %.sink.split

.sink.split:                                      ; preds = %51, %56
  %.sink49 = phi ptr [ %61, %56 ], [ %55, %51 ]
  %62 = load i32, ptr %.sink49, align 4, !tbaa !12
  %63 = sub nsw i32 %.03640, %62
  br label %64

64:                                               ; preds = %.sink.split, %.lr.ph
  %.137 = phi i32 [ %.03640, %.lr.ph ], [ %63, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %66 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiS1_IiiEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br i1 %66, label %.lr.ph, label %._crit_edge

._crit_edge45.loopexit:                           ; preds = %._crit_edge
  %.pre = load i32, ptr @st, align 4, !tbaa !5
  %.pre47 = load i32, ptr getelementptr inbounds (i8, ptr @st, i64 4), align 4, !tbaa !11
  %.pre48 = mul nsw i32 %.pre47, %.pre
  br label %._crit_edge45

._crit_edge45:                                    ; preds = %._crit_edge45.loopexit, %1
  %.pre-phi = phi i32 [ %.pre48, %._crit_edge45.loopexit ], [ %11, %1 ]
  %67 = phi i32 [ %.pre47, %._crit_edge45.loopexit ], [ %10, %1 ]
  %.032.lcssa = phi i32 [ %.1, %._crit_edge45.loopexit ], [ 0, %1 ]
  %68 = icmp eq i32 %.032.lcssa, %.pre-phi
  br i1 %68, label %69, label %70

69:                                               ; preds = %._crit_edge45
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS3_S4_EEEbE4typeELb1EEERKiS8_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3MOD, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3MOD)
  br label %73

70:                                               ; preds = %._crit_edge45
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  %71 = sdiv i32 %.032.lcssa, %67
  store i32 %71, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #3
  %72 = srem i32 %.032.lcssa, %67
  store i32 %72, ptr %8, align 4, !tbaa !12
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  br label %73

73:                                               ; preds = %70, %69
  %74 = load i64, ptr %2, align 8
  ret i64 %74
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm250000EEixEm(ptr noundef nonnull align 4 dereferenceable(1000000), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(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_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 #2

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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, !7, i64 0}
!6 = !{!"_ZTS3hsh", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt5arrayI2miLm2EE", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !7, i64 4}
!16 = !{!"_ZTSSt4pairIiS_IiiEE", !7, i64 0, !17, i64 4}
!17 = !{!"_ZTSSt4pairIiiE", !7, i64 0, !7, i64 4}
!18 = !{!16, !7, i64 8}
!19 = !{!16, !7, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"any pointer", !8, i64 0}


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