; LLVM IR from tangjz/acm-icpc :: codeforces/gym (102012F)

; 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.SuffixArray = type <{ [400003 x i8], i8, [400003 x i32], [200001 x i32], [4 x i8], ptr, [200001 x i32], [200001 x i32], [200001 x i32], [4 x i8] }>
%class.SparseTable = type { i32, i32, i32, [5 x [200001 x i32]], [15 x [13334 x i32]] }
%class.HashTable = type { [200001 x i32], [200001 x i32], [200001 x i32], [200001 x i32], %"class.std::unordered_map", i32, [200001 x i32] }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%struct.List = type { i32, i32 }
%struct.Event = type { i32, i32, i32, i32 }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon = type { ptr }
%class.anon.2 = type { ptr }

@buf = external dso_local global [200001 x i8], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@suf = external dso_local global %class.SuffixArray, align 8
@Log = external dso_local global [200001 x i32], align 16
@rk2 = external dso_local global [200001 x i32], align 16
@st = external dso_local global %class.SparseTable, align 4
@st2 = external dso_local global %class.SparseTable, align 4
@sp = external dso_local global %class.SparseTable, align 4
@ht = external dso_local global %class.HashTable, align 8
@sz = external dso_local global [200001 x i32], align 16
@lnk = external dso_local global [200001 x i32], align 16
@p = external dso_local global [400003 x %struct.List], align 16
@etot = external dso_local global i32, align 4
@ord = external dso_local global [1600009 x i32], align 16
@eve = external dso_local global [800005 x %struct.Event], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3dsu = external hidden global [200001 x i32], align 16
@_ZZ4mainE3val = external hidden global [200001 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7rebuildv() #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7getRunsPFiiiiiE(ptr noundef) #0

; 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 norecurse uwtable
define dso_local noundef i32 @main() #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::function", align 8
  %9 = alloca %class.anon, align 8
  %10 = alloca %class.anon.2, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 -1, ptr @Log, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %31, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 200001
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %34

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = ashr i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [200001 x i32], ptr @Log, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [200001 x i32], ptr @Log, i64 0, i64 %29
  store i32 %27, ptr %30, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %21
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

34:                                               ; preds = %20
  call void @_ZN9HashTable4initEv(ptr noundef nonnull align 8 dereferenceable(4000080) @ht)
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %36

36:                                               ; preds = %260, %34
  %37 = load i32, ptr @t, align 4, !tbaa !5
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr @t, align 4, !tbaa !5
  %39 = icmp ne i32 %37, 0
  br i1 %39, label %40, label %263

40:                                               ; preds = %36
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @buf)
  %42 = call i64 @strlen(ptr noundef @buf) #10
  %43 = trunc i64 %42 to i32
  store i32 %43, ptr @n, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i8, ptr @buf, i64 %45
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef @buf, ptr noundef %46)
  %47 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SuffixArray4initEiPc(ptr noundef nonnull align 8 dereferenceable(5200044) @suf, i32 noundef %47, ptr noundef @buf)
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = mul i64 %49, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @rk2, ptr align 4 getelementptr inbounds (%class.SuffixArray, ptr @suf, i32 0, i32 7), i64 %50, i1 false)
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr @rk2, i64 %52
  call void @_ZSt7reverseIPiEvT_S1_(ptr noundef @rk2, ptr noundef %53)
  %54 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072) @st2, i32 noundef %54, ptr noundef getelementptr inbounds (%class.SuffixArray, ptr @suf, i32 0, i32 8))
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i8, ptr @buf, i64 %56
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef @buf, ptr noundef %57)
  %58 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SuffixArray4initEiPc(ptr noundef nonnull align 8 dereferenceable(5200044) @suf, i32 noundef %58, ptr noundef @buf)
  %59 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072) @st, i32 noundef %59, ptr noundef getelementptr inbounds (%class.SuffixArray, ptr @suf, i32 0, i32 8))
  %60 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072) @sp, i32 noundef %60, ptr noundef getelementptr inbounds (%class.SuffixArray, ptr @suf, i32 0, i32 7))
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = add nsw i64 %64, 1
  %66 = mul nsw i64 %62, %65
  %67 = sdiv i64 %66, 2
  store i64 %67, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %81, %40
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  br label %84

73:                                               ; preds = %68
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [200001 x i32], ptr getelementptr inbounds (%class.SuffixArray, ptr @suf, i32 0, i32 8), i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = load i64, ptr %3, align 8, !tbaa !11
  %80 = sub nsw i64 %79, %78
  store i64 %80, ptr %3, align 8, !tbaa !11
  br label %81

81:                                               ; preds = %73
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %4, align 4, !tbaa !5
  br label %68, !llvm.loop !13

84:                                               ; preds = %72
  store i32 0, ptr @etot, align 4, !tbaa !5
  %85 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN9HashTable5parseEiPc(ptr noundef nonnull align 8 dereferenceable(4000080) @ht, i32 noundef %85, ptr noundef @buf)
  call void @_Z7getRunsPFiiiiiE(ptr noundef @_Z4cmpFiiii)
  call void @_Z7getRunsPFiiiiiE(ptr noundef @_Z4cmpBiiii)
  call void @_Z7rebuildv()
  %86 = load i32, ptr @etot, align 4, !tbaa !5
  %87 = load i32, ptr @etot, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1600009 x i32], ptr @ord, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  %90 = load i32, ptr @etot, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %91
  %93 = getelementptr inbounds %struct.Event, ptr %92, i32 0, i32 0
  store i32 -1, ptr %93, align 16, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %259, %84
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = load i32, ptr @etot, align 4, !tbaa !5
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 10, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  br label %260

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1600009 x i32], ptr @ord, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %104
  %106 = getelementptr inbounds %struct.Event, ptr %105, i32 0, i32 0
  %107 = load i32, ptr %106, align 16, !tbaa !14
  store i32 %107, ptr %7, align 4, !tbaa !5
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [200001 x i32], ptr @sz, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = mul i64 %112, 4
  call void @llvm.memset.p0.i64(ptr align 16 @_ZZ4mainE3dsu, i8 -1, i64 %113, i1 false)
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [200001 x i32], ptr @sz, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = mul i64 %118, 4
  call void @llvm.memset.p0.i64(ptr align 16 @_ZZ4mainE3val, i8 0, i64 %119, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #9
  call void @_ZNSt8functionIFiiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %120 = getelementptr inbounds %class.anon, ptr %9, i32 0, i32 0
  store ptr %8, ptr %120, align 8, !tbaa !16
  %121 = call noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFiiEEaSIZ4mainE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS4_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS6_E4typeEE4typeES1_EE5valueESt5decayIS6_EE4type4typeESt15__invoke_resultIRSH_JiEEEE5valueERS1_E4typeEOS6_"(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %122 = getelementptr inbounds %class.anon.2, ptr %10, i32 0, i32 0
  store ptr %8, ptr %122, align 8, !tbaa !16
  br label %123

123:                                              ; preds = %200, %99
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = load i32, ptr %5, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1600009 x i32], ptr @ord, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.Event, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 16, !tbaa !14
  %133 = icmp eq i32 %124, %132
  br i1 %133, label %134, label %203

134:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1600009 x i32], ptr @ord, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  store i32 %138, ptr %11, align 4, !tbaa !5
  %139 = load i32, ptr %11, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %140
  %142 = getelementptr inbounds %struct.Event, ptr %141, i32 0, i32 1
  %143 = load i32, ptr %142, align 4, !tbaa !18
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %145
  %147 = getelementptr inbounds %struct.Event, ptr %146, i32 0, i32 2
  %148 = load i32, ptr %147, align 8, !tbaa !19
  %149 = icmp slt i32 %143, %148
  br i1 %149, label %150, label %171

150:                                              ; preds = %134
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %152
  %154 = getelementptr inbounds %struct.Event, ptr %153, i32 0, i32 1
  %155 = load i32, ptr %154, align 4, !tbaa !18
  %156 = load i32, ptr %11, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %157
  %159 = getelementptr inbounds %struct.Event, ptr %158, i32 0, i32 2
  %160 = load i32, ptr %159, align 8, !tbaa !19
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %162
  %164 = getelementptr inbounds %struct.Event, ptr %163, i32 0, i32 3
  %165 = load i32, ptr %164, align 4, !tbaa !20
  invoke void @"_ZZ4mainENK3$_1clEiii"(ptr noundef nonnull align 8 dereferenceable(8) %10, i32 noundef %155, i32 noundef %160, i32 noundef %165)
          to label %166 unwind label %167

166:                                              ; preds = %150
  br label %199

167:                                              ; preds = %187, %171, %150
  %168 = landingpad { ptr, i32 }
          cleanup
  %169 = extractvalue { ptr, i32 } %168, 0
  store ptr %169, ptr %12, align 8
  %170 = extractvalue { ptr, i32 } %168, 1
  store i32 %170, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  br label %264

171:                                              ; preds = %134
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %173
  %175 = getelementptr inbounds %struct.Event, ptr %174, i32 0, i32 1
  %176 = load i32, ptr %175, align 4, !tbaa !18
  %177 = load i32, ptr %7, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [200001 x i32], ptr @sz, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = sub nsw i32 %180, 1
  %182 = load i32, ptr %11, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %183
  %185 = getelementptr inbounds %struct.Event, ptr %184, i32 0, i32 3
  %186 = load i32, ptr %185, align 4, !tbaa !20
  invoke void @"_ZZ4mainENK3$_1clEiii"(ptr noundef nonnull align 8 dereferenceable(8) %10, i32 noundef %176, i32 noundef %181, i32 noundef %186)
          to label %187 unwind label %167

187:                                              ; preds = %171
  %188 = load i32, ptr %11, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %189
  %191 = getelementptr inbounds %struct.Event, ptr %190, i32 0, i32 2
  %192 = load i32, ptr %191, align 8, !tbaa !19
  %193 = load i32, ptr %11, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %194
  %196 = getelementptr inbounds %struct.Event, ptr %195, i32 0, i32 3
  %197 = load i32, ptr %196, align 4, !tbaa !20
  invoke void @"_ZZ4mainENK3$_1clEiii"(ptr noundef nonnull align 8 dereferenceable(8) %10, i32 noundef 0, i32 noundef %192, i32 noundef %197)
          to label %198 unwind label %167

198:                                              ; preds = %187
  br label %199

199:                                              ; preds = %198, %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %200

200:                                              ; preds = %199
  %201 = load i32, ptr %5, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %5, align 4, !tbaa !5
  br label %123, !llvm.loop !21

203:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %204 = load i32, ptr %7, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [200001 x i32], ptr @sz, i64 0, i64 %205
  %207 = load i32, ptr %206, align 4, !tbaa !5
  %208 = sub nsw i32 %207, 2
  store i32 %208, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  %209 = load i32, ptr %7, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [200001 x i32], ptr @lnk, i64 0, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !5
  store i32 %212, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %213 = load i32, ptr %15, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %214
  %216 = getelementptr inbounds %struct.List, ptr %215, i32 0, i32 0
  %217 = load i32, ptr %216, align 8, !tbaa !22
  store i32 %217, ptr %16, align 4, !tbaa !5
  br label %218

218:                                              ; preds = %250, %203
  %219 = load i32, ptr %14, align 4, !tbaa !5
  %220 = icmp sge i32 %219, 0
  br i1 %220, label %222, label %221

221:                                              ; preds = %218
  store i32 15, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %259

222:                                              ; preds = %218
  %223 = load i32, ptr %14, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [200001 x i32], ptr @_ZZ4mainE3val, i64 0, i64 %224
  %226 = load i32, ptr %225, align 4, !tbaa !5
  %227 = icmp ne i32 %226, 0
  br i1 %227, label %228, label %249

228:                                              ; preds = %222
  %229 = load i32, ptr %14, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [200001 x i32], ptr @_ZZ4mainE3val, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = load i32, ptr %15, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %235
  %237 = getelementptr inbounds %struct.List, ptr %236, i32 0, i32 1
  %238 = load i32, ptr %237, align 4, !tbaa !24
  %239 = load i32, ptr %16, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %240
  %242 = getelementptr inbounds %struct.List, ptr %241, i32 0, i32 1
  %243 = load i32, ptr %242, align 4, !tbaa !24
  %244 = sub nsw i32 %238, %243
  %245 = sext i32 %244 to i64
  %246 = mul nsw i64 %233, %245
  %247 = load i64, ptr %3, align 8, !tbaa !11
  %248 = sub nsw i64 %247, %246
  store i64 %248, ptr %3, align 8, !tbaa !11
  br label %249

249:                                              ; preds = %228, %222
  br label %250

250:                                              ; preds = %249
  %251 = load i32, ptr %14, align 4, !tbaa !5
  %252 = add nsw i32 %251, -1
  store i32 %252, ptr %14, align 4, !tbaa !5
  %253 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %253, ptr %15, align 4, !tbaa !5
  %254 = load i32, ptr %16, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %255
  %257 = getelementptr inbounds %struct.List, ptr %256, i32 0, i32 0
  %258 = load i32, ptr %257, align 8, !tbaa !22
  store i32 %258, ptr %16, align 4, !tbaa !5
  br label %218, !llvm.loop !25

259:                                              ; preds = %221
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  br label %94, !llvm.loop !26

260:                                              ; preds = %98
  %261 = load i64, ptr %3, align 8, !tbaa !11
  %262 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %261)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  br label %36, !llvm.loop !27

263:                                              ; preds = %36
  ret i32 0

264:                                              ; preds = %167
  %265 = load ptr, ptr %12, align 8
  %266 = load i32, ptr %13, align 4
  %267 = insertvalue { ptr, i32 } poison, ptr %265, 0
  %268 = insertvalue { ptr, i32 } %267, i32 %266, 1
  resume { ptr, i32 } %268
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPcEvT_S1_(ptr noundef, ptr noundef) #8

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPiEvT_S1_(ptr noundef, ptr noundef) #8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072), i32 noundef, ptr noundef) #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4cmpFiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #8

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4cmpBiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #8

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFiiEEaSIZ4mainE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS4_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS6_E4typeEE4typeES1_EE5valueESt5decayIS6_EE4type4typeESt15__invoke_resultIRSH_JiEEEE5valueERS1_E4typeEOS6_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZ4mainENK3$_1clEiii"(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i32 noundef, i32 noundef) #8 align 2

declare i32 @__gxx_personality_v0(...)

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

declare i32 @printf(ptr noundef, ...) #6

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

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS5Event", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!16 = !{!17, !17, i64 0}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!15, !6, i64 4}
!19 = !{!15, !6, i64 8}
!20 = !{!15, !6, i64 12}
!21 = distinct !{!21, !10}
!22 = !{!23, !6, i64 0}
!23 = !{!"_ZTS4List", !6, i64 0, !6, i64 4}
!24 = !{!23, !6, i64 4}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}


; 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.SuffixArray = type <{ [400003 x i8], i8, [400003 x i32], [200001 x i32], [4 x i8], ptr, [200001 x i32], [200001 x i32], [200001 x i32], [4 x i8] }>
%class.SparseTable = type { i32, i32, i32, [5 x [200001 x i32]], [15 x [13334 x i32]] }
%class.HashTable = type { [200001 x i32], [200001 x i32], [200001 x i32], [200001 x i32], %"class.std::unordered_map", i32, [200001 x i32] }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%struct.List = type { i32, i32 }
%struct.Event = type { i32, i32, i32, i32 }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon = type { ptr }
%class.anon.2 = type { ptr }

@buf = external dso_local global [200001 x i8], align 16
@t = external dso_local global i32, align 4
@n = external dso_local local_unnamed_addr global i32, align 4
@suf = external dso_local global %class.SuffixArray, align 8
@Log = external dso_local local_unnamed_addr global [200001 x i32], align 16
@rk2 = external dso_local global [200001 x i32], align 16
@st = external dso_local global %class.SparseTable, align 4
@st2 = external dso_local global %class.SparseTable, align 4
@sp = external dso_local global %class.SparseTable, align 4
@ht = external dso_local global %class.HashTable, align 8
@sz = external dso_local local_unnamed_addr global [200001 x i32], align 16
@lnk = external dso_local local_unnamed_addr global [200001 x i32], align 16
@p = external dso_local local_unnamed_addr global [400003 x %struct.List], align 16
@etot = external dso_local local_unnamed_addr global i32, align 4
@ord = external dso_local local_unnamed_addr global [1600009 x i32], align 16
@eve = external dso_local local_unnamed_addr global [800005 x %struct.Event], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3dsu = external hidden local_unnamed_addr global [200001 x i32], align 16
@_ZZ4mainE3val = external hidden local_unnamed_addr global [200001 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7rebuildv() local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7getRunsPFiiiiiE(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::function", align 8
  %2 = alloca %class.anon, align 8
  %3 = alloca %class.anon.2, align 8
  store i32 -1, ptr @Log, align 16, !tbaa !5
  br label %8

4:                                                ; preds = %8
  tail call void @_ZN9HashTable4initEv(ptr noundef nonnull align 8 dereferenceable(4000080) @ht)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %6 = load i32, ptr @t, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @t, align 4, !tbaa !5
  %.not79 = icmp eq i32 %6, 0
  br i1 %.not79, label %._crit_edge82, label %.lr.ph81

8:                                                ; preds = %8, %0
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %8 ]
  %9 = lshr i64 %indvars.iv, 1
  %10 = getelementptr inbounds [200001 x i32], ptr @Log, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  %13 = getelementptr inbounds [200001 x i32], ptr @Log, i64 0, i64 %indvars.iv
  store i32 %12, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = lshr i64 %indvars.iv.next, 1
  %15 = getelementptr inbounds [200001 x i32], ptr @Log, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = add nsw i32 %16, 1
  %18 = getelementptr inbounds [200001 x i32], ptr @Log, i64 0, i64 %indvars.iv.next
  store i32 %17, ptr %18, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 200001
  br i1 %exitcond.not.1, label %4, label %8, !llvm.loop !9

.lr.ph81:                                         ; preds = %4, %._crit_edge77
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @buf)
  %20 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @buf) #10
  %21 = trunc i64 %20 to i32
  store i32 %21, ptr @n, align 4, !tbaa !5
  %sext = shl i64 %20, 32
  %22 = ashr exact i64 %sext, 32
  %23 = getelementptr inbounds i8, ptr @buf, i64 %22
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef nonnull @buf, ptr noundef nonnull %23)
  %24 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SuffixArray4initEiPc(ptr noundef nonnull align 8 dereferenceable(5200044) @suf, i32 noundef %24, ptr noundef nonnull @buf)
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = shl nsw i64 %26, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @rk2, ptr nonnull align 4 getelementptr inbounds (i8, ptr @suf, i64 3600036), i64 %27, i1 false)
  %28 = getelementptr inbounds i32, ptr @rk2, i64 %26
  call void @_ZSt7reverseIPiEvT_S1_(ptr noundef nonnull @rk2, ptr noundef nonnull %28)
  %29 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072) @st2, i32 noundef %29, ptr noundef nonnull getelementptr inbounds (i8, ptr @suf, i64 4400040))
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr @buf, i64 %31
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef nonnull @buf, ptr noundef nonnull %32)
  %33 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SuffixArray4initEiPc(ptr noundef nonnull align 8 dereferenceable(5200044) @suf, i32 noundef %33, ptr noundef nonnull @buf)
  %34 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072) @st, i32 noundef %34, ptr noundef nonnull getelementptr inbounds (i8, ptr @suf, i64 4400040))
  %35 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072) @sp, i32 noundef %35, ptr noundef nonnull getelementptr inbounds (i8, ptr @suf, i64 3600036))
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = add nsw i64 %37, 1
  %39 = mul nsw i64 %38, %37
  %40 = sdiv i64 %39, 2
  %41 = icmp sgt i32 %36, 0
  br i1 %41, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph81
  %wide.trip.count = zext nneg i32 %36 to i64
  %min.iters.check = icmp ult i32 %36, 4
  br i1 %min.iters.check, label %.lr.ph.preheader97, label %vector.ph

.lr.ph.preheader97:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv85.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %.04356.ph = phi i64 [ %40, %.lr.ph.preheader ], [ %50, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  %42 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %40, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %42, %vector.ph ], [ %47, %vector.body ]
  %vec.phi95 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %48, %vector.body ]
  %43 = getelementptr inbounds [200001 x i32], ptr getelementptr inbounds (i8, ptr @suf, i64 4400040), i64 0, i64 %index
  %44 = getelementptr inbounds i8, ptr %43, i64 8
  %wide.load = load <2 x i32>, ptr %43, align 8, !tbaa !5
  %wide.load96 = load <2 x i32>, ptr %44, align 8, !tbaa !5
  %45 = sext <2 x i32> %wide.load to <2 x i64>
  %46 = sext <2 x i32> %wide.load96 to <2 x i64>
  %47 = sub <2 x i64> %vec.phi, %45
  %48 = sub <2 x i64> %vec.phi95, %46
  %index.next = add nuw i64 %index, 4
  %49 = icmp eq i64 %index.next, %n.vec
  br i1 %49, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %48, %47
  %50 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader97

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.lr.ph81
  %.043.lcssa = phi i64 [ %40, %.lr.ph81 ], [ %50, %middle.block ], [ %59, %.lr.ph ]
  store i32 0, ptr @etot, align 4, !tbaa !5
  call void @_ZN9HashTable5parseEiPc(ptr noundef nonnull align 8 dereferenceable(4000080) @ht, i32 noundef %36, ptr noundef nonnull @buf)
  call void @_Z7getRunsPFiiiiiE(ptr noundef nonnull @_Z4cmpFiiii)
  call void @_Z7getRunsPFiiiiiE(ptr noundef nonnull @_Z4cmpBiiii)
  call void @_Z7rebuildv()
  %51 = load i32, ptr @etot, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1600009 x i32], ptr @ord, i64 0, i64 %52
  store i32 %51, ptr %53, align 4, !tbaa !5
  %54 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %52
  store i32 -1, ptr %54, align 16, !tbaa !14
  %55 = icmp sgt i32 %51, 0
  br i1 %55, label %.lr.ph76, label %._crit_edge77

.lr.ph:                                           ; preds = %.lr.ph.preheader97, %.lr.ph
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %.lr.ph ], [ %indvars.iv85.ph, %.lr.ph.preheader97 ]
  %.04356 = phi i64 [ %59, %.lr.ph ], [ %.04356.ph, %.lr.ph.preheader97 ]
  %56 = getelementptr inbounds [200001 x i32], ptr getelementptr inbounds (i8, ptr @suf, i64 4400040), i64 0, i64 %indvars.iv85
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = sub nsw i64 %.04356, %58
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count
  br i1 %exitcond88.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge77:                                    ; preds = %._crit_edge71, %._crit_edge
  %.1.lcssa = phi i64 [ %.043.lcssa, %._crit_edge ], [ %.2.lcssa, %._crit_edge71 ]
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.1.lcssa)
  %61 = load i32, ptr @t, align 4, !tbaa !5
  %62 = add nsw i32 %61, -1
  store i32 %62, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %61, 0
  br i1 %.not, label %._crit_edge82, label %.lr.ph81, !llvm.loop !17

.lr.ph76:                                         ; preds = %._crit_edge, %._crit_edge71
  %.174 = phi i64 [ %.2.lcssa, %._crit_edge71 ], [ %.043.lcssa, %._crit_edge ]
  %.04573 = phi i32 [ %.146.lcssa, %._crit_edge71 ], [ 0, %._crit_edge ]
  %63 = sext i32 %.04573 to i64
  %64 = getelementptr inbounds [1600009 x i32], ptr @ord, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %66
  %68 = load i32, ptr %67, align 16, !tbaa !14
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [200001 x i32], ptr @sz, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = shl nsw i64 %72, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @_ZZ4mainE3dsu, i8 -1, i64 %73, i1 false)
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @_ZZ4mainE3val, i8 0, i64 %73, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #11
  call void @_ZNSt8functionIFiiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #11
  store ptr %1, ptr %2, align 8, !tbaa !18
  %74 = call noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFiiEEaSIZ4mainE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS4_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS6_E4typeEE4typeES1_EE5valueESt5decayIS6_EE4type4typeESt15__invoke_resultIRSH_JiEEEE5valueERS1_E4typeEOS6_"(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #11
  store ptr %1, ptr %3, align 8, !tbaa !18
  %75 = load i32, ptr %64, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %76
  %78 = load i32, ptr %77, align 16, !tbaa !14
  %79 = icmp eq i32 %68, %78
  br i1 %79, label %.lr.ph59, label %._crit_edge60

.lr.ph59:                                         ; preds = %.lr.ph76, %100
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %100 ], [ %63, %.lr.ph76 ]
  %80 = phi ptr [ %104, %100 ], [ %77, %.lr.ph76 ]
  %81 = getelementptr inbounds i8, ptr %80, i64 4
  %82 = load i32, ptr %81, align 4, !tbaa !20
  %83 = getelementptr inbounds i8, ptr %80, i64 8
  %84 = load i32, ptr %83, align 8, !tbaa !21
  %85 = icmp slt i32 %82, %84
  br i1 %85, label %86, label %90

86:                                               ; preds = %.lr.ph59
  %87 = getelementptr inbounds i8, ptr %80, i64 12
  br label %.invoke

88:                                               ; preds = %.invoke, %90
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #11
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #11
  resume { ptr, i32 } %89

90:                                               ; preds = %.lr.ph59
  %91 = load i32, ptr %70, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  %93 = getelementptr inbounds i8, ptr %80, i64 12
  %94 = load i32, ptr %93, align 4, !tbaa !22
  invoke void @"_ZZ4mainENK3$_1clEiii"(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %82, i32 noundef %92, i32 noundef %94)
          to label %95 unwind label %88

95:                                               ; preds = %90
  %96 = load i32, ptr %83, align 8, !tbaa !21
  br label %.invoke

.invoke:                                          ; preds = %86, %95
  %.sink = phi ptr [ %87, %86 ], [ %93, %95 ]
  %97 = phi i32 [ %82, %86 ], [ 0, %95 ]
  %98 = phi i32 [ %84, %86 ], [ %96, %95 ]
  %99 = load i32, ptr %.sink, align 4, !tbaa !22
  invoke void @"_ZZ4mainENK3$_1clEiii"(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %97, i32 noundef %98, i32 noundef %99)
          to label %100 unwind label %88

100:                                              ; preds = %.invoke
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, 1
  %101 = getelementptr inbounds [1600009 x i32], ptr @ord, i64 0, i64 %indvars.iv.next90
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %103
  %105 = load i32, ptr %104, align 16, !tbaa !14
  %106 = icmp eq i32 %68, %105
  br i1 %106, label %.lr.ph59, label %._crit_edge60.loopexit, !llvm.loop !23

._crit_edge60.loopexit:                           ; preds = %100
  %107 = trunc nsw i64 %indvars.iv.next90 to i32
  br label %._crit_edge60

._crit_edge60:                                    ; preds = %._crit_edge60.loopexit, %.lr.ph76
  %.146.lcssa = phi i32 [ %.04573, %.lr.ph76 ], [ %107, %._crit_edge60.loopexit ]
  %108 = load i32, ptr %70, align 4, !tbaa !5
  %109 = icmp sgt i32 %108, 1
  br i1 %109, label %.lr.ph70.preheader, label %._crit_edge71

.lr.ph70.preheader:                               ; preds = %._crit_edge60
  %110 = getelementptr inbounds [200001 x i32], ptr @lnk, i64 0, i64 %69
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = add nsw i32 %108, -2
  %113 = zext i32 %112 to i64
  %114 = and i64 %113, 1
  %lcmp.mod.not.not = icmp eq i64 %114, 0
  br i1 %lcmp.mod.not.not, label %.lr.ph70.prol, label %.lr.ph70.prol.loopexit

.lr.ph70.prol:                                    ; preds = %.lr.ph70.preheader
  %.pn67.prol = sext i32 %111 to i64
  %.068.in.prol = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %.pn67.prol
  %.068.prol = load i32, ptr %.068.in.prol, align 8, !tbaa !24
  %115 = getelementptr inbounds [200001 x i32], ptr @_ZZ4mainE3val, i64 0, i64 %113
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %.not51.prol = icmp eq i32 %116, 0
  br i1 %.not51.prol, label %.lr.ph70.prol.loopexit.unr-lcssa, label %117

117:                                              ; preds = %.lr.ph70.prol
  %118 = sext i32 %116 to i64
  %119 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %.pn67.prol, i32 1
  %120 = load i32, ptr %119, align 4, !tbaa !26
  %121 = sext i32 %.068.prol to i64
  %122 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %121, i32 1
  %123 = load i32, ptr %122, align 4, !tbaa !26
  %124 = sub nsw i32 %120, %123
  %125 = sext i32 %124 to i64
  %126 = mul nsw i64 %125, %118
  %127 = sub nsw i64 %.174, %126
  br label %.lr.ph70.prol.loopexit.unr-lcssa

.lr.ph70.prol.loopexit.unr-lcssa:                 ; preds = %117, %.lr.ph70.prol
  %.3.prol = phi i64 [ %127, %117 ], [ %.174, %.lr.ph70.prol ]
  %indvars.iv.next93.prol = add nsw i64 %113, -1
  br label %.lr.ph70.prol.loopexit

.lr.ph70.prol.loopexit:                           ; preds = %.lr.ph70.prol.loopexit.unr-lcssa, %.lr.ph70.preheader
  %indvars.iv92.unr = phi i64 [ %113, %.lr.ph70.preheader ], [ %indvars.iv.next93.prol, %.lr.ph70.prol.loopexit.unr-lcssa ]
  %.pn67.in.unr = phi i32 [ %111, %.lr.ph70.preheader ], [ %.068.prol, %.lr.ph70.prol.loopexit.unr-lcssa ]
  %.265.unr = phi i64 [ %.174, %.lr.ph70.preheader ], [ %.3.prol, %.lr.ph70.prol.loopexit.unr-lcssa ]
  %.3.lcssa.unr = phi i64 [ poison, %.lr.ph70.preheader ], [ %.3.prol, %.lr.ph70.prol.loopexit.unr-lcssa ]
  %128 = icmp eq i32 %112, 0
  br i1 %128, label %._crit_edge71, label %.lr.ph70

._crit_edge71:                                    ; preds = %.lr.ph70.prol.loopexit, %157, %._crit_edge60
  %.2.lcssa = phi i64 [ %.174, %._crit_edge60 ], [ %.3.lcssa.unr, %.lr.ph70.prol.loopexit ], [ %.3.1, %157 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #11
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #11
  %129 = load i32, ptr @etot, align 4, !tbaa !5
  %130 = icmp slt i32 %.146.lcssa, %129
  br i1 %130, label %.lr.ph76, label %._crit_edge77, !llvm.loop !27

.lr.ph70:                                         ; preds = %.lr.ph70.prol.loopexit, %157
  %indvars.iv92 = phi i64 [ %indvars.iv.next93.1, %157 ], [ %indvars.iv92.unr, %.lr.ph70.prol.loopexit ]
  %.pn67.in = phi i32 [ %.068.1, %157 ], [ %.pn67.in.unr, %.lr.ph70.prol.loopexit ]
  %.265 = phi i64 [ %.3.1, %157 ], [ %.265.unr, %.lr.ph70.prol.loopexit ]
  %.pn67 = sext i32 %.pn67.in to i64
  %.068.in = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %.pn67
  %.068 = load i32, ptr %.068.in, align 8, !tbaa !24
  %131 = getelementptr inbounds [200001 x i32], ptr @_ZZ4mainE3val, i64 0, i64 %indvars.iv92
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %.not51 = icmp eq i32 %132, 0
  br i1 %.not51, label %.lr.ph70.1, label %133

133:                                              ; preds = %.lr.ph70
  %134 = sext i32 %132 to i64
  %135 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %.pn67, i32 1
  %136 = load i32, ptr %135, align 4, !tbaa !26
  %137 = sext i32 %.068 to i64
  %138 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %137, i32 1
  %139 = load i32, ptr %138, align 4, !tbaa !26
  %140 = sub nsw i32 %136, %139
  %141 = sext i32 %140 to i64
  %142 = mul nsw i64 %141, %134
  %143 = sub nsw i64 %.265, %142
  br label %.lr.ph70.1

.lr.ph70.1:                                       ; preds = %.lr.ph70, %133
  %.3 = phi i64 [ %143, %133 ], [ %.265, %.lr.ph70 ]
  %indvars.iv.next93 = add nsw i64 %indvars.iv92, -1
  %.pn67.1 = sext i32 %.068 to i64
  %.068.in.1 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %.pn67.1
  %.068.1 = load i32, ptr %.068.in.1, align 8, !tbaa !24
  %144 = getelementptr inbounds [200001 x i32], ptr @_ZZ4mainE3val, i64 0, i64 %indvars.iv.next93
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %.not51.1 = icmp eq i32 %145, 0
  br i1 %.not51.1, label %157, label %146

146:                                              ; preds = %.lr.ph70.1
  %147 = sext i32 %145 to i64
  %148 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %.pn67.1, i32 1
  %149 = load i32, ptr %148, align 4, !tbaa !26
  %150 = sext i32 %.068.1 to i64
  %151 = getelementptr inbounds [400003 x %struct.List], ptr @p, i64 0, i64 %150, i32 1
  %152 = load i32, ptr %151, align 4, !tbaa !26
  %153 = sub nsw i32 %149, %152
  %154 = sext i32 %153 to i64
  %155 = mul nsw i64 %154, %147
  %156 = sub nsw i64 %.3, %155
  br label %157

157:                                              ; preds = %146, %.lr.ph70.1
  %.3.1 = phi i64 [ %156, %146 ], [ %.3, %.lr.ph70.1 ]
  %indvars.iv.next93.1 = add nsw i64 %indvars.iv92, -2
  %158 = icmp sgt i64 %indvars.iv92, 1
  br i1 %158, label %.lr.ph70, label %._crit_edge71, !llvm.loop !28

._crit_edge82:                                    ; preds = %._crit_edge77, %4
  ret i32 0
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPcEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #8

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11SparseTable4initEiPi(ptr noundef nonnull align 4 dereferenceable(4800072), i32 noundef, ptr noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4cmpFiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #8

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4cmpBiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #8

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFiiEEaSIZ4mainE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS4_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS6_E4typeEE4typeES1_EE5valueESt5decayIS6_EE4type4typeESt15__invoke_resultIRSH_JiEEEE5valueERS1_E4typeEOS6_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZ4mainENK3$_1clEiii"(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #8 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #9

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #8 = { 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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS5Event", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!16 = distinct !{!16, !10, !13, !12}
!17 = distinct !{!17, !10}
!18 = !{!19, !19, i64 0}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!15, !6, i64 4}
!21 = !{!15, !6, i64 8}
!22 = !{!15, !6, i64 12}
!23 = distinct !{!23, !10}
!24 = !{!25, !6, i64 0}
!25 = !{!"_ZTS4List", !6, i64 0, !6, i64 4}
!26 = !{!25, !6, i64 4}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}


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